diff fft-test.c @ 5417:3eca9008175b libavcodec

print max and mse
author michael
date Sun, 29 Jul 2007 09:58:36 +0000
parents e9f8a337c5ce
children 95234f2e0bdd
line wrap: on
line diff
--- a/fft-test.c	Sun Jul 29 04:04:21 2007 +0000
+++ b/fft-test.c	Sun Jul 29 09:58:36 2007 +0000
@@ -144,13 +144,19 @@
 void check_diff(float *tab1, float *tab2, int n)
 {
     int i;
+    double max= 0;
+    double error= 0;
 
     for(i=0;i<n;i++) {
-        if (fabsf(tab1[i] - tab2[i]) >= 1e-3) {
+        double e= fabsf(tab1[i] - tab2[i]);
+        if (e >= 1e-3) {
             av_log(NULL, AV_LOG_ERROR, "ERROR %d: %f %f\n",
                    i, tab1[i], tab2[i]);
         }
+        error+= e*e;
+        if(e>max) max= e;
     }
+    av_log(NULL, AV_LOG_INFO, "max:%f e:%g\n", max, sqrt(error)/n);
 }