Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
af1f3a70
Commit
af1f3a70
authored
Aug 07, 2009
by
Jean-Baptiste Kempf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E-AC3 patch update
parent
0b6f7750
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
117 additions
and
90 deletions
+117
-90
extras/contrib/src/Makefile
extras/contrib/src/Makefile
+1
-1
extras/contrib/src/Patches/eac3_spectral.patch
extras/contrib/src/Patches/eac3_spectral.patch
+116
-89
No files found.
extras/contrib/src/Makefile
View file @
af1f3a70
...
@@ -1097,7 +1097,7 @@ ifdef NO_TEXT_RELOCATION
...
@@ -1097,7 +1097,7 @@ ifdef NO_TEXT_RELOCATION
echo
"Broken LD. Fix your tools."
echo
"Broken LD. Fix your tools."
exit
-1
exit
-1
endif
endif
patch
-p0
< Patches/eac3_spectral.patch
(
cd
$@
;
patch
-p1
< ../Patches/eac3_spectral.patch
)
else
else
ffmpeg-$(FFMPEG_VERSION).tar.gz
:
ffmpeg-$(FFMPEG_VERSION).tar.gz
:
echo
"ffmpeg snapshot is too old, you MUST use subversion !"
echo
"ffmpeg snapshot is too old, you MUST use subversion !"
...
...
extras/contrib/src/Patches/eac3_spectral.patch
View file @
af1f3a70
Index: ffmpeg
/libavcodec/ac3dec.c
diff --git a/libavcodec/ac3dec.c b
/libavcodec/ac3dec.c
===================================================================
index baff415..49d6ea9 100644
---
ffmpeg/libavcodec/ac3dec.c (revision 19357)
---
a/libavcodec/ac3dec.c
+++
ffmpeg/libavcodec/ac3dec.c (working copy)
+++
b/libavcodec/ac3dec.c
@@ -8
19,15 +819,100 @@
@@ -8
26,14 +826,105 @@
static int decode_audio_block(AC3DecodeContext *s, int blk)
/* spectral extension strategy */
/* spectral extension strategy */
if (s->eac3 && (!blk || get_bits1(gbc))) {
if (s->eac3 && (!blk || get_bits1(gbc))) {
- if (get_bits1(gbc)) {
- av_log_missing_feature(s->avctx, "Spectral extension", 1);
- return -1;
+ s->spx_in_use = get_bits1(gbc);
+ s->spx_in_use = get_bits1(gbc);
+ if (s->spx_in_use) {
+ if (s->spx_in_use) {
+ int begf, endf;
+ int copy_start, start_subband, end_subband, start_freq, end_freq;
+ int spx_end_subband;
+
+
+ /* determine which channels use spx */
+ /* determine which channels use spx */
+ if (s->channel_mode == AC3_CHMODE_MONO) {
+ if (s->channel_mode == AC3_CHMODE_MONO) {
+ s->channel_
in
_spx[1] = 1;
+ s->channel_
uses
_spx[1] = 1;
+ } else {
+ } else {
+ for (ch = 1; ch <= fbw_channels; ch++)
+ for (ch = 1; ch <= fbw_channels; ch++)
+ s->channel_
in
_spx[ch] = get_bits1(gbc);
+ s->channel_
uses
_spx[ch] = get_bits1(gbc);
+ }
+ }
+
+
+ s->spx_copy_start_freq = get_bits(gbc, 2) * 12 + 25;
+ /* get the frequency bins of the spx copy region and the spx start
+ begf = get_bits(gbc, 3);
+ and end subbands */
+ endf = get_bits(gbc, 3);
+ copy_start = get_bits(gbc, 2);
+ s->spx_start_subband = begf < 6 ? begf+2 : 2*begf-3;
+ start_subband = get_bits(gbc, 3) + 2;
+ spx_end_subband = endf < 4 ? endf+5 : 2*endf+3;
+ if (start_subband > 7)
+ if (s->spx_start_subband >= spx_end_subband) {
+ start_subband += start_subband - 7;
+ av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension range (%d >= %d)\n",
+ end_subband = get_bits(gbc, 3) + 5;
+ s->spx_start_subband, spx_end_subband);
+ if (end_subband > 7)
+ end_subband += end_subband - 7;
+ copy_start = copy_start * 12 + 25;
+ start_freq = start_subband * 12 + 25;
+ end_freq = end_subband * 12 + 25;
+
+ /* check validity of spx ranges */
+ if (start_subband >= end_subband) {
+ av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
+ "range (%d >= %d)\n", start_subband, end_subband);
+ return -1;
+ return -1;
+ }
+ }
+ s->spx_start_freq = s->spx_start_subband * 12 + 25;
+ if (copy_start >= start_freq) {
+ s->spx_end_freq = spx_end_subband * 12 + 25;
+ av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
+ if (s->spx_copy_start_freq >= s->spx_start_freq) {
+ "copy start bin (%d >= %d)\n", copy_start, start_freq);
+ av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension copy start bin (%d >= %d)\n",
+ s->spx_copy_start_freq, s->spx_start_freq);
+ return -1;
+ return -1;
+ }
+ }
+
+ s->spx_copy_start_freq = copy_start;
+ s->spx_start_subband = start_subband;
+ s->spx_start_freq = start_freq;
+ s->spx_end_freq = end_freq;
+
+ decode_band_structure(gbc, blk, s->eac3, 0,
+ decode_band_structure(gbc, blk, s->eac3, 0,
+ s
->spx_start_subband, spx_
end_subband,
+ s
tart_subband,
end_subband,
+ ff_eac3_default_spx_band_struct,
+ ff_eac3_default_spx_band_struct,
+ s->spx_band_struct, &s->num_spx_bands,
+ s->spx_band_struct, &s->num_spx_bands,
+ s->spx_band_sizes);
+ s->spx_band_sizes);
+ } else {
+ } else {
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ s->channel_
in
_spx[ch] = 0;
+ s->channel_
uses
_spx[ch] = 0;
+ s->first_spx_coords[ch] = 1;
+ s->first_spx_coords[ch] = 1;
+ }
+ }
+ }
if (get_bits1(gbc)) {
av_log_missing_feature(s->avctx, "Spectral extension", 1);
return -1;
}
}
- /* TODO: parse spectral extension strategy info */
- /* TODO: parse spectral extension strategy info */
}
}
...
@@ -58,11 +69,11 @@ Index: ffmpeg/libavcodec/ac3dec.c
...
@@ -58,11 +69,11 @@ Index: ffmpeg/libavcodec/ac3dec.c
+ /* spectral extension coordinates */
+ /* spectral extension coordinates */
+ if (s->spx_in_use) {
+ if (s->spx_in_use) {
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ for (ch = 1; ch <= fbw_channels; ch++) {
+ if (s->channel_
in
_spx[ch]) {
+ if (s->channel_
uses
_spx[ch]) {
+ if (s->first_spx_coords[ch] || get_bits1(gbc)) {
+ if (s->first_spx_coords[ch] || get_bits1(gbc)) {
+ float spx_blend;
+ float spx_blend;
+ int bin, master_spx_coord;
+ int bin, master_spx_coord;
+
+ s->first_spx_coords[ch] = 0;
+ s->first_spx_coords[ch] = 0;
+ spx_blend = get_bits(gbc, 5) * (1.0f/32);
+ spx_blend = get_bits(gbc, 5) * (1.0f/32);
+ master_spx_coord = get_bits(gbc, 2) * 3;
+ master_spx_coord = get_bits(gbc, 2) * 3;
...
@@ -84,10 +95,8 @@ Index: ffmpeg/libavcodec/ac3dec.c
...
@@ -84,10 +95,8 @@ Index: ffmpeg/libavcodec/ac3dec.c
+ /* decode spx coordinates */
+ /* decode spx coordinates */
+ spx_coord_exp = get_bits(gbc, 4);
+ spx_coord_exp = get_bits(gbc, 4);
+ spx_coord_mant = get_bits(gbc, 2);
+ spx_coord_mant = get_bits(gbc, 2);
+ if (spx_coord_exp == 15)
+ if (spx_coord_exp == 15) spx_coord_mant <<= 1;
+ spx_coord_mant <<= 1;
+ else spx_coord_mant += 4;
+ else
+ spx_coord_mant += 4;
+ spx_coord_mant <<= (25 - spx_coord_exp - master_spx_coord);
+ spx_coord_mant <<= (25 - spx_coord_exp - master_spx_coord);
+ spx_coord = spx_coord_mant * (1.0f/(1<<23));
+ spx_coord = spx_coord_mant * (1.0f/(1<<23));
+
+
...
@@ -101,11 +110,10 @@ Index: ffmpeg/libavcodec/ac3dec.c
...
@@ -101,11 +110,10 @@ Index: ffmpeg/libavcodec/ac3dec.c
+ }
+ }
+ }
+ }
+ }
+ }
+
/* coupling strategy */
/* coupling strategy */
if (s->eac3 ? s->cpl_strategy_exists[blk] : get_bits1(gbc)) {
if (s->eac3 ? s->cpl_strategy_exists[blk] : get_bits1(gbc)) {
memset(bit_alloc_stages, 3, AC3_MAX_CHANNELS);
@@ -870,9 +961,9 @@
static int decode_audio_block(AC3DecodeContext *s, int blk)
@@ -863,9 +948,9 @@
s->phase_flags_in_use = get_bits1(gbc);
s->phase_flags_in_use = get_bits1(gbc);
/* coupling frequency range */
/* coupling frequency range */
...
@@ -117,7 +125,7 @@ Index: ffmpeg/libavcodec/ac3dec.c
...
@@ -117,7 +125,7 @@ Index: ffmpeg/libavcodec/ac3dec.c
if (cpl_start_subband >= cpl_end_subband) {
if (cpl_start_subband >= cpl_end_subband) {
av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n",
av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n",
cpl_start_subband, cpl_end_subband);
cpl_start_subband, cpl_end_subband);
@@ -9
38,8 +1023,11 @@
@@ -9
45,8 +1036,11 @@
static int decode_audio_block(AC3DecodeContext *s, int blk)
if (channel_mode == AC3_CHMODE_STEREO) {
if (channel_mode == AC3_CHMODE_STEREO) {
if ((s->eac3 && !blk) || get_bits1(gbc)) {
if ((s->eac3 && !blk) || get_bits1(gbc)) {
s->num_rematrixing_bands = 4;
s->num_rematrixing_bands = 4;
...
@@ -130,16 +138,16 @@ Index: ffmpeg/libavcodec/ac3dec.c
...
@@ -130,16 +138,16 @@ Index: ffmpeg/libavcodec/ac3dec.c
for(bnd=0; bnd<s->num_rematrixing_bands; bnd++)
for(bnd=0; bnd<s->num_rematrixing_bands; bnd++)
s->rematrixing_flags[bnd] = get_bits1(gbc);
s->rematrixing_flags[bnd] = get_bits1(gbc);
} else if (!blk) {
} else if (!blk) {
@@ -9
64,6 +1052,8 @@
@@ -9
71,6 +1065,8 @@
static int decode_audio_block(AC3DecodeContext *s, int blk)
int prev = s->end_freq[ch];
int prev = s->end_freq[ch];
if (s->channel_in_cpl[ch])
if (s->channel_in_cpl[ch])
s->end_freq[ch] = s->start_freq[CPL_CH];
s->end_freq[ch] = s->start_freq[CPL_CH];
+ else if (s->channel_
in
_spx[ch])
+ else if (s->channel_
uses
_spx[ch])
+ s->end_freq[ch] = s->spx_start_freq;
+ s->end_freq[ch] = s->spx_start_freq;
else {
else {
int bandwidth_code = get_bits(gbc, 6);
int bandwidth_code = get_bits(gbc, 6);
if (bandwidth_code > 60) {
if (bandwidth_code > 60) {
@@ -116
0,8 +1254,6 @@
@@ -116
7,8 +1263,6 @@
static int decode_audio_block(AC3DecodeContext *s, int blk)
/* TODO: generate enhanced coupling coordinates and uncouple */
/* TODO: generate enhanced coupling coordinates and uncouple */
...
@@ -148,7 +156,7 @@ Index: ffmpeg/libavcodec/ac3dec.c
...
@@ -148,7 +156,7 @@ Index: ffmpeg/libavcodec/ac3dec.c
/* recover coefficients if rematrixing is in use */
/* recover coefficients if rematrixing is in use */
if(s->channel_mode == AC3_CHMODE_STEREO)
if(s->channel_mode == AC3_CHMODE_STEREO)
do_rematrixing(s);
do_rematrixing(s);
@@ -11
77,6 +1269,10 @@
@@ -11
84,6 +1278,10 @@
static int decode_audio_block(AC3DecodeContext *s, int blk)
s->dsp.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256);
s->dsp.int32_to_float_fmul_scalar(s->transform_coeffs[ch], s->fixed_coeffs[ch], gain, 256);
}
}
...
@@ -159,10 +167,10 @@ Index: ffmpeg/libavcodec/ac3dec.c
...
@@ -159,10 +167,10 @@ Index: ffmpeg/libavcodec/ac3dec.c
/* downmix and MDCT. order depends on whether block switching is used for
/* downmix and MDCT. order depends on whether block switching is used for
any channel in this block. this is because coefficients for the long
any channel in this block. this is because coefficients for the long
and short transforms cannot be mixed. */
and short transforms cannot be mixed. */
Index: ffmpeg
/libavcodec/ac3dec.h
diff --git a/libavcodec/ac3dec.h b
/libavcodec/ac3dec.h
===================================================================
index 38c2deb..fa6057d 100644
---
ffmpeg/libavcodec/ac3dec.h (revision 19357)
---
a/libavcodec/ac3dec.h
+++
ffmpeg/libavcodec/ac3dec.h (working copy)
+++
b/libavcodec/ac3dec.h
@@ -42,6 +42,7 @@
@@ -42,6 +42,7 @@
#define AC3_MAX_COEFS 256
#define AC3_MAX_COEFS 256
#define AC3_BLOCK_SIZE 256
#define AC3_BLOCK_SIZE 256
...
@@ -171,19 +179,19 @@ Index: ffmpeg/libavcodec/ac3dec.h
...
@@ -171,19 +179,19 @@ Index: ffmpeg/libavcodec/ac3dec.h
typedef struct {
typedef struct {
AVCodecContext *avctx; ///< parent context
AVCodecContext *avctx; ///< parent context
@@ -88,6 +89,23 @@
@@ -88,6 +89,23 @@
typedef struct {
int cpl_coords[AC3_MAX_CHANNELS][18]; ///< coupling coordinates (cplco)
int cpl_coords[AC3_MAX_CHANNELS][18]; ///< coupling coordinates (cplco)
///@}
///@}
+///@defgroup spx spectral extension
+///@defgroup spx spectral extension
+///@{
+///@{
+ int spx_in_use; ///< spectral extension in use (spxinu)
+ int spx_in_use; ///< spectral extension in use (spxinu)
+ uint8_t channel_
in_spx[AC3_MAX_CHANNELS]; ///< channel in spectral extension
(chinspx)
+ uint8_t channel_
uses_spx[AC3_MAX_CHANNELS]; ///< channel uses spectral extension
(chinspx)
+ int8_t spx_atten_code[AC3_MAX_CHANNELS]; ///< spx attenuation code (spxattencod)
+ int8_t spx_atten_code[AC3_MAX_CHANNELS]; ///< spx attenuation code (spxattencod)
+ int spx_start_subband; ///< spx beginning frequency band (spxbegf)
+ int spx_start_subband; ///< spx beginning frequency band (spxbegf)
+ int spx_start_freq; ///< spx start frequency bin
+ int spx_start_freq; ///< spx start frequency bin
+ int spx_end_freq; ///< spx end frequency bin
+ int spx_end_freq; ///< spx end frequency bin
+ int spx_copy_start_freq; ///< spx starting frequency
for copying
(copystartmant)
+ int spx_copy_start_freq; ///< spx starting frequency
bin for copying
(copystartmant)
+ int num_spx_bands; ///< number of spx bands (nspxbnds)
+ int num_spx_bands; ///< number of spx bands (nspxbnds)
+ uint8_t spx_band_struct[SPX_MAX_BANDS]; ///< spectral extension band structure (spxbndstrc)
+ uint8_t spx_band_struct[SPX_MAX_BANDS]; ///< spectral extension band structure (spxbndstrc)
+ uint8_t spx_band_sizes[SPX_MAX_BANDS]; ///< number of bins in each band (spxbndsztab)
+ uint8_t spx_band_sizes[SPX_MAX_BANDS]; ///< number of bins in each band (spxbndsztab)
...
@@ -195,7 +203,7 @@ Index: ffmpeg/libavcodec/ac3dec.h
...
@@ -195,7 +203,7 @@ Index: ffmpeg/libavcodec/ac3dec.h
///@defgroup aht adaptive hybrid transform
///@defgroup aht adaptive hybrid transform
int channel_uses_aht[AC3_MAX_CHANNELS]; ///< channel AHT in use (chahtinu)
int channel_uses_aht[AC3_MAX_CHANNELS]; ///< channel AHT in use (chahtinu)
int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][MAX_BLOCKS]; ///< pre-IDCT mantissas
int pre_mantissa[AC3_MAX_CHANNELS][AC3_MAX_COEFS][MAX_BLOCKS]; ///< pre-IDCT mantissas
@@ -179,4 +197,11 @@
@@ -179,4 +197,11 @@
int ff_eac3_parse_header(AC3DecodeContext *s);
*/
*/
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
...
@@ -207,10 +215,35 @@ Index: ffmpeg/libavcodec/ac3dec.h
...
@@ -207,10 +215,35 @@ Index: ffmpeg/libavcodec/ac3dec.h
+void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
+void ff_eac3_apply_spectral_extension(AC3DecodeContext *s);
+
+
#endif /* AVCODEC_AC3DEC_H */
#endif /* AVCODEC_AC3DEC_H */
Index: ffmpeg/libavcodec/eac3dec.c
diff --git a/libavcodec/ac3dec_data.c b/libavcodec/ac3dec_data.c
===================================================================
index 907a3ae..abe359b 100644
--- ffmpeg/libavcodec/eac3dec.c (revision 19357)
--- a/libavcodec/ac3dec_data.c
+++ ffmpeg/libavcodec/eac3dec.c (working copy)
+++ b/libavcodec/ac3dec_data.c
@@ -64,3 +64,9 @@
const uint8_t ff_eac3_hebap_tab[64] = {
*/
const uint8_t ff_eac3_default_cpl_band_struct[18] =
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 };
+
+/**
+ * Table E2.15 Default Spectral Extension Banding Structure
+ */
+const uint8_t ff_eac3_default_spx_band_struct[17] =
+{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
diff --git a/libavcodec/ac3dec_data.h b/libavcodec/ac3dec_data.h
index 8d9db05..9ed7c73 100644
--- a/libavcodec/ac3dec_data.h
+++ b/libavcodec/ac3dec_data.h
@@ -29,5 +29,6 @@
extern const uint8_t ff_ac3_rematrix_band_tab[5];
extern const uint8_t ff_eac3_hebap_tab[64];
extern const uint8_t ff_eac3_default_cpl_band_struct[18];
+extern const uint8_t ff_eac3_default_spx_band_struct[17];
#endif /* AVCODEC_AC3DEC_DATA_H */
diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c
index 3784ccf..3a78540 100644
--- a/libavcodec/eac3dec.c
+++ b/libavcodec/eac3dec.c
@@ -23,10 +23,6 @@
@@ -23,10 +23,6 @@
/*
/*
* There are several features of E-AC-3 that this decoder does not yet support.
* There are several features of E-AC-3 that this decoder does not yet support.
...
@@ -222,7 +255,7 @@ Index: ffmpeg/libavcodec/eac3dec.c
...
@@ -222,7 +255,7 @@ Index: ffmpeg/libavcodec/eac3dec.c
* Enhanced Coupling
* Enhanced Coupling
* No known samples exist. If any ever surface, this feature should not be
* No known samples exist. If any ever surface, this feature should not be
* too difficult to implement.
* too difficult to implement.
@@ -6
6,6 +62,95 @@
@@ -6
7,6 +63,95 @@
typedef enum {
#define EAC3_SR_CODE_REDUCED 3
#define EAC3_SR_CODE_REDUCED 3
...
@@ -256,7 +289,7 @@ Index: ffmpeg/libavcodec/eac3dec.c
...
@@ -256,7 +289,7 @@ Index: ffmpeg/libavcodec/eac3dec.c
+ copy_sizes[num_copy_sections++] = bin - s->spx_copy_start_freq;
+ copy_sizes[num_copy_sections++] = bin - s->spx_copy_start_freq;
+
+
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ if (!s->channel_
in
_spx[ch])
+ if (!s->channel_
uses
_spx[ch])
+ continue;
+ continue;
+
+
+ /* Copy coeffs from normal bands to extension bands */
+ /* Copy coeffs from normal bands to extension bands */
...
@@ -306,7 +339,7 @@ Index: ffmpeg/libavcodec/eac3dec.c
...
@@ -306,7 +339,7 @@ Index: ffmpeg/libavcodec/eac3dec.c
+ float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f/(1<<31));
+ float nscale = s->spx_noise_blend[ch][bnd] * rms_energy[bnd] * (1.0f/(1<<31));
+ float sscale = s->spx_signal_blend[ch][bnd];
+ float sscale = s->spx_signal_blend[ch][bnd];
+ for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
+ for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
+ float noise = nscale * (int)av_lfg_get(&s->dith_state);
+ float noise = nscale * (int
32_t
)av_lfg_get(&s->dith_state);
+ s->transform_coeffs[ch][bin] *= sscale;
+ s->transform_coeffs[ch][bin] *= sscale;
+ s->transform_coeffs[ch][bin++] += noise;
+ s->transform_coeffs[ch][bin++] += noise;
+ }
+ }
...
@@ -318,21 +351,26 @@ Index: ffmpeg/libavcodec/eac3dec.c
...
@@ -318,21 +351,26 @@ Index: ffmpeg/libavcodec/eac3dec.c
/** lrint(M_SQRT2*cos(2*M_PI/12)*(1<<23)) */
/** lrint(M_SQRT2*cos(2*M_PI/12)*(1<<23)) */
#define COEFF_0 10273905LL
#define COEFF_0 10273905LL
@@ -494,9 +579,10 @@
@@ -492,13 +577,11 @@
int ff_eac3_parse_header(AC3DecodeContext *s)
if (parse_spx_atten_data) {
}
av_log_missing_feature(s->avctx, "Spectral extension attenuation", 1);
for (ch = 1; ch <= s->fbw_channels; ch++) {
/* spectral extension attenuation data */
- if (parse_spx_atten_data) {
- av_log_missing_feature(s->avctx, "Spectral extension attenuation", 1);
- for (ch = 1; ch <= s->fbw_channels; ch++) {
- if (get_bits1(gbc)) { // channel has spx attenuation
- if (get_bits1(gbc)) { // channel has spx attenuation
- skip_bits(gbc, 5); // skip spx attenuation code
- skip_bits(gbc, 5); // skip spx attenuation code
- }
- }
- }
+ for (ch = 1; ch <= s->fbw_channels; ch++) {
+ if (parse_spx_atten_data && get_bits1(gbc))
+ if (parse_spx_atten_data && get_bits1(gbc))
+ s->spx_atten_code[ch] = get_bits(gbc, 5);
+ s->spx_atten_code[ch] = get_bits(gbc, 5);
+ else
+ else
+ s->spx_atten_code[ch] = -1;
+ s->spx_atten_code[ch] = -1;
}
}
}
@@ -513,6 +599,7 @@
/* block start information */
@@ -514,6 +597,7 @@
int ff_eac3_parse_header(AC3DecodeContext *s)
/* syntax state initialization */
/* syntax state initialization */
for (ch = 1; ch <= s->fbw_channels; ch++) {
for (ch = 1; ch <= s->fbw_channels; ch++) {
...
@@ -340,18 +378,14 @@ Index: ffmpeg/libavcodec/eac3dec.c
...
@@ -340,18 +378,14 @@ Index: ffmpeg/libavcodec/eac3dec.c
s->first_cpl_coords[ch] = 1;
s->first_cpl_coords[ch] = 1;
}
}
s->first_cpl_leak = 1;
s->first_cpl_leak = 1;
Index: ffmpeg/libavcodec/ac3dec_data.c
diff --git a/libavcodec/eac3dec_data.c b/libavcodec/eac3dec_data.c
===================================================================
index 6c6a551..9e9f8a2 100644
--- ffmpeg/libavcodec/ac3dec_data.c (revision 19357)
--- a/libavcodec/eac3dec_data.c
+++ ffmpeg/libavcodec/ac3dec_data.c (working copy)
+++ b/libavcodec/eac3dec_data.c
@@ -1127,6 +1127,51 @@
@@ -1093,3 +1093,42 @@
const uint8_t ff_eac3_frm_expstr[32][6] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1 };
{ EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D25, EXP_REUSE},
{ EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45, EXP_D45},
/**
};
+ * Table E2.15 Default Spectral Extension Banding Structure
+ */
+const uint8_t ff_eac3_default_spx_band_struct[17] =
+{ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
+
+
+/**
+/**
+ * Table E.25: Spectral Extension Attenuation Table
+ * Table E.25: Spectral Extension Attenuation Table
...
@@ -391,21 +425,14 @@ Index: ffmpeg/libavcodec/ac3dec_data.c
...
@@ -391,21 +425,14 @@ Index: ffmpeg/libavcodec/ac3dec_data.c
+ { 0.238710400977604098f, 0.056982655534888536f, 0.013602352551501938f },
+ { 0.238710400977604098f, 0.056982655534888536f, 0.013602352551501938f },
+ { 0.227930622139554201f, 0.051952368508924235f, 0.011841535675862483f }
+ { 0.227930622139554201f, 0.051952368508924235f, 0.011841535675862483f }
+};
+};
+
diff --git a/libavcodec/eac3dec_data.h b/libavcodec/eac3dec_data.h
+/**
index 76dd154..1331833 100644
* Table of bin locations for rematrixing bands
--- a/libavcodec/eac3dec_data.h
* reference: Section 7.5.2 Rematrixing : Frequency Band Definitions
+++ b/libavcodec/eac3dec_data.h
*/
@@ -31,5 +31,6 @@
extern const int16_t ff_eac3_gaq_remap_2_4_b[9][2];
Index: ffmpeg/libavcodec/ac3dec_data.h
===================================================================
--- ffmpeg/libavcodec/ac3dec_data.h (revision 19357)
+++ ffmpeg/libavcodec/ac3dec_data.h (working copy)
@@ -34,6 +34,8 @@
extern const int16_t (* const ff_eac3_mantissa_vq[8])[6];
extern const int16_t (* const ff_eac3_mantissa_vq[8])[6];
extern const uint8_t ff_eac3_frm_expstr[32][6];
extern const uint8_t ff_eac3_frm_expstr[32][6];
extern const uint8_t ff_eac3_default_cpl_band_struct[18];
+extern const uint8_t ff_eac3_default_spx_band_struct[17];
+extern const float ff_eac3_spx_atten_tab[32][3];
+extern const float ff_eac3_spx_atten_tab[32][3];
extern const uint8_t ff_ac3_rematrix_band_tab[5];
#endif /* AVCODEC_EAC3DEC_DATA_H */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment