From 0401e8946735af2b638ae48eb6c9250cfdb41812 Mon Sep 17 00:00:00 2001
From: Luc Trudeau <luc@trud.ca>
Date: Thu, 31 Aug 2017 00:37:11 -0400
Subject: [PATCH] [Palette] Fix partial colormap memcpy

Colormap memcpy must copy the entire colormap not just the visible
pixels

Change-Id: Ia2d5ab8684227f4f263b8396cf432c27c328bb47
---
 av1/encoder/rdopt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 7ea0319c3c..0693b36e7c 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -3193,7 +3193,7 @@ static int rd_pick_palette_intra_sby(const AV1_COMP *const cpi, MACROBLOCK *x,
 
   if (best_mbmi->palette_mode_info.palette_size[0] > 0) {
     memcpy(color_map, best_palette_color_map,
-           rows * cols * sizeof(best_palette_color_map[0]));
+           block_width * block_height * sizeof(best_palette_color_map[0]));
   }
   *mbmi = *best_mbmi;
   return rate_overhead;
@@ -5616,7 +5616,8 @@ static void rd_pick_palette_intra_sbuv(const AV1_COMP *const cpi, MACROBLOCK *x,
   }
   if (best_mbmi->palette_mode_info.palette_size[1] > 0) {
     memcpy(color_map, best_palette_color_map,
-           rows * cols * sizeof(best_palette_color_map[0]));
+           plane_block_width * plane_block_height *
+               sizeof(best_palette_color_map[0]));
   }
 }
 
-- 
GitLab