ref: e7c5ca8983b3b59f3f68208038c817798f2be7d5
parent: ef101af8ae80a8a58030437256228575905460b1
parent: f1559bdeaf5d5d25d7d13e5f435a43f15c76b215
author: Dmitry Kovalev <[email protected]>
date: Fri Aug 9 13:22:46 EDT 2013
Merge "Inlining 16 as a stride for BLOCK_OFFSET macro."
--- a/vp9/common/vp9_blockd.h
+++ b/vp9/common/vp9_blockd.h
@@ -197,7 +197,7 @@
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];
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -91,7 +91,7 @@
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,
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -271,7 +271,7 @@
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) {
--- a/vp9/encoder/vp9_encodemb.c
+++ b/vp9/encoder/vp9_encodemb.c
@@ -149,8 +149,7 @@
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 @@
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 @@
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 @@
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 @@
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;
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -159,14 +159,14 @@
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],
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -495,7 +495,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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,
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -135,7 +135,7 @@
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;