diff options
author | Nathan Caldwell <saintdev@gmail.com> | 2010-10-27 05:54:44 +0000 |
---|---|---|
committer | Anton Khirnov <wyskas@gmail.com> | 2010-10-27 05:54:44 +0000 |
commit | 4df5aebb811aac306751f42ccf7db8398161604e (patch) | |
tree | 02bc6ec7d921c32e197f27b5dbb385c94b1ef016 | |
parent | eafadadaf502560d1d3c2a1cb8e8cb9991221e14 (diff) | |
download | ffmpeg-streaming-4df5aebb811aac306751f42ccf7db8398161604e.zip ffmpeg-streaming-4df5aebb811aac306751f42ccf7db8398161604e.tar.gz |
aacenc: Fix threshold-in-quiet calculation in the 3GPP psymodel.
Removing the modification vastly improves quality (at a slight bitrate
cost) for some samples. castanets.wav is a good example. The closest
equivalent I see to the modification in the 3GPP spec is a similar
modification (over a specific frequency range) when TNS is used.
This also changes the threshold-in-quiet calculation to match the
3GPP spec.
patch by Nathan Caldwell saintdev (at) gmail
Originally committed as revision 25588 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/aacpsy.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index 5b637b8..77eebb9 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -419,12 +419,10 @@ static void psy_3gpp_analyze(FFPsyContext *ctx, int channel, for (g = num_bands - 2; g >= 0; g--) band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_hi [g]); for (g = 0; g < num_bands; g++) { - band[g].thr_quiet = FFMAX(band[g].thr, coeffs->ath[g]); + band[g].thr_quiet = band[g].thr = FFMAX(band[g].thr, coeffs->ath[g]); if (!(wi->window_type[0] == LONG_STOP_SEQUENCE || (wi->window_type[1] == LONG_START_SEQUENCE && !w))) - band[g].thr_quiet = FFMAX(PSY_3GPP_RPEMIN*band[g].thr_quiet, - FFMIN(band[g].thr_quiet, - PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); - band[g].thr = FFMAX(band[g].thr, band[g].thr_quiet * 0.25); + band[g].thr = FFMAX(PSY_3GPP_RPEMIN*band[g].thr, FFMIN(band[g].thr, + PSY_3GPP_RPELEV*pch->prev_band[w+g].thr_quiet)); ctx->psy_bands[channel*PSY_MAX_BANDS+w+g].threshold = band[g].thr; } |