resample2.c File Reference


Detailed Description

audio resampling

Author:
Michael Niedermayer <michaelni@gmx.at>

Definition in file resample2.c.

Go to the source code of this file.

Classes

struct  AVResampleContext

Functions

static double bessel (double x)
 0th order modified bessel function of the first kind.
void av_build_filter (FELEM *filter, double factor, int tap_count, int phase_count, int scale, int type)
 builds a polyphase filterbank.
AVResampleContextav_resample_init (int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff)
 Initializes an audio resampler.
void av_resample_close (AVResampleContext *c)
void av_resample_compensate (AVResampleContext *c, int sample_delta, int compensation_distance)
 Compensates samplerate/timestamp drift.
int av_resample (AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx)
 resamples.


Function Documentation

static double bessel ( double  x  )  [static]

0th order modified bessel function of the first kind.

Definition at line 76 of file resample2.c.

Referenced by ac3_window_init(), and av_build_filter().

void av_build_filter ( FELEM *  filter,
double  factor,
int  tap_count,
int  phase_count,
int  scale,
int  type 
)

builds a polyphase filterbank.

Parameters:
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 95 of file resample2.c.

AVResampleContext* av_resample_init ( int  out_rate,
int  in_rate,
int  filter_size,
int  phase_shift,
int  linear,
double  cutoff 
) [read]

Initializes an audio resampler.

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

Definition at line 182 of file resample2.c.

Referenced by audio_resample_init().

void av_resample_close ( AVResampleContext c  ) 

Definition at line 204 of file resample2.c.

Referenced by audio_resample_close().

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

Compensates samplerate/timestamp drift.

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

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 221 of file resample2.c.

Referenced by av_resample().

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

resamples.

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 wont 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 occured

Definition at line 236 of file resample2.c.

Referenced by audio_resample().


Generated on Sat Dec 18 05:15:55 2010 for MythTV by  doxygen 1.5.5