From: Hui Su Date: Tue, 8 Dec 2015 17:44:22 +0000 (+0000) Subject: Merge "Bring palette back to nextgenv2" into nextgenv2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cdffec73e9dadef6cdfef9b69121dd3d4a895f51;p=libvpx Merge "Bring palette back to nextgenv2" into nextgenv2 --- cdffec73e9dadef6cdfef9b69121dd3d4a895f51 diff --cc vp10/common/reconintra.c index f28510f54,06f38f05d..32f592eb3 --- a/vp10/common/reconintra.c +++ b/vp10/common/reconintra.c @@@ -1161,15 -1164,45 +1161,49 @@@ void vp10_predict_intra_block(const MAC 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,