[FFmpeg-soc] [soc]: r2255 - in eac3: ac3dec.c ac3dec_data.c ac3dec_data.h checkout.sh eac3dec.c ffmpeg.patch

jbr subversion at mplayerhq.hu
Fri May 30 04:29:41 CEST 2008


Author: jbr
Date: Fri May 30 04:29:39 2008
New Revision: 2255

Log:
update to ffmpeg svn r13545

Modified:
   eac3/ac3dec.c
   eac3/ac3dec_data.c
   eac3/ac3dec_data.h
   eac3/checkout.sh
   eac3/eac3dec.c
   eac3/ffmpeg.patch

Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c	(original)
+++ eac3/ac3dec.c	Fri May 30 04:29:39 2008
@@ -236,21 +236,6 @@ static int ac3_parse_header(AC3DecodeCon
     GetBitContext *gbc = &s->gbc;
     int i;
 
-    /* skip over portion of header which has already been read */
-    skip_bits(gbc, 16); // skip the sync_word
-    skip_bits(gbc, 16); // skip crc1
-    skip_bits(gbc, 8);  // skip fscod and frmsizecod
-    skip_bits(gbc, 11); // skip bsid, bsmod, and acmod
-    if(s->channel_mode == AC3_CHMODE_STEREO) {
-        skip_bits(gbc, 2); // skip dsurmod
-    } else {
-        if((s->channel_mode & 1) && s->channel_mode != AC3_CHMODE_MONO)
-            s->center_mix_level = center_levels[get_bits(gbc, 2)];
-        if(s->channel_mode & 4)
-            s->surround_mix_level = surround_levels[get_bits(gbc, 2)];
-    }
-    skip_bits1(gbc); // skip lfeon
-
     /* read the rest of the bsi. read twice for dual mono mode. */
     i = !(s->channel_mode);
     do {
@@ -291,7 +276,7 @@ static int parse_frame_header(AC3DecodeC
     AC3HeaderInfo hdr;
     int err;
 
-    err = ff_ac3_parse_header(s->gbc.buffer, &hdr);
+    err = ff_ac3_parse_header(&s->gbc, &hdr);
     if(err)
         return err;
 
@@ -307,7 +292,11 @@ static int parse_frame_header(AC3DecodeC
     s->lfe_ch                       = s->fbw_channels + 1;
     s->frame_size                   = hdr.frame_size;
     s->bitstream_id                 = hdr.bitstream_id;
+    s->center_mix_level             = hdr.center_mix_level;
+    s->surround_mix_level           = hdr.surround_mix_level;
     s->num_blocks                   = hdr.num_blocks;
+    s->frame_type                   = hdr.frame_type;
+    s->substreamid                  = hdr.substreamid;
 
     if(s->lfe_on) {
         s->start_freq[s->lfe_ch] = 0;
@@ -316,10 +305,6 @@ static int parse_frame_header(AC3DecodeC
         s->channel_in_cpl[s->lfe_ch] = 0;
     }
 
-    /* set default mix levels */
-    s->center_mix_level = 5;    // -4.5dB
-    s->surround_mix_level = 6;  // -6.0dB
-
     if(s->bitstream_id <= 10) {
         s->eac3 = 0;
         return ac3_parse_header(s);

Modified: eac3/ac3dec_data.c
==============================================================================
--- eac3/ac3dec_data.c	(original)
+++ eac3/ac3dec_data.c	Fri May 30 04:29:39 2008
@@ -1105,20 +1105,6 @@ 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_L |               AC3_CHMAP_R, // FIXME Ch1+Ch2
-                  AC3_CHMAP_C,
-    AC3_CHMAP_L |               AC3_CHMAP_R,
-    AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R,
-    AC3_CHMAP_L |               AC3_CHMAP_R |                   AC3_CHMAP_C_SUR,
-    AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R |                   AC3_CHMAP_C_SUR,
-    AC3_CHMAP_L |               AC3_CHMAP_R | AC3_CHMAP_L_SUR |                  AC3_CHMAP_R_SUR,
-    AC3_CHMAP_L | AC3_CHMAP_C | AC3_CHMAP_R | AC3_CHMAP_L_SUR |                  AC3_CHMAP_R_SUR
-};
-
-/**
  * 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	Fri May 30 04:29:39 2008
@@ -38,21 +38,4 @@ 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 CustomChannelMapLocation{
-    AC3_CHMAP_L=        1<<(15-0),
-    AC3_CHMAP_C=        1<<(15-1),
-    AC3_CHMAP_R=        1<<(15-2),
-    AC3_CHMAP_L_SUR=    1<<(15-3),
-    AC3_CHMAP_R_SUR =   1<<(15-4),
-    AC3_CHMAP_C_SUR=    1<<(15-7),
-    AC3_CHMAP_LFE =     1<<(15-15)
-};
-
 #endif /* FFMPEG_AC3DEC_DATA_H */

Modified: eac3/checkout.sh
==============================================================================
--- eac3/checkout.sh	(original)
+++ eac3/checkout.sh	Fri May 30 04:29:39 2008
@@ -1,10 +1,10 @@
 FILES="eac3dec.c ac3dec.c ac3dec.h ac3dec_data.c ac3dec_data.h"
 
 echo "checking out ffmpeg svn"
-for i in $FILES Makefile aac_ac3_parser.h aac_parser.c ac3_parser.c ac3_parser.h ac3enc.c ac3.c ac3.h; do
+for i in $FILES Makefile ac3_parser.c ac3enc.c ac3.c ac3.h; do
     rm -f ffmpeg/libavcodec/$i
 done
-svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r 12599
+svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r 13545
 echo "patching ffmpeg"
 cd ffmpeg
 patch -p0 <../ffmpeg.patch

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Fri May 30 04:29:39 2008
@@ -272,12 +272,9 @@ static int parse_bsi(AC3DecodeContext *s
     int i, blk;
     GetBitContext *gbc = &s->gbc;
 
-    skip_bits(gbc, 16); // skip the sync word
-
     /* an E-AC3 stream can have multiple independent streams which the
        application can select from. each independent stream can also contain
        dependent streams which are used to add or replace channels. */
-    s->frame_type = get_bits(gbc, 2);
     if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT) {
         ff_eac3_log_missing_feature(s->avctx, "Dependent substream");
         return AC3_PARSE_ERROR_FRAME_TYPE;
@@ -289,7 +286,6 @@ static int parse_bsi(AC3DecodeContext *s
     /* the substream id indicates which substream this frame belongs to. each
        independent stream has its own substream id, and the dependent streams
        associated to an independent stream have matching substream id's */
-    s->substreamid = get_bits(gbc, 3);
     if (s->substreamid) {
         // TODO: allow user to select which substream to decode
         av_log(s->avctx, AV_LOG_INFO, "Skipping additional substream #%d\n",
@@ -297,9 +293,6 @@ static int parse_bsi(AC3DecodeContext *s
         return AC3_PARSE_ERROR_FRAME_TYPE;
     }
 
-    /* skip parameters which have already been read */
-    skip_bits(gbc, 11); // skip frame size
-    skip_bits(gbc, 2);  // skip samplerate code
     if (s->bit_alloc_params.sr_code == EAC3_SR_CODE_REDUCED) {
         /* The E-AC3 specification does not tell how to handle reduced sample
            rates in bit allocation.  The best assumption would be that it is
@@ -307,11 +300,7 @@ static int parse_bsi(AC3DecodeContext *s
            sample which utilizes this feature. */
         ff_eac3_log_missing_feature(s->avctx, "Reduced Sampling Rates");
         return -1;
-    } else {
-        skip_bits(gbc, 2); // skip number of blocks code
     }
-    skip_bits(gbc, 3); // skip channel mode
-    skip_bits1(gbc);   // skip lfe indicator
     skip_bits(gbc, 5); // skip bitstream id
 
     /* dialog normalization and compression gain are volume control params */

Modified: eac3/ffmpeg.patch
==============================================================================
--- eac3/ffmpeg.patch	(original)
+++ eac3/ffmpeg.patch	Fri May 30 04:29:39 2008
@@ -1,19 +1,6 @@
-Index: libavcodec/aac_ac3_parser.h
-===================================================================
---- libavcodec/aac_ac3_parser.h	(revision 12599)
-+++ libavcodec/aac_ac3_parser.h	(working copy)
-@@ -37,7 +37,7 @@
-     int sample_rate;
-     int bit_rate;
-     int samples;
--    uint8_t stream_type;
-+    uint8_t frame_type;
- } AACAC3ParseContext;
- 
- int ff_aac_ac3_parse(AVCodecParserContext *s1,
 Index: libavcodec/Makefile
 ===================================================================
---- libavcodec/Makefile	(revision 12599)
+--- libavcodec/Makefile	(revision 13545)
 +++ libavcodec/Makefile	(working copy)
 @@ -30,7 +30,7 @@
  OBJS-$(CONFIG_ENCODERS)                += faandct.o jfdctfst.o jfdctint.o
@@ -24,64 +11,73 @@ Index: libavcodec/Makefile
  OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc.o ac3tab.o ac3.o
  OBJS-$(CONFIG_ALAC_DECODER)            += alac.o
  OBJS-$(CONFIG_AMV_DECODER)             += sp5xdec.o mjpegdec.o mjpeg.o
-Index: libavcodec/aac_parser.c
-===================================================================
---- libavcodec/aac_parser.c	(revision 12599)
-+++ libavcodec/aac_parser.c	(working copy)
-@@ -84,7 +84,7 @@
- static av_cold int aac_parse_init(AVCodecParserContext *s1)
- {
-     AACAC3ParseContext *s = s1->priv_data;
--    s->stream_type = EAC3_STREAM_TYPE_INDEPENDENT;
-+    s->frame_type = EAC3_FRAME_TYPE_INDEPENDENT;
-     s->inbuf_ptr = s->inbuf;
-     s->header_size = AAC_HEADER_SIZE;
-     s->sync = aac_sync;
 Index: libavcodec/ac3_parser.c
 ===================================================================
---- libavcodec/ac3_parser.c	(revision 12599)
+--- libavcodec/ac3_parser.c	(revision 13545)
 +++ libavcodec/ac3_parser.c	(working copy)
-@@ -38,7 +38,6 @@
+@@ -49,7 +49,6 @@
+ int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
  {
-     GetBitContext gbc;
      int frame_size_code;
 -    int num_blocks;
  
      memset(hdr, 0, sizeof(*hdr));
  
-@@ -84,13 +83,14 @@
+@@ -62,6 +61,10 @@
+     if(hdr->bitstream_id > 16)
+         return AC3_PARSE_ERROR_BSID;
+ 
++    /* set default mix levels */
++    hdr->center_mix_level   = 5;  // -4.5dB
++    hdr->surround_mix_level = 6;  // -6.0dB
++
+     if(hdr->bitstream_id <= 10) {
+         /* Normal AC-3 */
+         hdr->crc1 = get_bits(gbc, 16);
+@@ -78,10 +81,6 @@
+         skip_bits(gbc, 3); // skip bitstream mode
+         hdr->channel_mode = get_bits(gbc, 3);
+ 
+-        /* set default mix levels */
+-        hdr->center_mix_level   = 3;  // -4.5dB
+-        hdr->surround_mix_level = 4;  // -6.0dB
+-
+         if(hdr->channel_mode == AC3_CHMODE_STEREO) {
+             skip_bits(gbc, 2); // skip dsurmod
+         } else {
+@@ -97,7 +96,9 @@
          hdr->bit_rate = (ff_ac3_bitrate_tab[frame_size_code>>1] * 1000) >> hdr->sr_shift;
          hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
          hdr->frame_size = ff_ac3_frame_size_tab[frame_size_code][hdr->sr_code] * 2;
--        hdr->stream_type = EAC3_STREAM_TYPE_INDEPENDENT;
 +        hdr->num_blocks = 6;
-+        hdr->frame_type = EAC3_FRAME_TYPE_INDEPENDENT;
+         hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
++        hdr->substreamid = 0;
      } else {
          /* Enhanced AC-3 */
          hdr->crc1 = 0;
--        hdr->stream_type = get_bits(&gbc, 2);
--        if(hdr->stream_type == EAC3_STREAM_TYPE_RESERVED)
--            return AC3_PARSE_ERROR_STREAM_TYPE;
-+        hdr->frame_type = get_bits(&gbc, 2);
-+        if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED)
-+            return AC3_PARSE_ERROR_FRAME_TYPE;
+@@ -105,7 +106,7 @@
+         if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED)
+             return AC3_PARSE_ERROR_FRAME_TYPE;
  
-         skip_bits(&gbc, 3); // skip substream id
+-        skip_bits(gbc, 3); // skip substream id
++        hdr->substreamid = get_bits(gbc, 3);
  
-@@ -105,9 +105,9 @@
+         hdr->frame_size = (get_bits(gbc, 11) + 1) << 1;
+         if(hdr->frame_size < AC3_HEADER_SIZE)
+@@ -118,9 +119,9 @@
                  return AC3_PARSE_ERROR_SAMPLE_RATE;
              hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
              hdr->sr_shift = 1;
 -            num_blocks = 6;
 +            hdr->num_blocks = 6;
          } else {
--            num_blocks = eac3_blocks[get_bits(&gbc, 2)];
-+            hdr->num_blocks = eac3_blocks[get_bits(&gbc, 2)];
+-            num_blocks = eac3_blocks[get_bits(gbc, 2)];
++            hdr->num_blocks = eac3_blocks[get_bits(gbc, 2)];
              hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
              hdr->sr_shift = 0;
          }
-@@ -116,7 +116,7 @@
-         hdr->lfe_on = get_bits1(&gbc);
+@@ -129,7 +130,7 @@
+         hdr->lfe_on = get_bits1(gbc);
  
          hdr->bit_rate = (uint32_t)(8.0 * hdr->frame_size * hdr->sample_rate /
 -                        (num_blocks * 256.0));
@@ -89,31 +85,9 @@ Index: libavcodec/ac3_parser.c
          hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
      }
  
-@@ -136,7 +136,7 @@
-     hdr_info->sample_rate = hdr.sample_rate;
-     hdr_info->bit_rate = hdr.bit_rate;
-     hdr_info->channels = hdr.channels;
--    hdr_info->samples = AC3_FRAME_SIZE;
-+    hdr_info->samples = hdr.num_blocks * 256;
-     return hdr.frame_size;
- }
- 
-Index: libavcodec/ac3_parser.h
-===================================================================
---- libavcodec/ac3_parser.h	(revision 12599)
-+++ libavcodec/ac3_parser.h	(working copy)
-@@ -30,7 +30,7 @@
-     AC3_PARSE_ERROR_BSID        = -2,
-     AC3_PARSE_ERROR_SAMPLE_RATE = -3,
-     AC3_PARSE_ERROR_FRAME_SIZE  = -4,
--    AC3_PARSE_ERROR_STREAM_TYPE = -5,
-+    AC3_PARSE_ERROR_FRAME_TYPE  = -5,
- } AC3ParseError;
- 
- /**
 Index: libavcodec/ac3.c
 ===================================================================
---- libavcodec/ac3.c	(revision 12599)
+--- libavcodec/ac3.c	(revision 13545)
 +++ libavcodec/ac3.c	(working copy)
 @@ -173,7 +173,8 @@
  }
@@ -146,40 +120,25 @@ Index: libavcodec/ac3.c
  /**
 Index: libavcodec/ac3.h
 ===================================================================
---- libavcodec/ac3.h	(revision 12599)
+--- libavcodec/ac3.h	(revision 13545)
 +++ libavcodec/ac3.h	(working copy)
-@@ -84,7 +84,7 @@
-     uint8_t bitstream_id;
+@@ -85,6 +85,7 @@
      uint8_t channel_mode;
      uint8_t lfe_on;
--    uint8_t stream_type;
-+    uint8_t frame_type;
+     uint8_t frame_type;
++    int substreamid;
      /** @} */
  
      /** @defgroup derived Derived values
-@@ -95,15 +95,16 @@
-     uint32_t bit_rate;
-     uint8_t channels;
-     uint16_t frame_size;
-+    uint8_t num_blocks;
+@@ -98,6 +99,7 @@
+     int center_mix_level;                   ///< Center mix level index
+     int surround_mix_level;                 ///< Surround mix level index
+     uint16_t channel_map;
++    int num_blocks;
      /** @} */
  } AC3HeaderInfo;
  
- typedef enum {
--    EAC3_STREAM_TYPE_INDEPENDENT = 0,
--    EAC3_STREAM_TYPE_DEPENDENT,
--    EAC3_STREAM_TYPE_AC3_CONVERT,
--    EAC3_STREAM_TYPE_RESERVED
--} EAC3StreamType;
-+    EAC3_FRAME_TYPE_INDEPENDENT = 0,
-+    EAC3_FRAME_TYPE_DEPENDENT,
-+    EAC3_FRAME_TYPE_AC3_CONVERT,
-+    EAC3_FRAME_TYPE_RESERVED
-+} EAC3FrameType;
- 
- void ac3_common_init(void);
- 
-@@ -163,10 +164,12 @@
+@@ -166,10 +168,12 @@
   * @param[in]  end        ending bin location
   * @param[in]  snr_offset SNR adjustment
   * @param[in]  floor      noise floor
@@ -195,7 +154,7 @@ Index: libavcodec/ac3.h
                                     int8_t *exp, int start, int end,
 Index: libavcodec/ac3enc.c
 ===================================================================
---- libavcodec/ac3enc.c	(revision 12599)
+--- libavcodec/ac3enc.c	(revision 13545)
 +++ libavcodec/ac3enc.c	(working copy)
 @@ -463,7 +463,8 @@
          for(ch=0;ch<s->nb_all_channels;ch++) {



More information about the FFmpeg-soc mailing list