Audio resampling
[Encoding/Decoding Library]


Typedefs

typedef struct ReSampleContext ReSampleContext

Functions

ReSampleContextav_audio_resample_init (int output_channels, int input_channels, int output_rate, int input_rate, enum AVSampleFormat sample_fmt_out, enum AVSampleFormat sample_fmt_in, int filter_length, int log2_phase_count, int linear, double cutoff)
 Initialize audio resampling context.
int audio_resample (ReSampleContext *s, short *output, short *input, int nb_samples)
void audio_resample_close (ReSampleContext *s)
 Free resample context.
struct AVResampleContextav_resample_init (int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff)
 Initialize an audio resampler.
int av_resample (struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx)
 Resample an array of samples using a previously configured context.
void av_resample_compensate (struct AVResampleContext *c, int sample_delta, int compensation_distance)
 Compensate samplerate/timestamp drift.
void av_resample_close (struct AVResampleContext *c)

Typedef Documentation

Definition at line 4330 of file avcodec.h.


Function Documentation

int audio_resample ( ReSampleContext s,
short *  output,
short *  input,
int  nb_samples 
)

Definition at line 282 of file resample.c.

void audio_resample_close ( ReSampleContext s  ) 

Free resample context.

Parameters:
s a non-NULL pointer to a resample context previously created with av_audio_resample_init()

Definition at line 420 of file resample.c.

ReSampleContext* av_audio_resample_init ( int  output_channels,
int  input_channels,
int  output_rate,
int  input_rate,
enum AVSampleFormat  sample_fmt_out,
enum AVSampleFormat  sample_fmt_in,
int  filter_length,
int  log2_phase_count,
int  linear,
double  cutoff 
)

Initialize audio resampling context.

Parameters:
output_channels number of output channels
input_channels number of input channels
output_rate output sample rate
input_rate input sample rate
sample_fmt_out requested output sample format
sample_fmt_in input sample format
filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
log2_phase_count log2 of the number of entries in the polyphase filterbank
linear if 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used
cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
Returns:
allocated ReSampleContext, NULL if error occurred

Definition at line 201 of file resample.c.

int av_resample ( struct AVResampleContext c,
short *  dst,
short *  src,
int consumed,
int  src_size,
int  dst_size,
int  update_ctx 
)

Resample an array of samples using a previously configured context.

Parameters:
src an array of unconsumed samples
consumed the number of samples of src which have been consumed are returned here
src_size the number of unconsumed samples available
dst_size the amount of space in samples available in dst
update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
Returns:
the number of samples written in dst or -1 if an error occurred

Definition at line 236 of file resample2.c.

Referenced by audio_resample().

void av_resample_close ( struct AVResampleContext c  ) 

Definition at line 225 of file resample2.c.

Referenced by audio_resample_close().

void av_resample_compensate ( struct AVResampleContext c,
int  sample_delta,
int  compensation_distance 
)

Compensate samplerate/timestamp drift.

The compensation is done by changing the resampler parameters, so no audible clicks or similar distortions occur

Parameters:
compensation_distance distance in output samples over which the compensation should be performed
sample_delta number of output samples which should be output less
example: av_resample_compensate(c, 10, 500) here instead of 510 samples only 500 samples would be output

note, due to rounding the actual compensation might be slightly different, especially if the compensation_distance is large and the in_rate used during init is small

Definition at line 230 of file resample2.c.

Referenced by av_resample(), and swri_resample_TMPL().

struct AVResampleContext* av_resample_init ( int  out_rate,
int  in_rate,
int  filter_length,
int  log2_phase_count,
int  linear,
double  cutoff 
) [read]

Initialize an audio resampler.

Note, if either rate is not an integer then simply scale both rates up so they are.

Parameters:
filter_length length of each FIR filter in the filterbank relative to the cutoff freq
log2_phase_count log2 of the number of entries in the polyphase filterbank
linear If 1 then the used FIR filter will be linearly interpolated between the 2 closest, if 0 the closest will be used
cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate

Definition at line 191 of file resample2.c.

Referenced by av_audio_resample_init().


Generated on Fri Oct 26 02:50:13 2012 for FFmpeg by  doxygen 1.5.8