Move EOB to per-plane data

Continue migrating data from BLOCKD/MACROBLOCKD to the per-plane
structures.

Change-Id: Ibbfa68d6da438d32dcbe8df68245ee28b0a2fa2c
This commit is contained in:
John Koleszar 2013-04-04 12:03:27 -07:00
parent 4c05a051ab
commit 05a79f2fbf
12 changed files with 320 additions and 287 deletions

View File

@ -298,6 +298,7 @@ enum { MAX_MB_PLANE = 3 };
struct mb_plane { struct mb_plane {
DECLARE_ALIGNED(16, int16_t, qcoeff[64 * 64]); DECLARE_ALIGNED(16, int16_t, qcoeff[64 * 64]);
DECLARE_ALIGNED(16, int16_t, dqcoeff[64 * 64]); DECLARE_ALIGNED(16, int16_t, dqcoeff[64 * 64]);
DECLARE_ALIGNED(16, uint16_t, eobs[256]);
}; };
#define BLOCK_OFFSET(x, i, n) ((x) + (i) * (n)) #define BLOCK_OFFSET(x, i, n) ((x) + (i) * (n))
@ -310,7 +311,6 @@ struct mb_plane {
typedef struct macroblockd { typedef struct macroblockd {
DECLARE_ALIGNED(16, int16_t, diff[64*64+32*32*2]); /* from idct diff */ DECLARE_ALIGNED(16, int16_t, diff[64*64+32*32*2]); /* from idct diff */
DECLARE_ALIGNED(16, uint8_t, predictor[384]); // unused for superblocks DECLARE_ALIGNED(16, uint8_t, predictor[384]); // unused for superblocks
DECLARE_ALIGNED(16, uint16_t, eobs[256+64*2]);
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
DECLARE_ALIGNED(16, uint16_t, nzcs[256+64*2]); DECLARE_ALIGNED(16, uint16_t, nzcs[256+64*2]);
#endif #endif
@ -700,21 +700,19 @@ struct plane_block_idx {
// TODO(jkoleszar): returning a struct so it can be used in a const context, // TODO(jkoleszar): returning a struct so it can be used in a const context,
// expect to refactor this further later. // expect to refactor this further later.
static INLINE struct plane_block_idx plane_block_idx(MACROBLOCKD *xd, static INLINE struct plane_block_idx plane_block_idx(int y_blocks,
int b_idx) { int b_idx) {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type; const int v_offset = y_blocks * 5 / 4;
const int u_offset = 16 << (sb_type * 2);
const int v_offset = 20 << (sb_type * 2);
struct plane_block_idx res; struct plane_block_idx res;
if (b_idx < u_offset) { if (b_idx < y_blocks) {
res.plane = 0; res.plane = 0;
res.block = b_idx; res.block = b_idx;
} else if (b_idx < v_offset) { } else if (b_idx < v_offset) {
res.plane = 1; res.plane = 1;
res.block = b_idx - u_offset; res.block = b_idx - y_blocks;
} else { } else {
assert(b_idx < (24 << (sb_type * 2))); assert(b_idx < y_blocks * 3 / 2);
res.plane = 2; res.plane = 2;
res.block = b_idx - v_offset; res.block = b_idx - v_offset;
} }

View File

@ -29,7 +29,8 @@ void vp9_inverse_transform_mby_4x4(MACROBLOCKD *xd) {
vp9_short_iht4x4(BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16), vp9_short_iht4x4(BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16),
xd->block[i].diff, 16, tx_type); xd->block[i].diff, 16, tx_type);
} else { } else {
vp9_inverse_transform_b_4x4(xd, xd->eobs[i], vp9_inverse_transform_b_4x4(xd,
xd->plane[0].eobs[i],
BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16), BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16),
xd->block[i].diff, 32); xd->block[i].diff, 32);
} }
@ -40,12 +41,12 @@ void vp9_inverse_transform_mbuv_4x4(MACROBLOCKD *xd) {
int i; int i;
for (i = 16; i < 20; i++) { for (i = 16; i < 20; i++) {
vp9_inverse_transform_b_4x4(xd, xd->eobs[i], vp9_inverse_transform_b_4x4(xd, xd->plane[1].eobs[i - 16],
BLOCK_OFFSET(xd->plane[1].dqcoeff, i - 16, 16), BLOCK_OFFSET(xd->plane[1].dqcoeff, i - 16, 16),
xd->block[i].diff, 16); xd->block[i].diff, 16);
} }
for (i = 20; i < 24; i++) { for (i = 20; i < 24; i++) {
vp9_inverse_transform_b_4x4(xd, xd->eobs[i], vp9_inverse_transform_b_4x4(xd, xd->plane[2].eobs[i - 20],
BLOCK_OFFSET(xd->plane[2].dqcoeff, i - 20, 16), BLOCK_OFFSET(xd->plane[2].dqcoeff, i - 20, 16),
xd->block[i].diff, 16); xd->block[i].diff, 16);
} }
@ -175,7 +176,7 @@ void vp9_inverse_transform_sby_4x4(MACROBLOCKD *xd) {
const TX_TYPE tx_type = get_tx_type_4x4(xd, y_idx * 8 + x_idx); const TX_TYPE tx_type = get_tx_type_4x4(xd, y_idx * 8 + x_idx);
if (tx_type == DCT_DCT) { if (tx_type == DCT_DCT) {
vp9_inverse_transform_b_4x4(xd, xd->eobs[n], vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[n],
BLOCK_OFFSET(xd->plane[0].dqcoeff, n, 16), BLOCK_OFFSET(xd->plane[0].dqcoeff, n, 16),
xd->diff + x_idx * 4 + y_idx * 4 * 32, 64); xd->diff + x_idx * 4 + y_idx * 4 * 32, 64);
} else { } else {
@ -213,11 +214,11 @@ void vp9_inverse_transform_sbuv_4x4(MACROBLOCKD *xd) {
for (n = 0; n < 16; n++) { for (n = 0; n < 16; n++) {
const int x_idx = n & 3, y_idx = n >> 2; const int x_idx = n & 3, y_idx = n >> 2;
vp9_inverse_transform_b_4x4(xd, xd->eobs[64 + n], vp9_inverse_transform_b_4x4(xd, xd->plane[1].eobs[n],
BLOCK_OFFSET(xd->plane[1].dqcoeff, n, 16), BLOCK_OFFSET(xd->plane[1].dqcoeff, n, 16),
xd->diff + 1024 + x_idx * 4 + y_idx * 16 * 4, xd->diff + 1024 + x_idx * 4 + y_idx * 16 * 4,
32); 32);
vp9_inverse_transform_b_4x4(xd, xd->eobs[64 + 16 + n], vp9_inverse_transform_b_4x4(xd, xd->plane[2].eobs[n],
BLOCK_OFFSET(xd->plane[2].dqcoeff, n, 16), BLOCK_OFFSET(xd->plane[2].dqcoeff, n, 16),
xd->diff + 1280 + x_idx * 4 + y_idx * 16 * 4, xd->diff + 1280 + x_idx * 4 + y_idx * 16 * 4,
32); 32);
@ -278,7 +279,7 @@ void vp9_inverse_transform_sb64y_4x4(MACROBLOCKD *xd) {
const TX_TYPE tx_type = get_tx_type_4x4(xd, y_idx * 16 + x_idx); const TX_TYPE tx_type = get_tx_type_4x4(xd, y_idx * 16 + x_idx);
if (tx_type == DCT_DCT) { if (tx_type == DCT_DCT) {
vp9_inverse_transform_b_4x4(xd, xd->eobs[n], vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[n],
BLOCK_OFFSET(xd->plane[0].dqcoeff, n, 16), BLOCK_OFFSET(xd->plane[0].dqcoeff, n, 16),
xd->diff + x_idx * 4 + y_idx * 4 * 64, 128); xd->diff + x_idx * 4 + y_idx * 4 * 64, 128);
} else { } else {
@ -327,10 +328,10 @@ void vp9_inverse_transform_sb64uv_4x4(MACROBLOCKD *xd) {
for (n = 0; n < 64; n++) { for (n = 0; n < 64; n++) {
const int x_idx = n & 7, y_idx = n >> 3, off = x_idx * 4 + y_idx * 32 * 4; const int x_idx = n & 7, y_idx = n >> 3, off = x_idx * 4 + y_idx * 32 * 4;
vp9_inverse_transform_b_4x4(xd, xd->eobs[256 + n], vp9_inverse_transform_b_4x4(xd, xd->plane[1].eobs[n],
BLOCK_OFFSET(xd->plane[1].dqcoeff, n, 16), BLOCK_OFFSET(xd->plane[1].dqcoeff, n, 16),
xd->diff + 4096 + off, 64); xd->diff + 4096 + off, 64);
vp9_inverse_transform_b_4x4(xd, xd->eobs[256 + 64 + n], vp9_inverse_transform_b_4x4(xd, xd->plane[2].eobs[n],
BLOCK_OFFSET(xd->plane[2].dqcoeff, n, 16), BLOCK_OFFSET(xd->plane[2].dqcoeff, n, 16),
xd->diff + 4096 + 1024 + off, 64); xd->diff + 4096 + 1024 + off, 64);
} }

View File

@ -248,20 +248,20 @@ static void decode_16x16(VP9D_COMP *pbi, MACROBLOCKD *xd,
vp9_ht_dequant_idct_add_16x16_c(tx_type, xd->plane[0].qcoeff, vp9_ht_dequant_idct_add_16x16_c(tx_type, xd->plane[0].qcoeff,
xd->block[0].dequant, xd->predictor, xd->block[0].dequant, xd->predictor,
xd->dst.y_buffer, 16, xd->dst.y_stride, xd->dst.y_buffer, 16, xd->dst.y_stride,
xd->eobs[0]); xd->plane[0].eobs[0]);
} else { } else {
vp9_dequant_idct_add_16x16(xd->plane[0].qcoeff, xd->block[0].dequant, vp9_dequant_idct_add_16x16(xd->plane[0].qcoeff, xd->block[0].dequant,
xd->predictor, xd->dst.y_buffer, xd->predictor, xd->dst.y_buffer,
16, xd->dst.y_stride, xd->eobs[0]); 16, xd->dst.y_stride, xd->plane[0].eobs[0]);
} }
vp9_dequant_idct_add_8x8(xd->plane[1].qcoeff, xd->block[16].dequant, vp9_dequant_idct_add_8x8(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, 8, xd->predictor + 16 * 16, xd->dst.u_buffer, 8,
xd->dst.uv_stride, xd->eobs[16]); xd->dst.uv_stride, xd->plane[1].eobs[0]);
vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[16].dequant, vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, 8, xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, 8,
xd->dst.uv_stride, xd->eobs[20]); xd->dst.uv_stride, xd->plane[2].eobs[0]);
} }
static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd, static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
@ -298,10 +298,10 @@ static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
tx_type = get_tx_type_8x8(xd, ib); tx_type = get_tx_type_8x8(xd, ib);
if (tx_type != DCT_DCT) { if (tx_type != DCT_DCT) {
vp9_ht_dequant_idct_add_8x8_c(tx_type, q, dq, pre, dst, 16, stride, vp9_ht_dequant_idct_add_8x8_c(tx_type, q, dq, pre, dst, 16, stride,
xd->eobs[idx]); xd->plane[0].eobs[idx]);
} else { } else {
vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride,
xd->eobs[idx]); xd->plane[0].eobs[idx]);
} }
} }
} else { } else {
@ -325,29 +325,31 @@ static void decode_8x8(VP9D_COMP *pbi, MACROBLOCKD *xd,
vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor); vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor);
xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 8, b->dst_stride, xd->eobs[16 + i]); *(b->base_dst) + b->dst, 8, b->dst_stride,
xd->plane[1].eobs[i]);
b = &xd->block[20 + i]; b = &xd->block[20 + i];
vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor); vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 8, b->dst_stride, xd->eobs[20 + i]); *(b->base_dst) + b->dst, 8, b->dst_stride,
xd->plane[2].eobs[i]);
} }
} else if (xd->mode_info_context->mbmi.mode == SPLITMV) { } else if (xd->mode_info_context->mbmi.mode == SPLITMV) {
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->predictor + 16 * 16, xd->dst.u_buffer,
xd->dst.uv_stride, xd->eobs + 16); xd->dst.uv_stride, xd->plane[1].eobs);
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, xd->predictor + 16 * 16 + 64, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs + 20); xd->dst.uv_stride, xd->plane[2].eobs);
} else { } else {
vp9_dequant_idct_add_8x8(xd->plane[1].qcoeff, xd->block[16].dequant, vp9_dequant_idct_add_8x8(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, 8, xd->predictor + 16 * 16, xd->dst.u_buffer, 8,
xd->dst.uv_stride, xd->eobs[16]); xd->dst.uv_stride, xd->plane[1].eobs[0]);
vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[16].dequant, vp9_dequant_idct_add_8x8(xd->plane[2].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, 8, xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, 8,
xd->dst.uv_stride, xd->eobs[20]); xd->dst.uv_stride, xd->plane[2].eobs[0]);
} }
#if 0 // def DEC_DEBUG #if 0 // def DEC_DEBUG
if (dec_debug) { if (dec_debug) {
@ -394,24 +396,27 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
BLOCK_OFFSET(xd->plane[0].qcoeff, ib + iblock[j], 16), BLOCK_OFFSET(xd->plane[0].qcoeff, ib + iblock[j], 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, *(b->base_dst) + b->dst, 16,
b->dst_stride, xd->eobs[ib + iblock[j]]); b->dst_stride,
xd->plane[0].eobs[ib + iblock[j]]);
} else { } else {
xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, ib + iblock[j], 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, ib + iblock[j], 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride, *(b->base_dst) + b->dst, 16, b->dst_stride,
xd->eobs[ib + iblock[j]]); xd->plane[0].eobs[ib + iblock[j]]);
} }
} }
b = &xd->block[16 + i]; b = &xd->block[16 + i];
vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor); vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor);
xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[1].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 8, b->dst_stride, xd->eobs[16 + i]); *(b->base_dst) + b->dst, 8, b->dst_stride,
xd->plane[1].eobs[i]);
b = &xd->block[20 + i]; b = &xd->block[20 + i];
vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor); vp9_intra_uv4x4_predict(xd, b, i8x8mode, b->predictor);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 8, b->dst_stride, xd->eobs[20 + i]); *(b->base_dst) + b->dst, 8, b->dst_stride,
xd->plane[2].eobs[i]);
} }
} else if (mode == B_PRED) { } else if (mode == B_PRED) {
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
@ -430,11 +435,12 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16), BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride, *(b->base_dst) + b->dst, 16, b->dst_stride,
xd->eobs[i]); xd->plane[0].eobs[i]);
} else { } else {
xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride, xd->eobs[i]); *(b->base_dst) + b->dst, 16, b->dst_stride,
xd->plane[0].eobs[i]);
} }
} }
#if CONFIG_NEWBINTRAMODES #if CONFIG_NEWBINTRAMODES
@ -444,10 +450,10 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
vp9_build_intra_predictors_mbuv(xd); vp9_build_intra_predictors_mbuv(xd);
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->predictor + 16 * 16, xd->dst.u_buffer,
xd->dst.uv_stride, xd->eobs + 16); xd->dst.uv_stride, xd->plane[1].eobs);
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, xd->predictor + 16 * 16 + 64, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs + 20); xd->dst.uv_stride, xd->plane[2].eobs);
} else if (mode == SPLITMV || get_tx_type_4x4(xd, 0) == DCT_DCT) { } else if (mode == SPLITMV || get_tx_type_4x4(xd, 0) == DCT_DCT) {
xd->itxm_add_y_block(xd->plane[0].qcoeff, xd->itxm_add_y_block(xd->plane[0].qcoeff,
xd->block[0].dequant, xd->block[0].dequant,
@ -457,10 +463,10 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
xd); xd);
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->predictor + 16 * 16, xd->dst.u_buffer,
xd->dst.uv_stride, xd->eobs + 16); xd->dst.uv_stride, xd->plane[1].eobs);
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, xd->predictor + 16 * 16 + 64, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs + 20); xd->dst.uv_stride, xd->plane[2].eobs);
} else { } else {
#if 0 // def DEC_DEBUG #if 0 // def DEC_DEBUG
if (dec_debug) { if (dec_debug) {
@ -487,19 +493,20 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd,
BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16), BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, *(b->base_dst) + b->dst, 16,
b->dst_stride, xd->eobs[i]); b->dst_stride, xd->plane[0].eobs[i]);
} else { } else {
xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16),
b->dequant, b->predictor, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride, xd->eobs[i]); *(b->base_dst) + b->dst, 16, b->dst_stride,
xd->plane[0].eobs[i]);
} }
} }
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16, xd->dst.u_buffer, xd->predictor + 16 * 16, xd->dst.u_buffer,
xd->dst.uv_stride, xd->eobs + 16); xd->dst.uv_stride, xd->plane[1].eobs);
xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant, xd->itxm_add_uv_block(xd->plane[2].qcoeff, xd->block[16].dequant,
xd->predictor + 16 * 16 + 64, xd->dst.v_buffer, xd->predictor + 16 * 16 + 64, xd->dst.v_buffer,
xd->dst.uv_stride, xd->eobs + 20); xd->dst.uv_stride, xd->plane[2].eobs);
} }
} }
@ -507,9 +514,6 @@ static void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
const int y_count = y_size * y_size; const int y_count = y_size * y_size;
const int uv_size = y_size / 2; const int uv_size = y_size / 2;
const int uv_count = uv_size * uv_size; const int uv_count = uv_size * uv_size;
const int u_eob_offset = 16 * y_count;
const int v_eob_offset = u_eob_offset + 16 * uv_count;
int n; int n;
for (n = 0; n < y_count; n++) { for (n = 0; n < y_count; n++) {
@ -524,7 +528,7 @@ static void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
mb->dst.y_buffer + y_offset, mb->dst.y_buffer + y_offset,
mb->dst.y_buffer + y_offset, mb->dst.y_buffer + y_offset,
mb->dst.y_stride, mb->dst.y_stride, mb->dst.y_stride, mb->dst.y_stride,
mb->eobs[n * 16]); mb->plane[0].eobs[n * 16]);
} else { } else {
vp9_ht_dequant_idct_add_16x16_c(tx_type, vp9_ht_dequant_idct_add_16x16_c(tx_type,
BLOCK_OFFSET(mb->plane[0].qcoeff, n, 256), BLOCK_OFFSET(mb->plane[0].qcoeff, n, 256),
@ -532,7 +536,7 @@ static void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
mb->dst.y_buffer + y_offset, mb->dst.y_buffer + y_offset,
mb->dst.y_buffer + y_offset, mb->dst.y_buffer + y_offset,
mb->dst.y_stride, mb->dst.y_stride, mb->dst.y_stride, mb->dst.y_stride,
mb->eobs[n * 16]); mb->plane[0].eobs[n * 16]);
} }
} }
@ -545,13 +549,13 @@ static void decode_sb_16x16(MACROBLOCKD *mb, int y_size) {
mb->dst.u_buffer + uv_offset, mb->dst.u_buffer + uv_offset,
mb->dst.u_buffer + uv_offset, mb->dst.u_buffer + uv_offset,
mb->dst.uv_stride, mb->dst.uv_stride, mb->dst.uv_stride, mb->dst.uv_stride,
mb->eobs[u_eob_offset + n * 16]); mb->plane[1].eobs[n * 16]);
vp9_dequant_idct_add_16x16(BLOCK_OFFSET(mb->plane[2].qcoeff, n, 256), vp9_dequant_idct_add_16x16(BLOCK_OFFSET(mb->plane[2].qcoeff, n, 256),
mb->block[20].dequant, mb->block[20].dequant,
mb->dst.v_buffer + uv_offset, mb->dst.v_buffer + uv_offset,
mb->dst.v_buffer + uv_offset, mb->dst.v_buffer + uv_offset,
mb->dst.uv_stride, mb->dst.uv_stride, mb->dst.uv_stride, mb->dst.uv_stride,
mb->eobs[v_eob_offset + n * 16]); mb->plane[2].eobs[n * 16]);
} }
} }
@ -559,9 +563,6 @@ static INLINE void decode_sb_8x8(MACROBLOCKD *xd, int y_size) {
const int y_count = y_size * y_size; const int y_count = y_size * y_size;
const int uv_size = y_size / 2; const int uv_size = y_size / 2;
const int uv_count = uv_size * uv_size; const int uv_count = uv_size * uv_size;
const int u_eob_offset = 4 * y_count;
const int v_eob_offset = u_eob_offset + 4 * uv_count;
int n; int n;
// luma // luma
@ -577,7 +578,7 @@ static INLINE void decode_sb_8x8(MACROBLOCKD *xd, int y_size) {
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride,
xd->eobs[n * 4]); xd->plane[0].eobs[n * 4]);
} else { } else {
vp9_ht_dequant_idct_add_8x8_c(tx_type, vp9_ht_dequant_idct_add_8x8_c(tx_type,
BLOCK_OFFSET(xd->plane[0].qcoeff, n, 64), BLOCK_OFFSET(xd->plane[0].qcoeff, n, 64),
@ -585,7 +586,7 @@ static INLINE void decode_sb_8x8(MACROBLOCKD *xd, int y_size) {
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride,
xd->eobs[n * 4]); xd->plane[0].eobs[n * 4]);
} }
} }
@ -599,13 +600,13 @@ static INLINE void decode_sb_8x8(MACROBLOCKD *xd, int y_size) {
xd->dst.u_buffer + uv_offset, xd->dst.u_buffer + uv_offset,
xd->dst.u_buffer + uv_offset, xd->dst.u_buffer + uv_offset,
xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride,
xd->eobs[u_eob_offset + n * 4]); xd->plane[1].eobs[n * 4]);
vp9_dequant_idct_add_8x8_c(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 64), vp9_dequant_idct_add_8x8_c(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 64),
xd->block[20].dequant, xd->block[20].dequant,
xd->dst.v_buffer + uv_offset, xd->dst.v_buffer + uv_offset,
xd->dst.v_buffer + uv_offset, xd->dst.v_buffer + uv_offset,
xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride,
xd->eobs[v_eob_offset + n * 4]); xd->plane[2].eobs[n * 4]);
} }
} }
@ -614,9 +615,6 @@ static void decode_sb_4x4(MACROBLOCKD *xd, int y_size) {
const int y_count = y_size * y_size; const int y_count = y_size * y_size;
const int uv_size = y_size / 2; const int uv_size = y_size / 2;
const int uv_count = uv_size * uv_size; const int uv_count = uv_size * uv_size;
const int u_eob_offset = y_count;
const int v_eob_offset = u_eob_offset + uv_count;
int n; int n;
for (n = 0; n < y_count; n++) { for (n = 0; n < y_count; n++) {
@ -630,7 +628,7 @@ static void decode_sb_4x4(MACROBLOCKD *xd, int y_size) {
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride,
xd->eobs[n]); xd->plane[0].eobs[n]);
} else { } else {
vp9_ht_dequant_idct_add_c(tx_type, vp9_ht_dequant_idct_add_c(tx_type,
BLOCK_OFFSET(xd->plane[0].qcoeff, n, 16), BLOCK_OFFSET(xd->plane[0].qcoeff, n, 16),
@ -639,7 +637,7 @@ static void decode_sb_4x4(MACROBLOCKD *xd, int y_size) {
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_stride, xd->dst.y_stride,
xd->dst.y_stride, xd->dst.y_stride,
xd->eobs[n]); xd->plane[0].eobs[n]);
} }
} }
@ -651,12 +649,12 @@ static void decode_sb_4x4(MACROBLOCKD *xd, int y_size) {
xd->block[16].dequant, xd->block[16].dequant,
xd->dst.u_buffer + uv_offset, xd->dst.u_buffer + uv_offset,
xd->dst.u_buffer + uv_offset, xd->dst.u_buffer + uv_offset,
xd->dst.uv_stride, xd->dst.uv_stride, xd->eobs[u_eob_offset + n]); xd->dst.uv_stride, xd->dst.uv_stride, xd->plane[1].eobs[n]);
xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 16), xd->itxm_add(BLOCK_OFFSET(xd->plane[2].qcoeff, n, 16),
xd->block[20].dequant, xd->block[20].dequant,
xd->dst.v_buffer + uv_offset, xd->dst.v_buffer + uv_offset,
xd->dst.v_buffer + uv_offset, xd->dst.v_buffer + uv_offset,
xd->dst.uv_stride, xd->dst.uv_stride, xd->eobs[v_eob_offset + n]); xd->dst.uv_stride, xd->dst.uv_stride, xd->plane[2].eobs[n]);
} }
} }
@ -712,14 +710,14 @@ static void decode_sb64(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
xd->block[0].dequant, xd->block[0].dequant,
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_buffer + y_offset, xd->dst.y_buffer + y_offset,
xd->dst.y_stride, xd->dst.y_stride, xd->eobs[n * 64]); xd->dst.y_stride, xd->dst.y_stride, xd->plane[0].eobs[n * 64]);
} }
vp9_dequant_idct_add_32x32(xd->plane[1].qcoeff, vp9_dequant_idct_add_32x32(xd->plane[1].qcoeff,
xd->block[16].dequant, xd->dst.u_buffer, xd->dst.u_buffer, xd->block[16].dequant, xd->dst.u_buffer, xd->dst.u_buffer,
xd->dst.uv_stride, xd->dst.uv_stride, xd->eobs[256]); xd->dst.uv_stride, xd->dst.uv_stride, xd->plane[1].eobs[0]);
vp9_dequant_idct_add_32x32(xd->plane[2].qcoeff, vp9_dequant_idct_add_32x32(xd->plane[2].qcoeff,
xd->block[20].dequant, xd->dst.v_buffer, xd->dst.v_buffer, xd->block[20].dequant, xd->dst.v_buffer, xd->dst.v_buffer,
xd->dst.uv_stride, xd->dst.uv_stride, xd->eobs[320]); xd->dst.uv_stride, xd->dst.uv_stride, xd->plane[2].eobs[0]);
break; break;
case TX_16X16: case TX_16X16:
decode_sb_16x16(xd, 4); decode_sb_16x16(xd, 4);
@ -789,15 +787,15 @@ static void decode_sb32(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
vp9_dequant_idct_add_32x32(xd->plane[0].qcoeff, xd->block[0].dequant, vp9_dequant_idct_add_32x32(xd->plane[0].qcoeff, xd->block[0].dequant,
xd->dst.y_buffer, xd->dst.y_buffer, xd->dst.y_buffer, xd->dst.y_buffer,
xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride, xd->dst.y_stride,
xd->eobs[0]); xd->plane[0].eobs[0]);
vp9_dequant_idct_add_16x16(xd->plane[1].qcoeff, xd->block[16].dequant, vp9_dequant_idct_add_16x16(xd->plane[1].qcoeff, xd->block[16].dequant,
xd->dst.u_buffer, xd->dst.u_buffer, xd->dst.u_buffer, xd->dst.u_buffer,
xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride,
xd->eobs[64]); xd->plane[1].eobs[0]);
vp9_dequant_idct_add_16x16(xd->plane[2].qcoeff, xd->block[16].dequant, vp9_dequant_idct_add_16x16(xd->plane[2].qcoeff, xd->block[16].dequant,
xd->dst.v_buffer, xd->dst.v_buffer, xd->dst.v_buffer, xd->dst.v_buffer,
xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride, xd->dst.uv_stride,
xd->eobs[80]); xd->plane[2].eobs[0]);
break; break;
case TX_16X16: case TX_16X16:
decode_sb_16x16(xd, 2); decode_sb_16x16(xd, 2);

View File

@ -396,7 +396,7 @@ static INLINE int decode_sb(VP9D_COMP* const pbi,
const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_Y_WITH_DC, seg_eob, const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_Y_WITH_DC, seg_eob,
BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16), BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16),
tx_size); tx_size);
xd->eobs[i] = c; xd->plane[0].eobs[i] = c;
eobtotal += c; eobtotal += c;
} }
@ -406,7 +406,7 @@ static INLINE int decode_sb(VP9D_COMP* const pbi,
const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob, const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob,
BLOCK_OFFSET(xd->plane[1].qcoeff, b, 16), BLOCK_OFFSET(xd->plane[1].qcoeff, b, 16),
tx_size); tx_size);
xd->eobs[i] = c; xd->plane[1].eobs[b] = c;
eobtotal += c; eobtotal += c;
} }
for (i = offset * 5 / 4; i < count; i += inc) { for (i = offset * 5 / 4; i < count; i += inc) {
@ -414,7 +414,7 @@ static INLINE int decode_sb(VP9D_COMP* const pbi,
const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob, const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob,
BLOCK_OFFSET(xd->plane[2].qcoeff, b, 16), BLOCK_OFFSET(xd->plane[2].qcoeff, b, 16),
tx_size); tx_size);
xd->eobs[i] = c; xd->plane[2].eobs[b] = c;
eobtotal += c; eobtotal += c;
} }
@ -432,7 +432,7 @@ int vp9_decode_sb_tokens(VP9D_COMP* const pbi,
int c = decode_coefs(pbi, xd, bc, 0, PLANE_TYPE_Y_WITH_DC, int c = decode_coefs(pbi, xd, bc, 0, PLANE_TYPE_Y_WITH_DC,
get_eob(xd, segment_id, 1024), get_eob(xd, segment_id, 1024),
xd->plane[0].qcoeff, TX_32X32); xd->plane[0].qcoeff, TX_32X32);
xd->eobs[0] = c; xd->plane[0].eobs[0] = c;
eobtotal += c; eobtotal += c;
// 16x16 chroma blocks // 16x16 chroma blocks
@ -440,11 +440,11 @@ int vp9_decode_sb_tokens(VP9D_COMP* const pbi,
c = decode_coefs(pbi, xd, bc, 64, PLANE_TYPE_UV, seg_eob, c = decode_coefs(pbi, xd, bc, 64, PLANE_TYPE_UV, seg_eob,
xd->plane[1].qcoeff, TX_16X16); xd->plane[1].qcoeff, TX_16X16);
xd->eobs[64] = c; xd->plane[1].eobs[0] = c;
eobtotal += c; eobtotal += c;
c = decode_coefs(pbi, xd, bc, 80, PLANE_TYPE_UV, seg_eob, c = decode_coefs(pbi, xd, bc, 80, PLANE_TYPE_UV, seg_eob,
xd->plane[2].qcoeff, TX_16X16); xd->plane[2].qcoeff, TX_16X16);
xd->eobs[80] = c; xd->plane[2].eobs[0] = c;
eobtotal += c; eobtotal += c;
return eobtotal; return eobtotal;
} }
@ -488,7 +488,7 @@ static int vp9_decode_mb_tokens_16x16(VP9D_COMP* const pbi,
int c = decode_coefs(pbi, xd, bc, 0, PLANE_TYPE_Y_WITH_DC, int c = decode_coefs(pbi, xd, bc, 0, PLANE_TYPE_Y_WITH_DC,
get_eob(xd, segment_id, 256), get_eob(xd, segment_id, 256),
xd->plane[0].qcoeff, TX_16X16); xd->plane[0].qcoeff, TX_16X16);
xd->eobs[0] = c; xd->plane[0].eobs[0] = c;
eobtotal += c; eobtotal += c;
// 8x8 chroma blocks // 8x8 chroma blocks
@ -496,11 +496,11 @@ static int vp9_decode_mb_tokens_16x16(VP9D_COMP* const pbi,
c = decode_coefs(pbi, xd, bc, 16, PLANE_TYPE_UV, c = decode_coefs(pbi, xd, bc, 16, PLANE_TYPE_UV,
seg_eob, xd->plane[1].qcoeff, TX_8X8); seg_eob, xd->plane[1].qcoeff, TX_8X8);
xd->eobs[16] = c; xd->plane[1].eobs[0] = c;
eobtotal += c; eobtotal += c;
c = decode_coefs(pbi, xd, bc, 20, PLANE_TYPE_UV, c = decode_coefs(pbi, xd, bc, 20, PLANE_TYPE_UV,
seg_eob, xd->plane[2].qcoeff, TX_8X8); seg_eob, xd->plane[2].qcoeff, TX_8X8);
xd->eobs[20] = c; xd->plane[2].eobs[0] = c;
eobtotal += c; eobtotal += c;
return eobtotal; return eobtotal;
} }
@ -517,7 +517,7 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_Y_WITH_DC, seg_eob, const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_Y_WITH_DC, seg_eob,
BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16), BLOCK_OFFSET(xd->plane[0].qcoeff, i, 16),
TX_8X8); TX_8X8);
xd->eobs[i] = c; xd->plane[0].eobs[i] = c;
eobtotal += c; eobtotal += c;
} }
@ -530,14 +530,14 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob, const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob,
BLOCK_OFFSET(xd->plane[1].qcoeff, i - 16, 16), BLOCK_OFFSET(xd->plane[1].qcoeff, i - 16, 16),
TX_4X4); TX_4X4);
xd->eobs[i] = c; xd->plane[1].eobs[i - 16] = c;
eobtotal += c; eobtotal += c;
} }
for (i = 20; i < 24; i++) { for (i = 20; i < 24; i++) {
const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob, const int c = decode_coefs(pbi, xd, bc, i, PLANE_TYPE_UV, seg_eob,
BLOCK_OFFSET(xd->plane[2].qcoeff, i - 20, 16), BLOCK_OFFSET(xd->plane[2].qcoeff, i - 20, 16),
TX_4X4); TX_4X4);
xd->eobs[i] = c; xd->plane[2].eobs[i - 20] = c;
eobtotal += c; eobtotal += c;
} }
} else { } else {
@ -545,11 +545,11 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
c = decode_coefs(pbi, xd, bc, 16, PLANE_TYPE_UV, seg_eob, c = decode_coefs(pbi, xd, bc, 16, PLANE_TYPE_UV, seg_eob,
xd->plane[1].qcoeff, TX_8X8); xd->plane[1].qcoeff, TX_8X8);
xd->eobs[16] = c; xd->plane[1].eobs[0] = c;
eobtotal += c; eobtotal += c;
c = decode_coefs(pbi, xd, bc, 20, PLANE_TYPE_UV, seg_eob, c = decode_coefs(pbi, xd, bc, 20, PLANE_TYPE_UV, seg_eob,
xd->plane[2].qcoeff, TX_8X8); xd->plane[2].qcoeff, TX_8X8);
xd->eobs[20] = c; xd->plane[2].eobs[0] = c;
eobtotal += c; eobtotal += c;
} }
@ -559,9 +559,10 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi,
static int decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd, static int decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
BOOL_DECODER* const bc, BOOL_DECODER* const bc,
PLANE_TYPE type, int i, int seg_eob) { PLANE_TYPE type, int i, int seg_eob) {
const struct plane_block_idx pb_idx = plane_block_idx(16, i);
const int c = decode_coefs(dx, xd, bc, i, type, seg_eob, const int c = decode_coefs(dx, xd, bc, i, type, seg_eob,
MB_SUBBLOCK_FIELD(xd, qcoeff, i), TX_4X4); BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16), TX_4X4);
xd->eobs[i] = c; xd->plane[pb_idx.plane].eobs[pb_idx.block] = c;
return c; return c;
} }

View File

@ -20,7 +20,8 @@ void vp9_dequant_idct_add_y_block_c(int16_t *q, const int16_t *dq,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
vp9_dequant_idct_add(q, dq, pre, dst, 16, stride, xd->eobs[i * 4 + j]); vp9_dequant_idct_add(q, dq, pre, dst, 16, stride,
xd->plane[0].eobs[i * 4 + j]);
q += 16; q += 16;
pre += 4; pre += 4;
dst += 4; dst += 4;
@ -56,15 +57,17 @@ void vp9_dequant_idct_add_y_block_8x8_c(int16_t *q, const int16_t *dq,
uint8_t *origdest = dst; uint8_t *origdest = dst;
uint8_t *origpred = pre; uint8_t *origpred = pre;
vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride, xd->eobs[0]); vp9_dequant_idct_add_8x8_c(q, dq, pre, dst, 16, stride,
xd->plane[0].eobs[0]);
vp9_dequant_idct_add_8x8_c(&q[64], dq, origpred + 8, vp9_dequant_idct_add_8x8_c(&q[64], dq, origpred + 8,
origdest + 8, 16, stride, xd->eobs[4]); origdest + 8, 16, stride,
xd->plane[0].eobs[4]);
vp9_dequant_idct_add_8x8_c(&q[128], dq, origpred + 8 * 16, vp9_dequant_idct_add_8x8_c(&q[128], dq, origpred + 8 * 16,
origdest + 8 * stride, 16, stride, origdest + 8 * stride, 16, stride,
xd->eobs[8]); xd->plane[0].eobs[8]);
vp9_dequant_idct_add_8x8_c(&q[192], dq, origpred + 8 * 16 + 8, vp9_dequant_idct_add_8x8_c(&q[192], dq, origpred + 8 * 16 + 8,
origdest + 8 * stride + 8, 16, stride, origdest + 8 * stride + 8, 16, stride,
xd->eobs[12]); xd->plane[0].eobs[12]);
} }
void vp9_dequant_idct_add_y_block_lossless_c(int16_t *q, const int16_t *dq, void vp9_dequant_idct_add_y_block_lossless_c(int16_t *q, const int16_t *dq,
@ -76,7 +79,7 @@ void vp9_dequant_idct_add_y_block_lossless_c(int16_t *q, const int16_t *dq,
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
vp9_dequant_idct_add_lossless_c(q, dq, pre, dst, 16, stride, vp9_dequant_idct_add_lossless_c(q, dq, pre, dst, 16, stride,
xd->eobs[i * 4 + j]); xd->plane[0].eobs[i * 4 + j]);
q += 16; q += 16;
pre += 4; pre += 4;
dst += 4; dst += 4;

View File

@ -171,10 +171,13 @@ struct macroblock {
void (*fwd_txm8x4)(int16_t *input, int16_t *output, int pitch); void (*fwd_txm8x4)(int16_t *input, int16_t *output, int pitch);
void (*fwd_txm8x8)(int16_t *input, int16_t *output, int pitch); void (*fwd_txm8x8)(int16_t *input, int16_t *output, int pitch);
void (*fwd_txm16x16)(int16_t *input, int16_t *output, int pitch); void (*fwd_txm16x16)(int16_t *input, int16_t *output, int pitch);
void (*quantize_b_4x4)(MACROBLOCK *x, int b_idx); void (*quantize_b_4x4)(MACROBLOCK *x, int b_idx, int y_blocks);
void (*quantize_b_4x4_pair)(MACROBLOCK *x, int b_idx1, int b_idx2); void (*quantize_b_4x4_pair)(MACROBLOCK *x, int b_idx1, int b_idx2,
void (*quantize_b_16x16)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type); int y_blocks);
void (*quantize_b_8x8)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type); void (*quantize_b_16x16)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type,
int y_blocks);
void (*quantize_b_8x8)(MACROBLOCK *x, int b_idx, TX_TYPE tx_type,
int y_blocks);
}; };
#endif // VP9_ENCODER_VP9_BLOCK_H_ #endif // VP9_ENCODER_VP9_BLOCK_H_

View File

@ -63,8 +63,8 @@ static void encode_intra4x4block(MACROBLOCK *x, int ib) {
b->diff, 16, tx_type); b->diff, 16, tx_type);
} else { } else {
x->fwd_txm4x4(be->src_diff, be->coeff, 32); x->fwd_txm4x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4(x, ib); x->quantize_b_4x4(x, ib, 16);
vp9_inverse_transform_b_4x4(&x->e_mbd, x->e_mbd.eobs[ib], vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[0].eobs[ib],
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16), BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
b->diff, 32); b->diff, 32);
} }
@ -164,12 +164,12 @@ void vp9_encode_intra8x8(MACROBLOCK *x, int ib) {
tx_type = get_tx_type_8x8(xd, ib); tx_type = get_tx_type_8x8(xd, ib);
if (tx_type != DCT_DCT) { if (tx_type != DCT_DCT) {
vp9_short_fht8x8(be->src_diff, (x->block + idx)->coeff, 16, tx_type); vp9_short_fht8x8(be->src_diff, (x->block + idx)->coeff, 16, tx_type);
x->quantize_b_8x8(x, idx, tx_type); x->quantize_b_8x8(x, idx, tx_type, 16);
vp9_short_iht8x8(dqcoeff, xd->block[ib].diff, vp9_short_iht8x8(dqcoeff, xd->block[ib].diff,
16, tx_type); 16, tx_type);
} else { } else {
x->fwd_txm8x8(be->src_diff, (x->block + idx)->coeff, 32); x->fwd_txm8x8(be->src_diff, (x->block + idx)->coeff, 32);
x->quantize_b_8x8(x, idx, DCT_DCT); x->quantize_b_8x8(x, idx, DCT_DCT, 16);
vp9_short_idct8x8(dqcoeff, xd->block[ib].diff, 32); vp9_short_idct8x8(dqcoeff, xd->block[ib].diff, 32);
} }
} else { } else {
@ -188,16 +188,16 @@ void vp9_encode_intra8x8(MACROBLOCK *x, int ib) {
} else if (!(i & 1) && } else if (!(i & 1) &&
get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) { get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
x->fwd_txm8x4(be->src_diff, be->coeff, 32); x->fwd_txm8x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1); x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1, 16);
vp9_inverse_transform_b_4x4(xd, xd->eobs[ib + iblock[i]], vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
dqcoeff, b->diff, 32); dqcoeff, b->diff, 32);
vp9_inverse_transform_b_4x4(xd, xd->eobs[ib + iblock[i] + 1], vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i] + 1],
dqcoeff + 16, (b + 1)->diff, 32); dqcoeff + 16, (b + 1)->diff, 32);
i++; i++;
} else { } else {
x->fwd_txm4x4(be->src_diff, be->coeff, 32); x->fwd_txm4x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4(x, ib + iblock[i]); x->quantize_b_4x4(x, ib + iblock[i], 16);
vp9_inverse_transform_b_4x4(xd, xd->eobs[ib + iblock[i]], vp9_inverse_transform_b_4x4(xd, xd->plane[0].eobs[ib + iblock[i]],
dqcoeff, b->diff, 32); dqcoeff, b->diff, 32);
} }
} }
@ -223,6 +223,8 @@ static void encode_intra_uv4x4(MACROBLOCK *x, int ib, int mode) {
BLOCKD *b = &x->e_mbd.block[ib]; BLOCKD *b = &x->e_mbd.block[ib];
BLOCK *be = &x->block[ib]; BLOCK *be = &x->block[ib];
int16_t * const dqcoeff = MB_SUBBLOCK_FIELD(xd, dqcoeff, ib); int16_t * const dqcoeff = MB_SUBBLOCK_FIELD(xd, dqcoeff, ib);
const int plane = ib < 20 ? 1 : 2;
const int block = ib < 20 ? ib - 16 : ib - 20;
assert(ib >= 16 && ib < 24); assert(ib >= 16 && ib < 24);
vp9_intra_uv4x4_predict(&x->e_mbd, b, mode, b->predictor); vp9_intra_uv4x4_predict(&x->e_mbd, b, mode, b->predictor);
@ -230,8 +232,8 @@ static void encode_intra_uv4x4(MACROBLOCK *x, int ib, int mode) {
vp9_subtract_b(be, b, 8); vp9_subtract_b(be, b, 8);
x->fwd_txm4x4(be->src_diff, be->coeff, 16); x->fwd_txm4x4(be->src_diff, be->coeff, 16);
x->quantize_b_4x4(x, ib); x->quantize_b_4x4(x, ib, 16);
vp9_inverse_transform_b_4x4(&x->e_mbd, x->e_mbd.eobs[ib], vp9_inverse_transform_b_4x4(&x->e_mbd, xd->plane[plane].eobs[block],
dqcoeff, b->diff, 16); dqcoeff, b->diff, 16);
vp9_recon_uv_b_c(b->predictor, b->diff, *(b->base_dst) + b->dst, vp9_recon_uv_b_c(b->predictor, b->diff, *(b->base_dst) + b->dst,

View File

@ -544,16 +544,16 @@ static void optimize_b(VP9_COMMON *const cm,
MACROBLOCK *mb, int ib, PLANE_TYPE type, MACROBLOCK *mb, int ib, PLANE_TYPE type,
const int16_t *dequant_ptr, const int16_t *dequant_ptr,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l, ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *l,
int tx_size) { int tx_size, int y_blocks) {
const int ref = mb->e_mbd.mode_info_context->mbmi.ref_frame != INTRA_FRAME; const int ref = mb->e_mbd.mode_info_context->mbmi.ref_frame != INTRA_FRAME;
MACROBLOCKD *const xd = &mb->e_mbd; MACROBLOCKD *const xd = &mb->e_mbd;
vp9_token_state tokens[1025][2]; vp9_token_state tokens[1025][2];
unsigned best_index[1025][2]; unsigned best_index[1025][2];
const struct plane_block_idx pb_idx = plane_block_idx(xd, ib); const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, ib);
const int16_t *coeff_ptr = mb->coeff + ib * 16; const int16_t *coeff_ptr = mb->coeff + ib * 16;
int16_t *qcoeff_ptr; int16_t *qcoeff_ptr;
int16_t *dqcoeff_ptr; int16_t *dqcoeff_ptr;
int eob = xd->eobs[ib], final_eob, sz = 0; int eob = xd->plane[pb_idx.plane].eobs[pb_idx.block], final_eob, sz = 0;
const int i0 = 0; const int i0 = 0;
int rc, x, next, i; int rc, x, next, i;
int64_t rdmult, rddiv, rd_cost0, rd_cost1; int64_t rdmult, rddiv, rd_cost0, rd_cost1;
@ -583,6 +583,7 @@ static void optimize_b(VP9_COMMON *const cm,
nzc0 = nzc1 = nzc; nzc0 = nzc1 = nzc;
#endif #endif
assert((!type && !pb_idx.plane) || (type && pb_idx.plane));
dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16); dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16);
qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16); qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16);
switch (tx_size) { switch (tx_size) {
@ -644,6 +645,7 @@ static void optimize_b(VP9_COMMON *const cm,
#endif #endif
break; break;
} }
assert(eob <= default_eob);
/* Now set up a Viterbi trellis to evaluate alternative roundings. */ /* Now set up a Viterbi trellis to evaluate alternative roundings. */
rdmult = mb->rdmult * err_mult; rdmult = mb->rdmult * err_mult;
@ -841,7 +843,7 @@ static void optimize_b(VP9_COMMON *const cm,
} }
final_eob++; final_eob++;
xd->eobs[ib] = final_eob; xd->plane[pb_idx.plane].eobs[pb_idx.block] = final_eob;
*a = *l = (final_eob > 0); *a = *l = (final_eob > 0);
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
assert(final_nzc == final_nzc_exp); assert(final_nzc == final_nzc_exp);
@ -867,7 +869,7 @@ void vp9_optimize_mby_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 16; b++) { for (b = 0; b < 16; b++) {
optimize_b(cm, x, b, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[b].dequant, optimize_b(cm, x, b, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[b].dequant,
ta + vp9_block2above[TX_4X4][b], ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b], TX_4X4); tl + vp9_block2left[TX_4X4][b], TX_4X4, 16);
} }
} }
@ -889,7 +891,7 @@ void vp9_optimize_mbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 16; b < 24; b++) { for (b = 16; b < 24; b++) {
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[b].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[b].dequant,
ta + vp9_block2above[TX_4X4][b], ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b], TX_4X4); tl + vp9_block2left[TX_4X4][b], TX_4X4, 16);
} }
} }
@ -918,7 +920,7 @@ void vp9_optimize_mby_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0; ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0;
ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0; ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0;
optimize_b(cm, x, b, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[b].dequant, optimize_b(cm, x, b, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[b].dequant,
&above_ec, &left_ec, TX_8X8); &above_ec, &left_ec, TX_8X8, 16);
a[1] = a[0] = above_ec; a[1] = a[0] = above_ec;
l[1] = l[0] = left_ec; l[1] = l[0] = left_ec;
} }
@ -938,7 +940,7 @@ void vp9_optimize_mbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0; ENTROPY_CONTEXT above_ec = (a[0] + a[1]) != 0;
ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0; ENTROPY_CONTEXT left_ec = (l[0] + l[1]) != 0;
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[b].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[b].dequant,
&above_ec, &left_ec, TX_8X8); &above_ec, &left_ec, TX_8X8, 16);
} }
} }
@ -958,7 +960,7 @@ void vp9_optimize_mby_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
ta = (t_above->y1[0] + t_above->y1[1] + t_above->y1[2] + t_above->y1[3]) != 0; ta = (t_above->y1[0] + t_above->y1[1] + t_above->y1[2] + t_above->y1[3]) != 0;
tl = (t_left->y1[0] + t_left->y1[1] + t_left->y1[2] + t_left->y1[3]) != 0; tl = (t_left->y1[0] + t_left->y1[1] + t_left->y1[2] + t_left->y1[3]) != 0;
optimize_b(cm, x, 0, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, 0, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
&ta, &tl, TX_16X16); &ta, &tl, TX_16X16, 16);
} }
static void optimize_mb_16x16(VP9_COMMON *const cm, MACROBLOCK *x) { static void optimize_mb_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
@ -976,7 +978,7 @@ void vp9_optimize_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x) {
ta = (a[0] + a[1] + a[2] + a[3] + a1[0] + a1[1] + a1[2] + a1[3]) != 0; ta = (a[0] + a[1] + a[2] + a[3] + a1[0] + a1[1] + a1[2] + a1[3]) != 0;
tl = (l[0] + l[1] + l[2] + l[3] + l1[0] + l1[1] + l1[2] + l1[3]) != 0; tl = (l[0] + l[1] + l[2] + l[3] + l1[0] + l1[1] + l1[2] + l1[3]) != 0;
optimize_b(cm, x, 0, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, 0, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
&ta, &tl, TX_32X32); &ta, &tl, TX_32X32, 64);
} }
void vp9_optimize_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x) { void vp9_optimize_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
@ -995,7 +997,7 @@ void vp9_optimize_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
const int x_idx = n & 1, y_idx = n >> 1; const int x_idx = n & 1, y_idx = n >> 1;
optimize_b(cm, x, n * 16, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, n * 16, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
ta + x_idx, tl + y_idx, TX_16X16); ta + x_idx, tl + y_idx, TX_16X16, 64);
} }
} }
@ -1019,7 +1021,7 @@ void vp9_optimize_sby_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
const int x_idx = n & 3, y_idx = n >> 2; const int x_idx = n & 3, y_idx = n >> 2;
optimize_b(cm, x, n * 4, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, n * 4, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
ta + x_idx, tl + y_idx, TX_8X8); ta + x_idx, tl + y_idx, TX_8X8, 64);
} }
} }
@ -1035,7 +1037,7 @@ void vp9_optimize_sby_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
const int x_idx = n & 7, y_idx = n >> 3; const int x_idx = n & 7, y_idx = n >> 3;
optimize_b(cm, x, n, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, n, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
ta + x_idx, tl + y_idx, TX_4X4); ta + x_idx, tl + y_idx, TX_4X4, 64);
} }
} }
@ -1054,7 +1056,7 @@ void vp9_optimize_sbuv_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
above_ec = (a[0] + a[1] + a1[0] + a1[1]) != 0; above_ec = (a[0] + a[1] + a1[0] + a1[1]) != 0;
left_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0; left_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0;
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant,
&above_ec, &left_ec, TX_16X16); &above_ec, &left_ec, TX_16X16, 64);
} }
} }
@ -1074,7 +1076,7 @@ void vp9_optimize_sbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
above_ec = (a[0] + a[1]) != 0; above_ec = (a[0] + a[1]) != 0;
left_ec = (l[0] + l[1]) != 0; left_ec = (l[0] + l[1]) != 0;
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant,
&above_ec, &left_ec, TX_8X8); &above_ec, &left_ec, TX_8X8, 64);
a[0] = a[1] = above_ec; a[0] = a[1] = above_ec;
l[0] = l[1] = left_ec; l[0] = l[1] = left_ec;
} }
@ -1094,7 +1096,7 @@ void vp9_optimize_sbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
a = ta + vp9_block2above_sb[TX_4X4][b]; a = ta + vp9_block2above_sb[TX_4X4][b];
l = tl + vp9_block2left_sb[TX_4X4][b]; l = tl + vp9_block2left_sb[TX_4X4][b];
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant,
a, l, TX_4X4); a, l, TX_4X4, 64);
} }
} }
@ -1118,7 +1120,7 @@ void vp9_optimize_sb64y_32x32(VP9_COMMON *const cm, MACROBLOCK *x) {
const int x_idx = n & 1, y_idx = n >> 1; const int x_idx = n & 1, y_idx = n >> 1;
optimize_b(cm, x, n * 64, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, n * 64, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
ta + x_idx, tl + y_idx, TX_32X32); ta + x_idx, tl + y_idx, TX_32X32, 256);
} }
} }
@ -1146,7 +1148,7 @@ void vp9_optimize_sb64y_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
const int x_idx = n & 3, y_idx = n >> 2; const int x_idx = n & 3, y_idx = n >> 2;
optimize_b(cm, x, n * 16, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, n * 16, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
ta + x_idx, tl + y_idx, TX_16X16); ta + x_idx, tl + y_idx, TX_16X16, 256);
} }
} }
@ -1182,7 +1184,7 @@ void vp9_optimize_sb64y_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
const int x_idx = n & 7, y_idx = n >> 3; const int x_idx = n & 7, y_idx = n >> 3;
optimize_b(cm, x, n * 4, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, n * 4, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
ta + x_idx, tl + y_idx, TX_8X8); ta + x_idx, tl + y_idx, TX_8X8, 256);
} }
} }
@ -1202,7 +1204,7 @@ void vp9_optimize_sb64y_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
const int x_idx = n & 15, y_idx = n >> 4; const int x_idx = n & 15, y_idx = n >> 4;
optimize_b(cm, x, n, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant, optimize_b(cm, x, n, PLANE_TYPE_Y_WITH_DC, x->e_mbd.block[0].dequant,
ta + x_idx, tl + y_idx, TX_4X4); ta + x_idx, tl + y_idx, TX_4X4, 256);
} }
} }
@ -1225,7 +1227,7 @@ void vp9_optimize_sb64uv_32x32(VP9_COMMON *const cm, MACROBLOCK *x) {
a_ec = (a[0] + a[1] + a1[0] + a1[1] + a2[0] + a2[1] + a3[0] + a3[1]) != 0; a_ec = (a[0] + a[1] + a1[0] + a1[1] + a2[0] + a2[1] + a3[0] + a3[1]) != 0;
l_ec = (l[0] + l[1] + l1[0] + l1[1] + l2[0] + l2[1] + l3[0] + l3[1]) != 0; l_ec = (l[0] + l[1] + l1[0] + l1[1] + l2[0] + l2[1] + l3[0] + l3[1]) != 0;
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant,
&a_ec, &l_ec, TX_32X32); &a_ec, &l_ec, TX_32X32, 256);
} }
} }
@ -1247,7 +1249,7 @@ void vp9_optimize_sb64uv_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
above_ec = (a[0] + a[1] + a1[0] + a1[1]) != 0; above_ec = (a[0] + a[1] + a1[0] + a1[1]) != 0;
left_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0; left_ec = (l[0] + l[1] + l1[0] + l1[1]) != 0;
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant,
&above_ec, &left_ec, TX_16X16); &above_ec, &left_ec, TX_16X16, 256);
a[0] = a[1] = a1[0] = a1[1] = above_ec; a[0] = a[1] = a1[0] = a1[1] = above_ec;
l[0] = l[1] = l1[0] = l1[1] = left_ec; l[0] = l[1] = l1[0] = l1[1] = left_ec;
} }
@ -1269,7 +1271,7 @@ void vp9_optimize_sb64uv_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
above_ec = (a[0] + a[1]) != 0; above_ec = (a[0] + a[1]) != 0;
left_ec = (l[0] + l[1]) != 0; left_ec = (l[0] + l[1]) != 0;
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant,
&above_ec, &left_ec, TX_8X8); &above_ec, &left_ec, TX_8X8, 256);
a[0] = a[1] = above_ec; a[0] = a[1] = above_ec;
l[0] = l[1] = left_ec; l[0] = l[1] = left_ec;
} }
@ -1289,7 +1291,7 @@ void vp9_optimize_sb64uv_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
a = ta + vp9_block2above_sb64[TX_4X4][b]; a = ta + vp9_block2above_sb64[TX_4X4][b];
l = tl + vp9_block2left_sb64[TX_4X4][b]; l = tl + vp9_block2left_sb64[TX_4X4][b];
optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant, optimize_b(cm, x, b, PLANE_TYPE_UV, x->e_mbd.block[cidx].dequant,
a, l, TX_4X4); a, l, TX_4X4, 256);
} }
} }

View File

@ -21,14 +21,9 @@
extern int enc_debug; extern int enc_debug;
#endif #endif
static INLINE int plane_idx(MACROBLOCKD *xd, int b_idx) { static INLINE int plane_idx(int plane) {
const BLOCK_SIZE_TYPE sb_type = xd->mode_info_context->mbmi.sb_type; return plane == 0 ? 0 :
if (b_idx < (16 << (sb_type * 2))) plane == 1 ? 16 : 20;
return 0; // Y
else if (b_idx < (20 << (sb_type * 2)))
return 16; // U
assert(b_idx < (24 << (sb_type * 2)));
return 20; // V
} }
void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) { void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
@ -54,7 +49,6 @@ void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
int nzc = 0; int nzc = 0;
#endif #endif
assert(plane_idx(xd, b_idx) == 0);
switch (tx_type) { switch (tx_type) {
case ADST_DCT: case ADST_DCT:
pt_scan = vp9_row_scan_4x4; pt_scan = vp9_row_scan_4x4;
@ -102,16 +96,16 @@ void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
} }
} }
xd->eobs[b_idx] = eob + 1; xd->plane[0].eobs[b_idx] = eob + 1;
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
xd->nzcs[b_idx] = nzc; xd->nzcs[b_idx] = nzc;
#endif #endif
} }
void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx) { void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, int y_blocks) {
MACROBLOCKD *const xd = &mb->e_mbd; MACROBLOCKD *const xd = &mb->e_mbd;
const int c_idx = plane_idx(xd, b_idx); const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
const struct plane_block_idx pb_idx = plane_block_idx(xd, b_idx); const int c_idx = plane_idx(pb_idx.plane);
BLOCK *const b = &mb->block[c_idx]; BLOCK *const b = &mb->block[c_idx];
BLOCKD *const d = &xd->block[c_idx]; BLOCKD *const d = &xd->block[c_idx];
int i, rc, eob; int i, rc, eob;
@ -133,6 +127,9 @@ void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx) {
int nzc = 0; int nzc = 0;
#endif #endif
if (c_idx == 0) assert(pb_idx.plane == 0);
if (c_idx == 16) assert(pb_idx.plane == 1);
if (c_idx == 20) assert(pb_idx.plane == 2);
vpx_memset(qcoeff_ptr, 0, 32); vpx_memset(qcoeff_ptr, 0, 32);
vpx_memset(dqcoeff_ptr, 0, 32); vpx_memset(dqcoeff_ptr, 0, 32);
@ -169,7 +166,7 @@ void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx) {
} }
} }
xd->eobs[b_idx] = eob + 1; xd->plane[pb_idx.plane].eobs[pb_idx.block] = eob + 1;
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
xd->nzcs[b_idx] = nzc; xd->nzcs[b_idx] = nzc;
#endif #endif
@ -183,7 +180,7 @@ void vp9_quantize_mby_4x4(MACROBLOCK *x) {
if (tx_type != DCT_DCT) { if (tx_type != DCT_DCT) {
vp9_ht_quantize_b_4x4(x, i, tx_type); vp9_ht_quantize_b_4x4(x, i, tx_type);
} else { } else {
x->quantize_b_4x4(x, i); x->quantize_b_4x4(x, i, 16);
} }
} }
} }
@ -195,7 +192,7 @@ void vp9_quantize_mbuv_4x4(MACROBLOCK *x) {
xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_MB16X16; xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_MB16X16;
for (i = 16; i < 24; i++) for (i = 16; i < 24; i++)
x->quantize_b_4x4(x, i); x->quantize_b_4x4(x, i, 16);
xd->mode_info_context->mbmi.sb_type = real_sb_type; xd->mode_info_context->mbmi.sb_type = real_sb_type;
} }
@ -204,10 +201,11 @@ void vp9_quantize_mb_4x4(MACROBLOCK *x) {
vp9_quantize_mbuv_4x4(x); vp9_quantize_mbuv_4x4(x);
} }
void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) { void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
int y_blocks) {
MACROBLOCKD *const xd = &mb->e_mbd; MACROBLOCKD *const xd = &mb->e_mbd;
const struct plane_block_idx pb_idx = plane_block_idx(xd, b_idx); const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
const int c_idx = plane_idx(xd, b_idx); const int c_idx = plane_idx(pb_idx.plane);
int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff,
pb_idx.block, 16); pb_idx.block, 16);
int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, int16_t *dqcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff,
@ -228,6 +226,9 @@ void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
break; break;
} }
if (c_idx == 0) assert(pb_idx.plane == 0);
if (c_idx == 16) assert(pb_idx.plane == 1);
if (c_idx == 20) assert(pb_idx.plane == 2);
vpx_memset(qcoeff_ptr, 0, 64 * sizeof(int16_t)); vpx_memset(qcoeff_ptr, 0, 64 * sizeof(int16_t));
vpx_memset(dqcoeff_ptr, 0, 64 * sizeof(int16_t)); vpx_memset(dqcoeff_ptr, 0, 64 * sizeof(int16_t));
@ -306,12 +307,12 @@ void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
} }
} }
} }
xd->eobs[b_idx] = eob + 1; xd->plane[pb_idx.plane].eobs[pb_idx.block] = eob + 1;
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
xd->nzcs[b_idx] = nzc; xd->nzcs[b_idx] = nzc;
#endif #endif
} else { } else {
xd->eobs[b_idx] = 0; xd->plane[pb_idx.plane].eobs[pb_idx.block] = 0;
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
xd->nzcs[b_idx] = 0; xd->nzcs[b_idx] = 0;
#endif #endif
@ -328,7 +329,7 @@ void vp9_quantize_mby_8x8(MACROBLOCK *x) {
#endif #endif
for (i = 0; i < 16; i += 4) { for (i = 0; i < 16; i += 4) {
TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd, (i & 8) + ((i & 4) >> 1)); TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd, (i & 8) + ((i & 4) >> 1));
x->quantize_b_8x8(x, i, tx_type); x->quantize_b_8x8(x, i, tx_type, 16);
} }
} }
@ -344,7 +345,7 @@ void vp9_quantize_mbuv_8x8(MACROBLOCK *x) {
} }
#endif #endif
for (i = 16; i < 24; i += 4) for (i = 16; i < 24; i += 4)
x->quantize_b_8x8(x, i, DCT_DCT); x->quantize_b_8x8(x, i, DCT_DCT, 16);
xd->mode_info_context->mbmi.sb_type = real_sb_type; xd->mode_info_context->mbmi.sb_type = real_sb_type;
} }
@ -361,7 +362,7 @@ void vp9_quantize_mby_16x16(MACROBLOCK *x) {
x->e_mbd.nzcs[i] = 0; x->e_mbd.nzcs[i] = 0;
} }
#endif #endif
x->quantize_b_16x16(x, 0, tx_type); x->quantize_b_16x16(x, 0, tx_type, 16);
} }
void vp9_quantize_mb_16x16(MACROBLOCK *x) { void vp9_quantize_mb_16x16(MACROBLOCK *x) {
@ -430,10 +431,11 @@ static void quantize(int16_t *zbin_boost_orig_ptr,
#endif #endif
} }
void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) { void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
int y_blocks) {
MACROBLOCKD *const xd = &mb->e_mbd; MACROBLOCKD *const xd = &mb->e_mbd;
const int c_idx = plane_idx(xd, b_idx); const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
const struct plane_block_idx pb_idx = plane_block_idx(xd, b_idx); const int c_idx = plane_idx(pb_idx.plane);
BLOCK *const b = &mb->block[c_idx]; BLOCK *const b = &mb->block[c_idx];
BLOCKD *const d = &xd->block[c_idx]; BLOCKD *const d = &xd->block[c_idx];
const int *pt_scan; const int *pt_scan;
@ -450,6 +452,9 @@ void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
break; break;
} }
if (c_idx == 0) assert(pb_idx.plane == 0);
if (c_idx == 16) assert(pb_idx.plane == 1);
if (c_idx == 20) assert(pb_idx.plane == 2);
quantize(b->zrun_zbin_boost, quantize(b->zrun_zbin_boost,
mb->coeff + 16 * b_idx, mb->coeff + 16 * b_idx,
256, b->skip_block, 256, b->skip_block,
@ -458,20 +463,23 @@ void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type) {
BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16), BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16),
d->dequant, d->dequant,
b->zbin_extra, b->zbin_extra,
&xd->eobs[b_idx], &xd->plane[pb_idx.plane].eobs[pb_idx.block],
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
&xd->nzcs[b_idx], &xd->nzcs[b_idx],
#endif #endif
pt_scan, 1); pt_scan, 1);
} }
void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx) { void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx, int y_blocks) {
MACROBLOCKD *const xd = &mb->e_mbd; MACROBLOCKD *const xd = &mb->e_mbd;
const int c_idx = plane_idx(xd, b_idx); const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, b_idx);
const struct plane_block_idx pb_idx = plane_block_idx(xd, b_idx); const int c_idx = plane_idx(pb_idx.plane);
BLOCK *const b = &mb->block[c_idx]; BLOCK *const b = &mb->block[c_idx];
BLOCKD *const d = &xd->block[c_idx]; BLOCKD *const d = &xd->block[c_idx];
if (c_idx == 0) assert(pb_idx.plane == 0);
if (c_idx == 16) assert(pb_idx.plane == 1);
if (c_idx == 20) assert(pb_idx.plane == 2);
quantize(b->zrun_zbin_boost, quantize(b->zrun_zbin_boost,
mb->coeff + b_idx * 16, mb->coeff + b_idx * 16,
1024, b->skip_block, 1024, b->skip_block,
@ -481,7 +489,7 @@ void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx) {
BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16), BLOCK_OFFSET(xd->plane[pb_idx.plane].dqcoeff, pb_idx.block, 16),
d->dequant, d->dequant,
b->zbin_extra, b->zbin_extra,
&xd->eobs[b_idx], &xd->plane[pb_idx.plane].eobs[pb_idx.block],
#if CONFIG_CODE_NONZEROCOUNT #if CONFIG_CODE_NONZEROCOUNT
&xd->nzcs[b_idx], &xd->nzcs[b_idx],
#endif #endif
@ -489,7 +497,7 @@ void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx) {
} }
void vp9_quantize_sby_32x32(MACROBLOCK *x) { void vp9_quantize_sby_32x32(MACROBLOCK *x) {
vp9_regular_quantize_b_32x32(x, 0); vp9_regular_quantize_b_32x32(x, 0, 64);
} }
void vp9_quantize_sby_16x16(MACROBLOCK *x) { void vp9_quantize_sby_16x16(MACROBLOCK *x) {
@ -498,7 +506,7 @@ void vp9_quantize_sby_16x16(MACROBLOCK *x) {
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
TX_TYPE tx_type = get_tx_type_16x16(&x->e_mbd, TX_TYPE tx_type = get_tx_type_16x16(&x->e_mbd,
(16 * (n & 2)) + ((n & 1) * 4)); (16 * (n & 2)) + ((n & 1) * 4));
x->quantize_b_16x16(x, n * 16, tx_type); x->quantize_b_16x16(x, n * 16, tx_type, 64);
} }
} }
@ -508,7 +516,7 @@ void vp9_quantize_sby_8x8(MACROBLOCK *x) {
for (n = 0; n < 16; n++) { for (n = 0; n < 16; n++) {
TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd, TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd,
(4 * (n & 12)) + ((n & 3) * 2)); (4 * (n & 12)) + ((n & 3) * 2));
x->quantize_b_8x8(x, n * 4, tx_type); x->quantize_b_8x8(x, n * 4, tx_type, 64);
} }
} }
@ -521,35 +529,35 @@ void vp9_quantize_sby_4x4(MACROBLOCK *x) {
if (tx_type != DCT_DCT) { if (tx_type != DCT_DCT) {
vp9_ht_quantize_b_4x4(x, n, tx_type); vp9_ht_quantize_b_4x4(x, n, tx_type);
} else { } else {
x->quantize_b_4x4(x, n); x->quantize_b_4x4(x, n, 64);
} }
} }
} }
void vp9_quantize_sbuv_16x16(MACROBLOCK *x) { void vp9_quantize_sbuv_16x16(MACROBLOCK *x) {
x->quantize_b_16x16(x, 64, DCT_DCT); x->quantize_b_16x16(x, 64, DCT_DCT, 64);
x->quantize_b_16x16(x, 80, DCT_DCT); x->quantize_b_16x16(x, 80, DCT_DCT, 64);
} }
void vp9_quantize_sbuv_8x8(MACROBLOCK *x) { void vp9_quantize_sbuv_8x8(MACROBLOCK *x) {
int i; int i;
for (i = 64; i < 96; i += 4) for (i = 64; i < 96; i += 4)
x->quantize_b_8x8(x, i, DCT_DCT); x->quantize_b_8x8(x, i, DCT_DCT, 64);
} }
void vp9_quantize_sbuv_4x4(MACROBLOCK *x) { void vp9_quantize_sbuv_4x4(MACROBLOCK *x) {
int i; int i;
for (i = 64; i < 96; i++) for (i = 64; i < 96; i++)
x->quantize_b_4x4(x, i); x->quantize_b_4x4(x, i, 64);
} }
void vp9_quantize_sb64y_32x32(MACROBLOCK *x) { void vp9_quantize_sb64y_32x32(MACROBLOCK *x) {
int n; int n;
for (n = 0; n < 4; n++) for (n = 0; n < 4; n++)
vp9_regular_quantize_b_32x32(x, n * 64); vp9_regular_quantize_b_32x32(x, n * 64, 256);
} }
void vp9_quantize_sb64y_16x16(MACROBLOCK *x) { void vp9_quantize_sb64y_16x16(MACROBLOCK *x) {
@ -558,7 +566,7 @@ void vp9_quantize_sb64y_16x16(MACROBLOCK *x) {
for (n = 0; n < 16; n++) { for (n = 0; n < 16; n++) {
TX_TYPE tx_type = get_tx_type_16x16(&x->e_mbd, TX_TYPE tx_type = get_tx_type_16x16(&x->e_mbd,
(16 * (n & 12)) + ((n & 3) * 4)); (16 * (n & 12)) + ((n & 3) * 4));
x->quantize_b_16x16(x, n * 16, tx_type); x->quantize_b_16x16(x, n * 16, tx_type, 256);
} }
} }
@ -568,7 +576,7 @@ void vp9_quantize_sb64y_8x8(MACROBLOCK *x) {
for (n = 0; n < 64; n++) { for (n = 0; n < 64; n++) {
TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd, TX_TYPE tx_type = get_tx_type_8x8(&x->e_mbd,
(4 * (n & 56)) + ((n & 7) * 2)); (4 * (n & 56)) + ((n & 7) * 2));
x->quantize_b_8x8(x, n * 4, tx_type); x->quantize_b_8x8(x, n * 4, tx_type, 256);
} }
} }
@ -581,44 +589,45 @@ void vp9_quantize_sb64y_4x4(MACROBLOCK *x) {
if (tx_type != DCT_DCT) { if (tx_type != DCT_DCT) {
vp9_ht_quantize_b_4x4(x, n, tx_type); vp9_ht_quantize_b_4x4(x, n, tx_type);
} else { } else {
x->quantize_b_4x4(x, n); x->quantize_b_4x4(x, n, 256);
} }
} }
} }
void vp9_quantize_sb64uv_32x32(MACROBLOCK *x) { void vp9_quantize_sb64uv_32x32(MACROBLOCK *x) {
vp9_regular_quantize_b_32x32(x, 256); vp9_regular_quantize_b_32x32(x, 256, 256);
vp9_regular_quantize_b_32x32(x, 320); vp9_regular_quantize_b_32x32(x, 320, 256);
} }
void vp9_quantize_sb64uv_16x16(MACROBLOCK *x) { void vp9_quantize_sb64uv_16x16(MACROBLOCK *x) {
int i; int i;
for (i = 256; i < 384; i += 16) for (i = 256; i < 384; i += 16)
x->quantize_b_16x16(x, i, DCT_DCT); x->quantize_b_16x16(x, i, DCT_DCT, 256);
} }
void vp9_quantize_sb64uv_8x8(MACROBLOCK *x) { void vp9_quantize_sb64uv_8x8(MACROBLOCK *x) {
int i; int i;
for (i = 256; i < 384; i += 4) for (i = 256; i < 384; i += 4)
x->quantize_b_8x8(x, i, DCT_DCT); x->quantize_b_8x8(x, i, DCT_DCT, 256);
} }
void vp9_quantize_sb64uv_4x4(MACROBLOCK *x) { void vp9_quantize_sb64uv_4x4(MACROBLOCK *x) {
int i; int i;
for (i = 256; i < 384; i++) for (i = 256; i < 384; i++)
x->quantize_b_4x4(x, i); x->quantize_b_4x4(x, i, 256);
} }
/* quantize_b_pair function pointer in MACROBLOCK structure is set to one of /* quantize_b_pair function pointer in MACROBLOCK structure is set to one of
* these two C functions if corresponding optimized routine is not available. * these two C functions if corresponding optimized routine is not available.
* NEON optimized version implements currently the fast quantization for pair * NEON optimized version implements currently the fast quantization for pair
* of blocks. */ * of blocks. */
void vp9_regular_quantize_b_4x4_pair(MACROBLOCK *x, int b_idx1, int b_idx2) { void vp9_regular_quantize_b_4x4_pair(MACROBLOCK *x, int b_idx1, int b_idx2,
vp9_regular_quantize_b_4x4(x, b_idx1); int y_blocks) {
vp9_regular_quantize_b_4x4(x, b_idx2); vp9_regular_quantize_b_4x4(x, b_idx1, y_blocks);
vp9_regular_quantize_b_4x4(x, b_idx2, y_blocks);
} }
static void invert_quant(int16_t *quant, uint8_t *shift, int d) { static void invert_quant(int16_t *quant, uint8_t *shift, int d) {

View File

@ -27,11 +27,15 @@
#endif #endif
void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_ix, TX_TYPE type); void vp9_ht_quantize_b_4x4(MACROBLOCK *mb, int b_ix, TX_TYPE type);
void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx); void vp9_regular_quantize_b_4x4(MACROBLOCK *mb, int b_idx, int y_blocks);
void vp9_regular_quantize_b_4x4_pair(MACROBLOCK *mb, int b_idx1, int b_idx2); void vp9_regular_quantize_b_4x4_pair(MACROBLOCK *mb, int b_idx1, int b_idx2,
void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type); int y_blocks);
void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type); void vp9_regular_quantize_b_8x8(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx); int y_blocks);
void vp9_regular_quantize_b_16x16(MACROBLOCK *mb, int b_idx, TX_TYPE tx_type,
int y_blocks);
void vp9_regular_quantize_b_32x32(MACROBLOCK *mb, int b_idx,
int y_blocks);
void vp9_quantize_mb_4x4(MACROBLOCK *x); void vp9_quantize_mb_4x4(MACROBLOCK *x);
void vp9_quantize_mb_8x8(MACROBLOCK *x); void vp9_quantize_mb_8x8(MACROBLOCK *x);

View File

@ -431,15 +431,16 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
int ib, PLANE_TYPE type, int ib, PLANE_TYPE type,
ENTROPY_CONTEXT *a, ENTROPY_CONTEXT *a,
ENTROPY_CONTEXT *l, ENTROPY_CONTEXT *l,
TX_SIZE tx_size) { TX_SIZE tx_size,
int y_blocks) {
MACROBLOCKD *const xd = &mb->e_mbd; MACROBLOCKD *const xd = &mb->e_mbd;
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi; MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
int pt; int pt;
const int eob = xd->eobs[ib];
int c = 0; int c = 0;
int cost = 0, pad; int cost = 0, pad;
const int *scan, *nb; const int *scan, *nb;
const struct plane_block_idx pb_idx = plane_block_idx(xd, ib); const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, ib);
const int eob = xd->plane[pb_idx.plane].eobs[pb_idx.block];
const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff,
pb_idx.block, 16); pb_idx.block, 16);
const int ref = mbmi->ref_frame != INTRA_FRAME; const int ref = mbmi->ref_frame != INTRA_FRAME;
@ -463,6 +464,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
uint8_t token_cache[1024]; uint8_t token_cache[1024];
// Check for consistency of tx_size with mode info // Check for consistency of tx_size with mode info
assert((!type && !pb_idx.plane) || (type && pb_idx.plane));
if (type == PLANE_TYPE_Y_WITH_DC) { if (type == PLANE_TYPE_Y_WITH_DC) {
assert(xd->mode_info_context->mbmi.txfm_size == tx_size); assert(xd->mode_info_context->mbmi.txfm_size == tx_size);
} else { } else {
@ -565,6 +567,7 @@ static INLINE int cost_coeffs(VP9_COMMON *const cm, MACROBLOCK *mb,
abort(); abort();
break; break;
} }
assert(eob <= seg_eob);
VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec); VP9_COMBINEENTROPYCONTEXTS(pt, a_ec, l_ec);
nb = vp9_get_coef_neighbors_handle(scan, &pad); nb = vp9_get_coef_neighbors_handle(scan, &pad);
@ -647,7 +650,7 @@ static int rdcost_mby_4x4(VP9_COMMON *const cm, MACROBLOCK *mb) {
cost += cost_coeffs(cm, mb, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, mb, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_4X4][b], ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b], tl + vp9_block2left[TX_4X4][b],
TX_4X4); TX_4X4, 16);
return cost; return cost;
} }
@ -683,7 +686,7 @@ static int rdcost_mby_8x8(VP9_COMMON *const cm, MACROBLOCK *mb) {
cost += cost_coeffs(cm, mb, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, mb, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_8X8][b], ta + vp9_block2above[TX_8X8][b],
tl + vp9_block2left[TX_8X8][b], tl + vp9_block2left[TX_8X8][b],
TX_8X8); TX_8X8, 16);
return cost; return cost;
} }
@ -713,7 +716,7 @@ static int rdcost_mby_16x16(VP9_COMMON *const cm, MACROBLOCK *mb) {
vpx_memcpy(&t_above, xd->above_context, sizeof(t_above)); vpx_memcpy(&t_above, xd->above_context, sizeof(t_above));
vpx_memcpy(&t_left, xd->left_context, sizeof(t_left)); vpx_memcpy(&t_left, xd->left_context, sizeof(t_left));
return cost_coeffs(cm, mb, 0, PLANE_TYPE_Y_WITH_DC, ta, tl, TX_16X16); return cost_coeffs(cm, mb, 0, PLANE_TYPE_Y_WITH_DC, ta, tl, TX_16X16, 16);
} }
static void macro_block_yrd_16x16(VP9_COMMON *const cm, MACROBLOCK *mb, static void macro_block_yrd_16x16(VP9_COMMON *const cm, MACROBLOCK *mb,
@ -894,7 +897,7 @@ static int rdcost_sby_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 64; b++) for (b = 0; b < 64; b++)
cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above_sb[TX_4X4][b], ta + vp9_block2above_sb[TX_4X4][b],
tl + vp9_block2left_sb[TX_4X4][b], TX_4X4); tl + vp9_block2left_sb[TX_4X4][b], TX_4X4, 64);
return cost; return cost;
} }
@ -925,7 +928,7 @@ static int rdcost_sby_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 64; b += 4) for (b = 0; b < 64; b += 4)
cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above_sb[TX_8X8][b], ta + vp9_block2above_sb[TX_8X8][b],
tl + vp9_block2left_sb[TX_8X8][b], TX_8X8); tl + vp9_block2left_sb[TX_8X8][b], TX_8X8, 64);
return cost; return cost;
} }
@ -956,7 +959,7 @@ static int rdcost_sby_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 64; b += 16) for (b = 0; b < 64; b += 16)
cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above_sb[TX_16X16][b], ta + vp9_block2above_sb[TX_16X16][b],
tl + vp9_block2left_sb[TX_16X16][b], TX_16X16); tl + vp9_block2left_sb[TX_16X16][b], TX_16X16, 64);
return cost; return cost;
} }
@ -983,7 +986,7 @@ static int rdcost_sby_32x32(VP9_COMMON *const cm, MACROBLOCK *x) {
vpx_memcpy(&t_above, xd->above_context, sizeof(t_above)); vpx_memcpy(&t_above, xd->above_context, sizeof(t_above));
vpx_memcpy(&t_left, xd->left_context, sizeof(t_left)); vpx_memcpy(&t_left, xd->left_context, sizeof(t_left));
return cost_coeffs(cm, x, 0, PLANE_TYPE_Y_WITH_DC, ta, tl, TX_32X32); return cost_coeffs(cm, x, 0, PLANE_TYPE_Y_WITH_DC, ta, tl, TX_32X32, 64);
} }
static void super_block_yrd_32x32(VP9_COMMON *const cm, MACROBLOCK *x, static void super_block_yrd_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
@ -1032,7 +1035,7 @@ static int rdcost_sb64y_4x4(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 256; b++) for (b = 0; b < 256; b++)
cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above_sb64[TX_4X4][b], ta + vp9_block2above_sb64[TX_4X4][b],
tl + vp9_block2left_sb64[TX_4X4][b], TX_4X4); tl + vp9_block2left_sb64[TX_4X4][b], TX_4X4, 256);
return cost; return cost;
} }
@ -1063,7 +1066,7 @@ static int rdcost_sb64y_8x8(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 256; b += 4) for (b = 0; b < 256; b += 4)
cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above_sb64[TX_8X8][b], ta + vp9_block2above_sb64[TX_8X8][b],
tl + vp9_block2left_sb64[TX_8X8][b], TX_8X8); tl + vp9_block2left_sb64[TX_8X8][b], TX_8X8, 256);
return cost; return cost;
} }
@ -1094,7 +1097,7 @@ static int rdcost_sb64y_16x16(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 256; b += 16) for (b = 0; b < 256; b += 16)
cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above_sb64[TX_16X16][b], ta + vp9_block2above_sb64[TX_16X16][b],
tl + vp9_block2left_sb64[TX_16X16][b], TX_16X16); tl + vp9_block2left_sb64[TX_16X16][b], TX_16X16, 256);
return cost; return cost;
} }
@ -1126,7 +1129,7 @@ static int rdcost_sb64y_32x32(VP9_COMMON *const cm, MACROBLOCK *x) {
for (b = 0; b < 256; b += 64) for (b = 0; b < 256; b += 64)
cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC, cost += cost_coeffs(cm, x, b, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above_sb64[TX_32X32][b], ta + vp9_block2above_sb64[TX_32X32][b],
tl + vp9_block2left_sb64[TX_32X32][b], TX_32X32); tl + vp9_block2left_sb64[TX_32X32][b], TX_32X32, 256);
return cost; return cost;
} }
@ -1250,14 +1253,14 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
vp9_ht_quantize_b_4x4(x, be - x->block, tx_type); vp9_ht_quantize_b_4x4(x, be - x->block, tx_type);
} else { } else {
x->fwd_txm4x4(be->src_diff, be->coeff, 32); x->fwd_txm4x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4(x, be - x->block); x->quantize_b_4x4(x, be - x->block, 16);
} }
tempa = ta; tempa = ta;
templ = tl; templ = tl;
ratey = cost_coeffs(cm, x, b - xd->block, ratey = cost_coeffs(cm, x, b - xd->block,
PLANE_TYPE_Y_WITH_DC, &tempa, &templ, TX_4X4); PLANE_TYPE_Y_WITH_DC, &tempa, &templ, TX_4X4, 16);
rate += ratey; rate += ratey;
distortion = vp9_block_error(be->coeff, distortion = vp9_block_error(be->coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16), BLOCK_OFFSET(xd->plane[0].dqcoeff, ib, 16),
@ -1551,7 +1554,7 @@ static int64_t rd_pick_intra8x8block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
vp9_short_fht8x8(be->src_diff, (x->block + idx)->coeff, 16, tx_type); vp9_short_fht8x8(be->src_diff, (x->block + idx)->coeff, 16, tx_type);
else else
x->fwd_txm8x8(be->src_diff, (x->block + idx)->coeff, 32); x->fwd_txm8x8(be->src_diff, (x->block + idx)->coeff, 32);
x->quantize_b_8x8(x, idx, tx_type); x->quantize_b_8x8(x, idx, tx_type, 16);
// compute quantization mse of 8x8 block // compute quantization mse of 8x8 block
distortion = vp9_block_error_c((x->block + idx)->coeff, distortion = vp9_block_error_c((x->block + idx)->coeff,
@ -1566,7 +1569,7 @@ static int64_t rd_pick_intra8x8block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
tl1 = tl0 + 1; tl1 = tl0 + 1;
rate_t = cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC, rate_t = cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC,
ta0, tl0, TX_8X8); ta0, tl0, TX_8X8, 16);
rate += rate_t; rate += rate_t;
} else { } else {
@ -1592,23 +1595,23 @@ static int64_t rd_pick_intra8x8block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
} else if (!(i & 1) && } else if (!(i & 1) &&
get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) { get_tx_type_4x4(xd, ib + iblock[i] + 1) == DCT_DCT) {
x->fwd_txm8x4(be->src_diff, be->coeff, 32); x->fwd_txm8x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1); x->quantize_b_4x4_pair(x, ib + iblock[i], ib + iblock[i] + 1, 16);
do_two = 1; do_two = 1;
} else { } else {
x->fwd_txm4x4(be->src_diff, be->coeff, 32); x->fwd_txm4x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4(x, ib + iblock[i]); x->quantize_b_4x4(x, ib + iblock[i], 16);
} }
distortion += vp9_block_error_c(be->coeff, distortion += vp9_block_error_c(be->coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[i], 16), BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[i], 16),
16 << do_two); 16 << do_two);
rate_t += cost_coeffs(cm, x, ib + iblock[i], PLANE_TYPE_Y_WITH_DC, rate_t += cost_coeffs(cm, x, ib + iblock[i], PLANE_TYPE_Y_WITH_DC,
i&1 ? ta1 : ta0, i&2 ? tl1 : tl0, i&1 ? ta1 : ta0, i&2 ? tl1 : tl0,
TX_4X4); TX_4X4, 16);
if (do_two) { if (do_two) {
i++; i++;
rate_t += cost_coeffs(cm, x, ib + iblock[i], PLANE_TYPE_Y_WITH_DC, rate_t += cost_coeffs(cm, x, ib + iblock[i], PLANE_TYPE_Y_WITH_DC,
i&1 ? ta1 : ta0, i&2 ? tl1 : tl0, i&1 ? ta1 : ta0, i&2 ? tl1 : tl0,
TX_4X4); TX_4X4, 16);
} }
} }
b = &xd->block[ib]; b = &xd->block[ib];
@ -1775,8 +1778,6 @@ static int rd_cost_mbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *mb, int backup) {
MACROBLOCKD *xd = &mb->e_mbd; MACROBLOCKD *xd = &mb->e_mbd;
ENTROPY_CONTEXT_PLANES t_above, t_left; ENTROPY_CONTEXT_PLANES t_above, t_left;
ENTROPY_CONTEXT *ta, *tl; ENTROPY_CONTEXT *ta, *tl;
const BLOCK_SIZE_TYPE real_sb_type = xd->mode_info_context->mbmi.sb_type;
xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_MB16X16;
if (backup) { if (backup) {
vpx_memcpy(&t_above, xd->above_context, sizeof(ENTROPY_CONTEXT_PLANES)); vpx_memcpy(&t_above, xd->above_context, sizeof(ENTROPY_CONTEXT_PLANES));
@ -1793,9 +1794,8 @@ static int rd_cost_mbuv_4x4(VP9_COMMON *const cm, MACROBLOCK *mb, int backup) {
cost += cost_coeffs(cm, mb, b, PLANE_TYPE_UV, cost += cost_coeffs(cm, mb, b, PLANE_TYPE_UV,
ta + vp9_block2above[TX_4X4][b], ta + vp9_block2above[TX_4X4][b],
tl + vp9_block2left[TX_4X4][b], tl + vp9_block2left[TX_4X4][b],
TX_4X4); TX_4X4, 16);
xd->mode_info_context->mbmi.sb_type = real_sb_type;
return cost; return cost;
} }
@ -1819,8 +1819,6 @@ static int rd_cost_mbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *mb, int backup) {
MACROBLOCKD *xd = &mb->e_mbd; MACROBLOCKD *xd = &mb->e_mbd;
ENTROPY_CONTEXT_PLANES t_above, t_left; ENTROPY_CONTEXT_PLANES t_above, t_left;
ENTROPY_CONTEXT *ta, *tl; ENTROPY_CONTEXT *ta, *tl;
const BLOCK_SIZE_TYPE real_sb_type = xd->mode_info_context->mbmi.sb_type;
xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_MB16X16;
if (backup) { if (backup) {
vpx_memcpy(&t_above, xd->above_context, sizeof(ENTROPY_CONTEXT_PLANES)); vpx_memcpy(&t_above, xd->above_context, sizeof(ENTROPY_CONTEXT_PLANES));
@ -1836,9 +1834,8 @@ static int rd_cost_mbuv_8x8(VP9_COMMON *const cm, MACROBLOCK *mb, int backup) {
for (b = 16; b < 24; b += 4) for (b = 16; b < 24; b += 4)
cost += cost_coeffs(cm, mb, b, PLANE_TYPE_UV, cost += cost_coeffs(cm, mb, b, PLANE_TYPE_UV,
ta + vp9_block2above[TX_8X8][b], ta + vp9_block2above[TX_8X8][b],
tl + vp9_block2left[TX_8X8][b], TX_8X8); tl + vp9_block2left[TX_8X8][b], TX_8X8, 16);
xd->mode_info_context->mbmi.sb_type = real_sb_type;
return cost; return cost;
} }
@ -1876,7 +1873,7 @@ static int rd_cost_sbuv_16x16(VP9_COMMON *const cm, MACROBLOCK *x, int backup) {
for (b = 16; b < 24; b += 4) for (b = 16; b < 24; b += 4)
cost += cost_coeffs(cm, x, b * 4, PLANE_TYPE_UV, cost += cost_coeffs(cm, x, b * 4, PLANE_TYPE_UV,
ta + vp9_block2above[TX_8X8][b], ta + vp9_block2above[TX_8X8][b],
tl + vp9_block2left[TX_8X8][b], TX_16X16); tl + vp9_block2left[TX_8X8][b], TX_16X16, 64);
return cost; return cost;
} }
@ -2153,7 +2150,7 @@ static int rd_cost_sb64uv_32x32(VP9_COMMON *const cm, MACROBLOCK *x,
for (b = 16; b < 24; b += 4) for (b = 16; b < 24; b += 4)
cost += cost_coeffs(cm, x, b * 16, PLANE_TYPE_UV, cost += cost_coeffs(cm, x, b * 16, PLANE_TYPE_UV,
ta + vp9_block2above[TX_8X8][b], ta + vp9_block2above[TX_8X8][b],
tl + vp9_block2left[TX_8X8][b], TX_32X32); tl + vp9_block2left[TX_8X8][b], TX_32X32, 256);
return cost; return cost;
} }
@ -2506,13 +2503,13 @@ static int64_t encode_inter_mb_segment(VP9_COMMON *const cm,
vp9_subtract_b(be, bd, 16); vp9_subtract_b(be, bd, 16);
x->fwd_txm4x4(be->src_diff, be->coeff, 32); x->fwd_txm4x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4(x, i); x->quantize_b_4x4(x, i, 16);
thisdistortion = vp9_block_error(be->coeff, thisdistortion = vp9_block_error(be->coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16), 16); BLOCK_OFFSET(xd->plane[0].dqcoeff, i, 16), 16);
*distortion += thisdistortion; *distortion += thisdistortion;
*labelyrate += cost_coeffs(cm, x, i, PLANE_TYPE_Y_WITH_DC, *labelyrate += cost_coeffs(cm, x, i, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_4X4][i], ta + vp9_block2above[TX_4X4][i],
tl + vp9_block2left[TX_4X4][i], TX_4X4); tl + vp9_block2left[TX_4X4][i], TX_4X4, 16);
} }
} }
*distortion >>= 2; *distortion >>= 2;
@ -2574,7 +2571,7 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
if (xd->mode_info_context->mbmi.txfm_size == TX_4X4) { if (xd->mode_info_context->mbmi.txfm_size == TX_4X4) {
if (otherrd) { if (otherrd) {
x->fwd_txm8x8(be->src_diff, be2->coeff, 32); x->fwd_txm8x8(be->src_diff, be2->coeff, 32);
x->quantize_b_8x8(x, idx, DCT_DCT); x->quantize_b_8x8(x, idx, DCT_DCT, 16);
thisdistortion = vp9_block_error_c(be2->coeff, thisdistortion = vp9_block_error_c(be2->coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64); BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
otherdist += thisdistortion; otherdist += thisdistortion;
@ -2582,14 +2579,14 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
othercost += cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC, othercost += cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC,
tacp + vp9_block2above[TX_8X8][idx], tacp + vp9_block2above[TX_8X8][idx],
tlcp + vp9_block2left[TX_8X8][idx], tlcp + vp9_block2left[TX_8X8][idx],
TX_8X8); TX_8X8, 16);
xd->mode_info_context->mbmi.txfm_size = TX_4X4; xd->mode_info_context->mbmi.txfm_size = TX_4X4;
} }
for (j = 0; j < 4; j += 2) { for (j = 0; j < 4; j += 2) {
bd = &xd->block[ib + iblock[j]]; bd = &xd->block[ib + iblock[j]];
be = &x->block[ib + iblock[j]]; be = &x->block[ib + iblock[j]];
x->fwd_txm8x4(be->src_diff, be->coeff, 32); x->fwd_txm8x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1); x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1, 16);
thisdistortion = vp9_block_error_c(be->coeff, thisdistortion = vp9_block_error_c(be->coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32); BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32);
*distortion += thisdistortion; *distortion += thisdistortion;
@ -2597,20 +2594,20 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
cost_coeffs(cm, x, ib + iblock[j], PLANE_TYPE_Y_WITH_DC, cost_coeffs(cm, x, ib + iblock[j], PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_4X4][ib + iblock[j]], ta + vp9_block2above[TX_4X4][ib + iblock[j]],
tl + vp9_block2left[TX_4X4][ib + iblock[j]], tl + vp9_block2left[TX_4X4][ib + iblock[j]],
TX_4X4); TX_4X4, 16);
*labelyrate += *labelyrate +=
cost_coeffs(cm, x, ib + iblock[j] + 1, cost_coeffs(cm, x, ib + iblock[j] + 1,
PLANE_TYPE_Y_WITH_DC, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_4X4][ib + iblock[j] + 1], ta + vp9_block2above[TX_4X4][ib + iblock[j] + 1],
tl + vp9_block2left[TX_4X4][ib + iblock[j]], tl + vp9_block2left[TX_4X4][ib + iblock[j]],
TX_4X4); TX_4X4, 16);
} }
} else /* 8x8 */ { } else /* 8x8 */ {
if (otherrd) { if (otherrd) {
for (j = 0; j < 4; j += 2) { for (j = 0; j < 4; j += 2) {
BLOCK *be = &x->block[ib + iblock[j]]; BLOCK *be = &x->block[ib + iblock[j]];
x->fwd_txm8x4(be->src_diff, be->coeff, 32); x->fwd_txm8x4(be->src_diff, be->coeff, 32);
x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1); x->quantize_b_4x4_pair(x, ib + iblock[j], ib + iblock[j] + 1, 16);
thisdistortion = vp9_block_error_c(be->coeff, thisdistortion = vp9_block_error_c(be->coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32); BLOCK_OFFSET(xd->plane[0].dqcoeff, ib + iblock[j], 16), 32);
otherdist += thisdistortion; otherdist += thisdistortion;
@ -2619,24 +2616,25 @@ static int64_t encode_inter_mb_segment_8x8(VP9_COMMON *const cm,
cost_coeffs(cm, x, ib + iblock[j], PLANE_TYPE_Y_WITH_DC, cost_coeffs(cm, x, ib + iblock[j], PLANE_TYPE_Y_WITH_DC,
tacp + vp9_block2above[TX_4X4][ib + iblock[j]], tacp + vp9_block2above[TX_4X4][ib + iblock[j]],
tlcp + vp9_block2left[TX_4X4][ib + iblock[j]], tlcp + vp9_block2left[TX_4X4][ib + iblock[j]],
TX_4X4); TX_4X4, 16);
othercost += othercost +=
cost_coeffs(cm, x, ib + iblock[j] + 1, cost_coeffs(cm, x, ib + iblock[j] + 1,
PLANE_TYPE_Y_WITH_DC, PLANE_TYPE_Y_WITH_DC,
tacp + vp9_block2above[TX_4X4][ib + iblock[j] + 1], tacp + vp9_block2above[TX_4X4][ib + iblock[j] + 1],
tlcp + vp9_block2left[TX_4X4][ib + iblock[j]], tlcp + vp9_block2left[TX_4X4][ib + iblock[j]],
TX_4X4); TX_4X4, 16);
xd->mode_info_context->mbmi.txfm_size = TX_8X8; xd->mode_info_context->mbmi.txfm_size = TX_8X8;
} }
} }
x->fwd_txm8x8(be->src_diff, be2->coeff, 32); x->fwd_txm8x8(be->src_diff, be2->coeff, 32);
x->quantize_b_8x8(x, idx, DCT_DCT); x->quantize_b_8x8(x, idx, DCT_DCT, 16);
thisdistortion = vp9_block_error_c(be2->coeff, thisdistortion = vp9_block_error_c(be2->coeff,
BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64); BLOCK_OFFSET(xd->plane[0].dqcoeff, idx, 16), 64);
*distortion += thisdistortion; *distortion += thisdistortion;
*labelyrate += cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC, *labelyrate += cost_coeffs(cm, x, idx, PLANE_TYPE_Y_WITH_DC,
ta + vp9_block2above[TX_8X8][idx], ta + vp9_block2above[TX_8X8][idx],
tl + vp9_block2left[TX_8X8][idx], TX_8X8); tl + vp9_block2left[TX_8X8][idx], TX_8X8,
16);
} }
} }
} }
@ -2896,13 +2894,13 @@ static void rd_check_segment_txsize(VP9_COMP *cpi, MACROBLOCK *x,
if (x->e_mbd.mode_info_context->mbmi.txfm_size == TX_4X4) { if (x->e_mbd.mode_info_context->mbmi.txfm_size == TX_4X4) {
for (j = 0; j < 16; j++) for (j = 0; j < 16; j++)
if (labels[j] == i) if (labels[j] == i)
best_eobs[j] = x->e_mbd.eobs[j]; best_eobs[j] = x->e_mbd.plane[0].eobs[j];
} else { } else {
for (j = 0; j < 4; j++) { for (j = 0; j < 4; j++) {
int ib = vp9_i8x8_block[j], idx = j * 4; int ib = vp9_i8x8_block[j], idx = j * 4;
if (labels[ib] == i) if (labels[ib] == i)
best_eobs[idx] = x->e_mbd.eobs[idx]; best_eobs[idx] = x->e_mbd.plane[0].eobs[idx];
} }
} }
if (other_rd < best_other_rd) if (other_rd < best_other_rd)
@ -3177,7 +3175,7 @@ static int rd_pick_best_mbsegmentation(VP9_COMP *cpi, MACROBLOCK *x,
bd->bmi.as_mv[0].as_int = bsi.mvs[i].as_int; bd->bmi.as_mv[0].as_int = bsi.mvs[i].as_int;
if (mbmi->second_ref_frame > 0) if (mbmi->second_ref_frame > 0)
bd->bmi.as_mv[1].as_int = bsi.second_mvs[i].as_int; bd->bmi.as_mv[1].as_int = bsi.second_mvs[i].as_int;
x->e_mbd.eobs[i] = bsi.eobs[i]; x->e_mbd.plane[0].eobs[i] = bsi.eobs[i];
} }
*returntotrate = bsi.r; *returntotrate = bsi.r;

View File

@ -117,13 +117,14 @@ static void tokenize_b(VP9_COMP *cpi,
TOKENEXTRA **tp, TOKENEXTRA **tp,
PLANE_TYPE type, PLANE_TYPE type,
TX_SIZE tx_size, TX_SIZE tx_size,
int y_blocks,
int dry_run) { int dry_run) {
MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi; MB_MODE_INFO *mbmi = &xd->mode_info_context->mbmi;
int pt; /* near block/prev token context index */ int pt; /* near block/prev token context index */
int c = 0; int c = 0;
const int eob = xd->eobs[ib]; /* one beyond last nonzero coeff */
TOKENEXTRA *t = *tp; /* store tokens starting here */ TOKENEXTRA *t = *tp; /* store tokens starting here */
const struct plane_block_idx pb_idx = plane_block_idx(xd, ib); const struct plane_block_idx pb_idx = plane_block_idx(y_blocks, ib);
const int eob = xd->plane[pb_idx.plane].eobs[pb_idx.block];
const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff,
pb_idx.block, 16); pb_idx.block, 16);
int seg_eob, default_eob, pad; int seg_eob, default_eob, pad;
@ -142,6 +143,7 @@ static void tokenize_b(VP9_COMP *cpi,
assert(xd->nzcs[ib] == 0); assert(xd->nzcs[ib] == 0);
#endif #endif
assert((!type && !pb_idx.plane) || (type && pb_idx.plane));
if (sb_type == BLOCK_SIZE_SB64X64) { if (sb_type == BLOCK_SIZE_SB64X64) {
a = (ENTROPY_CONTEXT *)xd->above_context + a = (ENTROPY_CONTEXT *)xd->above_context +
vp9_block2above_sb64[tx_size][ib]; vp9_block2above_sb64[tx_size][ib];
@ -340,7 +342,7 @@ int vp9_mby_is_skippable_4x4(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
@ -349,8 +351,10 @@ int vp9_mbuv_is_skippable_4x4(MACROBLOCKD *xd) {
int skip = 1; int skip = 1;
int i; int i;
for (i = 16; i < 24; i++) for (i = 0; i < 4; i++)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[1].eobs[i]);
for (i = 0; i < 4; i++)
skip &= (!xd->plane[2].eobs[i]);
return skip; return skip;
} }
@ -364,13 +368,13 @@ int vp9_mby_is_skippable_8x8(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 16; i += 4) for (i = 0; i < 16; i += 4)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
int vp9_mbuv_is_skippable_8x8(MACROBLOCKD *xd) { int vp9_mbuv_is_skippable_8x8(MACROBLOCKD *xd) {
return (!xd->eobs[16]) & (!xd->eobs[20]); return (!xd->plane[1].eobs[0]) & (!xd->plane[2].eobs[0]);
} }
static int mb_is_skippable_8x8(MACROBLOCKD *xd) { static int mb_is_skippable_8x8(MACROBLOCKD *xd) {
@ -384,7 +388,7 @@ static int mb_is_skippable_8x8_4x4uv(MACROBLOCKD *xd) {
} }
int vp9_mby_is_skippable_16x16(MACROBLOCKD *xd) { int vp9_mby_is_skippable_16x16(MACROBLOCKD *xd) {
return (!xd->eobs[0]); return (!xd->plane[0].eobs[0]);
} }
static int mb_is_skippable_16x16(MACROBLOCKD *xd) { static int mb_is_skippable_16x16(MACROBLOCKD *xd) {
@ -392,11 +396,11 @@ static int mb_is_skippable_16x16(MACROBLOCKD *xd) {
} }
int vp9_sby_is_skippable_32x32(MACROBLOCKD *xd) { int vp9_sby_is_skippable_32x32(MACROBLOCKD *xd) {
return (!xd->eobs[0]); return (!xd->plane[0].eobs[0]);
} }
int vp9_sbuv_is_skippable_16x16(MACROBLOCKD *xd) { int vp9_sbuv_is_skippable_16x16(MACROBLOCKD *xd) {
return (!xd->eobs[64]) & (!xd->eobs[80]); return (!xd->plane[1].eobs[0]) & (!xd->plane[2].eobs[0]);
} }
static int sb_is_skippable_32x32(MACROBLOCKD *xd) { static int sb_is_skippable_32x32(MACROBLOCKD *xd) {
@ -409,7 +413,7 @@ int vp9_sby_is_skippable_16x16(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 64; i += 16) for (i = 0; i < 64; i += 16)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
@ -423,7 +427,7 @@ int vp9_sby_is_skippable_8x8(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 64; i += 4) for (i = 0; i < 64; i += 4)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
@ -432,8 +436,10 @@ int vp9_sbuv_is_skippable_8x8(MACROBLOCKD *xd) {
int skip = 1; int skip = 1;
int i = 0; int i = 0;
for (i = 64; i < 96; i += 4) for (i = 0; i < 16; i += 4)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[1].eobs[i]);
for (i = 0; i < 16; i += 4)
skip &= (!xd->plane[2].eobs[i]);
return skip; return skip;
} }
@ -447,7 +453,7 @@ int vp9_sby_is_skippable_4x4(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 64; i++) for (i = 0; i < 64; i++)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
@ -456,8 +462,10 @@ int vp9_sbuv_is_skippable_4x4(MACROBLOCKD *xd) {
int skip = 1; int skip = 1;
int i = 0; int i = 0;
for (i = 64; i < 96; i++) for (i = 0; i < 16; i++)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[1].eobs[i]);
for (i = 0; i < 16; i++)
skip &= (!xd->plane[2].eobs[i]);
return skip; return skip;
} }
@ -513,34 +521,34 @@ void vp9_tokenize_sb(VP9_COMP *cpi,
switch (mbmi->txfm_size) { switch (mbmi->txfm_size) {
case TX_32X32: case TX_32X32:
tokenize_b(cpi, xd, 0, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, 0, t, PLANE_TYPE_Y_WITH_DC,
TX_32X32, dry_run); TX_32X32, 64, dry_run);
for (b = 64; b < 96; b += 16) for (b = 64; b < 96; b += 16)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_16X16, dry_run); TX_16X16, 64, dry_run);
break; break;
case TX_16X16: case TX_16X16:
for (b = 0; b < 64; b += 16) for (b = 0; b < 64; b += 16)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC,
TX_16X16, dry_run); TX_16X16, 64, dry_run);
for (b = 64; b < 96; b += 16) for (b = 64; b < 96; b += 16)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_16X16, dry_run); TX_16X16, 64, dry_run);
break; break;
case TX_8X8: case TX_8X8:
for (b = 0; b < 64; b += 4) for (b = 0; b < 64; b += 4)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC,
TX_8X8, dry_run); TX_8X8, 64, dry_run);
for (b = 64; b < 96; b += 4) for (b = 64; b < 96; b += 4)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_8X8, dry_run); TX_8X8, 64, dry_run);
break; break;
case TX_4X4: case TX_4X4:
for (b = 0; b < 64; b++) for (b = 0; b < 64; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC,
TX_4X4, dry_run); TX_4X4, 64, dry_run);
for (b = 64; b < 96; b++) for (b = 64; b < 96; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_4X4, dry_run); TX_4X4, 64, dry_run);
break; break;
default: assert(0); default: assert(0);
} }
@ -554,13 +562,13 @@ int vp9_sb64y_is_skippable_32x32(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 256; i += 64) for (i = 0; i < 256; i += 64)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
int vp9_sb64uv_is_skippable_32x32(MACROBLOCKD *xd) { int vp9_sb64uv_is_skippable_32x32(MACROBLOCKD *xd) {
return (!xd->eobs[256]) & (!xd->eobs[320]); return (!xd->plane[1].eobs[0]) & (!xd->plane[2].eobs[0]);
} }
static int sb64_is_skippable_32x32(MACROBLOCKD *xd) { static int sb64_is_skippable_32x32(MACROBLOCKD *xd) {
@ -572,7 +580,7 @@ int vp9_sb64y_is_skippable_16x16(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 256; i += 16) for (i = 0; i < 256; i += 16)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
@ -581,8 +589,10 @@ int vp9_sb64uv_is_skippable_16x16(MACROBLOCKD *xd) {
int skip = 1; int skip = 1;
int i = 0; int i = 0;
for (i = 256; i < 384; i += 16) for (i = 0; i < 64; i += 16)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[1].eobs[i]);
for (i = 0; i < 64; i += 16)
skip &= (!xd->plane[2].eobs[i]);
return skip; return skip;
} }
@ -596,7 +606,7 @@ int vp9_sb64y_is_skippable_8x8(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 256; i += 4) for (i = 0; i < 256; i += 4)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
@ -605,8 +615,10 @@ int vp9_sb64uv_is_skippable_8x8(MACROBLOCKD *xd) {
int skip = 1; int skip = 1;
int i = 0; int i = 0;
for (i = 256; i < 384; i += 4) for (i = 0; i < 64; i += 4)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[1].eobs[i]);
for (i = 0; i < 64; i += 4)
skip &= (!xd->plane[2].eobs[i]);
return skip; return skip;
} }
@ -620,7 +632,7 @@ int vp9_sb64y_is_skippable_4x4(MACROBLOCKD *xd) {
int i = 0; int i = 0;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[0].eobs[i]);
return skip; return skip;
} }
@ -629,8 +641,10 @@ int vp9_sb64uv_is_skippable_4x4(MACROBLOCKD *xd) {
int skip = 1; int skip = 1;
int i = 0; int i = 0;
for (i = 256; i < 384; i++) for (i = 0; i < 64; i++)
skip &= (!xd->eobs[i]); skip &= (!xd->plane[1].eobs[i]);
for (i = 0; i < 64; i++)
skip &= (!xd->plane[2].eobs[i]);
return skip; return skip;
} }
@ -687,34 +701,34 @@ void vp9_tokenize_sb64(VP9_COMP *cpi,
case TX_32X32: case TX_32X32:
for (b = 0; b < 256; b += 64) for (b = 0; b < 256; b += 64)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC,
TX_32X32, dry_run); TX_32X32, 256, dry_run);
for (b = 256; b < 384; b += 64) for (b = 256; b < 384; b += 64)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_32X32, dry_run); TX_32X32, 256, dry_run);
break; break;
case TX_16X16: case TX_16X16:
for (b = 0; b < 256; b += 16) for (b = 0; b < 256; b += 16)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC,
TX_16X16, dry_run); TX_16X16, 256, dry_run);
for (b = 256; b < 384; b += 16) for (b = 256; b < 384; b += 16)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_16X16, dry_run); TX_16X16, 256, dry_run);
break; break;
case TX_8X8: case TX_8X8:
for (b = 0; b < 256; b += 4) for (b = 0; b < 256; b += 4)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC,
TX_8X8, dry_run); TX_8X8, 256, dry_run);
for (b = 256; b < 384; b += 4) for (b = 256; b < 384; b += 4)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_8X8, dry_run); TX_8X8, 256, dry_run);
break; break;
case TX_4X4: case TX_4X4:
for (b = 0; b < 256; b++) for (b = 0; b < 256; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC,
TX_4X4, dry_run); TX_4X4, 256, dry_run);
for (b = 256; b < 384; b++) for (b = 256; b < 384; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV,
TX_4X4, dry_run); TX_4X4, 256, dry_run);
break; break;
default: assert(0); default: assert(0);
} }
@ -782,29 +796,29 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
cpi->skip_false_count[mb_skip_context] += skip_inc; cpi->skip_false_count[mb_skip_context] += skip_inc;
if (tx_size == TX_16X16) { if (tx_size == TX_16X16) {
tokenize_b(cpi, xd, 0, t, PLANE_TYPE_Y_WITH_DC, TX_16X16, dry_run); tokenize_b(cpi, xd, 0, t, PLANE_TYPE_Y_WITH_DC, TX_16X16, 16, dry_run);
for (b = 16; b < 24; b += 4) { for (b = 16; b < 24; b += 4) {
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_8X8, dry_run); tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_8X8, 16, dry_run);
} }
} else if (tx_size == TX_8X8) { } else if (tx_size == TX_8X8) {
for (b = 0; b < 16; b += 4) { for (b = 0; b < 16; b += 4) {
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_8X8, dry_run); tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_8X8, 16, dry_run);
} }
if (xd->mode_info_context->mbmi.mode == I8X8_PRED || if (xd->mode_info_context->mbmi.mode == I8X8_PRED ||
xd->mode_info_context->mbmi.mode == SPLITMV) { xd->mode_info_context->mbmi.mode == SPLITMV) {
for (b = 16; b < 24; b++) { for (b = 16; b < 24; b++) {
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_4X4, dry_run); tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_4X4, 16, dry_run);
} }
} else { } else {
for (b = 16; b < 24; b += 4) { for (b = 16; b < 24; b += 4) {
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_8X8, dry_run); tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_8X8, 16, dry_run);
} }
} }
} else { } else {
for (b = 0; b < 16; b++) for (b = 0; b < 16; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_4X4, dry_run); tokenize_b(cpi, xd, b, t, PLANE_TYPE_Y_WITH_DC, TX_4X4, 16, dry_run);
for (b = 16; b < 24; b++) for (b = 16; b < 24; b++)
tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_4X4, dry_run); tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_4X4, 16, dry_run);
} }
if (dry_run) if (dry_run)
*t = t_backup; *t = t_backup;