diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2004-06-17 16:34:46 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2004-06-17 16:34:46 +0000 |
commit | 08f7073a6ff09ca0f8fc38313eeca0ae739fc254 (patch) | |
tree | dcb1bcdcb5fe51cfba246fa1bc3824d79dbe682e | |
parent | aaaf1635c058dd17bf977356f0deb10b009bc059 (diff) | |
download | ffmpeg-08f7073a6ff09ca0f8fc38313eeca0ae739fc254.tar.gz |
avoid useless normalization and 10l fix
Originally committed as revision 3229 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/resample2.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/libavcodec/resample2.c b/libavcodec/resample2.c index 7ea623e11b..e4115118a2 100644 --- a/libavcodec/resample2.c +++ b/libavcodec/resample2.c @@ -93,7 +93,7 @@ void av_build_filter(int16_t *filter, double factor, int tap_count, int phase_co break; case 2: w = 2.0*x / (factor*tap_count*M_PI); - y *= bessel(16*sqrt(FFMAX(1-w*w, 0))) / bessel(16); + y *= bessel(16*sqrt(FFMAX(1-w*w, 0))); break; } @@ -139,10 +139,9 @@ void av_resample_close(AVResampleContext *c){ } void av_resample_compensate(AVResampleContext *c, int sample_delta, int compensation_distance){ - assert(!c->compensation_distance); //FIXME - +// sample_delta += (c->ideal_dst_incr - c->dst_incr)*(int64_t)c->compensation_distance / c->ideal_dst_incr; c->compensation_distance= compensation_distance; - c->dst_incr-= c->ideal_dst_incr * sample_delta / compensation_distance; + c->dst_incr = c->ideal_dst_incr - c->ideal_dst_incr * (int64_t)sample_delta / compensation_distance; } /** @@ -202,7 +201,7 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int } if(update_ctx){ if(c->compensation_distance){ - c->compensation_distance -= index; + c->compensation_distance -= dst_index; if(!c->compensation_distance) c->dst_incr= c->ideal_dst_incr; } @@ -210,5 +209,13 @@ int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int c->index=0; } *consumed= index >> PHASE_SHIFT; +#if 0 + if(update_ctx && !c->compensation_distance){ +#undef rand + av_resample_compensate(c, rand() % (8000*2) - 8000, 8000*2); +av_log(NULL, AV_LOG_DEBUG, "%d %d %d\n", c->dst_incr, c->ideal_dst_incr, c->compensation_distance); + } +#endif + return dst_index; } |