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

bwolowiec subversion at mplayerhq.hu
Mon Mar 17 23:21:11 CET 2008


Author: bwolowiec
Date: Mon Mar 17 23:21:11 2008
New Revision: 2021

Log:
added support for dependent stream channel map


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

Modified: eac3/ac3dec.h
==============================================================================
--- eac3/ac3dec.h	(original)
+++ eac3/ac3dec.h	Mon Mar 17 23:21:11 2008
@@ -77,6 +77,7 @@ typedef struct AC3DecodeContext {
     int num_blocks;     ///< Number of audio blocks
     int channel_mode;   ///< Channel mode (acmod)
     int lfe_on;         ///< Low frequency effect channel on (lfeon)
+    int channel_map;    ///< Custom channel map
     int bitstream_id;   ///< Bit stream identification (bsid)
     int center_mix_level;   ///< Center mix level index
     int surround_mix_level; ///< Surround mix level index

Modified: eac3/ac3dec_data.c
==============================================================================
--- eac3/ac3dec_data.c	(original)
+++ eac3/ac3dec_data.c	Mon Mar 17 23:21:11 2008
@@ -1105,6 +1105,23 @@ const uint8_t ff_eac3_frm_expstr[32][6] 
 };
 
 /**
+ * Default channel map for a dependent substream defined by acmod
+ */
+const uint16_t ff_eac3_default_chmap[8] = {
+    AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT, // FIXME Ch1+Ch2
+    AC3_CHMAP_CENTRE,
+    AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT,
+    AC3_CHMAP_LEFT | AC3_CHMAP_CENTRE | AC3_CHMAP_RIGHT,
+    AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT | AC3_CHMAP_CENTRE_SURROUND,
+    AC3_CHMAP_LEFT | AC3_CHMAP_CENTRE | AC3_CHMAP_RIGHT |
+    AC3_CHMAP_CENTRE_SURROUND,
+    AC3_CHMAP_LEFT | AC3_CHMAP_RIGHT | AC3_CHMAP_LEFT_SURROUND |
+        AC3_CHMAP_RIGHT_SURROUND,
+    AC3_CHMAP_LEFT | AC3_CHMAP_CENTRE | AC3_CHMAP_RIGHT |
+        AC3_CHMAP_LEFT_SURROUND | AC3_CHMAP_RIGHT_SURROUND
+};
+
+/**
  * Table E2.16 Default Coupling Banding Structure
  */
 const uint8_t ff_eac3_default_cpl_band_struct[18] =

Modified: eac3/ac3dec_data.h
==============================================================================
--- eac3/ac3dec_data.h	(original)
+++ eac3/ac3dec_data.h	Mon Mar 17 23:21:11 2008
@@ -37,4 +37,18 @@ extern const uint8_t ff_eac3_defecplbnds
 
 extern const uint8_t ff_ac3_rematrix_band_tab[5];
 
+extern const uint16_t ff_eac3_default_chmap[8];
+
+/** Custom channel map locations bitmask
+ *  Other channels described in documentation: Lc/Rc pair, Lrs/Rrs pair, Ts, Lsd/Rsd pair, Lw/Rw pair, Lvh/Rvh pair, Cvh, Reserved, LFE2 */
+enum {
+    AC3_CHMAP_LEFT =            1<<0,
+    AC3_CHMAP_CENTRE =          1<<1,
+    AC3_CHMAP_RIGHT =           1<<2,
+    AC3_CHMAP_LEFT_SURROUND =   1<<3,
+    AC3_CHMAP_RIGHT_SURROUND =  1<<4,
+    AC3_CHMAP_CENTRE_SURROUND = 1<<7,
+    AC3_CHMAP_LFE =             1<<15
+};
+
 #endif /* FFMPEG_AC3DEC_DATA_H */

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Mon Mar 17 23:21:11 2008
@@ -331,9 +331,12 @@ static int parse_bsi(AC3DecodeContext *s
     /* dependent stream channel map */
     if (s->stream_type == EAC3_STREAM_TYPE_DEPENDENT) {
         if (get_bits1(gbc)) {
-            skip_bits(gbc, 16); // skip custom channel map
+            s->channel_map = get_bits(gbc, 16); //custom channel map
         } else {
-            //TODO default channel map based on acmod and lfeon
+            //default channel map based on acmod and lfeon
+            s->channel_map = ff_eac3_default_chmap[s->channel_mode];
+            if(s->lfe_on)
+                s->channel_map |= AC3_CHMAP_LFE;
         }
     }
 #endif



More information about the FFmpeg-soc mailing list