shithub: aacdec

Download patch

ref: b44f998fd131d47960f6bf97b290e7b7cff9d767
parent: 37365c52f772209be58bad1f7acace60cf54e26b
author: knik <knik>
date: Sun Feb 22 05:09:29 EST 2015

The bugfix does not fully fix DRC processing in FAAD2 but
significantly improves the implementation.
Patch by unknown author.

--- a/libfaad/drc.c
+++ b/libfaad/drc.c
@@ -25,7 +25,7 @@
 ** Commercial non-GPL licensing of this software is possible.
 ** For more info contact Nero AG through Mpeg4AAClicense@nero.com.
 **
-** $Id: drc.c,v 1.28 2007/11/01 12:33:30 menno Exp $
+** $Id: drc.c,v 1.29 2015/02/22 10:09:29 knik Exp $
 **/
 
 #include "common.h"
@@ -130,9 +130,9 @@
 #ifndef FIXED_POINT
         /* Decode DRC gain factor */
         if (drc->dyn_rng_sgn[bd])  /* compress */
-            exp = -drc->ctrl1 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
+            exp = ((-drc->ctrl1 * drc->dyn_rng_ctl[bd]) - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
         else /* boost */
-            exp = drc->ctrl2 * (drc->dyn_rng_ctl[bd] - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
+            exp = ((drc->ctrl2 * drc->dyn_rng_ctl[bd]) - (DRC_REF_LEVEL - drc->prog_ref_level))/REAL_CONST(24.0);
         factor = (real_t)pow(2.0, exp);
 
         /* Apply gain factor */