]> granicus.if.org Git - libvpx/commitdiff
Use derived variable size for memcpy
authorYaowu Xu <yaowu@google.com>
Tue, 11 Oct 2016 00:39:29 +0000 (17:39 -0700)
committerYaowu Xu <yaowu@google.com>
Tue, 11 Oct 2016 00:39:29 +0000 (17:39 -0700)
Manually cherry-picked from aom/master:
bf2ad75a1723d223c376b93295aa06dd23226937

Change-Id: I99f05e79ec8ad35a49bc124e6dd829ccc7d9cc36

av1/common/reconintra.c
test/convolve_test.cc

index 3b2221f3faa148c9d0674efb84fb9a37bec4c77c..719b78852407934ab572363034665fded66daea1 100644 (file)
@@ -1257,11 +1257,12 @@ static void build_intra_predictors_high(
     const int need_right = !!(extend_modes[mode] & NEED_ABOVERIGHT);
 #endif  // CONFIG_EXT_INTRA
     if (n_top_px > 0) {
-      memcpy(above_row, above_ref, n_top_px * 2);
+      memcpy(above_row, above_ref, n_top_px * sizeof(above_ref[0]));
       i = n_top_px;
       if (need_right && n_topright_px > 0) {
         assert(n_top_px == bs);
-        memcpy(above_row + bs, above_ref + bs, n_topright_px * 2);
+        memcpy(above_row + bs, above_ref + bs,
+               n_topright_px * sizeof(above_ref[0]));
         i += n_topright_px;
       }
       if (i < (bs << need_right))
index 26102649c27f7d6a62ab64e21bee327523c4e9a7..de1ae042d120435dc9865899e60a4c5d6fc0ca9e 100644 (file)
@@ -396,8 +396,8 @@ class ConvolveTest : public ::testing::TestWithParam<ConvolveParam> {
   void CopyOutputToRef() {
     memcpy(output_ref_, output_, kOutputBufferSize);
 #if CONFIG_AOM_HIGHBITDEPTH
-    memcpy(output16_ref_, output16_,
-           kOutputBufferSize * sizeof(output16_ref_[0]));
+    // Copy 16-bit pixels values. The effective number of bytes is double.
+    memcpy(output16_ref_, output16_, sizeof(output16_[0]) * kOutputBufferSize);
 #endif
   }