[FFmpeg-soc] [soc]: r3729 - in eac3: ac3dec.c eac3dec.c ffmpeg.patch
jbr
subversion at mplayerhq.hu
Mon Sep 8 04:36:32 CEST 2008
Author: jbr
Date: Mon Sep 8 04:36:32 2008
New Revision: 3729
Log:
apply noise-blended scaling of SPX coeffs
Modified:
eac3/ac3dec.c
eac3/eac3dec.c
eac3/ffmpeg.patch
Modified: eac3/ac3dec.c
==============================================================================
--- eac3/ac3dec.c (original)
+++ eac3/ac3dec.c Mon Sep 8 04:36:32 2008
@@ -197,6 +197,7 @@ static av_cold int ac3_decode_init(AVCod
ff_kbd_window_init(s->window, 5.0, 256);
dsputil_init(&s->dsp, avctx);
av_lfg_init(&s->dith_state, 0);
+ av_znrng_init(&s->spx_noise_state, 0xDEADBEEF);
/* set bias values for float to int16 conversion */
if(s->dsp.float_to_int16_interleave == ff_float_to_int16_interleave_c) {
Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c (original)
+++ eac3/eac3dec.c Mon Sep 8 04:36:32 2008
@@ -117,6 +117,16 @@ void ff_eac3_apply_spectral_extension(AC
/* Apply coefficient and noise scaling based on previously calculated
RMS energy and blending factors for each band. */
+ bin = s->spx_start_freq;
+ for (bnd = 0; bnd < s->num_spx_bands; bnd++) {
+ int64_t nscale = (s->spx_noise_blend [ch][bnd] * rms_energy[bnd]) >> 23;
+ int64_t sscale = s->spx_signal_blend[ch][bnd];
+ for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
+ int64_t noise = nscale * (av_znrng_get(&s->spx_noise_state) >> 5);
+ int64_t signal = sscale * s->fixed_coeffs[ch][bin];
+ s->fixed_coeffs[ch][bin++] = (noise + signal) >> 23;
+ }
+ }
/* Scale coefficients using spectral extension coordinates */
}
Modified: eac3/ffmpeg.patch
==============================================================================
--- eac3/ffmpeg.patch (original)
+++ eac3/ffmpeg.patch Mon Sep 8 04:36:32 2008
@@ -2,7 +2,15 @@ Index: libavcodec/ac3dec.h
===================================================================
--- libavcodec/ac3dec.h (revision 15141)
+++ libavcodec/ac3dec.h (working copy)
-@@ -42,7 +42,13 @@
+@@ -28,6 +28,7 @@
+ #define AVCODEC_AC3DEC_H
+
+ #include "libavutil/lfg.h"
++#include "libavutil/znrng.h"
+ #include "ac3.h"
+ #include "bitstream.h"
+ #include "dsputil.h"
+@@ -42,7 +43,13 @@
#define AC3_MAX_COEFS 256
#define AC3_BLOCK_SIZE 256
#define MAX_BLOCKS 6
@@ -16,7 +24,7 @@ Index: libavcodec/ac3dec.h
typedef struct {
AVCodecContext *avctx; ///< parent context
GetBitContext gbc; ///< bitstream reader
-@@ -79,15 +85,34 @@
+@@ -79,15 +86,35 @@
int cpl_strategy_exists[MAX_BLOCKS]; ///< coupling strategy exists (cplstre)
int channel_in_cpl[AC3_MAX_CHANNELS]; ///< channel in coupling (chincpl)
int phase_flags_in_use; ///< phase flags in use (phsflginu)
@@ -49,12 +57,13 @@ Index: libavcodec/ac3dec.h
+ int spx_noise_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS]; ///< spx noise blending factor (nblendfact)
+ int spx_signal_blend[AC3_MAX_CHANNELS][SPX_MAX_BANDS]; ///< spx signal blending factor (sblendfact)
+ int spx_coords[AC3_MAX_CHANNELS][SPX_MAX_BANDS]; ///< spectral extension coordinates (spxco)
++ AVRandomState spx_noise_state; ///< random context for noise generation
+///@}
+
///@defgroup aht adaptive hybrid transform
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
-@@ -179,4 +204,6 @@
+@@ -179,4 +206,6 @@
*/
void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
More information about the FFmpeg-soc
mailing list