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

superdump subversion at mplayerhq.hu
Sun Aug 10 12:06:04 CEST 2008


Author: superdump
Date: Sun Aug 10 12:06:04 2008
New Revision: 3119

Log:
Simplify apply_channel_coupling() by swapping is_cpe[] for type[]


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

Modified: aac/aac.c
==============================================================================
--- aac/aac.c	(original)
+++ aac/aac.c	Sun Aug 10 12:06:04 2008
@@ -1157,13 +1157,14 @@ static int decode_cce(AACContext * ac, G
     coup->num_coupled = get_bits(gb, 3);
     for (c = 0; c <= coup->num_coupled; c++) {
         num_gain++;
-        coup->is_cpe[c] = get_bits1(gb);
+        coup->type[c] = get_bits1(gb) ? TYPE_CPE : TYPE_SCE;
         coup->id_select[c] = get_bits(gb, 4);
-        if (coup->is_cpe[c]) {
+        if (coup->type[c] == TYPE_CPE) {
             coup->ch_select[c] = get_bits(gb, 2);
             if (coup->ch_select[c] == 3)
                 num_gain++;
-        }
+        } else
+            coup->ch_select[c] = 1;
     }
     domain = get_bits1(gb);
 
@@ -1711,20 +1712,18 @@ static void apply_channel_coupling(AACCo
     int index = 0;
     ChannelCoupling * coup = &cc->coup;
     for (c = 0; c <= coup->num_coupled; c++) {
-        if (     !coup->is_cpe[c] && ac->che[TYPE_SCE][coup->id_select[c]]) {
-            apply_coupling_method(ac, &ac->che[TYPE_SCE][coup->id_select[c]]->ch[0], cc, index++);
-        } else if(coup->is_cpe[c] && ac->che[TYPE_CPE][coup->id_select[c]]) {
+        if (ac->che[coup->type[c]][coup->id_select[c]]) {
             if (coup->ch_select[c] != 2) {
-                apply_coupling_method(ac, &ac->che[TYPE_CPE][coup->id_select[c]]->ch[0], cc, index);
+                apply_coupling_method(ac, &ac->che[coup->type[c]][coup->id_select[c]]->ch[0], cc, index);
                 if (coup->ch_select[c] != 0)
                     index++;
             }
             if (coup->ch_select[c] != 1)
-                apply_coupling_method(ac, &ac->che[TYPE_CPE][coup->id_select[c]]->ch[1], cc, index++);
+                apply_coupling_method(ac, &ac->che[coup->type[c]][coup->id_select[c]]->ch[1], cc, index++);
         } else {
             av_log(ac->avccontext, AV_LOG_ERROR,
                    "coupling target %sE[%d] not available\n",
-                   coup->is_cpe[c] ? "CP" : "SC", coup->id_select[c]);
+                   coup->type[c] == TYPE_CPE ? "CP" : "SC", coup->id_select[c]);
             break;
         }
     }

Modified: aac/aac.h
==============================================================================
--- aac/aac.h	(original)
+++ aac/aac.h	Sun Aug 10 12:06:04 2008
@@ -246,7 +246,7 @@ typedef struct {
 typedef struct {
     enum CouplingPoint coupling_point;  ///< The point during decoding at which coupling is applied.
     int num_coupled;       ///< number of target elements
-    int is_cpe[8];         ///< Set if target is an CPE (otherwise it's an SCE).
+    enum RawDataBlockType type[8];   ///< Type of channel element to be coupled - SCE or CPE.
     int id_select[8];      ///< element id
     int ch_select[8];      /**< [0] shared list of gains; [1] list of gains for left channel;
                             *   [2] list of gains for right channel; [3] lists of gains for both channels



More information about the FFmpeg-soc mailing list