#include "libavutil/libm.h"
#include "libavutil/log.h"
#include "internal.h"
#include "audio_data.h"
Go to the source code of this file.
Data Structures | |
struct | ResampleContext |
Defines | |
#define | FILTER_SHIFT 15 |
#define | FELEM int16_t |
#define | FELEM2 int32_t |
#define | FELEML int64_t |
#define | FELEM_MAX INT16_MAX |
#define | FELEM_MIN INT16_MIN |
#define | WINDOW_TYPE 9 |
Functions | |
static double | bessel (double x) |
0th order modified bessel function of the first kind. | |
static int | build_filter (FELEM *filter, double factor, int tap_count, int phase_count, int scale, int type) |
Build a polyphase filterbank. | |
ResampleContext * | ff_audio_resample_init (AVAudioResampleContext *avr) |
Allocate and initialize a ResampleContext. | |
void | ff_audio_resample_free (ResampleContext **c) |
Free a ResampleContext. | |
int | avresample_set_compensation (AVAudioResampleContext *avr, int sample_delta, int compensation_distance) |
Set compensation for resampling. | |
static int | resample (ResampleContext *c, int16_t *dst, const int16_t *src, int *consumed, int src_size, int dst_size, int update_ctx) |
int | ff_audio_resample (ResampleContext *c, AudioData *dst, AudioData *src, int *consumed) |
Resample audio data. | |
int | avresample_get_delay (AVAudioResampleContext *avr) |
Return the number of samples currently in the resampling delay buffer. |
#define FELEM int16_t |
Definition at line 46 of file resample.c.
#define FELEM2 int32_t |
Definition at line 47 of file resample.c.
#define FELEM_MAX INT16_MAX |
Definition at line 49 of file resample.c.
#define FELEM_MIN INT16_MIN |
Definition at line 50 of file resample.c.
#define FELEML int64_t |
Definition at line 48 of file resample.c.
#define FILTER_SHIFT 15 |
Definition at line 45 of file resample.c.
#define WINDOW_TYPE 9 |
Definition at line 51 of file resample.c.
int avresample_get_delay | ( | AVAudioResampleContext * | avr | ) |
Return the number of samples currently in the resampling delay buffer.
When resampling, there may be a delay between the input and output. Any unconverted samples in each call are stored internally in a delay buffer. This function allows the user to determine the current number of samples in the delay buffer, which can be useful for synchronization.
avr | audio resample context |
Definition at line 474 of file resample.c.
Referenced by filter_samples(), get_delay(), main(), and request_frame().
int avresample_set_compensation | ( | AVAudioResampleContext * | avr, | |
int | sample_delta, | |||
int | compensation_distance | |||
) |
Set compensation for resampling.
This can be called anytime after avresample_open(). If resampling was not being done previously, the AVAudioResampleContext is closed and reopened with resampling enabled. In this case, any samples remaining in the output FIFO and the current channel mixing matrix will be restored after reopening the context.
avr | audio resample context | |
sample_delta | compensation delta, in samples | |
compensation_distance | compensation distance, in samples |
Definition at line 240 of file resample.c.
Referenced by filter_samples().
static double bessel | ( | double | x | ) | [static] |
static int build_filter | ( | FELEM * | filter, | |
double | factor, | |||
int | tap_count, | |||
int | phase_count, | |||
int | scale, | |||
int | type | |||
) | [static] |
Build a polyphase filterbank.
[out] | filter | filter coefficients |
factor | resampling factor | |
tap_count | tap count | |
phase_count | phase count | |
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 103 of file resample.c.
int ff_audio_resample | ( | ResampleContext * | c, | |
AudioData * | dst, | |||
AudioData * | src, | |||
int * | consumed | |||
) |
Resample audio data.
Changes the sample rate.
c | ResampleContext | |
dst | destination audio data | |
src | source audio data | |
consumed | number of samples consumed from the source |
Definition at line 419 of file resample.c.
Referenced by avresample_convert().
void ff_audio_resample_free | ( | ResampleContext ** | c | ) |
Free a ResampleContext.
c | ResampleContext |
Definition at line 231 of file resample.c.
Referenced by avresample_close().
ResampleContext* ff_audio_resample_init | ( | AVAudioResampleContext * | avr | ) |
Allocate and initialize a ResampleContext.
The parameters in the AVAudioResampleContext are used to initialize the ResampleContext.
avr | AVAudioResampleContext |
Definition at line 164 of file resample.c.
Referenced by avresample_open().
static int resample | ( | ResampleContext * | c, | |
int16_t * | dst, | |||
const int16_t * | src, | |||
int * | consumed, | |||
int | src_size, | |||
int | dst_size, | |||
int | update_ctx | |||
) | [static] |
Definition at line 314 of file resample.c.
Referenced by avfilter_register_all(), ff_audio_resample(), and swr_convert_internal().