[FFmpeg-soc] [soc]: r3012 - in eac3: ac3dec.c ac3dec.h ac3dec_data.c ac3dec_data.h checkout.sh eac3dec.c ffmpeg.patch
jbr
subversion at mplayerhq.hu
Tue Aug 5 01:21:25 CEST 2008
Author: jbr
Date: Tue Aug 5 01:21:24 2008
New Revision: 3012
Log:
update E-AC-3 decoder to work with FFmpeg SVN-r14540
Removed:
eac3/ac3dec.h
eac3/ac3dec_data.c
eac3/ac3dec_data.h
Modified:
eac3/ac3dec.c
eac3/checkout.sh
eac3/eac3dec.c
eac3/ffmpeg.patch
Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c (original)
+++ eac3/ac3dec.c Tue Aug 5 01:21:24 2008
@@ -41,6 +41,7 @@
#include "bitstream.h"
#include "dsputil.h"
#include "ac3dec.h"
+#include "ac3dec_data.h"
/** Large enough for maximum possible frame size when the specification limit is ignored */
#define AC3_FRAME_BUFFER_SIZE 32768
@@ -291,7 +292,6 @@ static int parse_frame_header(AC3DecodeC
s->fbw_channels = s->channels - s->lfe_on;
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;
@@ -305,7 +305,7 @@ static int parse_frame_header(AC3DecodeC
s->channel_in_cpl[s->lfe_ch] = 0;
}
- if(s->bitstream_id <= 10) {
+ if(hdr.bitstream_id <= 10) {
s->eac3 = 0;
return ac3_parse_header(s);
} else {
@@ -321,8 +321,8 @@ static int parse_frame_header(AC3DecodeC
static void set_downmix_coeffs(AC3DecodeContext *s)
{
int i;
- float cmix = gain_levels[s->center_mix_level];
- float smix = gain_levels[s->surround_mix_level];
+ float cmix = gain_levels[center_levels[s->center_mix_level]];
+ float smix = gain_levels[surround_levels[s->surround_mix_level]];
for(i=0; i<s->fbw_channels; i++) {
s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]];
Modified: eac3/checkout.sh
==============================================================================
--- eac3/checkout.sh (original)
+++ eac3/checkout.sh Tue Aug 5 01:21:24 2008
@@ -1,10 +1,10 @@
-FILES="eac3dec.c ac3dec.c ac3dec.h ac3dec_data.c ac3dec_data.h"
+FILES="eac3dec.c ac3dec.c"
echo "checking out ffmpeg svn"
-for i in $FILES Makefile ac3_parser.c ac3_parser.h ac3enc.c ac3.c ac3.h; do
+for i in $FILES Makefile ac3enc.c ac3dec.h; do
rm -f ffmpeg/libavcodec/$i
done
-svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r 13613
+svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r 14540
echo "patching ffmpeg"
cd ffmpeg
patch -p0 <../ffmpeg.patch
Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c (original)
+++ eac3/eac3dec.c Tue Aug 5 01:21:24 2008
@@ -23,6 +23,7 @@
#include "ac3.h"
#include "ac3_parser.h"
#include "ac3dec.h"
+#include "ac3dec_data.h"
/** Channel gain adaptive quantization mode */
typedef enum {
Modified: eac3/ffmpeg.patch
==============================================================================
--- eac3/ffmpeg.patch (original)
+++ eac3/ffmpeg.patch Tue Aug 5 01:21:24 2008
@@ -1,171 +1,39 @@
+Index: libavcodec/ac3dec.h
+===================================================================
+--- libavcodec/ac3dec.h (revision 14540)
++++ libavcodec/ac3dec.h (working copy)
+@@ -172,4 +172,10 @@
+ ///@}
+ } AC3DecodeContext;
+
++int ff_eac3_parse_header(AC3DecodeContext *s);
++void ff_eac3_get_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
++void ff_eac3_idct_transform_coeffs_ch(AC3DecodeContext *s, int ch, int blk);
++void ff_eac3_tables_init(void);
++void ff_eac3_log_missing_feature(AVCodecContext *avctx, const char *log);
++
+ #endif /* FFMPEG_AC3DEC_H */
Index: libavcodec/Makefile
===================================================================
---- libavcodec/Makefile (revision 13613)
+--- libavcodec/Makefile (revision 14540)
+++ libavcodec/Makefile (working copy)
-@@ -30,7 +30,7 @@
+@@ -26,7 +26,7 @@
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o
OBJS-$(CONFIG_AASC_DECODER) += aasc.o
--OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3tab.o ac3.o mdct.o fft.o
-+OBJS-$(CONFIG_AC3_DECODER) += eac3dec.o ac3dec.o ac3tab.o ac3.o mdct.o fft.o ac3_parser.o ac3dec_data.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_AMV_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
-Index: libavcodec/ac3_parser.c
-===================================================================
---- libavcodec/ac3_parser.c (revision 13613)
-+++ libavcodec/ac3_parser.c (working copy)
-@@ -49,7 +49,6 @@
- int ff_ac3_parse_header(GetBitContext *gbc, AC3HeaderInfo *hdr)
- {
- int frame_size_code;
-- int num_blocks;
-
- memset(hdr, 0, sizeof(*hdr));
-
-@@ -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->num_blocks = 6;
- hdr->frame_type = EAC3_FRAME_TYPE_AC3_CONVERT; //EAC3_FRAME_TYPE_INDEPENDENT;
-+ hdr->substreamid = 0;
- } else {
- /* Enhanced AC-3 */
- hdr->crc1 = 0;
-@@ -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
-+ hdr->substreamid = get_bits(gbc, 3);
-
- 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)];
- hdr->sample_rate = ff_ac3_sample_rate_tab[hdr->sr_code];
- hdr->sr_shift = 0;
- }
-@@ -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));
-+ (hdr->num_blocks * 256.0));
- hdr->channels = ff_ac3_channels_tab[hdr->channel_mode] + hdr->lfe_on;
- }
-
-Index: libavcodec/ac3.c
-===================================================================
---- libavcodec/ac3.c (revision 13613)
-+++ libavcodec/ac3.c (working copy)
-@@ -173,7 +173,8 @@
- }
-
- void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
-- int snr_offset, int floor, uint8_t *bap)
-+ int snr_offset, int floor,
-+ const uint8_t *bap_tab, uint8_t *bap)
- {
- int i, j, k, end1, v, address;
-
-@@ -190,7 +191,7 @@
- end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end);
- for (k = i; k < end1; k++) {
- address = av_clip((psd[i] - v) >> 5, 0, 63);
-- bap[i] = ff_ac3_bap_tab[address];
-+ bap[i] = bap_tab[address];
- i++;
- }
- } while (end > band_start_tab[j++]);
-@@ -215,7 +216,8 @@
- dba_mode, dba_nsegs, dba_offsets, dba_lengths, dba_values,
- mask);
-
-- ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor, bap);
-+ ff_ac3_bit_alloc_calc_bap(mask, psd, start, end, snr_offset, s->floor,
-+ ff_ac3_bap_tab, bap);
- }
-
- /**
-Index: libavcodec/ac3.h
-===================================================================
---- libavcodec/ac3.h (revision 13613)
-+++ libavcodec/ac3.h (working copy)
-@@ -85,9 +85,11 @@
- uint8_t channel_mode;
- uint8_t lfe_on;
- uint8_t frame_type;
-+ int substreamid;
- int center_mix_level; ///< Center mix level index
- int surround_mix_level; ///< Surround mix level index
- uint16_t channel_map;
-+ int num_blocks;
- /** @} */
-
- /** @defgroup derived Derived values
-@@ -166,10 +168,12 @@
- * @param[in] end ending bin location
- * @param[in] snr_offset SNR adjustment
- * @param[in] floor noise floor
-+ * @param[in] bap_tab look-up table for bit allocation pointers
- * @param[out] bap bit allocation pointers
- */
- void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end,
-- int snr_offset, int floor, uint8_t *bap);
-+ int snr_offset, int floor,
-+ const uint8_t *bap_tab, uint8_t *bap);
-
- void ac3_parametric_bit_allocation(AC3BitAllocParameters *s, uint8_t *bap,
- int8_t *exp, int start, int end,
Index: libavcodec/ac3enc.c
===================================================================
---- libavcodec/ac3enc.c (revision 13613)
+--- libavcodec/ac3enc.c (revision 14540)
+++ libavcodec/ac3enc.c (working copy)
-@@ -463,7 +463,8 @@
- for(ch=0;ch<s->nb_all_channels;ch++) {
- ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0,
- s->nb_coefs[ch], snr_offset,
-- s->bit_alloc.floor, bap[i][ch]);
-+ s->bit_alloc.floor, ff_ac3_bap_tab,
-+ bap[i][ch]);
- frame_bits += compute_mantissa_size(s, bap[i][ch],
- s->nb_coefs[ch]);
- }
-@@ -1363,5 +1364,5 @@
- AC3_encode_frame,
+@@ -1365,5 +1365,5 @@
AC3_encode_close,
NULL,
-- .long_name = "ATSC A/52 / AC-3",
-+ .long_name = "ATSC A/52 (AC-3, E-AC-3)",
+ .sample_fmts = (enum SampleFormat[]){SAMPLE_FMT_S16,SAMPLE_FMT_NONE},
+- .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 / AC-3"),
++ .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52 (AC-3, E-AC-3)"),
};
More information about the FFmpeg-soc
mailing list