#include "libavutil/log.h"
#include "libavutil/avassert.h"
#include "swresample_internal.h"
#include "resample_template.c"
Go to the source code of this file.
Data Structures | |
struct | ResampleContext |
Defines | |
#define | WINDOW_TYPE 9 |
#define | RENAME(N) N ## _int16 |
#define | FILTER_SHIFT 15 |
#define | DELEM int16_t |
#define | FELEM int16_t |
#define | FELEM2 int32_t |
#define | FELEML int64_t |
#define | FELEM_MAX INT16_MAX |
#define | FELEM_MIN INT16_MIN |
#define | OUT(d, v) |
#define | RENAME(N) N ## _int32 |
#define | FILTER_SHIFT 30 |
#define | DELEM int32_t |
#define | FELEM int32_t |
#define | FELEM2 int64_t |
#define | FELEML int64_t |
#define | FELEM_MAX INT32_MAX |
#define | FELEM_MIN INT32_MIN |
#define | OUT(d, v) |
#define | RENAME(N) N ## _float |
#define | FILTER_SHIFT 0 |
#define | DELEM float |
#define | FELEM float |
#define | FELEM2 float |
#define | FELEML float |
#define | OUT(d, v) d = v |
#define | RENAME(N) N ## _double |
#define | FILTER_SHIFT 0 |
#define | DELEM double |
#define | FELEM double |
#define | FELEM2 double |
#define | FELEML double |
#define | OUT(d, v) d = v |
Functions | |
static double | bessel (double x) |
0th order modified bessel function of the first kind. | |
static int | build_filter (ResampleContext *c, void *filter, double factor, int tap_count, int phase_count, int scale, int type) |
builds a polyphase filterbank. | |
ResampleContext * | swri_resample_init (ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff, enum AVSampleFormat format) |
void | swri_resample_free (ResampleContext **c) |
int | swr_set_compensation (struct SwrContext *s, int sample_delta, int compensation_distance) |
Activate resampling compensation. | |
int | swri_multiple_resample (ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed) |
int64_t | swr_get_delay (struct SwrContext *s, int64_t base) |
Gets the delay the next input sample will experience relative to the next output sample. |
Definition in file resample.c.
#define DELEM double |
Definition at line 350 of file resample.c.
#define DELEM float |
Definition at line 350 of file resample.c.
#define DELEM int32_t |
Definition at line 350 of file resample.c.
#define DELEM int16_t |
Definition at line 350 of file resample.c.
#define FELEM double |
Definition at line 351 of file resample.c.
#define FELEM float |
Definition at line 351 of file resample.c.
#define FELEM int32_t |
Definition at line 351 of file resample.c.
#define FELEM int16_t |
Definition at line 351 of file resample.c.
#define FELEM2 double |
Definition at line 352 of file resample.c.
#define FELEM2 float |
Definition at line 352 of file resample.c.
#define FELEM2 int64_t |
Definition at line 352 of file resample.c.
#define FELEM2 int32_t |
Definition at line 352 of file resample.c.
#define FELEM_MAX INT32_MAX |
Definition at line 311 of file resample.c.
#define FELEM_MAX INT16_MAX |
Definition at line 311 of file resample.c.
#define FELEM_MIN INT32_MIN |
Definition at line 312 of file resample.c.
#define FELEM_MIN INT16_MIN |
Definition at line 312 of file resample.c.
#define FELEML double |
Definition at line 353 of file resample.c.
#define FELEML float |
Definition at line 353 of file resample.c.
#define FELEML int64_t |
Definition at line 353 of file resample.c.
#define FELEML int64_t |
Definition at line 353 of file resample.c.
#define FILTER_SHIFT 0 |
Definition at line 349 of file resample.c.
#define FILTER_SHIFT 0 |
Definition at line 349 of file resample.c.
#define FILTER_SHIFT 30 |
Definition at line 349 of file resample.c.
#define FILTER_SHIFT 15 |
Definition at line 349 of file resample.c.
#define OUT | ( | d, | |||
v | ) | d = v |
Definition at line 354 of file resample.c.
#define OUT | ( | d, | |||
v | ) | d = v |
Definition at line 354 of file resample.c.
#define OUT | ( | d, | |||
v | ) |
Value:
v = (v + (1<<(FILTER_SHIFT-1)))>>FILTER_SHIFT;\ d = (uint64_t)(v + 0x80000000) > 0xFFFFFFFF ? (v>>63) ^ 0x7FFFFFFF : v
Definition at line 354 of file resample.c.
#define OUT | ( | d, | |||
v | ) |
Value:
v = (v + (1<<(FILTER_SHIFT-1)))>>FILTER_SHIFT;\ d = (unsigned)(v + 32768) > 65535 ? (v>>31) ^ 32767 : v
Definition at line 354 of file resample.c.
Referenced by print_formats(), and swri_resample_TMPL().
#define RENAME | ( | N | ) | N ## _double |
Definition at line 348 of file resample.c.
#define RENAME | ( | N | ) | N ## _float |
Definition at line 348 of file resample.c.
#define RENAME | ( | N | ) | N ## _int32 |
Definition at line 348 of file resample.c.
#define RENAME | ( | N | ) | N ## _int16 |
Definition at line 348 of file resample.c.
#define WINDOW_TYPE 9 |
Definition at line 32 of file resample.c.
static double bessel | ( | double | x | ) | [static] |
static int build_filter | ( | ResampleContext * | c, | |
void * | filter, | |||
double | factor, | |||
int | tap_count, | |||
int | phase_count, | |||
int | scale, | |||
int | type | |||
) | [static] |
builds a polyphase filterbank.
factor | resampling factor | |
scale | wanted sum of coefficients for each filter | |
type | 0->cubic, 1->blackman nuttall windowed sinc, 2..16->kaiser windowed sinc beta=2..16 |
Definition at line 92 of file resample.c.
int64_t swr_get_delay | ( | struct SwrContext * | s, | |
int64_t | base | |||
) |
Gets the delay the next input sample will experience relative to the next output sample.
Swresample can buffer data if more input has been provided than available output space, also converting between sample rates needs a delay. This function returns the sum of all such delays.
s | swr context | |
base | timebase in which the returned delay will be if its set to 1 the returned delay is in seconds if its set to 1000 the returned delay is in milli seconds if its set to the input sample rate then the returned delay is in input samples if its set to the output sample rate then the returned delay is in output samples an exact rounding free delay can be found by using LCM(in_sample_rate, out_sample_rate) |
Definition at line 371 of file resample.c.
Referenced by swr_next_pts().
int swr_set_compensation | ( | struct SwrContext * | s, | |
int | sample_delta, | |||
int | compensation_distance | |||
) |
Activate resampling compensation.
Definition at line 259 of file resample.c.
Referenced by audio_decode_frame(), and swr_next_pts().
int swri_multiple_resample | ( | ResampleContext * | c, | |
AudioData * | dst, | |||
int | dst_size, | |||
AudioData * | src, | |||
int | src_size, | |||
int * | consumed | |||
) |
void swri_resample_free | ( | ResampleContext ** | c | ) |
ResampleContext* swri_resample_init | ( | ResampleContext * | c, | |
int | out_rate, | |||
int | in_rate, | |||
int | filter_size, | |||
int | phase_shift, | |||
int | linear, | |||
double | cutoff, | |||
enum AVSampleFormat | format | |||
) | [read] |