[FFmpeg-devel] ac3 imdct question
Arpi
arpi
Mon Oct 13 15:17:53 CEST 2008
Hi,
Could someone DSP guru please explain me, what ff_fft_calc exactly
calculates in ff_imdct_half_c() of mdct.c ?
I've tried to replace it (for experimenting with pitch correction...)
with the 'standard' inverse discrete fourier transform but it does
not work, the sound (ac3 music sample file) gets heavily distorted :(
here's my modification:
--- mdct.c.ORIG 2008-09-08 15:37:12.000000000 +0200
+++ mdct.c 2008-10-13 15:10:45.000000000 +0200
@@ -122,6 +122,7 @@
const FFTSample *tcos = s->tcos;
const FFTSample *tsin = s->tsin;
const FFTSample *in1, *in2;
+ FFTComplex buf[1024];
FFTComplex *z = (FFTComplex *)output;
n = 1 << s->nbits;
@@ -134,11 +135,29 @@
in2 = input + n2 - 1;
for(k = 0; k < n4; k++) {
j=revtab[k];
- CMUL(z[j].re, z[j].im, *in2, *in1, tcos[k], tsin[k]);
+// CMUL(z[j].re, zi[j].im, *in2, *in1, tcos[k], tsin[k]);
+ CMUL(buf[k].re, buf[k].im, *in2, *in1, tcos[k], tsin[k]);
in1 += 2;
in2 -= 2;
}
- ff_fft_calc(&s->fft, z);
+
+#if 1
+#undef fprintf
+ fprintf(stderr,"ff_imdct_half_c: n4=%d\n",n4);
+ // n4==128
+ for(k=0;k<n4;k++){
+ float s=k*(2*M_PI/n4);
+ double x=0,y=0;
+ for(j=0;j<n4;j++){
+ x+=buf[j].re*cos(j*s);
+ y+=buf[j].im*sin(j*s);
+ }
+ z[k].re=x;
+ z[k].im=y;
+ }
+// ff_fft_calc(&s->fft, buf);
+#endif
+
/* post rotation + reordering */
output += n4;
thanks,
A'rpi
More information about the ffmpeg-devel
mailing list