[FFmpeg-soc] [soc]: r1697 - eac3/eac3dec.c

jbr subversion at mplayerhq.hu
Sun Dec 30 02:54:20 CET 2007


Author: jbr
Date: Sun Dec 30 02:54:20 2007
New Revision: 1697

Log:
make the GAQ dequantization code more readable

Modified:
   eac3/eac3dec.c

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Sun Dec 30 02:54:20 2007
@@ -208,18 +208,26 @@ static void get_transform_coeffs_aht_ch(
             }
 
             for (blk = 0; blk < 6; blk++) {
-                pre_mantissa = get_sbits(gbc, bits-log_gain);
+                int gbits = bits - log_gain;
+                pre_mantissa = get_sbits(gbc, gbits);
                 if (log_gain == 0) {
                     // Gk = 1, GAQ mode = 0, or hebap is outside of GAQ range
                     mant = pre_mantissa * ff_ac3_scale_factors[bits-1];
                     remap = 1;
-                } else if (pre_mantissa == -(1 << (bits-log_gain-1))) {
+                } else if (pre_mantissa == -(1 << (gbits-1))) {
                     // large mantissa
-                    pre_mantissa = get_sbits(gbc, bits-(log_gain==1));
-                    mant = pre_mantissa * ff_ac3_scale_factors[bits-(log_gain==1)-1];
+                    if(log_gain == 1) {
+                        // Gk = 2
+                        pre_mantissa = get_sbits(gbc, bits-1);
+                        mant = pre_mantissa * ff_ac3_scale_factors[bits-2];
+                    } else {
+                        // Gk = 4
+                        pre_mantissa = get_sbits(gbc, bits);
+                        mant = pre_mantissa * ff_ac3_scale_factors[bits-1];
+                    }
                     remap = 1;
                 } else {
-                    // small mantissa
+                    // small mantissa, Gk = 2 or 4
                     mant = pre_mantissa * ff_ac3_scale_factors[bits-1];
                     remap = 0;
                 }



More information about the FFmpeg-soc mailing list