aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-03 14:42:37 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-03 14:42:37 +0200
commit29ed1900cc07d9704c3e2ebdb721baf73f17f328 (patch)
tree3b53e770d5d45a3bab076eb6b7d3fdc045f9cbc4
parent28d37f71607bd63f7f09f9125a3e243179ebf9af (diff)
downloadffmpeg-29ed1900cc07d9704c3e2ebdb721baf73f17f328.tar.gz
swr-test: fix rounding error leading to NAN
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libswresample/swresample_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libswresample/swresample_test.c b/libswresample/swresample_test.c
index 35eede231c..7c6e466871 100644
--- a/libswresample/swresample_test.c
+++ b/libswresample/swresample_test.c
@@ -357,6 +357,7 @@ int main(int argc, char **argv){
maxdiff= FFMAX(maxdiff, FFABS(a-b));
}
sse= sum_aa + sum_bb - 2*sum_ab;
+ if(sse < 0 && sse > -0.00001) sse=0; //fix rounding error
fprintf(stderr, "[e:%f c:%f max:%f] len:%5d\n", sqrt(sse/out_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, out_count);
}
@@ -386,6 +387,7 @@ int main(int argc, char **argv){
maxdiff= FFMAX(maxdiff, FFABS(a-b));
}
sse= sum_aa + sum_bb - 2*sum_ab;
+ if(sse < 0 && sse > -0.00001) sse=0; //fix rounding error
fprintf(stderr, "[e:%f c:%f max:%f] len:%5d F:%3d\n", sqrt(sse/flush_count), sum_ab/(sqrt(sum_aa*sum_bb)), maxdiff, flush_count, flush_i);
}