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

jbr subversion at mplayerhq.hu
Sun Aug 31 05:31:30 CEST 2008


Author: jbr
Date: Sun Aug 31 05:31:30 2008
New Revision: 3682

Log:
update to match FFmpeg SVN r15103

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

Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c	(original)
+++ eac3/ac3dec.c	Sun Aug 31 05:31:30 2008
@@ -963,31 +963,31 @@ static int decode_audio_block(AC3DecodeC
     /* signal-to-noise ratio offsets and fast gains (signal-to-mask ratios) */
     if(!s->eac3 || !blk){
         if(s->snr_offset_strategy && get_bits1(gbc)) {
-        int snr = 0;
-        int csnr;
-        csnr = (get_bits(gbc, 6) - 15) << 4;
-        for (i = ch = !cpl_in_use; ch <= s->channels; ch++) {
-            /* snr offset */
-            if (ch == i || s->snr_offset_strategy == 2)
-                snr = (csnr + get_bits(gbc, 4)) << 2;
-            /* run at least last bit allocation stage if snr offset changes */
-            if(blk && s->snr_offset[ch] != snr) {
-                bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 1);
-            }
-            s->snr_offset[ch] = snr;
+            int snr = 0;
+            int csnr;
+            csnr = (get_bits(gbc, 6) - 15) << 4;
+            for (i = ch = !cpl_in_use; ch <= s->channels; ch++) {
+                /* snr offset */
+                if (ch == i || s->snr_offset_strategy == 2)
+                    snr = (csnr + get_bits(gbc, 4)) << 2;
+                /* run at least last bit allocation stage if snr offset changes */
+                if(blk && s->snr_offset[ch] != snr) {
+                    bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 1);
+                }
+                s->snr_offset[ch] = snr;
 
                 /* fast gain (normal AC-3 only) */
                 if (!s->eac3) {
                     int prev = s->fast_gain[ch];
-            s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
+                    s->fast_gain[ch] = ff_ac3_fast_gain_tab[get_bits(gbc, 3)];
                     /* run last 2 bit allocation stages if fast gain changes */
                     if(blk && prev != s->fast_gain[ch])
                         bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
-                    }
                 }
+            }
         } else if (!s->eac3 && !blk) {
-        av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
-        return -1;
+            av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
+            return -1;
         }
     }
 
@@ -1019,7 +1019,7 @@ static int decode_audio_block(AC3DecodeC
                coupling leak changes */
             if(blk && (fl != s->bit_alloc_params.cpl_fast_leak ||
                        sl != s->bit_alloc_params.cpl_slow_leak)) {
-            bit_alloc_stages[CPL_CH] = FFMAX(bit_alloc_stages[CPL_CH], 2);
+                bit_alloc_stages[CPL_CH] = FFMAX(bit_alloc_stages[CPL_CH], 2);
             }
             s->bit_alloc_params.cpl_fast_leak = fl;
             s->bit_alloc_params.cpl_slow_leak = sl;

Modified: eac3/checkout.sh
==============================================================================
--- eac3/checkout.sh	(original)
+++ eac3/checkout.sh	Sun Aug 31 05:31:30 2008
@@ -1,10 +1,10 @@
 FILES="eac3dec.c ac3dec.c"
 
 echo "checking out ffmpeg svn"
-for i in $FILES Makefile; do
+for i in $FILES ; do
     rm -f ffmpeg/libavcodec/$i
 done
-svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r 14991
+svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r 15103
 echo "patching ffmpeg"
 cd ffmpeg
 patch -p0 <../ffmpeg.patch

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Sun Aug 31 05:31:30 2008
@@ -131,7 +131,7 @@ void ff_eac3_decode_transform_coeffs_aht
             /* Vector Quantization */
             int v = get_bits(gbc, bits);
             for (blk = 0; blk < 6; blk++) {
-                s->pre_mantissa[ch][bin][blk] = ff_eac3_vq_hebap[hebap][v][blk] << 8;
+                s->pre_mantissa[ch][bin][blk] = ff_eac3_mantissa_vq[hebap][v][blk] << 8;
             }
         } else {
             /* Gain Adaptive Quantization */
@@ -399,9 +399,8 @@ int ff_eac3_parse_header(AC3DecodeContex
         }
     } else {
         /* LUT-based exponent strategy syntax */
-        int frmchexpstr;
         for (ch = !((s->channel_mode > 1) && num_cpl_blocks); ch <= s->fbw_channels; ch++) {
-            frmchexpstr = get_bits(gbc, 5);
+            int frmchexpstr = get_bits(gbc, 5);
             for (blk = 0; blk < 6; blk++) {
                 s->exp_strategy[blk][ch] = ff_eac3_frm_expstr[frmchexpstr][blk];
             }
@@ -416,28 +415,26 @@ int ff_eac3_parse_header(AC3DecodeContex
     /* original exponent strategies if this stream was converted from AC-3 */
     if (s->frame_type == EAC3_FRAME_TYPE_INDEPENDENT &&
             (s->num_blocks == 6 || get_bits1(gbc))) {
-        for (ch = 1; ch <= s->fbw_channels; ch++) {
-            skip_bits(gbc, 5); // skip converter channel exponent strategy
-        }
+        skip_bits(gbc, 5 * s->fbw_channels); // skip converter channel exponent strategy
     }
 
     /* determine which channels use AHT */
     if (parse_aht_info) {
-        /* AHT is only available when there are 6 blocks in the frame.
-           The coupling channel can only use AHT when coupling is in use for
-           all blocks.
-           reference: Section E3.3.2 Bit Stream Helper Variables */
+        /* For AHT to be used, all non-zero blocks must reuse exponents from
+           the first block.  Furthermore, for AHT to be used in the coupling
+           channel, all blocks must use coupling and use the same coupling
+           strategy. */
         s->channel_uses_aht[CPL_CH]=0;
         for (ch = (num_cpl_blocks != 6); ch <= s->channels; ch++) {
-            int nchregs = 0;
-            for (blk = 0; blk < 6; blk++) {
-                if (ch)
-                    nchregs += (s->exp_strategy[blk][ch] != EXP_REUSE);
-                else
-                    nchregs += s->cpl_strategy_exists[blk] ||
-                               (s->exp_strategy[blk][CPL_CH] != EXP_REUSE);
+            int use_aht = 1;
+            for (blk = 1; blk < 6; blk++) {
+                if ((s->exp_strategy[blk][ch] != EXP_REUSE) ||
+                        (!ch && s->cpl_strategy_exists[blk])) {
+                    use_aht = 0;
+                    break;
+                }
             }
-            s->channel_uses_aht[ch] = (nchregs == 1) && get_bits1(gbc);
+            s->channel_uses_aht[ch] = use_aht && get_bits1(gbc);
         }
     } else {
         memset(s->channel_uses_aht, 0, sizeof(s->channel_uses_aht));

Modified: eac3/ffmpeg.patch
==============================================================================
--- eac3/ffmpeg.patch	(original)
+++ eac3/ffmpeg.patch	Sun Aug 31 05:31:30 2008
@@ -1,13 +0,0 @@
-Index: libavcodec/Makefile
-===================================================================
---- libavcodec/Makefile	(revision 14991)
-+++ libavcodec/Makefile	(working copy)
-@@ -27,7 +27,7 @@
- 
- OBJS-$(CONFIG_AAC_DECODER)             += aac.o aactab.o mdct.o fft.o
- OBJS-$(CONFIG_AASC_DECODER)            += aasc.o
--OBJS-$(CONFIG_AC3_DECODER)             += ac3dec.o ac3tab.o ac3dec_data.o ac3.o mdct.o fft.o
-+OBJS-$(CONFIG_AC3_DECODER)             += eac3dec.o ac3dec.o ac3tab.o ac3dec_data.o ac3.o mdct.o fft.o
- OBJS-$(CONFIG_AC3_ENCODER)             += ac3enc.o ac3tab.o ac3.o
- OBJS-$(CONFIG_ALAC_DECODER)            += alac.o
- OBJS-$(CONFIG_ALAC_ENCODER)            += alacenc.o lpc.o



More information about the FFmpeg-soc mailing list