]> granicus.if.org Git - libvpx/commitdiff
Properly reset memory in hbd setting
authorJingning Han <jingning@google.com>
Wed, 20 Mar 2019 20:19:01 +0000 (13:19 -0700)
committerJingning Han <jingning@google.com>
Wed, 20 Mar 2019 20:19:30 +0000 (13:19 -0700)
This avoids a segmentation failure issue in high bit-depth case.

Change-Id: I9fbb3ec24b1735678f110cb084a29b15e3ec1a12

vp9/encoder/vp9_encoder.c

index 2a9a36f61863aea18673288085c2a9efa5fbc183..03e8ed674983f1af01e1d1b3deff52b9a342880b 100644 (file)
@@ -4746,13 +4746,16 @@ static void set_mb_wiener_variance(VP9_COMP *cpi) {
 
 #if CONFIG_VP9_HIGHBITDEPTH
   xd->cur_buf = cpi->Source;
-  if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH)
+  if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
     zero_pred = CONVERT_TO_BYTEPTR(zero_pred16);
-  else
+    memset(zero_pred16, 0, sizeof(*zero_pred16) * coeff_count);
+  } else {
     zero_pred = zero_pred8;
-#endif
-
+    memset(zero_pred8, 0, sizeof(*zero_pred8) * coeff_count);
+  }
+#else
   memset(zero_pred, 0, sizeof(*zero_pred) * coeff_count);
+#endif
 
   cpi->norm_wiener_variance = 0;