From 6e225de2fe1d4babb7dc15f436711777c1a2b03f Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Thu, 21 Oct 2004 21:07:40 +0000 Subject: [PATCH] user selectble cutoff frequency Originally committed as revision 3619 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/avcodec.h | 4 ++-- libavcodec/resample.c | 2 +- libavcodec/resample2.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3f91f5f162..4919e977ab 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -17,7 +17,7 @@ extern "C" { #define FFMPEG_VERSION_INT 0x000409 #define FFMPEG_VERSION "0.4.9-pre1" -#define LIBAVCODEC_BUILD 4726 +#define LIBAVCODEC_BUILD 4727 #define LIBAVCODEC_VERSION_INT FFMPEG_VERSION_INT #define LIBAVCODEC_VERSION FFMPEG_VERSION @@ -1942,7 +1942,7 @@ ReSampleContext *audio_resample_init(int output_channels, int input_channels, int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); void audio_resample_close(ReSampleContext *s); -struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear); +struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); void av_resample_close(struct AVResampleContext *c); diff --git a/libavcodec/resample.c b/libavcodec/resample.c index a5e1539993..02c1fd8fe6 100644 --- a/libavcodec/resample.c +++ b/libavcodec/resample.c @@ -160,7 +160,7 @@ ReSampleContext *audio_resample_init(int output_channels, int input_channels, if(s->filter_channels>2) s->filter_channels = 2; - s->resample_context= av_resample_init(output_rate, input_rate, 16, 10, 0); + s->resample_context= av_resample_init(output_rate, input_rate, 16, 10, 0, 1.0); return s; } diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c index 5fdd611539..c41f6e13a2 100644 --- a/libavcodec/resample2.c +++ b/libavcodec/resample2.c @@ -130,9 +130,9 @@ void av_build_filter(FELEM *filter, double factor, int tap_count, int phase_coun * initalizes a audio resampler. * note, if either rate is not a integer then simply scale both rates up so they are */ -AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear){ +AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff){ AVResampleContext *c= av_mallocz(sizeof(AVResampleContext)); - double factor= FFMIN(out_rate / (double)in_rate, 1.0); + double factor= FFMIN(out_rate * cutoff / in_rate, 1.0); int phase_count= 1<