]> granicus.if.org Git - libvpx/commitdiff
Fixed a variance calculation
authorYaowu Xu <yaowu@google.com>
Fri, 26 Jun 2015 22:54:43 +0000 (15:54 -0700)
committerYaowu Xu <yaowu@google.com>
Fri, 26 Jun 2015 22:54:43 +0000 (15:54 -0700)
This commit fixed a mistake in variance calculation.

Thanks to Xintong for spotting the error.

Change-Id: Ia285fc0128c00f0234a73b0a7eba6adc88b8a7de

vp9/encoder/vp9_firstpass.c

index 3d7843ea73192b3c9bcb636abdfdbfc35c9bb37b..16640fed9d5351d4efef273d1cc2635a2d849c02 100644 (file)
@@ -1031,8 +1031,10 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
       fps.mvr_abs = (double)sum_mvr_abs / mvcount;
       fps.MVc = (double)sum_mvc / mvcount;
       fps.mvc_abs = (double)sum_mvc_abs / mvcount;
-      fps.MVrv = ((double)sum_mvrs - (fps.MVr * fps.MVr / mvcount)) / mvcount;
-      fps.MVcv = ((double)sum_mvcs - (fps.MVc * fps.MVc / mvcount)) / mvcount;
+      fps.MVrv = ((double)sum_mvrs -
+                  ((double)sum_mvr * sum_mvr / mvcount)) / mvcount;
+      fps.MVcv = ((double)sum_mvcs -
+                  ((double)sum_mvc * sum_mvc / mvcount)) / mvcount;
       fps.mv_in_out_count = (double)sum_in_vectors / (mvcount * 2);
       fps.new_mv_count = new_mv_count;
       fps.pcnt_motion = (double)mvcount / num_mbs;