1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

swr-test: fix rounding error leading to NAN

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-05-03 14:42:37 +02:00
parent 28d37f7160
commit 29ed1900cc

View File

@ -357,6 +357,7 @@ int main(int argc, char **argv){
maxdiff= FFMAX(maxdiff, FFABS(a-b)); maxdiff= FFMAX(maxdiff, FFABS(a-b));
} }
sse= sum_aa + sum_bb - 2*sum_ab; 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); 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)); maxdiff= FFMAX(maxdiff, FFABS(a-b));
} }
sse= sum_aa + sum_bb - 2*sum_ab; 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); 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);
} }