]> granicus.if.org Git - libvpx/commitdiff
Adds a source variance computation function
authorDeb Mukherjee <debargha@google.com>
Thu, 1 Aug 2013 19:56:12 +0000 (12:56 -0700)
committerDeb Mukherjee <debargha@google.com>
Thu, 1 Aug 2013 20:01:54 +0000 (13:01 -0700)
Adds a function to compute source variance for various
sb_types to be used for pruning mode and partition searches.
[The existing activity measure function is currently specialized
for only 16x16 MBs and needs to be updated].

Change-Id: I22a41e6f1430184201487326fdbebb9b47e6fc24

vp9/common/vp9_common_data.c
vp9/common/vp9_common_data.h
vp9/encoder/vp9_encodeframe.c

index 7cd302a304e1087bc42a5c6b255cbc9fdc68c186..d272646960af0803f464c0b3e7563606fc77caed 100644 (file)
@@ -35,6 +35,9 @@ const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES] =
 const int size_group_lookup[BLOCK_SIZE_TYPES] =
   {0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3};
 
+const int num_pels_log2_lookup[BLOCK_SIZE_TYPES] =
+  {4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12};
+
 
 const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES] = {
   {  // 4X4
index 44ec7ae7529937e1781361ff7d49823ec60531f3..b3c1ba3db8b49f2176cbf0bf6498f72b27deff9e 100644 (file)
@@ -22,6 +22,7 @@ extern const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES];
 extern const int num_4x4_blocks_high_lookup[BLOCK_SIZE_TYPES];
 extern const int num_4x4_blocks_wide_lookup[BLOCK_SIZE_TYPES];
 extern const int size_group_lookup[BLOCK_SIZE_TYPES];
+extern const int num_pels_log2_lookup[BLOCK_SIZE_TYPES];
 
 extern const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES];
 
index 458da3f9c9a8884f3a687fac556701bd666d3f1f..0919dc68028d19abee3f4609efd7e921b3a67f5c 100644 (file)
@@ -60,8 +60,25 @@ static void adjust_act_zbin(VP9_COMP *cpi, MACROBLOCK *x);
  * Eventually this should be replaced by custom no-reference routines,
  *  which will be faster.
  */
-static const uint8_t VP9_VAR_OFFS[16] = {128, 128, 128, 128, 128, 128, 128, 128,
-    128, 128, 128, 128, 128, 128, 128, 128};
+static const uint8_t VP9_VAR_OFFS[64] = {
+  128, 128, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128,
+  128, 128, 128, 128, 128, 128, 128, 128
+};
+
+static unsigned int get_sb_variance(VP9_COMP *cpi, MACROBLOCK *x,
+                                    BLOCK_SIZE_TYPE bs) {
+  unsigned int var, sse;
+  var = cpi->fn_ptr[bs].vf(x->plane[0].src.buf,
+                           x->plane[0].src.stride,
+                           VP9_VAR_OFFS, 0, &sse);
+  return var >> num_pels_log2_lookup[bs];
+}
 
 // Original activity measure from Tim T's code.
 static unsigned int tt_activity_measure(VP9_COMP *cpi, MACROBLOCK *x) {