]> granicus.if.org Git - libvpx/commitdiff
Inlining 16 as a stride for BLOCK_OFFSET macro.
authorDmitry Kovalev <dkovalev@google.com>
Fri, 9 Aug 2013 23:40:05 +0000 (16:40 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Fri, 9 Aug 2013 23:40:05 +0000 (16:40 -0700)
Change-Id: I7f23d174eb089e5500f268a10db09648634c1b82

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

index 0f4d3aa19e1ca47f705c1e123accd88fa6ac3416..703821dfd89d964e6997e37656975e1b0228aeb9 100644 (file)
@@ -197,7 +197,7 @@ struct macroblockd_plane {
   ENTROPY_CONTEXT *left_context;
 };
 
-#define BLOCK_OFFSET(x, i, n) ((x) + (i) * (n))
+#define BLOCK_OFFSET(x, i) ((x) + (i) * 16)
 
 typedef struct macroblockd {
   struct macroblockd_plane plane[MAX_MB_PLANE];
index 66ca507706c563feb95bb523358ee41d7a4ae246..b80ba48e3d3abd0692ea086ebd745f7d252aaf01 100644 (file)
@@ -91,7 +91,7 @@ static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
                          int ss_txfrm_size, void *arg) {
   MACROBLOCKD* const xd = arg;
   struct macroblockd_plane *pd = &xd->plane[plane];
-  int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16);
+  int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
   const int stride = pd->dst.stride;
   const int eob = pd->eobs[block];
   const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
index 916b7210e43d3c65dea59b2472be9a9f307f2e53..021eb11e35208cf74d49061bec19105b05af7981 100644 (file)
@@ -271,7 +271,7 @@ static void decode_block(int plane, int block,
   ENTROPY_CONTEXT *L = pd->left_context + loff;
   const int eob = decode_coefs(&arg->pbi->common, xd, arg->r, block,
                                pd->plane_type, seg_eob,
-                               BLOCK_OFFSET(pd->qcoeff, block, 16),
+                               BLOCK_OFFSET(pd->qcoeff, block),
                                ss_tx_size, pd->dequant, A, L);
 
   if (xd->mb_to_right_edge < 0 || xd->mb_to_bottom_edge < 0) {
index a43c35733fc43b2dc08c8f10a677b30a4c29c3af..80b0cb573a71a58908c171e65a97a90e1940b6be 100644 (file)
@@ -149,8 +149,7 @@ static void optimize_b(MACROBLOCK *mb,
   const int ref = is_inter_block(&xd->mode_info_context->mbmi);
   vp9_token_state tokens[1025][2];
   unsigned best_index[1025][2];
-  const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[plane].coeff,
-                                          block, 16);
+  const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[plane].coeff, block);
   int16_t *qcoeff_ptr;
   int16_t *dqcoeff_ptr;
   int eob = xd->plane[plane].eobs[block], final_eob, sz = 0;
@@ -171,8 +170,8 @@ static void optimize_b(MACROBLOCK *mb,
   const uint8_t * band_translate;
 
   assert((!type && !plane) || (type && plane));
-  dqcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].dqcoeff, block, 16);
-  qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
+  dqcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].dqcoeff, block);
+  qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block);
   switch (tx_size) {
     default:
     case TX_4X4:
@@ -456,9 +455,9 @@ void xform_quant(int plane, int block, BLOCK_SIZE_TYPE bsize,
   MACROBLOCKD* const xd = &x->e_mbd;
   struct macroblock_plane *const p = &x->plane[plane];
   struct macroblockd_plane *const pd = &xd->plane[plane];
-  int16_t *coeff = BLOCK_OFFSET(p->coeff, block, 16);
-  int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16);
-  int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block, 16);
+  int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
+  int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
+  int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   const int16_t *scan, *iscan;
   uint16_t *eob = &pd->eobs[block];
   const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size / 2);
@@ -531,7 +530,7 @@ static void encode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
   const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
                                                        block, ss_txfrm_size);
   struct macroblockd_plane *const pd = &xd->plane[plane];
-  int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block, 16);
+  int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   uint8_t *const dst = raster_block_offset_uint8(xd, bsize, plane,
                                                  raster_block,
                                                  pd->dst.buf, pd->dst.stride);
@@ -634,9 +633,9 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
   const TX_SIZE tx_size = (TX_SIZE)(ss_txfrm_size / 2);
   struct macroblock_plane *const p = &x->plane[plane];
   struct macroblockd_plane *const pd = &xd->plane[plane];
-  int16_t *coeff = BLOCK_OFFSET(p->coeff, block, 16);
-  int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16);
-  int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block, 16);
+  int16_t *coeff = BLOCK_OFFSET(p->coeff, block);
+  int16_t *qcoeff = BLOCK_OFFSET(pd->qcoeff, block);
+  int16_t *dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   const int16_t *scan, *iscan;
   TX_TYPE tx_type;
   MB_PREDICTION_MODE mode;
index 525f4da79a851025e5c00c4df1aa76fcb1ef60b3..5a04a4b5051120779ebec2b6e5b90f53ea0efa27 100644 (file)
@@ -159,14 +159,14 @@ void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
   const int16_t *scan = get_scan_4x4(tx_type);
   const int16_t *iscan = get_iscan_4x4(tx_type);
 
-  vp9_quantize_b(BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block, 16),
+  vp9_quantize_b(BLOCK_OFFSET(mb->plane[pb_idx.plane].coeff, pb_idx.block),
            16, mb->skip_block,
            mb->plane[pb_idx.plane].zbin,
            mb->plane[pb_idx.plane].round,
            mb->plane[pb_idx.plane].quant,
            mb->plane[pb_idx.plane].quant_shift,
-           BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16),
-           BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16),
+           BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block),
+           BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block),
            xd->plane[pb_idx.plane].dequant,
            mb->plane[pb_idx.plane].zbin_extra,
            &xd->plane[pb_idx.plane].eobs[pb_idx.block],
index 9e4ce711b593a72a8ac151a7a18d4a8e36c8674f..6a9006a6c460bf5dd97781c394dbb9d6797910cd 100644 (file)
@@ -495,7 +495,7 @@ static INLINE int cost_coeffs(MACROBLOCK *mb,
   int pt, c, cost;
   const int16_t *band_count = &band_counts[tx_size][1];
   const int eob = xd->plane[plane].eobs[block];
-  const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
+  const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block);
   const int ref = mbmi->ref_frame[0] != INTRA_FRAME;
   unsigned int (*token_costs)[2][PREV_COEF_CONTEXTS]
                     [MAX_ENTROPY_TOKENS] = mb->token_costs[tx_size][type][ref];
@@ -581,8 +581,8 @@ static void dist_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
   struct macroblockd_plane *const pd = &xd->plane[0];
   int64_t this_sse;
   int shift = args->tx_size == TX_32X32 ? 0 : 2;
-  int16_t *const coeff = BLOCK_OFFSET(p->coeff, block, 16);
-  int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block, 16);
+  int16_t *const coeff = BLOCK_OFFSET(p->coeff, block);
+  int16_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
   args->dist += vp9_block_error(coeff, dqcoeff, 16 << ss_txfrm_size,
                                 &this_sse) >> shift;
   args->sse += this_sse >> shift;
@@ -1188,7 +1188,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
         xd->mode_info_context->bmi[block].as_mode = mode;
         src_diff = raster_block_offset_int16(xd, BLOCK_8X8, 0, block,
                                              p->src_diff);
-        coeff = BLOCK_OFFSET(x->plane[0].coeff, block, 16);
+        coeff = BLOCK_OFFSET(x->plane[0].coeff, block);
         vp9_predict_intra_block(xd, block, 1,
                                 TX_4X4, mode,
                                 x->skip_encode ? src : dst,
@@ -1211,17 +1211,16 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
         ratey += cost_coeffs(x, 0, block, PLANE_TYPE_Y_WITH_DC,
                              tempa + idx, templ + idy, TX_4X4, scan,
                              vp9_get_coef_neighbors_handle(scan));
-        distortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff,
-                                                          block, 16),
+        distortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, block),
                                       16, &ssz) >> 2;
         if (RDCOST(x->rdmult, x->rddiv, ratey, distortion) >= best_rd)
           goto next;
 
         if (tx_type != DCT_DCT)
-          vp9_short_iht4x4_add(BLOCK_OFFSET(pd->dqcoeff, block, 16),
+          vp9_short_iht4x4_add(BLOCK_OFFSET(pd->dqcoeff, block),
                                dst, pd->dst.stride, tx_type);
         else
-          xd->inv_txm4x4_add(BLOCK_OFFSET(pd->dqcoeff, block, 16),
+          xd->inv_txm4x4_add(BLOCK_OFFSET(pd->dqcoeff, block),
                              dst, pd->dst.stride);
       }
     }
@@ -1628,7 +1627,7 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi,
                                                  src_stride);
   int16_t* src_diff = raster_block_offset_int16(xd, BLOCK_8X8, 0, i,
                                                 x->plane[0].src_diff);
-  int16_t* coeff = BLOCK_OFFSET(x->plane[0].coeff, 16, i);
+  int16_t* coeff = BLOCK_OFFSET(x->plane[0].coeff, i);
   uint8_t* const pre = raster_block_offset_uint8(xd, BLOCK_8X8, 0, i,
                                                  pd->pre[0].buf,
                                                  pd->pre[0].stride);
@@ -1666,10 +1665,10 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi,
       k += (idy * 2 + idx);
       src_diff = raster_block_offset_int16(xd, BLOCK_8X8, 0, k,
                                            x->plane[0].src_diff);
-      coeff = BLOCK_OFFSET(x->plane[0].coeff, 16, k);
+      coeff = BLOCK_OFFSET(x->plane[0].coeff, k);
       x->fwd_txm4x4(src_diff, coeff, 16);
       x->quantize_b_4x4(x, k, DCT_DCT, 16);
-      thisdistortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, k, 16),
+      thisdistortion += vp9_block_error(coeff, BLOCK_OFFSET(pd->dqcoeff, k),
                                         16, &ssz);
       thissse += ssz;
       thisrate += cost_coeffs(x, 0, k, PLANE_TYPE_Y_WITH_DC,
index caa89b21856125c50efbf8cb14d4e1916e824931..d52f9b2bbb9629fde6aa042ef901825108d55641 100644 (file)
@@ -135,7 +135,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
   TOKENEXTRA *t = *tp;        /* store tokens starting here */
   const int eob = xd->plane[plane].eobs[block];
   const PLANE_TYPE type = xd->plane[plane].plane_type;
-  const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
+  const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block);
   const int bwl = b_width_log2(bsize);
   const int off = block >> (2 * tx_size);
   const int mod = bwl - tx_size - xd->plane[plane].subsampling_x;