[FFmpeg-soc] [soc]: r546 - in eac3: eac3.h eac3_parser.c

bwolowiec subversion at mplayerhq.hu
Sun Jul 29 11:36:23 CEST 2007


Author: bwolowiec
Date: Sun Jul 29 11:36:23 2007
New Revision: 546

Log:
Optimization and remove unused variables


Modified:
   eac3/eac3.h
   eac3/eac3_parser.c

Modified: eac3/eac3.h
==============================================================================
--- eac3/eac3.h	(original)
+++ eac3/eac3.h	Sun Jul 29 11:36:23 2007
@@ -88,11 +88,8 @@ typedef struct EAC3Context{
     int lfeon; // 1);                ///< Low frequency effect channel on
     int bsid; // 5);                 ///< Bit stream identification
     int dialnorm[2]; // 5);          ///< Dialogue normalization
-    int compre; // 1);               ///< Compression gain word exists
     int compr; // 8);                ///< Compression gain word
-    int compr2e; // 1);              ///< Compression gain word ch2 exists
     int compr2; // 8);               ///< Compression gain word ch2
-    int chanmape; // 1);             ///< Custom channel map exists
     int chanmap; // 16);             ///< Custom channel map
     int mixmdate; // 1);             ///< Mixing meta-data exists
     int dmixmod; // 2);              ///<
@@ -102,19 +99,13 @@ typedef struct EAC3Context{
     int lorosurmixlev; // 3);
     int lfemixlevcode; // 1);        ///< lfe mix level code exists
     int lfemixlevcod; // 5);         ///< lfe mix level code
-    int pgmscle; // 1);              ///<  Program scale factor exists
     int pgmscl; // 6);               ///< Program scale factor
-    int pgmscl2e; // 1);             ///< Program scale factor #2 exists
     int pgmscl2; // 6);              ///< Program scale factor #2
-    int extpgmscle; // 1);           ///< External program scale factor exists
     int extpgmscl; // 6);            ///< External program scale factor
     int mixdef; // 2);               ///< Mix control type
-    int mixdata; // 12);             ///< Mixing parameter data
     int mixdeflen; // 5);            ///< Length of mixing parameter data field
 //    int *mixdata; // 8*(mixdeflen+2));
-    int paninfoe; // 1);             ///< Pan information exists
     int paninfo; // 14);             ///< Pan information
-    int paninfo2e; // 1);            ///< Pan information 2 exists
     int paninfo2; // 14);            ///< Pan information 2
     int frmmixcfginfoe; // 1);       ///< Frame mixing configuration information exists
     int blkmixcfginfo0; // 5);
@@ -136,8 +127,6 @@ typedef struct EAC3Context{
     int roomtyp2; // 2);             ///< room type ch2
     int adconvtyp2; // 1);           ///< A/D converter type
     int sourcefscod; // 1);          ///< Source sample rate code
-    int convsync; // 1);             ///< Converter synchronization flag
-    int blkid; // 1);                ///< Block identification
     int frmsizecod; // 6);           ///< Frame size code
     int addbsie; // 1);              ///< Additional bit stream information exists
     int addbsil; // 6);              ///< Additional bit stream information length
@@ -162,7 +151,6 @@ typedef struct EAC3Context{
     int frmcplexpstr; // 5);         ///< Frame based coupling exponent strategy
     int frmchexpstr[MAX_CHANNELS];   ///< frame based channel exponent strategy
     int lfeexpstr[MAX_BLOCKS];       ///< Lfe exponent strategy
-    int convexpstre; // 1);          ///< Converter exponent strategy exists
     int convexpstr[MAX_CHANNELS];    ///< Converter channel exponent strategy
     int cplahtinu; // 1);            ///< Coupling channel AHT in use
     int chahtinu[MAX_CHANNELS];      ///< Channel AHT in use

Modified: eac3/eac3_parser.c
==============================================================================
--- eac3/eac3_parser.c	(original)
+++ eac3/eac3_parser.c	Sun Jul 29 11:36:23 2007
@@ -84,24 +84,26 @@ int ff_eac3_parse_bsi(GetBitContext *gbc
     }
 
     GET_BITS(s->dialnorm[0], gbc, 5);
-    GET_BITS(s->compre, gbc, 1);
-    if(s->compre) {
+    if(get_bits1(gbc)) {
         GET_BITS(s->compr, gbc, 8);
+    }else{
+        //TODO default compr
     }
     if(s->acmod == 0x0) /* if 1+1 mode (dual mono, so some items need a second value) */
     {
         GET_BITS(s->dialnorm[1], gbc, 5);
-        GET_BITS(s->compr2e, gbc, 1);
-        if(s->compr2e) {
+        if(get_bits1(gbc)) {
             GET_BITS(s->compr2, gbc, 8);
+        }else{
+            //TODO default compr2
         }
-
     }
     if(s->strmtyp == 0x1) /* if dependent stream */
     {
-        GET_BITS(s->chanmape, gbc, 1);
-        if(s->chanmape) {
+        if(get_bits1(gbc)) {
             GET_BITS(s->chanmap, gbc, 16);
+        }else{
+            //TODO default channel map
         }
     }
     GET_BITS(s->mixmdate, gbc, 1);
@@ -130,45 +132,42 @@ int ff_eac3_parse_bsi(GetBitContext *gbc
         }
         if(s->strmtyp == 0x0) /* if independent stream */
         {
-            GET_BITS(s->pgmscle, gbc, 1);
-            if(s->pgmscle) {
+            if(get_bits1(gbc)) {
                 GET_BITS(s->pgmscl, gbc, 6);
+            }else{
+                //TODO program scale factor = 0dB
             }
             if(s->acmod == 0x0) /* if 1+1 mode (dual mono, so some items need a second value) */
             {
-                GET_BITS(s->pgmscl2e, gbc, 1);
-                if(s->pgmscl2e) {
+                if(get_bits1(gbc)) {
                     GET_BITS(s->pgmscl2, gbc, 6);
+                }else{
+                    //TODO program scale factor 2 = 0dB
                 }
             }
-            GET_BITS(s->extpgmscle, gbc, 1);
-            if(s->extpgmscle) {
+            if(get_bits1(gbc)) {
                 GET_BITS(s->extpgmscl, gbc, 6);
             }
             GET_BITS(s->mixdef, gbc, 2);
             if(s->mixdef == 0x1) /* mixing option 2 */ {
-                GET_BITS(s->mixdata, gbc, 5);
+                skip_bits(gbc, 5);
             }
             else if(s->mixdef == 0x2) /* mixing option 3 */ {
-                GET_BITS(s->mixdata, gbc, 12);
+                skip_bits(gbc, 12);
             }
             else if(s->mixdef == 0x3) /* mixing option 4 */
             {
                 GET_BITS(s->mixdeflen, gbc, 5);
-                av_log(s->avctx, AV_LOG_ERROR, "NOT IMPLEMENTED");
-                return -1;
-//                GET_BITS(s->mixdata, gbc, 8*(mixdeflen+2));
+                skip_bits(gbc, 8*(s->mixdeflen+2));
             }
             if(s->acmod < 0x2) /* if mono or dual mono source */
             {
-                GET_BITS(s->paninfoe, gbc, 1);
-                if(s->paninfoe) {
+                if(get_bits1(gbc)) {
                     GET_BITS(s->paninfo, gbc, 14);
                 }
                 if(s->acmod == 0x0) /* if 1+1 mode (dual mono, so some items need a second value) */
                 {
-                    GET_BITS(s->paninfo2e, gbc, 1);
-                    if(s->paninfo2e) {
+                    if(get_bits1(gbc)) {
                         GET_BITS(s->paninfo2, gbc, 14);
                     }
                 }
@@ -229,17 +228,11 @@ int ff_eac3_parse_bsi(GetBitContext *gbc
         }
     }
     if((s->strmtyp == 0x0) && (s->numblkscod != 0x3) ) {
-        GET_BITS(s->convsync, gbc, 1);
+        skip_bits1(gbc); //converter synchronization flag
     }
     if(s->strmtyp == 0x2) /* if bit stream converted from AC-3 */
     {
-        if(s->numblkscod == 0x3) /* 6 blocks per frame */ {
-            s->blkid = 1;
-        }
-        else {
-            GET_BITS(s->blkid, gbc, 1);
-        }
-        if(s->blkid) {
+        if(s->numblkscod == 0x3 || get_bits1(gbc)) /* 6 blocks per frame */ {
             GET_BITS(s->frmsizecod, gbc, 6);
         }
     }
@@ -316,6 +309,7 @@ int ff_eac3_parse_audfrm(GetBitContext *
         {
             if(s->cplinu[blk] == 1) {
                 GET_BITS(s->cplexpstr[blk], gbc, 2);
+                s->chexpstr[blk][0] = s->cplexpstr[blk];
             }
 
             for(ch = 1; ch <= s->nfchans; ch++) {
@@ -327,6 +321,7 @@ int ff_eac3_parse_audfrm(GetBitContext *
     {
         if( (s->acmod > 0x1) && (s->ncplblks > 0) ) {
             GET_BITS(s->frmcplexpstr, gbc, 5);
+            s->frmchexpstr[0] = s->frmcplexpstr;
         }
         for(ch = 1; ch <= s->nfchans; ch++) {
             GET_BITS(s->frmchexpstr[ch], gbc, 5);
@@ -345,14 +340,7 @@ int ff_eac3_parse_audfrm(GetBitContext *
     /* These fields for converter exponent strategy data */
     if(s->strmtyp == 0x0)
     {
-        if(s->numblkscod != 0x3) {
-            GET_BITS(s->convexpstre, gbc, 1);
-        }
-        else {
-            s->convexpstre = 1;
-        }
-        if(s->convexpstre == 1)
-        {
+        if(s->numblkscod == 0x3 || get_bits1(gbc)){
             for(ch = 1; ch <= s->nfchans; ch++) {
                 GET_BITS(s->convexpstr[ch], gbc, 5);
             }
@@ -960,28 +948,22 @@ int ff_eac3_parse_audblk(GetBitContext *
         assert(s->baie || blk);
         if(s->baie)
         {
-            GET_BITS(s->sdcycod, gbc, 2);
-            GET_BITS(s->fdcycod, gbc, 2);
-            GET_BITS(s->sgaincod, gbc, 2);
-            GET_BITS(s->dbpbcod, gbc, 2);
-            GET_BITS(s->floorcod, gbc, 3);
+            s->sdecay = ff_sdecaytab[get_bits(gbc, 2)];   /* Table 7.6 */
+            s->fdecay = ff_fdecaytab[get_bits(gbc, 2)];   /* Table 7.7 */
+            s->sgain = ff_sgaintab[get_bits(gbc, 2)];     /* Table 7.8 */
+            s->dbknee = ff_dbkneetab[get_bits(gbc, 2)];   /* Table 7.9 */
+            s->floor = ff_floortab[get_bits(gbc, 3)];     /* Table 7.10 */
         }
     }
     else
     {
-        s->sdcycod = 0x2;
-        s->fdcycod = 0x1;
-        s->sgaincod = 0x1;
-        s->dbpbcod = 0x2;
-        s->floorcod = 0x7;
+        s->sdecay = ff_sdecaytab[0x2];   /* Table 7.6 */
+        s->fdecay = ff_fdecaytab[0x1];   /* Table 7.7 */
+        s->sgain = ff_sgaintab[0x1];     /* Table 7.8 */
+        s->dbknee = ff_dbkneetab[0x2];   /* Table 7.9 */
+        s->floor = ff_floortab[0x7];     /* Table 7.10 */
     }
 
-    s->sdecay = ff_sdecaytab[s->sdcycod];   /* Table 7.6 */
-    s->fdecay = ff_fdecaytab[s->fdcycod];   /* Table 7.7 */
-    s->sgain = ff_sgaintab[s->sgaincod];    /* Table 7.8 */
-    s->dbknee = ff_dbkneetab[s->dbpbcod];   /* Table 7.9 */
-    s->floor = ff_floortab[s->floorcod];    /* Table 7.10 */
-
     if(s->snroffststr == 0x0)
     {
         if(s->cplinu[blk]) {



More information about the FFmpeg-soc mailing list