[FFmpeg-soc] [soc]: r1779 - in eac3: ac3dec.c eac3dec.c

jbr subversion at mplayerhq.hu
Sun Jan 6 21:38:48 CET 2008


Author: jbr
Date: Sun Jan  6 21:38:47 2008
New Revision: 1779

Log:
fix phase flag processing for the case when coupling coordinates are reused
for the right channel, but new for the left channel

Modified:
   eac3/ac3dec.c
   eac3/eac3dec.c

Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c	(original)
+++ eac3/ac3dec.c	Sun Jan  6 21:38:47 2008
@@ -430,8 +430,11 @@ static void uncouple_channels(AC3DecodeC
             subbnd++;
             for(j=0; j<12; j++) {
                 for(ch=1; ch<=s->fbw_channels; ch++) {
-                    if(s->channel_in_cpl[ch])
+                    if(s->channel_in_cpl[ch]) {
                         s->transform_coeffs[ch][i] = s->transform_coeffs[CPL_CH][i] * s->cpl_coords[ch][bnd] * 8.0f;
+                        if (ch == 2 && s->phase_flags[bnd])
+                            s->transform_coeffs[ch][i] = -s->transform_coeffs[ch][i];
+                    }
                 }
                 i++;
             }
@@ -845,10 +848,9 @@ static int ac3_parse_audio_block(AC3Deco
             }
         }
         /* phase flags */
-        if (channel_mode == AC3_CHMODE_STEREO && s->phase_flags_in_use && cpl_coords_exist) {
+        if (channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) {
             for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
-                if (get_bits1(gbc))
-                    s->cpl_coords[2][bnd] = -s->cpl_coords[2][bnd];
+                s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0;
             }
         }
     }

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Sun Jan  6 21:38:47 2008
@@ -929,11 +929,9 @@ int ff_eac3_parse_audio_block(AC3DecodeC
                     s->first_cpl_coords[ch] = 1;
                 }
             }
-            if ((s->channel_mode == AC3_CHMODE_STEREO) && s->phase_flags_in_use
-                    && cpl_coords_exist) {
+            if (s->channel_mode == AC3_CHMODE_STEREO && cpl_coords_exist) {
                 for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
-                    if (get_bits1(gbc))
-                        s->cpl_coords[2][bnd] = -s->cpl_coords[2][bnd];
+                    s->phase_flags[bnd] = s->phase_flags_in_use? get_bits1(gbc) : 0;
                 }
             }
         } else {



More information about the FFmpeg-soc mailing list