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
1 changed files with 2 additions and 0 deletions

View File

@ -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);
}