[FFmpeg-cvslog] r20396 - in trunk/libavcodec: Makefile dca.c synth_filter.c synth_filter.h
michael
subversion
Wed Oct 28 11:51:51 CET 2009
Author: michael
Date: Wed Oct 28 11:51:51 2009
New Revision: 20396
Log:
Split synth filter out of dca.c.
Added:
trunk/libavcodec/synth_filter.c
trunk/libavcodec/synth_filter.h
Modified:
trunk/libavcodec/Makefile
trunk/libavcodec/dca.c
Modified: trunk/libavcodec/Makefile
==============================================================================
--- trunk/libavcodec/Makefile Wed Oct 28 07:41:58 2009 (r20395)
+++ trunk/libavcodec/Makefile Wed Oct 28 11:51:51 2009 (r20396)
@@ -73,7 +73,7 @@ OBJS-$(CONFIG_CLJR_ENCODER) +
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 \
Modified: trunk/libavcodec/dca.c
==============================================================================
--- trunk/libavcodec/dca.c Wed Oct 28 07:41:58 2009 (r20395)
+++ trunk/libavcodec/dca.c Wed Oct 28 11:51:51 2009 (r20396)
@@ -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 *
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 *
/* 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 *
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,
Added: trunk/libavcodec/synth_filter.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libavcodec/synth_filter.c Wed Oct 28 11:51:51 2009 (r20396)
@@ -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;
+}
Added: trunk/libavcodec/synth_filter.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ trunk/libavcodec/synth_filter.h Wed Oct 28 11:51:51 2009 (r20396)
@@ -0,0 +1,27 @@
+/*
+ * 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 "dsputil.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);
+
More information about the ffmpeg-cvslog
mailing list