iirfilter: add fate test

Change the test program to output text instead of binary files so
it can be compared easily in FATE.

Signed-off-by: Mans Rullgard <mans@mansr.com>
This commit is contained in:
Mans Rullgard 2011-07-04 16:26:03 +01:00
parent 66e2dd1187
commit 75a24bef4a
3 changed files with 1033 additions and 8 deletions

View File

@ -311,6 +311,9 @@ av_cold void ff_iir_filter_free_coeffs(struct FFIIRFilterCoeffs *coeffs)
}
#ifdef TEST
#undef printf
#include <stdio.h>
#define FILT_ORDER 4
#define SIZE 1024
int main(void)
@ -320,7 +323,6 @@ int main(void)
float cutoff_coeff = 0.4;
int16_t x[SIZE], y[SIZE];
int i;
FILE* fd;
fcoeffs = ff_iir_filter_init_coeffs(NULL, FF_FILTER_TYPE_BUTTERWORTH,
FF_FILTER_MODE_LOWPASS, FILT_ORDER,
@ -333,13 +335,8 @@ int main(void)
ff_iir_filter(fcoeffs, fstate, SIZE, x, 1, y, 1);
fd = fopen("in.bin", "w");
fwrite(x, sizeof(x[0]), SIZE, fd);
fclose(fd);
fd = fopen("out.bin", "w");
fwrite(y, sizeof(y[0]), SIZE, fd);
fclose(fd);
for (i = 0; i < SIZE; i++)
printf("%6d %6d\n", x[i], y[i]);
ff_iir_filter_free_coeffs(fcoeffs);
ff_iir_filter_free_state(fstate);

View File

@ -218,3 +218,7 @@ fate-musepack7: CMD = pcm -i $(SAMPLES)/musepack/inside-mp7.mpc
fate-musepack7: CMP = oneoff
fate-musepack7: REF = $(SAMPLES)/musepack/inside-mp7.pcm
fate-musepack7: FUZZ = 1
FATE_TESTS += fate-iirfilter
fate-iirfilter: libavcodec/iirfilter-test$(EXESUF)
fate-iirfilter: CMD = run libavcodec/iirfilter-test

1024
tests/ref/fate/iirfilter Normal file

File diff suppressed because it is too large Load Diff