Browse Source

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>
tags/n0.9
Mans Rullgard 14 years ago
parent
commit
75a24bef4a
3 changed files with 1033 additions and 8 deletions
  1. +5
    -8
      libavcodec/iirfilter.c
  2. +4
    -0
      tests/fate2.mak
  3. +1024
    -0
      tests/ref/fate/iirfilter

+ 5
- 8
libavcodec/iirfilter.c 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);


+ 4
- 0
tests/fate2.mak 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
- 0
tests/ref/fate/iirfilter
File diff suppressed because it is too large
View File


Loading…
Cancel
Save