[FFmpeg-cvslog] r25622 - trunk/libavcodec/aacpsy.c

alexc subversion
Mon Nov 1 08:45:13 CET 2010


Author: alexc
Date: Mon Nov  1 08:45:13 2010
New Revision: 25622

Log:
aacenc: Correct spreading calculation for high spreading.

The 3GPP spec uses the following calculation for high spreading:

thr'_spr = max(thr_scaled, s_h(n) * thr_scaled(n-1))

where, n is defined as the current band, and s_h() is defined as "[...] the
distance of adjacent bands in Bark and a constant slope that is 15 dB/Bark
[...]". This is a little ambiguous as you would assume you want the Bark
width of the previous band for this calculation. However, this assumption
appears to be incorrect, and you really want the Bark width of the current
band. Coincidentally this is exactly what the spec calls for! =P

This noticeably improves Tom's Diner at low bitrates (I tested at 64kbps,
with mid/side disabled).

Patch by: Nathan Caldwell <saintdev at gmail.com>

Modified:
   trunk/libavcodec/aacpsy.c

Modified: trunk/libavcodec/aacpsy.c
==============================================================================
--- trunk/libavcodec/aacpsy.c	Mon Nov  1 08:39:31 2010	(r25621)
+++ trunk/libavcodec/aacpsy.c	Mon Nov  1 08:45:13 2010	(r25622)
@@ -414,7 +414,7 @@ static void psy_3gpp_analyze(FFPsyContex
     for (w = 0; w < wi->num_windows*16; w += 16) {
         AacPsyBand *band = &pch->band[w];
         for (g = 1; g < num_bands; g++)
-            band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_hi [g-1]);
+            band[g].thr = FFMAX(band[g].thr, band[g-1].thr * coeffs->spread_hi [g]);
         for (g = num_bands - 2; g >= 0; g--)
             band[g].thr = FFMAX(band[g].thr, band[g+1].thr * coeffs->spread_low[g]);
         for (g = 0; g < num_bands; g++) {



More information about the ffmpeg-cvslog mailing list