Reusing ROUND_POWER_OF_TWO macro.
authorDmitry Kovalev <dkovalev@google.com>
Tue, 7 Jan 2014 01:38:57 +0000 (17:38 -0800)
committerDmitry Kovalev <dkovalev@google.com>
Tue, 7 Jan 2014 01:38:57 +0000 (17:38 -0800)
Change-Id: I064ba32d5358bfbf080a4300fc1793b345080006

vp9/encoder/vp9_encodeframe.c

index c37a50e48fb1358ab129ffcf7894bd3f9a14c911..7c5d0bf6d0dc4a7f98542761d43867776b142e73 100644 (file)
@@ -107,11 +107,9 @@ static const uint8_t VP9_VAR_OFFS[64] = {
 static unsigned int get_sby_perpixel_variance(VP9_COMP *cpi, MACROBLOCK *x,
                                               BLOCK_SIZE bs) {
   unsigned int var, sse;
-  var = cpi->fn_ptr[bs].vf(x->plane[0].src.buf,
-                           x->plane[0].src.stride,
+  var = cpi->fn_ptr[bs].vf(x->plane[0].src.buf, x->plane[0].src.stride,
                            VP9_VAR_OFFS, 0, &sse);
-  return (var + (1 << (num_pels_log2_lookup[bs] - 1))) >>
-      num_pels_log2_lookup[bs];
+  return ROUND_POWER_OF_TWO(var, num_pels_log2_lookup[bs]);
 }
 
 // Original activity measure from Tim T's code.