]> granicus.if.org Git - libvpx/commitdiff
VP9: remove plane_type from macroblockd_plane
authorScott LaVarnway <slavarnway@google.com>
Tue, 29 Sep 2015 17:40:27 +0000 (10:40 -0700)
committerScott LaVarnway <slavarnway@google.com>
Wed, 30 Sep 2015 22:15:11 +0000 (15:15 -0700)
Change-Id: Ia5072a3a92212d8565f33359f6c146469bdfbbec

vp9/common/vp9_blockd.c
vp9/common/vp9_blockd.h
vp9/common/vp9_onyxc_int.h
vp9/decoder/vp9_detokenize.c
vp9/encoder/vp9_encodemb.c
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_tokenize.c

index e8334fc8c52211f776bd230b2b381b9e9b0e9fe5..0e104ee59b7343a4b85f2e4991eea1c0981f551d 100644 (file)
@@ -129,7 +129,6 @@ void vp9_setup_block_planes(MACROBLOCKD *xd, int ss_x, int ss_y) {
   int i;
 
   for (i = 0; i < MAX_MB_PLANE; i++) {
-    xd->plane[i].plane_type = i ? PLANE_TYPE_UV : PLANE_TYPE_Y;
     xd->plane[i].subsampling_x = i ? ss_x : 0;
     xd->plane[i].subsampling_y = i ? ss_y : 0;
   }
index 5683736c6ac23e19c1c730a6212fc69ebb319212..61eb59162f5acbf5fb6117580e785512a1ee6e63 100644 (file)
@@ -120,7 +120,6 @@ struct buf_2d {
 
 struct macroblockd_plane {
   tran_low_t *dqcoeff;
-  PLANE_TYPE plane_type;
   int subsampling_x;
   int subsampling_y;
   struct buf_2d dst;
@@ -200,6 +199,10 @@ typedef struct macroblockd {
   struct vpx_internal_error_info *error_info;
 } MACROBLOCKD;
 
+static INLINE PLANE_TYPE get_plane_type(int plane) {
+  return (PLANE_TYPE)(plane > 0);
+}
+
 static INLINE BLOCK_SIZE get_subsize(BLOCK_SIZE bsize,
                                      PARTITION_TYPE partition) {
   return subsize_lookup[partition][bsize];
index 6fb8dca224690c24d4196474ef670618a244fc1f..90bde55520ced8bc4891f844c6ad0d4a3827da95 100644 (file)
@@ -358,7 +358,7 @@ static INLINE void vp9_init_macroblockd(VP9_COMMON *cm, MACROBLOCKD *xd,
     xd->above_context[i] = cm->above_context +
         i * sizeof(*cm->above_context) * 2 * mi_cols_aligned_to_sb(cm->mi_cols);
 
-    if (xd->plane[i].plane_type == PLANE_TYPE_Y) {
+    if (get_plane_type(i) == PLANE_TYPE_Y) {
       memcpy(xd->plane[i].seg_dequant, cm->y_dequant, sizeof(cm->y_dequant));
     } else {
       memcpy(xd->plane[i].seg_dequant, cm->uv_dequant, sizeof(cm->uv_dequant));
index e4412dc35641641b26604055d372383c494bd24f..591236530d1c0c6bc2b8fa0738c05c9876763aa3 100644 (file)
@@ -259,7 +259,7 @@ int vp9_decode_block_tokens(MACROBLOCKD *xd,
   const int16_t *const dequant = pd->seg_dequant[seg_id];
   const int ctx = get_entropy_context(tx_size, pd->above_context + x,
                                                pd->left_context + y);
-  const int eob = decode_coefs(xd, pd->plane_type,
+  const int eob = decode_coefs(xd, get_plane_type(plane),
                                pd->dqcoeff, tx_size,
                                dequant, ctx, sc->scan, sc->neighbors, r);
   dec_set_contexts(xd, pd, tx_size, eob > 0, x, y);
index 00e4c610b37775a899b7e35c850c6543a1e2a316..3c6a9283c919d2538e4cacf2fd956a9205e317c4 100644 (file)
@@ -99,7 +99,7 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block,
   tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
   tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   const int eob = p->eobs[block];
-  const PLANE_TYPE type = pd->plane_type;
+  const PLANE_TYPE type = get_plane_type(plane);
   const int default_eob = 16 << (tx_size << 1);
   const int mul = 1 + (tx_size == TX_32X32);
   const int16_t *dequant_ptr = pd->dequant;
@@ -789,7 +789,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
   src_diff = &p->src_diff[4 * (j * diff_stride + i)];
 
   if (tx_size == TX_4X4) {
-    tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
+    tx_type = get_tx_type_4x4(get_plane_type(plane), xd, block);
     scan_order = &vp9_scan_orders[TX_4X4][tx_type];
     mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mbmi->uv_mode;
   } else {
@@ -797,7 +797,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
     if (tx_size == TX_32X32) {
       scan_order = &vp9_default_scan_orders[TX_32X32];
     } else {
-      tx_type = get_tx_type(pd->plane_type, xd);
+      tx_type = get_tx_type(get_plane_type(plane), xd);
       scan_order = &vp9_scan_orders[tx_size][tx_type];
     }
   }
index 0bffcbac2f70d376567a019794d8874a69c64301..1818906df4393d21e52e5a8daba900bd77c853d1 100644 (file)
@@ -341,8 +341,7 @@ static int cost_coeffs(MACROBLOCK *x,
   MACROBLOCKD *const xd = &x->e_mbd;
   MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
   const struct macroblock_plane *p = &x->plane[plane];
-  const struct macroblockd_plane *pd = &xd->plane[plane];
-  const PLANE_TYPE type = pd->plane_type;
+  const PLANE_TYPE type = get_plane_type(plane);
   const int16_t *band_count = &band_counts[tx_size][1];
   const int eob = p->eobs[block];
   const tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block);
@@ -358,8 +357,8 @@ static int cost_coeffs(MACROBLOCK *x,
 #endif
 
   // Check for consistency of tx_size with mode info
-  assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size
-                              : get_uv_tx_size(mbmi, pd) == tx_size);
+  assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size :
+         get_uv_tx_size(mbmi, &xd->plane[plane]) == tx_size);
 
   if (eob == 0) {
     // single eob token
@@ -570,7 +569,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x,
 
   vp9_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left);
 
-  args.so = get_scan(xd, tx_size, pd->plane_type, 0);
+  args.so = get_scan(xd, tx_size, get_plane_type(plane), 0);
 
   vp9_foreach_transformed_block_in_plane(xd, bsize, plane,
                                          block_rd_txfm, &args);
index 85cb2fcee256fac918942ec4de6fdf4742931f35..d9c2193f34f19392c9d421659d6abd3a3c991a84 100644 (file)
@@ -503,7 +503,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize,
   int c;
   TOKENEXTRA *t = *tp;        /* store tokens starting here */
   int eob = p->eobs[block];
-  const PLANE_TYPE type = pd->plane_type;
+  const PLANE_TYPE type = get_plane_type(plane);
   const tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block);
   const int segment_id = mbmi->segment_id;
   const int16_t *scan, *nb;