[FFmpeg-soc] [soc]: r3067 - in aac: aac.c aac.h

superdump subversion at mplayerhq.hu
Thu Aug 7 16:09:34 CEST 2008


Author: superdump
Date: Thu Aug  7 16:09:34 2008
New Revision: 3067

Log:
Merge ChannelCoupling.(is_indep_coup|domain) variables to make code clearer


Modified:
   aac/aac.c
   aac/aac.h

Modified: aac/aac.c
==============================================================================
--- aac/aac.c	(original)
+++ aac/aac.c	Thu Aug  7 16:09:34 2008
@@ -1189,7 +1189,7 @@ static int decode_cpe(AACContext * ac, G
 static int decode_cce(AACContext * ac, GetBitContext * gb, int tag) {
     int num_gain = 0;
     int c, g, sfb, ret;
-    int sign;
+    int is_indep_coup, domain, sign;
     float scale;
     SingleChannelElement * sce;
     ChannelCoupling * coup;
@@ -1199,7 +1199,7 @@ static int decode_cce(AACContext * ac, G
 
     coup = &ac->che[ID_CCE][tag]->coup;
 
-    coup->is_indep_coup = get_bits1(gb);
+    is_indep_coup = get_bits1(gb);
     coup->num_coupled = get_bits(gb, 3);
     for (c = 0; c <= coup->num_coupled; c++) {
         num_gain++;
@@ -1212,7 +1212,15 @@ static int decode_cce(AACContext * ac, G
                 num_gain++;
         }
     }
-    coup->domain = get_bits1(gb);
+    domain = get_bits1(gb);
+
+    if (is_indep_coup) {
+        coup->coupling_point = AFTER_IMDCT;
+    } else if(domain) {
+        coup->coupling_point = BETWEEN_TNS_AND_IMDCT;
+    } else
+        coup->coupling_point = BEFORE_TNS;
+
     sign = get_bits(gb, 1);
     scale = pow(2., pow(2., get_bits(gb, 2) - 3));
 
@@ -1224,7 +1232,7 @@ static int decode_cce(AACContext * ac, G
         int gain = 0;
         float gain_cache = 1.;
         if (c) {
-            cge = coup->is_indep_coup ? 1 : get_bits1(gb);
+            cge = coup->coupling_point == AFTER_IMDCT ? 1 : get_bits1(gb);
             gain = cge ? get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60: 0;
             gain_cache = pow(scale, gain);
         }
@@ -1777,7 +1785,7 @@ static int spectral_to_sample(AACContext
         for(j = 0; j < 4; j++) {
             ChannelElement *che = ac->che[j][i];
             if(che) {
-                if(j == ID_CCE && !che->coup.is_indep_coup && (che->coup.domain == 0))
+                if(j == ID_CCE && che->coup.coupling_point == BEFORE_TNS)
                     apply_channel_coupling(ac, che, apply_dependent_coupling);
 #ifdef AAC_LTP
                 if (ac->m4ac.object_type == AOT_AAC_LTP) {
@@ -1793,7 +1801,7 @@ static int spectral_to_sample(AACContext
                     apply_tns(che->ch[0].coeffs, &che->ch[0].tns, &che->ch[0].ics, 1);
                 if(che->ch[1].tns.present)
                     apply_tns(che->ch[1].coeffs, &che->ch[1].tns, &che->ch[1].ics, 1);
-                if(j == ID_CCE && !che->coup.is_indep_coup && (che->coup.domain == 1))
+                if(j == ID_CCE && che->coup.coupling_point == BETWEEN_TNS_AND_IMDCT)
                     apply_channel_coupling(ac, che, apply_dependent_coupling);
 #ifdef AAC_SSR
                 if (ac->m4ac.object_type == AOT_AAC_SSR) {
@@ -1808,7 +1816,7 @@ static int spectral_to_sample(AACContext
 #ifdef AAC_SSR
                 }
 #endif /* AAC_SSR */
-                if(j == ID_CCE && che->coup.is_indep_coup && (che->coup.domain == 1))
+                if(j == ID_CCE && che->coup.coupling_point == AFTER_IMDCT)
                     apply_channel_coupling(ac, che, apply_independent_coupling);
 #ifdef AAC_LTP
                 if (ac->m4ac.object_type == AOT_AAC_LTP) {

Modified: aac/aac.h
==============================================================================
--- aac/aac.h	(original)
+++ aac/aac.h	Thu Aug  7 16:09:34 2008
@@ -141,6 +141,15 @@ enum ChannelPosition {
 };
 
 /**
+ * The point during decoding at which channel coupling is applied.
+ */
+enum CouplingPoint {
+    BEFORE_TNS,
+    BETWEEN_TNS_AND_IMDCT,
+    AFTER_IMDCT,
+};
+
+/**
  * mix-down channel types
  */
 enum {
@@ -262,8 +271,7 @@ typedef struct {
  * coupling parameters
  */
 typedef struct {
-    int is_indep_coup;     ///< Set if independent coupling (i.e. after IMDCT).
-    int domain;            ///< Controls if coupling is performed before (0) or after (1) the TNS decoding of the target channels.
+    enum CouplingPoint coupling_point;  ///< The point during decoding at which coupling is applied.
     int num_coupled;       ///< number of target elements
     int is_cpe[9];         ///< Set if target is an CPE (otherwise it's an SCE).
     int tag_select[9];     ///< element tag index



More information about the FFmpeg-soc mailing list