[SCM] libav/experimental: Split synth filter out of dca.c.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:53:45 UTC 2013


The following commit has been merged in the experimental branch:
commit 4f99c31c3935a8a56b78af26ee0650c8d86d8a5b
Author: Michael Niedermayer <michaelni at gmx.at>
Date:   Wed Oct 28 10:51:51 2009 +0000

    Split synth filter out of dca.c.
    
    Originally committed as revision 20396 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index e5fecbc..30cdd11 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -73,7 +73,7 @@ OBJS-$(CONFIG_CLJR_ENCODER)            += cljr.o
 OBJS-$(CONFIG_COOK_DECODER)            += cook.o
 OBJS-$(CONFIG_CSCD_DECODER)            += cscd.o
 OBJS-$(CONFIG_CYUV_DECODER)            += cyuv.o
-OBJS-$(CONFIG_DCA_DECODER)             += dca.o
+OBJS-$(CONFIG_DCA_DECODER)             += dca.o synth_filter.o
 OBJS-$(CONFIG_DNXHD_DECODER)           += dnxhddec.o dnxhddata.o
 OBJS-$(CONFIG_DNXHD_ENCODER)           += dnxhdenc.o dnxhddata.o       \
                                           mpegvideo_enc.o motion_est.o \
diff --git a/libavcodec/dca.c b/libavcodec/dca.c
index f1a5ab4..bd8990f 100644
--- a/libavcodec/dca.c
+++ b/libavcodec/dca.c
@@ -37,6 +37,7 @@
 #include "dcadata.h"
 #include "dcahuff.h"
 #include "dca.h"
+#include "synth_filter.h"
 
 //#define TRACE
 
@@ -753,9 +754,6 @@ static void qmf_32_subbands(DCAContext * s, int chans,
     const float *prCoeff;
     int i, j;
 
-    int hist_index= s->hist_index[chans];
-    float *subband_fir_hist2 = s->subband_fir_noidea[chans];
-
     int subindex;
 
     scale *= sqrt(1/8.0);
@@ -768,7 +766,6 @@ static void qmf_32_subbands(DCAContext * s, int chans,
 
     /* Reconstructed channel sample index */
     for (subindex = 0; subindex < 8; subindex++) {
-        float *subband_fir_hist = s->subband_fir_hist[chans] + hist_index;
         /* Load in one sample from each subband and clear inactive subbands */
         for (i = 0; i < s->subband_activity[chans]; i++){
             if((i-1)&2) s->raXin[i] = -samples_in[i][subindex];
@@ -777,36 +774,13 @@ static void qmf_32_subbands(DCAContext * s, int chans,
         for (; i < 32; i++)
             s->raXin[i] = 0.0;
 
-        ff_imdct_half(&s->imdct, subband_fir_hist, s->raXin);
-
-        /* Multiply by filter coefficients */
-        for (i = 0; i < 16; i++){
-            float a= subband_fir_hist2[i   ];
-            float b= subband_fir_hist2[i+16];
-            float c= 0;
-            float d= 0;
-            for (j = 0; j < 512-hist_index; j += 64){
-                a += prCoeff[i+j   ]*(-subband_fir_hist[15-i+j]);
-                b += prCoeff[i+j+16]*( subband_fir_hist[   i+j]);
-                c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j]);
-                d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j]);
-            }
-            for (     ; j < 512; j += 64){
-                a += prCoeff[i+j   ]*(-subband_fir_hist[15-i+j-512]);
-                b += prCoeff[i+j+16]*( subband_fir_hist[   i+j-512]);
-                c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j-512]);
-                d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j-512]);
-            }
-            samples_out[i   ] = a * scale + bias;
-            samples_out[i+16] = b * scale + bias;
-            subband_fir_hist2[i   ] = c;
-            subband_fir_hist2[i+16] = d;
-        }
+        ff_synth_filter_float(&s->imdct,
+                              s->subband_fir_hist[chans], &s->hist_index[chans],
+                              s->subband_fir_noidea[chans], prCoeff,
+                              samples_out, s->raXin, scale, bias);
         samples_out+= 32;
 
-        hist_index = (hist_index-32)&511;
     }
-    s->hist_index[chans]= hist_index;
 }
 
 static void lfe_interpolation_fir(int decimation_select,
diff --git a/libavcodec/synth_filter.c b/libavcodec/synth_filter.c
new file mode 100644
index 0000000..3df1a2a
--- /dev/null
+++ b/libavcodec/synth_filter.c
@@ -0,0 +1,56 @@
+/*
+ * copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "synth_filter.h"
+
+void ff_synth_filter_float(FFTContext *imdct,
+                         float *synth_buf_ptr, int *synth_buf_offset,
+                         float synth_buf2[32], const float window[512],
+                         float out[32], const float in[32], float scale, float bias)
+{
+    float *synth_buf= synth_buf_ptr + *synth_buf_offset;
+    int i, j;
+
+    ff_imdct_half(imdct, synth_buf, in);
+
+    for (i = 0; i < 16; i++){
+        float a= synth_buf2[i   ];
+        float b= synth_buf2[i+16];
+        float c= 0;
+        float d= 0;
+        for (j = 0; j < 512 - *synth_buf_offset; j += 64){
+            a += window[i+j   ]*(-synth_buf[15-i+j]);
+            b += window[i+j+16]*( synth_buf[   i+j]);
+            c += window[i+j+32]*( synth_buf[16+i+j]);
+            d += window[i+j+48]*( synth_buf[31-i+j]);
+        }
+        for (     ; j < 512; j += 64){
+            a += window[i+j   ]*(-synth_buf[15-i+j-512]);
+            b += window[i+j+16]*( synth_buf[   i+j-512]);
+            c += window[i+j+32]*( synth_buf[16+i+j-512]);
+            d += window[i+j+48]*( synth_buf[31-i+j-512]);
+        }
+        out[i   ] = a * scale + bias;
+        out[i+16] = b * scale + bias;
+        synth_buf2[i   ] = c;
+        synth_buf2[i+16] = d;
+    }
+    *synth_buf_offset= (*synth_buf_offset-32)&511;
+}
diff --git a/ffserver.h b/libavcodec/synth_filter.h
similarity index 68%
copy from ffserver.h
copy to libavcodec/synth_filter.h
index c76752f..0472048 100644
--- a/ffserver.h
+++ b/libavcodec/synth_filter.h
@@ -1,6 +1,5 @@
 /*
- * Multiple format streaming server
- * copyright (c) 2002 Fabrice Bellard
+ * copyright (c) 2008 Michael Niedermayer <michaelni at gmx.at>
  *
  * This file is part of FFmpeg.
  *
@@ -18,11 +17,11 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#ifndef FFMPEG_FFSERVER_H
-#define FFMPEG_FFSERVER_H
 
-/* interface between ffserver and modules */
+#include "dsputil.h"
 
-void ffserver_module_init(void);
+void ff_synth_filter_float(FFTContext *imdct,
+                         float *synth_buf_ptr, int *synth_buf_offset,
+                         float synth_buf2[32], const float window[512],
+                         float out[32], const float in[32], float scale, float bias);
 
-#endif /* FFMPEG_FFSERVER_H */

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list