changeset 5414:9746c9a0384f libavcodec

change 2 fields from context to local variables
author jbr
date Sun, 29 Jul 2007 00:35:30 +0000
parents 28c20633db55
children 8bf7358978c8
files ac3dec.c
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ac3dec.c	Sat Jul 28 20:50:25 2007 +0000
+++ b/ac3dec.c	Sun Jul 29 00:35:30 2007 +0000
@@ -89,8 +89,6 @@
     int cplinu;
     int chincpl[AC3_MAX_CHANNELS];
     int phsflginu;
-    int cplbegf;
-    int cplendf;
     int cplcoe;
     uint32_t cplbndstrc;
     int rematstr;
@@ -801,23 +799,25 @@
         ctx->cplinu = get_bits1(gb);
         ctx->cplbndstrc = 0;
         if (ctx->cplinu) { /* coupling in use */
+            int cplbegf, cplendf;
+
             for (i = 0; i < nfchans; i++)
                 ctx->chincpl[i] = get_bits1(gb);
 
             if (acmod == AC3_ACMOD_STEREO)
                 ctx->phsflginu = get_bits1(gb); //phase flag in use
 
-            ctx->cplbegf = get_bits(gb, 4);
-            ctx->cplendf = get_bits(gb, 4);
+            cplbegf = get_bits(gb, 4);
+            cplendf = get_bits(gb, 4);
 
-            if (3 + ctx->cplendf - ctx->cplbegf < 0) {
-                av_log(NULL, AV_LOG_ERROR, "cplendf = %d < cplbegf = %d\n", ctx->cplendf, ctx->cplbegf);
+            if (3 + cplendf - cplbegf < 0) {
+                av_log(NULL, AV_LOG_ERROR, "cplendf = %d < cplbegf = %d\n", cplendf, cplbegf);
                 return -1;
             }
 
-            ctx->ncplbnd = ctx->ncplsubnd = 3 + ctx->cplendf - ctx->cplbegf;
-            ctx->cplstrtmant = ctx->cplbegf * 12 + 37;
-            ctx->cplendmant = ctx->cplendf * 12 + 73;
+            ctx->ncplbnd = ctx->ncplsubnd = 3 + cplendf - cplbegf;
+            ctx->cplstrtmant = cplbegf * 12 + 37;
+            ctx->cplendmant = cplendf * 12 + 73;
             for (i = 0; i < ctx->ncplsubnd - 1; i++) /* coupling band structure */
                 if (get_bits1(gb)) {
                     ctx->cplbndstrc |= 1 << i;
@@ -857,13 +857,13 @@
     if (acmod == AC3_ACMOD_STEREO) {/* rematrixing */
         ctx->rematstr = get_bits1(gb);
         if (ctx->rematstr) {
-            if (!(ctx->cplinu) || ctx->cplbegf > 2)
+            if (!(ctx->cplinu) || ctx->cplstrtmant > 61)
                 for (rbnd = 0; rbnd < 4; rbnd++)
                     ctx->rematflg[rbnd] = get_bits1(gb);
-            if (ctx->cplbegf > 0 && ctx->cplbegf <= 2 && ctx->cplinu)
+            if (ctx->cplstrtmant > 37 && ctx->cplstrtmant <= 61 && ctx->cplinu)
                 for (rbnd = 0; rbnd < 3; rbnd++)
                     ctx->rematflg[rbnd] = get_bits1(gb);
-            if (ctx->cplbegf == 0 && ctx->cplinu)
+            if (ctx->cplstrtmant == 37 && ctx->cplinu)
                 for (rbnd = 0; rbnd < 2; rbnd++)
                     ctx->rematflg[rbnd] = get_bits1(gb);
         }