mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
Merge commit '7288b345850792430302a8f85a4b29140b770497'
* commit '7288b345850792430302a8f85a4b29140b770497': fft-test: Drop unnecessary pointer indirection for context structs Conflicts: libavcodec/fft-test.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
088875b6b8
@ -232,11 +232,10 @@ int main(int argc, char **argv)
|
|||||||
FFTComplex *tab, *tab1, *tab_ref;
|
FFTComplex *tab, *tab1, *tab_ref;
|
||||||
FFTSample *tab2;
|
FFTSample *tab2;
|
||||||
enum tf_transform transform = TRANSFORM_FFT;
|
enum tf_transform transform = TRANSFORM_FFT;
|
||||||
FFTContext s1, *s = &s1;
|
FFTContext m, s;
|
||||||
FFTContext m1, *m = &m1;
|
|
||||||
#if FFT_FLOAT
|
#if FFT_FLOAT
|
||||||
RDFTContext r1, *r = &r1;
|
RDFTContext r;
|
||||||
DCTContext d1, *d = &d1;
|
DCTContext d;
|
||||||
#endif /* FFT_FLOAT */
|
#endif /* FFT_FLOAT */
|
||||||
int it, i, err = 1;
|
int it, i, err = 1;
|
||||||
int do_speed = 0, do_inverse = 0;
|
int do_speed = 0, do_inverse = 0;
|
||||||
@ -302,7 +301,7 @@ int main(int argc, char **argv)
|
|||||||
av_log(NULL, AV_LOG_INFO,"IMDCT");
|
av_log(NULL, AV_LOG_INFO,"IMDCT");
|
||||||
else
|
else
|
||||||
av_log(NULL, AV_LOG_INFO,"MDCT");
|
av_log(NULL, AV_LOG_INFO,"MDCT");
|
||||||
ff_mdct_init(m, fft_nbits, do_inverse, scale);
|
ff_mdct_init(&m, fft_nbits, do_inverse, scale);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_MDCT */
|
#endif /* CONFIG_MDCT */
|
||||||
case TRANSFORM_FFT:
|
case TRANSFORM_FFT:
|
||||||
@ -310,7 +309,7 @@ int main(int argc, char **argv)
|
|||||||
av_log(NULL, AV_LOG_INFO,"IFFT");
|
av_log(NULL, AV_LOG_INFO,"IFFT");
|
||||||
else
|
else
|
||||||
av_log(NULL, AV_LOG_INFO,"FFT");
|
av_log(NULL, AV_LOG_INFO,"FFT");
|
||||||
ff_fft_init(s, fft_nbits, do_inverse);
|
ff_fft_init(&s, fft_nbits, do_inverse);
|
||||||
fft_ref_init(fft_nbits, do_inverse);
|
fft_ref_init(fft_nbits, do_inverse);
|
||||||
break;
|
break;
|
||||||
#if FFT_FLOAT
|
#if FFT_FLOAT
|
||||||
@ -320,7 +319,7 @@ int main(int argc, char **argv)
|
|||||||
av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
|
av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
|
||||||
else
|
else
|
||||||
av_log(NULL, AV_LOG_INFO,"DFT_R2C");
|
av_log(NULL, AV_LOG_INFO,"DFT_R2C");
|
||||||
ff_rdft_init(r, fft_nbits, do_inverse ? IDFT_C2R : DFT_R2C);
|
ff_rdft_init(&r, fft_nbits, do_inverse ? IDFT_C2R : DFT_R2C);
|
||||||
fft_ref_init(fft_nbits, do_inverse);
|
fft_ref_init(fft_nbits, do_inverse);
|
||||||
break;
|
break;
|
||||||
# endif /* CONFIG_RDFT */
|
# endif /* CONFIG_RDFT */
|
||||||
@ -330,7 +329,7 @@ int main(int argc, char **argv)
|
|||||||
av_log(NULL, AV_LOG_INFO,"DCT_III");
|
av_log(NULL, AV_LOG_INFO,"DCT_III");
|
||||||
else
|
else
|
||||||
av_log(NULL, AV_LOG_INFO,"DCT_II");
|
av_log(NULL, AV_LOG_INFO,"DCT_II");
|
||||||
ff_dct_init(d, fft_nbits, do_inverse ? DCT_III : DCT_II);
|
ff_dct_init(&d, fft_nbits, do_inverse ? DCT_III : DCT_II);
|
||||||
break;
|
break;
|
||||||
# endif /* CONFIG_DCT */
|
# endif /* CONFIG_DCT */
|
||||||
#endif /* FFT_FLOAT */
|
#endif /* FFT_FLOAT */
|
||||||
@ -355,12 +354,12 @@ int main(int argc, char **argv)
|
|||||||
case TRANSFORM_MDCT:
|
case TRANSFORM_MDCT:
|
||||||
if (do_inverse) {
|
if (do_inverse) {
|
||||||
imdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
|
imdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
|
||||||
m->imdct_calc(m, tab2, (FFTSample *)tab1);
|
m.imdct_calc(&m, tab2, (FFTSample *)tab1);
|
||||||
err = check_diff((FFTSample *)tab_ref, tab2, fft_size, scale);
|
err = check_diff((FFTSample *)tab_ref, tab2, fft_size, scale);
|
||||||
} else {
|
} else {
|
||||||
mdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
|
mdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
|
||||||
|
|
||||||
m->mdct_calc(m, tab2, (FFTSample *)tab1);
|
m.mdct_calc(&m, tab2, (FFTSample *)tab1);
|
||||||
|
|
||||||
err = check_diff((FFTSample *)tab_ref, tab2, fft_size / 2, scale);
|
err = check_diff((FFTSample *)tab_ref, tab2, fft_size / 2, scale);
|
||||||
}
|
}
|
||||||
@ -368,8 +367,8 @@ int main(int argc, char **argv)
|
|||||||
#endif /* CONFIG_MDCT */
|
#endif /* CONFIG_MDCT */
|
||||||
case TRANSFORM_FFT:
|
case TRANSFORM_FFT:
|
||||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
||||||
s->fft_permute(s, tab);
|
s.fft_permute(&s, tab);
|
||||||
s->fft_calc(s, tab);
|
s.fft_calc(&s, tab);
|
||||||
|
|
||||||
fft_ref(tab_ref, tab1, fft_nbits);
|
fft_ref(tab_ref, tab1, fft_nbits);
|
||||||
err = check_diff((FFTSample *)tab_ref, (FFTSample *)tab, fft_size * 2, 1.0);
|
err = check_diff((FFTSample *)tab_ref, (FFTSample *)tab, fft_size * 2, 1.0);
|
||||||
@ -390,7 +389,7 @@ int main(int argc, char **argv)
|
|||||||
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
||||||
tab2[1] = tab1[fft_size_2].re;
|
tab2[1] = tab1[fft_size_2].re;
|
||||||
|
|
||||||
r->rdft_calc(r, tab2);
|
r.rdft_calc(&r, tab2);
|
||||||
fft_ref(tab_ref, tab1, fft_nbits);
|
fft_ref(tab_ref, tab1, fft_nbits);
|
||||||
for (i = 0; i < fft_size; i++) {
|
for (i = 0; i < fft_size; i++) {
|
||||||
tab[i].re = tab2[i];
|
tab[i].re = tab2[i];
|
||||||
@ -402,7 +401,7 @@ int main(int argc, char **argv)
|
|||||||
tab2[i] = tab1[i].re;
|
tab2[i] = tab1[i].re;
|
||||||
tab1[i].im = 0;
|
tab1[i].im = 0;
|
||||||
}
|
}
|
||||||
r->rdft_calc(r, tab2);
|
r.rdft_calc(&r, tab2);
|
||||||
fft_ref(tab_ref, tab1, fft_nbits);
|
fft_ref(tab_ref, tab1, fft_nbits);
|
||||||
tab_ref[0].im = tab_ref[fft_size_2].re;
|
tab_ref[0].im = tab_ref[fft_size_2].re;
|
||||||
err = check_diff((float *)tab_ref, (float *)tab2, fft_size, 1.0);
|
err = check_diff((float *)tab_ref, (float *)tab2, fft_size, 1.0);
|
||||||
@ -413,7 +412,7 @@ int main(int argc, char **argv)
|
|||||||
#if CONFIG_DCT
|
#if CONFIG_DCT
|
||||||
case TRANSFORM_DCT:
|
case TRANSFORM_DCT:
|
||||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
||||||
d->dct_calc(d, (FFTSample *)tab);
|
d.dct_calc(&d, (FFTSample *)tab);
|
||||||
if (do_inverse) {
|
if (do_inverse) {
|
||||||
idct_ref((FFTSample*)tab_ref, (FFTSample *)tab1, fft_nbits);
|
idct_ref((FFTSample*)tab_ref, (FFTSample *)tab1, fft_nbits);
|
||||||
} else {
|
} else {
|
||||||
@ -440,23 +439,23 @@ int main(int argc, char **argv)
|
|||||||
switch (transform) {
|
switch (transform) {
|
||||||
case TRANSFORM_MDCT:
|
case TRANSFORM_MDCT:
|
||||||
if (do_inverse) {
|
if (do_inverse) {
|
||||||
m->imdct_calc(m, (FFTSample *)tab, (FFTSample *)tab1);
|
m.imdct_calc(&m, (FFTSample *)tab, (FFTSample *)tab1);
|
||||||
} else {
|
} else {
|
||||||
m->mdct_calc(m, (FFTSample *)tab, (FFTSample *)tab1);
|
m.mdct_calc(&m, (FFTSample *)tab, (FFTSample *)tab1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRANSFORM_FFT:
|
case TRANSFORM_FFT:
|
||||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
||||||
s->fft_calc(s, tab);
|
s.fft_calc(&s, tab);
|
||||||
break;
|
break;
|
||||||
#if FFT_FLOAT
|
#if FFT_FLOAT
|
||||||
case TRANSFORM_RDFT:
|
case TRANSFORM_RDFT:
|
||||||
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
||||||
r->rdft_calc(r, tab2);
|
r.rdft_calc(&r, tab2);
|
||||||
break;
|
break;
|
||||||
case TRANSFORM_DCT:
|
case TRANSFORM_DCT:
|
||||||
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
||||||
d->dct_calc(d, tab2);
|
d.dct_calc(&d, tab2);
|
||||||
break;
|
break;
|
||||||
#endif /* FFT_FLOAT */
|
#endif /* FFT_FLOAT */
|
||||||
}
|
}
|
||||||
@ -475,21 +474,21 @@ int main(int argc, char **argv)
|
|||||||
switch (transform) {
|
switch (transform) {
|
||||||
#if CONFIG_MDCT
|
#if CONFIG_MDCT
|
||||||
case TRANSFORM_MDCT:
|
case TRANSFORM_MDCT:
|
||||||
ff_mdct_end(m);
|
ff_mdct_end(&m);
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_MDCT */
|
#endif /* CONFIG_MDCT */
|
||||||
case TRANSFORM_FFT:
|
case TRANSFORM_FFT:
|
||||||
ff_fft_end(s);
|
ff_fft_end(&s);
|
||||||
break;
|
break;
|
||||||
#if FFT_FLOAT
|
#if FFT_FLOAT
|
||||||
# if CONFIG_RDFT
|
# if CONFIG_RDFT
|
||||||
case TRANSFORM_RDFT:
|
case TRANSFORM_RDFT:
|
||||||
ff_rdft_end(r);
|
ff_rdft_end(&r);
|
||||||
break;
|
break;
|
||||||
# endif /* CONFIG_RDFT */
|
# endif /* CONFIG_RDFT */
|
||||||
# if CONFIG_DCT
|
# if CONFIG_DCT
|
||||||
case TRANSFORM_DCT:
|
case TRANSFORM_DCT:
|
||||||
ff_dct_end(d);
|
ff_dct_end(&d);
|
||||||
break;
|
break;
|
||||||
# endif /* CONFIG_DCT */
|
# endif /* CONFIG_DCT */
|
||||||
#endif /* FFT_FLOAT */
|
#endif /* FFT_FLOAT */
|
||||||
|
Loading…
Reference in New Issue
Block a user