[FFmpeg-cvslog] iirfilter: add fate test

Mans Rullgard git at videolan.org
Tue Jul 5 02:52:28 CEST 2011


ffmpeg | branch: master | Mans Rullgard <mans at mansr.com> | Mon Jul  4 16:26:03 2011 +0100| [75a24bef4a33a36d1bcd9dbd87c105d5893d0728] | committer: Mans Rullgard

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 at mansr.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=75a24bef4a33a36d1bcd9dbd87c105d5893d0728
---

 libavcodec/iirfilter.c   |   13 +-
 tests/fate2.mak          |    4 +
 tests/ref/fate/iirfilter | 1024 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1033 insertions(+), 8 deletions(-)

diff --git a/libavcodec/iirfilter.c b/libavcodec/iirfilter.c
index a942068..34d3962 100644
--- a/libavcodec/iirfilter.c
+++ b/libavcodec/iirfilter.c
@@ -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);
diff --git a/tests/fate2.mak b/tests/fate2.mak
index ef8c3b8..a743f0c 100644
--- a/tests/fate2.mak
+++ b/tests/fate2.mak
@@ -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
diff --git a/tests/ref/fate/iirfilter b/tests/ref/fate/iirfilter
new file mode 100644
index 0000000..2e5902d
--- /dev/null
+++ b/tests/ref/fate/iirfilter
@@ -0,0 +1,1024 @@
+     0      0
+    38      2
+   151     15
+   339     65
+   603    182
+   942    381
+  1356    664
+  1845   1021
+  2409   1450
+  3046   1953
+  3755   2530
+  4535   3182
+  5384   3907
+  6300   4700
+  7278   5563
+  8315   6491
+  9405   7481
+ 10541   8529
+ 11717   9629
+ 12924  10773
+ 14151  11956
+ 15385  13167
+ 16615  14396
+ 17825  15630
+ 18997  16857
+ 20114  18060
+ 21156  19222
+ 22102  20325
+ 22929  21349
+ 23613  22273
+ 24132  23073
+ 24461  23726
+ 24575  24208
+ 24453  24495
+ 24073  24564
+ 23416  24392
+ 22467  23959
+ 21213  23245
+ 19649  22236
+ 17773  20922
+ 15590  19296
+ 13116  17360
+ 10371  15119
+  7386  12591
+  4201   9797
+   867   6771
+ -2559   3554
+ -6008    199
+ -9405  -3235
+-12667  -6678
+-15707 -10053
+-18435 -13277
+-20762 -16261
+-22602 -18916
+-23875 -21153
+-24511 -22887
+-24457 -24040
+-23675 -24546
+-22151 -24352
+-19895 -23428
+-16946 -21762
+-13370 -19370
+ -9265 -16296
+ -4757 -12613
+     0  -8423
+  4831  -3858
+  9544    923
+ 13934   5743
+ 17799  10406
+ 20942  14708
+ 23189  18447
+ 24395  21430
+ 24457  23488
+ 23323  24483
+ 21001  24321
+ 17563  22963
+ 13148  20426
+  7959  16795
+  2259  12223
+ -3643   6922
+ -9405   1166
+-14670  -4731
+-19092 -10421
+-22359 -15550
+-24213 -19777
+-24481 -22797
+-23087 -24368
+-20071 -24334
+-15590 -22639
+ -9924 -19343
+ -3457 -14629
+  3345  -8793
+  9959  -2236
+ 15851   4563
+ 20517  11078
+ 23528  16779
+ 24575  21171
+ 23506  23846
+ 20349  24522
+ 15327  23076
+  8845  19572
+  1469  14264
+ -6117   7589
+-13180    135
+-18997  -7403
+-22942 -14289
+-24553 -19814
+-23592 -23377
+-20092 -24551
+-14366 -23145
+ -6989 -19239
+  1244 -13192
+  9405  -5620
+ 16532   2656
+ 21744  10697
+ 24357  17548
+ 23978  22356
+ 20579  24483
+ 14518  23593
+  6518  19723
+ -2409  13293
+-11083   5078
+-18310  -3876
+-23048 -12378
+-24568 -19252
+-22573 -23500
+-17270 -24458
+ -9370 -21908
+     0 -16140
+  9439  -7935
+ 17484   1526
+ 22832  10824
+ 24568  18508
+ 22327  23330
+ 16392  24452
+  7673  21608
+ -2409  15181
+-12146   6168
+-19828  -3955
+-24050 -13466
+-23978 -20689
+-19535 -24292
+-11451 -23552
+ -1168 -18512
+  9405 -10015
+ 18234    416
+ 23560  10836
+ 24257  19234
+ 20092  23929
+ 11817  23916
+  1055  19105
+ -9993  10379
+-18997   -540
+-23986 -11413
+-23802 -19939
+-18385 -24246
+ -8845 -23318
+  2746 -17260
+ 13778  -7325
+ 21691   4319
+ 24575  15045
+ 21656  22357
+ 13528  24482
+  2071  20823
+ -9959  12152
+-19581    484
+-24331 -11367
+-22915 -20460
+-15590 -24459
+ -4164 -22257
+  8421 -14315
+ 18828  -2603
+ 24213   9857
+ 23022  19756
+ 15474  24383
+  3569  22388
+ -9405  14211
+-19761   2031
+-24471 -10785
+-22069 -20591
+-13148 -24512
+  -264 -21311
+ 12763 -11818
+ 21968   1241
+ 24457  13990
+ 19351  22545
+  8137  24211
+ -5715  18362
+-17799   6720
+-24167  -7108
+-22646 -18722
+-13622 -24326
+     0 -21995
+ 13685 -12382
+ 22762   1409
+ 24035  14788
+ 16946  23188
+  3867  23644
+-10643  15884
+-21401   2514
+-24457 -11806
+-18584 -21960
+ -5825 -24220
+  9160 -17649
+ 20762  -4546
+ 24527  10303
+ 18901  21343
+  5935  24337
+ -9405  18028
+-21098   4727
+-24442 -10470
+-17979 -21608
+ -4201 -24206
+ 11351 -17110
+ 22280  -3064
+ 23970  12287
+ 15590  22636
+   565  23615
+-14760  14693
+-23773   -479
+-22467 -15504
+-11284 -23907
+  4942 -21954
+ 19021 -10373
+ 24575   5837
+ 18973  19502
+  4646  24445
+-11883  18316
+-22929   3786
+-23226 -12541
+-12505 -23090
+  4239 -22841
+ 18997 -11784
+ 24567   4932
+ 18107  19331
+  2671  24403
+-14151  17558
+-23919   2036
+-21602 -14549
+ -8244 -23897
+  9405 -21206
+ 22232  -7710
+ 23473   9785
+ 12342  22272
+ -5384  23186
+-20286  11920
+-24287  -5693
+-15090 -20319
+  2409 -24060
+ 18633 -14771
+ 24538   2613
+ 16698  18608
+  -603  24329
+-17616  16471
+-24575   -682
+-17351 -17495
+     0 -24355
+ 17404 -17211
+ 24575    -65
+ 17136  17163
+  -603  24334
+-18031  17094
+-24538   -374
+-16023 -17660
+  2409 -24287
+ 19397 -16108
+ 24287   1992
+ 13872  18902
+ -5384  24066
+-21251  14131
+-23473  -4761
+-10473 -20664
+  9405 -23351
+ 23151 -10967
+ 21602   8573
+  5642  22543
+-14151  21682
+-24430   6431
+-18107 -13147
+   641 -23920
+ 18997 -18514
+ 24207   -475
+ 12505  17922
+ -8030  23970
+-22929  13357
+-21511  -6625
+ -4646 -21972
+ 15619 -21758
+ 24575  -6009
+ 15561  14083
+ -4942  24019
+-21831  16485
+-22467  -3138
+ -6227 -20474
+ 14760 -22641
+ 24569  -7904
+ 15590  12791
+ -5421  23839
+-22280  16760
+-21797  -3160
+ -4201 -20666
+ 16754 -22169
+ 24442  -6381
+ 12602  14430
+ -9405  23865
+-23848  14348
+-18901  -6644
+  1545 -22308
+ 20762 -19937
+ 22804  -1339
+  5825  18365
+-16080  22954
+-24457   8529
+-12080 -13009
+ 10643 -23650
+ 24269 -14353
+ 16946   7119
+ -5127  22521
+-22762  18602
+-20413  -1370
+     0 -20152
+ 20454 -21342
+ 22646  -3797
+  4461  17096
+-17799  22804
+-23902   8148
+ -8137 -13817
+ 15149 -23296
+ 24457 -11618
+ 11016  10660
+-12763  23135
+-24574  14243
+-13148  -7861
+ 10813 -22608
+ 24471 -16124
+ 14609   5565
+ -9405  21949
+-24315  17379
+-15474  -3849
+  8598 -21336
+ 24213 -18120
+ 15793   2745
+ -8421  20885
+-24220  18429
+-15590  -2263
+  8880 -20663
+ 24331 -18359
+ 14851   2398
+ -9959  20685
+-24488  17917
+-13528  -3137
+ 11618 -20918
+ 24575 -17075
+ 11551   4460
+-13778  21286
+-24421  15770
+ -8845  -6328
+ 16307 -21661
+ 23802 -13916
+  5348   8671
+-18997  21868
+-22452  11421
+ -1055 -11371
+ 21548 -21685
+ 20092  -8212
+ -3941  14242
+-23560  20853
+-16476   4267
+  9405 -17009
+ 24547 -19106
+ 11451    343
+-14911  19309
+-23978  16208
+ -5053  -5409
+ 19828 -20699
+ 21364 -12016
+ -2409  10553
+-23347  20700
+-16392   6559
+ 10268 -15211
+ 24568 -18879
+  9090   -118
+-17484  18664
+-22690  14969
+     0  -6714
+ 22719 -20134
+ 17270  -9014
+ -9717  13022
+-24568  18943
+ -8527   1506
+ 18310 -17662
+ 21934 -14749
+ -2409   6538
+-23695  19463
+-14518   7789
+ 13433 -13633
+ 23978 -17566
+  3270    935
+-21744  18075
+-18184  11812
+  9405  -9654
+ 24544 -18394
+  6989  -3082
+-19939  16117
+-20092  13945
+  6881  -6613
+ 24553 -18196
+  8809  -5437
+-18997  14458
+-20742  14731
+  6117  -4859
+ 24531 -17657
+  8845  -6307
+-19210  13526
+-20349  14588
+  7170  -4444
+ 24575 -17109
+  7098  -5874
+-20517  13412
+-18780  13691
+  9959  -5272
+ 24347 -16558
+  3457  -4241
+-22482  13949
+-15590  11979
+ 14181  -7142
+ 23087 -15723
+ -2146  -1459
+-24213  14726
+-10200   9228
+ 19092  -9692
+ 19717 -14108
+ -9405   2343
+-24304  15085
+ -2259   5221
+ 23251 -12286
+ 13148 -11127
+-17190   6746
+-21001  14161
+  7745      2
+ 24457 -13938
+  2971  -6372
+-23189  10842
+-12860  11094
+ 17799  -5795
+ 20243 -13421
+ -9544    -30
+-24096  13184
+     0   5498
+ 24110 -10713
+  9265  -9718
+-20620   6673
+-16946  12155
+ 14427  -1883
+ 22151 -12653
+ -6591  -2861
+-24457  11378
+ -1770   6908
+ 23875  -8726
+  9648  -9817
+-20762   5209
+-16251  11385
+ 15707  -1358
+ 21059 -11610
+ -9405  -2353
+-23830  10656
+  2559   5560
+ 24560  -8789
+  4201  -8028
+-23439   6314
+-10371   9643
+ 20783  -3542
+ 15590 -10404
+-16973    742
+-19649  10386
+ 12407   1870
+ 22467  -9720
+ -7458  -4144
+-24073   8562
+  2446   5991
+ 24575  -7072
+  2371  -7375
+-24132   5398
+ -6808   8306
+ 22929  -3667
+ 10745  -8824
+-21156   1980
+-14120   8987
+ 18997   -408
+ 16918  -8863
+-16615  -1001
+-19163   8521
+ 14151   2220
+ 20902  -8027
+-11717  -3241
+-22200   7441
+  9405   4071
+ 23126  -6811
+ -7278  -4722
+-23754   6177
+  5384   5213
+ 24153  -5571
+ -3755  -5566
+-24386   5013
+  2409   5801
+ 24506  -4521
+ -1356  -5939
+-24557   4104
+   603   5999
+ 24573  -3765
+  -151  -5994
+-24575   3508
+     0   5937
+ 24575  -3331
+  -151  -5835
+-24573   3232
+   603   5694
+ 24557  -3205
+ -1356  -5517
+-24506   3244
+  2409   5303
+ 24386  -3343
+ -3755  -5049
+-24153   3494
+  5384   4752
+ 23754  -3685
+ -7278  -4407
+-23126   3906
+  9405   4007
+ 22200  -4143
+-11717  -3547
+-20902   4380
+ 14151   3025
+ 19163  -4598
+-16615  -2434
+-16918   4778
+ 18997   1780
+ 14120  -4898
+-21156  -1066
+-10745   4934
+ 22929    304
+  6808  -4862
+-24132    489
+ -2371   4664
+ 24575  -1288
+ -2446  -4320
+-24073   2060
+  7458   3820
+ 22467  -2767
+-12407  -3162
+-19649   3365
+ 16973   2357
+ 15590  -3808
+-20783  -1429
+-10371   4050
+ 23439    419
+  4201  -4055
+-24560    616
+  2559   3795
+ 23830  -1607
+ -9405  -3266
+-21059   2473
+ 15707   2486
+ 16251  -3130
+-20762  -1499
+ -9648   3505
+ 23875    386
+  1770  -3539
+-24457    754
+  6591   3205
+ 22151  -1798
+-14427  -2518
+-16946   2618
+ 20620   1540
+  9265  -3101
+-24110   -381
+     0   3162
+ 24096   -809
+ -9544  -2775
+-20243   1859
+ 17799   1978
+ 12860  -2598
+-23189   -879
+ -2971   2893
+ 24457   -344
+ -7745  -2674
+-21001   1478
+ 17190   1966
+ 13148  -2304
+-23251   -890
+ -2259   2647
+ 24304   -341
+ -9405  -2421
+-19717   1467
+ 19092   1662
+ 10200  -2229
+-24213   -535
+  2146   2434
+ 23087   -692
+-14181  -2022
+-15590   1706
+ 22482   1090
+  3457  -2230
+-24347    115
+  9959   2111
+ 18780  -1251
+-20517  -1374
+ -7098   1975
+ 24575    238
+ -7170  -2057
+-20349    938
+ 19210   1464
+  8845  -1763
+-24531   -392
+  6117   1949
+ 20742   -783
+-18997  -1425
+ -8809   1630
+ 24553    385
+ -6881  -1825
+-20092    770
+ 19939   1291
+  6989  -1572
+-24544   -244
+  9405   1688
+ 18184   -869
+-21744  -1069
+ -3270   1559
+ 23978     -7
+-13433  -1511
+-14518   1041
+ 23695    753
+ -2409  -1536
+-21934    344
+ 18310   1251
+  8527  -1225
+-24568   -337
+  9717   1436
+ 17270   -719
+-22719   -869
+     0   1342
+ 22690   -157
+-17484  -1188
+ -9090   1051
+ 24568    353
+-10268  -1293
+-16392    658
+ 23347    745
+ -2409  -1224
+-21364    244
+ 19828    996
+  5053  -1036
+-23978   -132
+ 14911   1114
+ 11451   -783
+-24547   -437
+  9405   1124
+ 16476   -513
+-23560   -661
+  3941   1058
+ 20092   -257
+-21548   -807
+ -1055    945
+ 22452    -37
+-18997   -887
+ -5348    815
+ 23802    142
+-16307   -917
+ -8845    682
+ 24421    276
+-13778   -913
+-11551    563
+ 24575    371
+-11618   -888
+-13528    463
+ 24488    431
+ -9959   -854
+-14851    386
+ 24331    462
+ -8880   -815
+-15590    333
+ 24220    471
+ -8421   -779
+-15793    302
+ 24213    460
+ -8598   -746
+-15474    292
+ 24315    433
+ -9405   -717
+-14609    300
+ 24471    391
+-10813   -689
+-13148    324
+ 24574    336
+-12763   -660
+-11016    359
+ 24457    267
+-15149   -627
+ -8137    400
+ 23902    184
+-17799   -584
+ -4461    444
+ 22646     90
+-20454   -527
+     0    483
+ 20413    -15
+-22762   -452
+  5127    511
+ 16946   -124
+-24269   -357
+ 10643    517
+ 12080   -232
+-24457   -241
+ 16080    495
+  5825   -328
+-22804   -107
+ 20762    440
+ -1545   -400
+-18901     35
+ 23848    347
+ -9405   -437
+-12602    173
+ 24442    220
+-16754   -426
+ -4201    290
+ 21797     69
+-22280   -362
+  5421    366
+ 15590    -89
+-24569   -247
+ 14760    384
+  6227   -228
+-22467    -95
+ 21831    335
+ -4942   -321
+-15561     71
+ 24575    222
+-15619   -344
+ -4646    214
+ 21511     65
+-22929   -288
+  8030    300
+ 12505   -102
+-24207   -162
+ 18997    304
+  -641   -232
+-18107      4
+ 24430    218
+-14151   -286
+ -5642    160
+ 21602     68
+-23151   -244
+  9405    253
+ 10473    -97
+-23473   -115
+ 21251    247
+ -5384   -216
+-13872     49
+ 24287    142
+-19397   -238
+  2409    183
+ 16023    -17
+-24538   -153
+ 18031    224
+  -603   -158
+-17136      0
+ 24575    153
+-17404   -209
+     0    142
+ 17351      6
+-24575   -144
+ 17616    196
+  -603   -133
+-16698     -1
+ 24538    131
+-18633   -182
+  2409    132
+ 15090    -11
+-24287   -111
+ 20286    169
+ -5384   -134
+-12342     30
+ 23473     86
+-22232   -152
+  9405    138
+  8244    -53
+-21602    -56
+ 23919    132
+-14151   -138
+ -2671     76
+ 18107     21
+-24567   -104
+ 18997    134
+ -4239    -98
+-12505     16
+ 23226     69
+-22929   -119
+ 11883    111
+  4646    -53
+-18973    -28
+ 24575     92
+-19021   -113
+  4942     82
+ 11284    -16
+-22467    -54
+ 23773     97
+-14760    -97
+  -565     56
+ 15590      8
+-23970    -65
+ 22280     93
+-11351    -82
+ -4201     37
+ 17979     21
+-24442    -67
+ 21098     85
+ -9405    -69
+ -5935     26
+ 18901     24
+-24527    -64
+ 20762     77
+ -9160    -61
+ -5825     23
+ 18584     21
+-24457    -56
+ 21401     69
+-10643    -57
+ -3867     25
+ 16946     15
+-24035    -47
+ 22762     62
+-13685    -55
+     0     29
+ 13622      4
+-22646    -35
+ 24167     53
+-17799    -52
+  5715     36
+  8137     -8
+-19351    -21
+ 24457     41
+-21968    -49
+ 12763     41
+   264    -21
+-13148     -4
+ 22069     27
+-24471    -40
+ 19761     42
+ -9405    -31
+ -3569     12
+ 15474      9
+-23022    -27
+ 24213     36
+-18828    -35
+  8421     25
+  4164     -9
+-15590     -9
+ 22915     23
+-24331    -31
+ 19581     31
+ -9959    -23
+ -2071     10
+ 13528      5
+-21656    -18
+ 24575     26
+-21691    -27
+ 13778     22
+ -2746    -12
+ -8845      0
+ 18385     11
+-23802    -20
+ 23986     23
+-18997    -22
+  9993     15
+  1055     -7
+-11817     -3
+ 20092     11
+-24257    -17
+ 23560     19
+-18234    -17
+  9405     12
+  1168     -5
+-11451     -3
+ 19535     10
+-23978    -14
+ 24050     16
+-19828    -14
+ 12146     11
+ -2409     -5
+ -7673      0
+ 16392      6
+-22327    -10
+ 24568     12
+-22832    -12
+ 17484     11
+ -9439     -7
+     0      3
+  9370      2
+-17270     -5
+ 22573      8
+-24568     -9
+ 23048     10
+-18310     -8
+ 11083      5
+ -2409     -3
+ -6518     -1
+ 14518      3
+-20579     -5
+ 23978      7
+-24357     -7
+ 21744      7
+-16532     -6
+  9405      3
+ -1244     -1
+ -6989     -1
+ 14366      3
+-20092     -4
+ 23592      5
+-24553     -5
+ 22942      5
+-18997     -4
+ 13180      3
+ -6117     -2
+ -1469      1
+  8845      2
+-15327     -2
+ 20349      3
+-23506     -4
+ 24575      3
+-23528     -4
+ 20517      3
+-15851     -2
+  9959      1
+ -3345      0
+ -3457      0
+  9924      1
+-15590     -2
+ 20071      2
+-23087     -2
+ 24481      3
+-24213     -2
+ 22359      2
+-19092     -1
+ 14670      1
+ -9405      0
+  3643      0
+  2259      0
+ -7959     -1
+ 13148      1
+-17563     -1
+ 21001      1
+-23323     -1
+ 24457      1
+-24395     -1
+ 23189      1
+-20942     -1
+ 17799      1
+-13934      0
+  9544      0
+ -4831      0
+     0      0
+  4757      1
+ -9265      0
+ 13370      0
+-16946     -1
+ 19895      0
+-22151     -1
+ 23675      0
+-24457     -1
+ 24511      0
+-23875      0
+ 22602      0
+-20762      0
+ 18435      0
+-15707      0
+ 12667      0
+ -9405      0
+  6008      0
+ -2559      0
+  -867      0
+  4201      0
+ -7386      0
+ 10371      0
+-13116      0
+ 15590      0
+-17773      0
+ 19649      0
+-21213      0
+ 22467      0
+-23416      0
+ 24073      0
+-24453      0
+ 24575      0
+-24461      0
+ 24132      0
+-23613      0
+ 22929      0
+-22102      0
+ 21156      0
+-20114      0
+ 18997      0
+-17825      0
+ 16615      0
+-15385      0
+ 14151      0
+-12924      0
+ 11717      0
+-10541      0
+  9405      0
+ -8315      0
+  7278      0
+ -6300      0
+  5384      0
+ -4535      0
+  3755      0
+ -3046      0
+  2409      0
+ -1845      0
+  1356      0
+  -942      0
+   603      0
+  -339      0
+   151      0
+   -38      0



More information about the ffmpeg-cvslog mailing list