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

jbr subversion at mplayerhq.hu
Fri Sep 12 00:45:05 CEST 2008


Author: jbr
Date: Fri Sep 12 00:45:04 2008
New Revision: 3742

Log:
use LFG to generate blended noise for SPX

Removed:
   eac3/znrng.c
   eac3/znrng.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	Fri Sep 12 00:45:04 2008
@@ -197,7 +197,6 @@ 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/checkout.sh
==============================================================================
--- eac3/checkout.sh	(original)
+++ eac3/checkout.sh	Fri Sep 12 00:45:04 2008
@@ -1,13 +1,9 @@
 LAVC_FILES="eac3dec.c ac3dec.c"
-LAVU_FILES="znrng.c znrng.h"
 
 echo "checking out ffmpeg svn"
 for i in $LAVC_FILES ac3dec.h ac3dec_data.c ac3dec_data.h; do
     rm -f ffmpeg/libavcodec/$i
 done
-for i in $LAVU_FILES Makefile; do
-    rm -f ffmpeg/libavutil/$i
-done
 svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r 15141
 echo "patching ffmpeg"
 cd ffmpeg
@@ -17,9 +13,4 @@ for i in $LAVC_FILES; do
     rm -f libavcodec/$i
     ln -s ../../$i libavcodec/$i
 done
-echo "copying the ZNRNG files to ffmpeg/libavutil"
-for i in $LAVU_FILES; do
-    rm -f libavutil/$i
-    ln -s ../../$i libavutil/$i
-done
 echo "Done, now just do a regular configure and make to build."

Modified: eac3/eac3dec.c
==============================================================================
--- eac3/eac3dec.c	(original)
+++ eac3/eac3dec.c	Fri Sep 12 00:45:04 2008
@@ -120,11 +120,13 @@ void ff_eac3_apply_spectral_extension(AC
            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];
-            int64_t spxco  = s->spx_coords[ch][bnd];
+            int64_t nscale, sscale, spxco;
+            nscale = (s->spx_noise_blend [ch][bnd] * rms_energy[bnd]) >> 23;
+            nscale = (nscale * 14529495) >> 23;
+            sscale = s->spx_signal_blend[ch][bnd];
+            spxco  = s->spx_coords[ch][bnd];
             for (i = 0; i < s->spx_band_sizes[bnd]; i++) {
-                int64_t noise  = (nscale * (av_znrng_get(&s->spx_noise_state) >> 4)) >> 23;
+                int64_t noise  = (nscale * (((int)av_lfg_get(&s->dith_state))>>8)) >> 23;
                 int64_t signal = (sscale * s->fixed_coeffs[ch][bin]) >> 23;
                 s->fixed_coeffs[ch][bin++] = ((noise + signal) * spxco) >> 23;
             }

Modified: eac3/ffmpeg.patch
==============================================================================
--- eac3/ffmpeg.patch	(original)
+++ eac3/ffmpeg.patch	Fri Sep 12 00:45:04 2008
@@ -2,15 +2,7 @@ Index: libavcodec/ac3dec.h
 ===================================================================
 --- libavcodec/ac3dec.h	(revision 15141)
 +++ libavcodec/ac3dec.h	(working copy)
-@@ -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 @@
+@@ -42,7 +42,13 @@
  #define AC3_MAX_COEFS   256
  #define AC3_BLOCK_SIZE  256
  #define MAX_BLOCKS        6
@@ -24,7 +16,7 @@ Index: libavcodec/ac3dec.h
  typedef struct {
      AVCodecContext *avctx;                  ///< parent context
      GetBitContext gbc;                      ///< bitstream reader
-@@ -79,15 +86,35 @@
+@@ -79,15 +85,34 @@
      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)
@@ -57,13 +49,12 @@ 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 +206,6 @@
+@@ -179,4 +204,6 @@
   */
  void ff_eac3_decode_transform_coeffs_aht_ch(AC3DecodeContext *s, int ch);
  
@@ -139,24 +130,3 @@ Index: libavcodec/ac3dec_data.h
  
  extern const uint8_t ff_ac3_rematrix_band_tab[5];
  
-Index: libavutil/Makefile
-===================================================================
---- libavutil/Makefile	(revision 15141)
-+++ libavutil/Makefile	(working copy)
-@@ -23,6 +23,7 @@
-        string.o \
-        tree.o \
-        utils.o \
-+       znrng.o \
- 
- HEADERS = adler32.h \
-           avstring.h \
-@@ -41,7 +42,7 @@
-           rational.h \
-           sha1.h
- 
--TESTS = $(addsuffix -test$(EXESUF), adler32 aes crc des lls md5 pca random sha1 softfloat tree)
-+TESTS = $(addsuffix -test$(EXESUF), adler32 aes crc des lls md5 pca random sha1 softfloat tree znrng)
- 
- include $(SUBDIR)../subdir.mak
- 



More information about the FFmpeg-soc mailing list