diff ac3dec.c @ 7328:9309e19c2b98 libavcodec

read 'coupling in use' parameter from bitstream into decoder context first, then copy to the local variable.
author jbr
date Sat, 19 Jul 2008 22:01:46 +0000
parents b5dacf4fc65b
children 85ab7655ad4d
line wrap: on
line diff
--- a/ac3dec.c	Sat Jul 19 21:53:54 2008 +0000
+++ b/ac3dec.c	Sat Jul 19 22:01:46 2008 +0000
@@ -753,8 +753,8 @@
     /* coupling strategy */
     if (get_bits1(gbc)) {
         memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
-        cpl_in_use = get_bits1(gbc);
-        if (cpl_in_use) {
+        s->cpl_in_use[blk] = get_bits1(gbc);
+        if (s->cpl_in_use[blk]) {
             /* coupling in use */
             int cpl_begin_freq, cpl_end_freq;
 
@@ -797,9 +797,9 @@
         av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must be present in block 0\n");
         return -1;
     } else {
-        cpl_in_use = s->cpl_in_use[blk-1];
+        s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
     }
-    s->cpl_in_use[blk] = cpl_in_use;
+    cpl_in_use = s->cpl_in_use[blk];
 
     /* coupling coordinates */
     if (cpl_in_use) {