[FFmpeg-soc] [soc]: r1767 - in eac3: ac3dec.h ac3tab.c ac3tab.h eac3dec.c

jbr subversion at mplayerhq.hu
Sun Jan 6 01:12:40 CET 2008


Author: jbr
Date: Sun Jan  6 01:12:40 2008
New Revision: 1767

Log:
add pre-processor defines for testing spectral extension and enhanced coupling

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

Modified: eac3/ac3dec.h
==============================================================================
--- eac3/ac3dec.h	(original)
+++ eac3/ac3dec.h	Sun Jan  6 01:12:40 2008
@@ -32,6 +32,9 @@
 #include "dsputil.h"
 #include "random.h"
 
+#define TEST_SPX 0
+#define TEST_ECPL 0
+
 /* override ac3.h to include coupling channel */
 #undef AC3_MAX_CHANNELS
 #define AC3_MAX_CHANNELS 7
@@ -116,10 +119,13 @@ typedef struct AC3DecodeContext {
     float pre_mantissa[6][AC3_MAX_CHANNELS][256];   ///< Pre-IDCT mantissas
 ///@}
 
+#if TEST_SPX
 ///@defgroup spx Spectral Extension
     int channel_uses_spx[AC3_MAX_CHANNELS]; ///< Channel in spectral extension attenuation process (chinspxatten)
     int spx_atten_code[AC3_MAX_CHANNELS];   ///< spectral extension attenuation code (spxattencod)
+#endif
     int spxinu;                             ///< spectral extension in use
+#if TEST_SPX
     int chinspx[AC3_MAX_CHANNELS];          ///< Channel in spectral extension
     int spxstrtf;                           ///< Spectral extension start copy frequency code
     int spxbegf;                            ///< Spectral extension begin frequency code
@@ -132,7 +138,9 @@ typedef struct AC3DecodeContext {
     int firstspxcos[AC3_MAX_CHANNELS];      ///< First spectral extension coordinates states
     float spxco[AC3_MAX_CHANNELS][18];      ///< Spectral extension coordinates
 ///@}
+#endif
 
+#if TEST_ECPL
 ///@defgroup ecpl Enhanced Coupling
     int ecpl_in_use;                        ///< Enhanced coupling in use
     int ecplbegf;                           ///< Enhanced coupling begin frequency code
@@ -149,6 +157,7 @@ typedef struct AC3DecodeContext {
     int ecplchaos[AC3_MAX_CHANNELS][23];    ///< Enhanced coupling chaos
     int ecpltrans[AC3_MAX_CHANNELS];        ///< Enhanced coupling transient present
 ///@}
+#endif
 
 ///@defgroup channel Channel
     int fbw_channels;                           ///< Number of fbw channels

Modified: eac3/ac3tab.c
==============================================================================
--- eac3/ac3tab.c	(original)
+++ eac3/ac3tab.c	Sun Jan  6 01:12:40 2008
@@ -1336,7 +1336,6 @@ const uint8_t ff_eac3_frm_expstr[32][6] 
 const uint8_t ff_eac3_default_cpl_band_struct[18] =
 { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 };
 
-#if 0
 /**
  * Table E2.15 Default Spectral Extension Banding Structure
  */
@@ -1388,7 +1387,6 @@ const float ff_eac3_spxattentab[32][3] =
     {0.238710401, 0.056982656, 0.013602353},
     {0.227930622, 0.051952369, 0.011841536}
 };
-#endif
 
 /**
  * Table of bin locations for rematrixing bands

Modified: eac3/ac3tab.h
==============================================================================
--- eac3/ac3tab.h	(original)
+++ eac3/ac3tab.h	Sun Jan  6 01:12:40 2008
@@ -48,11 +48,9 @@ extern const uint8_t ff_eac3_gaq_gk[4][3
 extern const int16_t (*ff_eac3_vq_hebap[8])[6];
 extern const uint8_t ff_eac3_frm_expstr[32][6];
 extern const uint8_t ff_eac3_default_cpl_band_struct[18];
-#if 0
 extern const uint8_t ff_eac3_defspxbndstrc[17];
 extern const uint8_t ff_eac3_defecplbndstrc[22];
 extern const float   ff_eac3_spxattentab[32][3];
-#endif
 
 extern const uint8_t ff_ac3_rematrix_band_tab[5];
 

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Sun Jan  6 01:12:40 2008
@@ -569,6 +569,7 @@ static int parse_audfrm(AC3DecodeContext
         }
     }
     /* Spectral extension attenuation data */
+#if TEST_SPX
     if (parse_spx_atten_data) {
         for (ch = 1; ch <= s->fbw_channels; ch++) {
             s->channel_uses_spx[ch] = get_bits1(gbc);
@@ -580,6 +581,7 @@ static int parse_audfrm(AC3DecodeContext
         for (ch = 1; ch <= s->fbw_channels; ch++)
             s->channel_uses_spx[ch]=0;
     }
+#endif
     /* Block start information */
     if (s->num_blocks > 1 && get_bits1(gbc)) {
         /* reference: Section E2.3.2.27
@@ -591,7 +593,9 @@ static int parse_audfrm(AC3DecodeContext
     }
     /* Syntax state initialization */
     for (ch = 1; ch <= s->fbw_channels; ch++) {
+#if TEST_SPX
         s->firstspxcos[ch] = 1;
+#endif
         s->first_cpl_coords[ch] = 1;
     }
     s->first_cpl_leak = 1;
@@ -647,9 +651,7 @@ int ff_eac3_parse_audio_block(AC3DecodeC
     if (s->eac3 && (!blk || get_bits1(gbc))) {
         s->spxinu = get_bits1(gbc);
         if (s->spxinu) {
-            log_missing_feature(s->avctx, "Spectral extension");
-            return -1;
-#if 0
+#if TEST_SPX
             if (s->channel_mode == AC3_CHMODE_MONO) {
                 s->chinspx[1] = 1;
             } else {
@@ -703,17 +705,22 @@ int ff_eac3_parse_audio_block(AC3DecodeC
                     s->spxbndsztab[s->nspxbnds - 1] += 12;
                 }
             }
+#else
+            log_missing_feature(s->avctx, "Spectral extension");
+            return -1;
 #endif
+#if TEST_SPX
         } else {
             /* !spxinu */
             for (ch = 1; ch <= s->fbw_channels; ch++) {
                 s->chinspx[ch] = 0;
                 s->firstspxcos[ch] = 1;
             }
+#endif
         }
     }
 
-#if 0
+#if TEST_SPX
     /* Spectral extension coordinates */
     if (s->spxinu) {
         for (ch = 1; ch <= s->fbw_channels; ch++) {
@@ -783,11 +790,15 @@ int ff_eac3_parse_audio_block(AC3DecodeC
 
                 /* get start and end subbands for coupling */
                 cpl_begin = get_bits(gbc, 4);
+#if TEST_SPX
                 if (!s->eac3 || !s->spxinu) {
                     cpl_end = get_bits(gbc, 4) + 3;
                 } else {
                     cpl_end = s->spxbegf - 1;
                 }
+#else
+                cpl_end = get_bits(gbc, 4) + 3;
+#endif
                 s->num_cpl_subbands =  cpl_end - cpl_begin;
 
                 /* calculate start and end frequency bins for coupling */
@@ -820,9 +831,8 @@ int ff_eac3_parse_audio_block(AC3DecodeC
                 }
             } else {
                 /* enhanced coupling in use */
-                log_missing_feature(s->avctx, "Enhanced coupling");
-                return -1;
-#if 0
+#if TEST_ECPL
+                int sbnd;
                 s->ecplbegf = get_bits(gbc, 4);
                 if (s->ecplbegf < 3) {
                     s->ecpl_start_subbnd = s->ecplbegf * 2;
@@ -860,6 +870,9 @@ int ff_eac3_parse_audio_block(AC3DecodeC
                 for (bnd = s->ecpl_start_subbnd; bnd < s->ecpl_end_subbnd; bnd++) {
                     s->necplbnd -= s->ecplbndstrc[bnd];
                 }
+#else
+                log_missing_feature(s->avctx, "Enhanced coupling");
+                return -1;
 #endif
             }
         } else {
@@ -926,11 +939,11 @@ int ff_eac3_parse_audio_block(AC3DecodeC
         } else {
             /* enhanced coupling in use */
             //TODO calc nchgrps[CPL_CH]
-#if 0
+#if TEST_ECPL
             s->firstchincpl = -1;
             s->ecplangleintrp = get_bits1(gbc);
             for (ch = 1; ch <= s->fbw_channels; ch++) {
-                if (s->chincpl[ch]) {
+                if (s->channel_in_cpl[ch]) {
                     if (s->firstchincpl == -1) {
                         s->firstchincpl = ch;
                     }
@@ -1014,7 +1027,11 @@ int ff_eac3_parse_audio_block(AC3DecodeC
         }
         if (s->exp_strategy[blk][ch] != EXP_REUSE) {
             s->start_freq[ch] = 0;
+#if TEST_SPX
             if ((!s->channel_in_cpl[ch]) && (!s->eac3 || !s->chinspx[ch])) {
+#else
+            if (!s->channel_in_cpl[ch]) {
+#endif
                 int prev = s->end_freq[ch];
                 chbwcod = get_bits(gbc, 6);
                 if (chbwcod > 60) {



More information about the FFmpeg-soc mailing list