]> granicus.if.org Git - libvpx/commitdiff
Merge "Bring palette back to nextgenv2" into nextgenv2
authorHui Su <huisu@google.com>
Tue, 8 Dec 2015 17:44:22 +0000 (17:44 +0000)
committerGerrit Code Review <noreply-gerritcodereview@google.com>
Tue, 8 Dec 2015 17:44:22 +0000 (17:44 +0000)
1  2 
vp10/common/reconintra.c

index f28510f54aeba48014c36bf7a0a28f8b92798c87,06f38f05de50bd6331cb6e6d8b258f5eb3fb9569..32f592eb3a9038063e44814d42b4b2c881eb6e2c
@@@ -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,