Commit 4f99c31c authored by Michael Niedermayer's avatar Michael Niedermayer

Split synth filter out of dca.c.

Originally committed as revision 20396 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 638783bf
...@@ -73,7 +73,7 @@ OBJS-$(CONFIG_CLJR_ENCODER) += cljr.o ...@@ -73,7 +73,7 @@ OBJS-$(CONFIG_CLJR_ENCODER) += cljr.o
OBJS-$(CONFIG_COOK_DECODER) += cook.o OBJS-$(CONFIG_COOK_DECODER) += cook.o
OBJS-$(CONFIG_CSCD_DECODER) += cscd.o OBJS-$(CONFIG_CSCD_DECODER) += cscd.o
OBJS-$(CONFIG_CYUV_DECODER) += cyuv.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_DECODER) += dnxhddec.o dnxhddata.o
OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o \ OBJS-$(CONFIG_DNXHD_ENCODER) += dnxhdenc.o dnxhddata.o \
mpegvideo_enc.o motion_est.o \ mpegvideo_enc.o motion_est.o \
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include "dcadata.h" #include "dcadata.h"
#include "dcahuff.h" #include "dcahuff.h"
#include "dca.h" #include "dca.h"
#include "synth_filter.h"
//#define TRACE //#define TRACE
...@@ -753,9 +754,6 @@ static void qmf_32_subbands(DCAContext * s, int chans, ...@@ -753,9 +754,6 @@ static void qmf_32_subbands(DCAContext * s, int chans,
const float *prCoeff; const float *prCoeff;
int i, j; int i, j;
int hist_index= s->hist_index[chans];
float *subband_fir_hist2 = s->subband_fir_noidea[chans];
int subindex; int subindex;
scale *= sqrt(1/8.0); scale *= sqrt(1/8.0);
...@@ -768,7 +766,6 @@ static void qmf_32_subbands(DCAContext * s, int chans, ...@@ -768,7 +766,6 @@ static void qmf_32_subbands(DCAContext * s, int chans,
/* Reconstructed channel sample index */ /* Reconstructed channel sample index */
for (subindex = 0; subindex < 8; subindex++) { 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 */ /* Load in one sample from each subband and clear inactive subbands */
for (i = 0; i < s->subband_activity[chans]; i++){ for (i = 0; i < s->subband_activity[chans]; i++){
if((i-1)&2) s->raXin[i] = -samples_in[i][subindex]; if((i-1)&2) s->raXin[i] = -samples_in[i][subindex];
...@@ -777,36 +774,13 @@ static void qmf_32_subbands(DCAContext * s, int chans, ...@@ -777,36 +774,13 @@ static void qmf_32_subbands(DCAContext * s, int chans,
for (; i < 32; i++) for (; i < 32; i++)
s->raXin[i] = 0.0; s->raXin[i] = 0.0;
ff_imdct_half(&s->imdct, subband_fir_hist, s->raXin); ff_synth_filter_float(&s->imdct,
s->subband_fir_hist[chans], &s->hist_index[chans],
/* Multiply by filter coefficients */ s->subband_fir_noidea[chans], prCoeff,
for (i = 0; i < 16; i++){ samples_out, s->raXin, scale, bias);
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;
}
samples_out+= 32; samples_out+= 32;
hist_index = (hist_index-32)&511;
} }
s->hist_index[chans]= hist_index;
} }
static void lfe_interpolation_fir(int decimation_select, static void lfe_interpolation_fir(int decimation_select,
......
/*
* copyright (c) 2008 Michael Niedermayer <michaelni@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;
}
/*
* copyright (c) 2008 Michael Niedermayer <michaelni@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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment