const int wpx = 4 * bw;
const int hpx = 4 * bh;
const int txpx = 4 * txw;
-
- int xr = (xd->mb_to_right_edge >> (3 + pd->subsampling_x)) + (wpx - x - txpx);
- int yd =
- (xd->mb_to_bottom_edge >> (3 + pd->subsampling_y)) + (hpx - y - txpx);
+ // Distance between the right edge of this prediction block to
+ // the frame right edge
+ const int xr = (xd->mb_to_right_edge >> (3 + pd->subsampling_x)) +
+ (wpx - x - txpx);
+ // Distance between the bottom edge of this prediction block to
+ // the frame bottom edge
+ const int yd = (xd->mb_to_bottom_edge >> (3 + pd->subsampling_y)) +
+ (hpx - y - txpx);
+ if (xd->mi[0]->mbmi.palette_mode_info.palette_size[plane != 0] > 0) {
+ const int bs = 4 * (1 << tx_size);
+ const int stride = 4 * (1 << bwl_in);
+ int r, c;
+ uint8_t *map = NULL;
+ #if CONFIG_VP9_HIGHBITDEPTH
+ uint16_t *palette = xd->mi[0]->mbmi.palette_mode_info.palette_colors +
+ plane * PALETTE_MAX_SIZE;
+ #else
+ uint8_t *palette = xd->mi[0]->mbmi.palette_mode_info.palette_colors +
+ plane * PALETTE_MAX_SIZE;
+ #endif // CONFIG_VP9_HIGHBITDEPTH
+
+ map = xd->plane[plane != 0].color_index_map;
+
+ #if CONFIG_VP9_HIGHBITDEPTH
+ if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
+ uint16_t *dst16 = CONVERT_TO_SHORTPTR(dst);
+ for (r = 0; r < bs; ++r)
+ for (c = 0; c < bs; ++c)
+ dst16[r * dst_stride + c] =
+ palette[map[(r + y) * stride + c + x]];
+ } else {
+ #endif // CONFIG_VP9_HIGHBITDEPTH
+ for (r = 0; r < bs; ++r)
+ for (c = 0; c < bs; ++c)
+ dst[r * dst_stride + c] = palette[map[(r + y) * stride + c + x]];
+ #if CONFIG_VP9_HIGHBITDEPTH
+ }
+ #endif // CONFIG_VP9_HIGHBITDEPTH
+
+ return;
+ }
+
#if CONFIG_VP9_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
build_intra_predictors_high(xd, ref, ref_stride, dst, dst_stride, mode,