shithub: libvpx

Download patch

ref: 5adb43b8bea52f308c2a8c113cffcf840672dfda
parent: 20946cdd3b6cad5573955d5ad78e80d038cc14cd
author: Yaowu Xu <[email protected]>
date: Fri Jul 8 07:02:59 EDT 2016

Fix non-highbitdepth coding path for HBD build

Change-Id: I38eb42b8d051924a7cd1ccc3421a4057cf6e170f

--- a/vp9/encoder/vp9_pickmode.c
+++ b/vp9/encoder/vp9_pickmode.c
@@ -239,7 +239,10 @@
 static void block_variance(const uint8_t *src, int src_stride,
                            const uint8_t *ref, int ref_stride,
                            int w, int h, unsigned int *sse, int *sum,
-                           int block_size, vpx_bit_depth_t bd,
+                           int block_size,
+#if CONFIG_VP9_HIGHBITDEPTH
+                           int use_highbitdepth, vpx_bit_depth_t bd,
+#endif
                            uint32_t *sse8x8, int *sum8x8, uint32_t *var8x8) {
   int i, j, k = 0;
 
@@ -249,25 +252,30 @@
   for (i = 0; i < h; i += block_size) {
     for (j = 0; j < w; j += block_size) {
 #if CONFIG_VP9_HIGHBITDEPTH
-      switch (bd) {
-        case VPX_BITS_8:
-          vpx_highbd_8_get8x8var(src + src_stride * i + j, src_stride,
-                                 ref + ref_stride * i + j, ref_stride,
-                                 &sse8x8[k], &sum8x8[k]);
+      if (use_highbitdepth) {
+        switch (bd) {
+          case VPX_BITS_8:
+            vpx_highbd_8_get8x8var(src + src_stride * i + j, src_stride,
+                                   ref + ref_stride * i + j, ref_stride,
+                                   &sse8x8[k], &sum8x8[k]);
           break;
-        case VPX_BITS_10:
-          vpx_highbd_10_get8x8var(src + src_stride * i + j, src_stride,
-                                  ref + ref_stride * i + j, ref_stride,
-                                  &sse8x8[k], &sum8x8[k]);
-          break;
-        case VPX_BITS_12:
-          vpx_highbd_12_get8x8var(src + src_stride * i + j, src_stride,
-                                  ref + ref_stride * i + j, ref_stride,
-                                  &sse8x8[k], &sum8x8[k]);
-          break;
+          case VPX_BITS_10:
+            vpx_highbd_10_get8x8var(src + src_stride * i + j, src_stride,
+                                    ref + ref_stride * i + j, ref_stride,
+                                    &sse8x8[k], &sum8x8[k]);
+            break;
+          case VPX_BITS_12:
+            vpx_highbd_12_get8x8var(src + src_stride * i + j, src_stride,
+                                    ref + ref_stride * i + j, ref_stride,
+                                    &sse8x8[k], &sum8x8[k]);
+            break;
+        }
+      } else {
+          vpx_get8x8var(src + src_stride * i + j, src_stride,
+                        ref + ref_stride * i + j, ref_stride,
+                        &sse8x8[k], &sum8x8[k]);
       }
 #else
-      (void)bd;
       vpx_get8x8var(src + src_stride * i + j, src_stride,
                     ref + ref_stride * i + j, ref_stride,
                     &sse8x8[k], &sum8x8[k]);
@@ -332,12 +340,17 @@
   unsigned int var8x8[64] = {0};
   TX_SIZE tx_size;
   int i, k;
+#if CONFIG_VP9_HIGHBITDEPTH
   const vpx_bit_depth_t bd = cpi->common.bit_depth;
-
+#endif
   // Calculate variance for whole partition, and also save 8x8 blocks' variance
   // to be used in following transform skipping test.
   block_variance(p->src.buf, p->src.stride, pd->dst.buf, pd->dst.stride,
-                 4 << bw, 4 << bh, &sse, &sum, 8, bd, sse8x8, sum8x8, var8x8);
+                 4 << bw, 4 << bh, &sse, &sum, 8,
+#if CONFIG_VP9_HIGHBITDEPTH
+                 cpi->common.use_highbitdepth, bd,
+#endif
+                 sse8x8, sum8x8, var8x8);
   var = sse - (((int64_t)sum * sum) >> (bw + bh + 4));
 
   *var_y = var;