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

jbr subversion at mplayerhq.hu
Sat Dec 15 19:17:53 CET 2007


Author: jbr
Date: Sat Dec 15 19:17:53 2007
New Revision: 1588

Log:
share function to uncouple channels between ac3 and eac3 decoders

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

Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c	(original)
+++ eac3/ac3dec.c	Sat Dec 15 19:17:53 2007
@@ -452,23 +452,28 @@ void ff_ac3_decode_exponents(GetBitConte
  * range using the coupling coefficients and coupling coordinates.
  * reference: Section 7.4.3 Coupling Coordinate Format
  */
-static void uncouple_channels(AC3DecodeContext *ctx)
+void ff_ac3_uncouple_channels(int fbw_channels, int cpl_start_freq,
+            int num_cpl_bands, int channel_in_cpl[AC3_MAX_CHANNELS],
+            int cpl_band_struct[18],
+            float transform_coeffs[AC3_MAX_CHANNELS][256],
+            float cpl_coords[AC3_MAX_CHANNELS][18])
 {
     int i, j, ch, bnd, subbnd;
 
     subbnd = -1;
-    i = ctx->start_freq[CPL_CH];
-    for(bnd=0; bnd<ctx->num_cpl_bands; bnd++) {
+    i = cpl_start_freq;
+    for(bnd=0; bnd<num_cpl_bands; bnd++) {
         do {
             subbnd++;
             for(j=0; j<12; j++) {
-                for(ch=1; ch<=ctx->fbw_channels; ch++) {
-                    if(ctx->channel_in_cpl[ch])
-                        ctx->transform_coeffs[ch][i] = ctx->transform_coeffs[CPL_CH][i] * ctx->cpl_coords[ch][bnd] * 8.0f;
+                for(ch=1; ch<=fbw_channels; ch++) {
+                    if(channel_in_cpl[ch])
+                        transform_coeffs[ch][i] = transform_coeffs[CPL_CH][i] *
+                            cpl_coords[ch][bnd] * 8.0f;
                 }
                 i++;
             }
-        } while(ctx->cpl_band_struct[subbnd]);
+        } while(cpl_band_struct[subbnd]);
     }
 }
 
@@ -603,7 +608,10 @@ static int get_transform_coeffs(AC3Decod
                     av_log(ctx->avctx, AV_LOG_ERROR, "error in decoupling channels\n");
                     return -1;
                 }
-                uncouple_channels(ctx);
+                ff_ac3_uncouple_channels(ctx->fbw_channels,
+                        ctx->start_freq[CPL_CH], ctx->num_cpl_bands,
+                        ctx->channel_in_cpl, ctx->cpl_band_struct,
+                        ctx->transform_coeffs, ctx->cpl_coords);
                 got_cplchan = 1;
             }
             end = ctx->end_freq[CPL_CH];

Modified: eac3/ac3dec.h
==============================================================================
--- eac3/ac3dec.h	(original)
+++ eac3/ac3dec.h	Sat Dec 15 19:17:53 2007
@@ -76,6 +76,12 @@ typedef struct {
 int ff_ac3_get_transform_coeffs_ch(mant_groups *m, GetBitContext *gb, uint8_t *exps,
         uint8_t *bap, float *coeffs, int start, int end, AVRandomState *dith_state);
 
+void ff_ac3_uncouple_channels(int fbw_channels, int cpl_start_freq,
+            int num_cpl_bands, int channel_in_cpl[AC3_MAX_CHANNELS],
+            int cpl_band_struct[18],
+            float transform_coeffs[AC3_MAX_CHANNELS][256],
+            float cpl_coords[AC3_MAX_CHANNELS][18]);
+
 void ff_ac3_do_rematrixing(float (*transform_coeffs)[256], int end, int nrematbnd, int *rematflg);
 
 void ff_ac3_do_imdct_256(float *tmp_output, float *transform_coeffs,

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Sat Dec 15 19:17:53 2007
@@ -36,27 +36,6 @@ static void log_missing_feature(AVCodecC
             "mailing list.\n", log);
 }
 
-static void uncouple_channels(EAC3Context *s){
-    int i, j, ch, bnd, subbnd;
-
-    subbnd = 0;
-    i = s->strtmant[CPL_CH];
-    for (bnd = 0; bnd < s->num_cpl_bands; bnd++) {
-        do {
-            for (j = 0; j < 12; j++) {
-                for (ch = 1; ch <= s->fbw_channels; 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;
-                    }
-                }
-                i++;
-            }
-        } while(s->cpl_band_struct[subbnd++]);
-    }
-}
-
 static void spectral_extension(EAC3Context *s){
     //Now turned off, because there are no samples for testing it.
 #if 0
@@ -1181,8 +1160,11 @@ static int parse_audblk(GetBitContext *g
         }
     }
 
-    if (s->cpl_in_use[blk])
-        uncouple_channels(s);
+    if (s->cpl_in_use[blk]) {
+        ff_ac3_uncouple_channels(s->fbw_channels, s->strtmant[CPL_CH],
+                s->num_cpl_bands, s->channel_in_cpl, s->cpl_band_struct,
+                s->transform_coeffs, s->cpl_coords);
+    }
 
     //apply spectral extension
     if (s->spxinu)



More information about the FFmpeg-soc mailing list