extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT];
-static INLINE TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
- MODE_INFO *const mi = xd->mode_info_context;
- MB_MODE_INFO *const mbmi = &mi->mbmi;
-
- if (xd->lossless || mbmi->ref_frame[0] != INTRA_FRAME)
+static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
+ const MACROBLOCKD *xd, int ib) {
+ const MODE_INFO *const mi = xd->mode_info_context;
+ const MB_MODE_INFO *const mbmi = &mi->mbmi;
+
+ if (plane_type != PLANE_TYPE_Y_WITH_DC ||
+ xd->lossless ||
+ mbmi->ref_frame[0] != INTRA_FRAME)
return DCT_DCT;
return mode2txfm_map[mbmi->sb_type < BLOCK_SIZE_SB8X8 ?
mi->bmi[ib].as_mode : mbmi->mode];
}
-static INLINE TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd) {
- return mode2txfm_map[xd->mode_info_context->mbmi.mode];
+static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type,
+ const MACROBLOCKD *xd) {
+ return plane_type == PLANE_TYPE_Y_WITH_DC ?
+ mode2txfm_map[xd->mode_info_context->mbmi.mode] : DCT_DCT;
}
-static INLINE TX_TYPE get_tx_type_16x16(const MACROBLOCKD *xd) {
- return mode2txfm_map[xd->mode_info_context->mbmi.mode];
+static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type,
+ const MACROBLOCKD *xd) {
+ return plane_type == PLANE_TYPE_Y_WITH_DC ?
+ mode2txfm_map[xd->mode_info_context->mbmi.mode] : DCT_DCT;
}
static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) {
struct macroblockd_plane *pd = &xd->plane[plane];
int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16);
const int stride = pd->dst.stride;
+ const int eob = pd->eobs[block];
const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
block, ss_txfrm_size);
uint8_t* const dst = raster_block_offset_uint8(xd, bsize, plane,
raster_block,
pd->dst.buf, stride);
- TX_TYPE tx_type;
-
switch (ss_txfrm_size / 2) {
- case TX_4X4:
- tx_type = plane == 0 ? get_tx_type_4x4(xd, raster_block) : DCT_DCT;
+ case TX_4X4: {
+ const TX_TYPE tx_type = get_tx_type_4x4(pd->plane_type, xd, raster_block);
if (tx_type == DCT_DCT)
- xd->itxm_add(qcoeff, dst, stride, pd->eobs[block]);
+ xd->itxm_add(qcoeff, dst, stride, eob);
else
- vp9_iht_add_c(tx_type, qcoeff, dst, stride, pd->eobs[block]);
+ vp9_iht_add_c(tx_type, qcoeff, dst, stride, eob);
break;
+ }
case TX_8X8:
- tx_type = plane == 0 ? get_tx_type_8x8(xd) : DCT_DCT;
- vp9_iht_add_8x8_c(tx_type, qcoeff, dst, stride, pd->eobs[block]);
+ vp9_iht_add_8x8_c(get_tx_type_8x8(pd->plane_type, xd), qcoeff, dst,
+ stride, eob);
break;
case TX_16X16:
- tx_type = plane == 0 ? get_tx_type_16x16(xd) : DCT_DCT;
- vp9_iht_add_16x16_c(tx_type, qcoeff, dst, stride, pd->eobs[block]);
+ vp9_iht_add_16x16_c(get_tx_type_16x16(pd->plane_type, xd), qcoeff, dst,
+ stride, eob);
break;
case TX_32X32:
- vp9_idct_add_32x32(qcoeff, dst, stride, pd->eobs[block]);
+ vp9_idct_add_32x32(qcoeff, dst, stride, eob);
break;
}
}
switch (txfm_size) {
default:
case TX_4X4: {
- const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
- get_tx_type_4x4(xd, block_idx) : DCT_DCT;
- scan = get_scan_4x4(tx_type);
+ scan = get_scan_4x4(get_tx_type_4x4(type, xd, block_idx));
above_ec = A[0] != 0;
left_ec = L[0] != 0;
band_translate = vp9_coefband_trans_4x4;
break;
}
case TX_8X8: {
- const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
- get_tx_type_8x8(xd) : DCT_DCT;
- scan = get_scan_8x8(tx_type);
+ scan = get_scan_8x8(get_tx_type_8x8(type, xd));
above_ec = (A[0] + A[1]) != 0;
left_ec = (L[0] + L[1]) != 0;
band_translate = vp9_coefband_trans_8x8plus;
break;
}
case TX_16X16: {
- const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
- get_tx_type_16x16(xd) : DCT_DCT;
- scan = get_scan_16x16(tx_type);
+ scan = get_scan_16x16(get_tx_type_16x16(type, xd));
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
band_translate = vp9_coefband_trans_8x8plus;
qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
switch (tx_size) {
default:
- case TX_4X4: {
- const TX_TYPE tx_type = plane == 0 ? get_tx_type_4x4(xd, ib) : DCT_DCT;
+ case TX_4X4:
default_eob = 16;
- scan = get_scan_4x4(tx_type);
+ scan = get_scan_4x4(get_tx_type_4x4(type, xd, ib));
band_translate = vp9_coefband_trans_4x4;
break;
- }
- case TX_8X8: {
- const TX_TYPE tx_type = plane == 0 ? get_tx_type_8x8(xd) : DCT_DCT;
- scan = get_scan_8x8(tx_type);
+ case TX_8X8:
+ scan = get_scan_8x8(get_tx_type_8x8(type, xd));
default_eob = 64;
band_translate = vp9_coefband_trans_8x8plus;
break;
- }
- case TX_16X16: {
- const TX_TYPE tx_type = plane == 0 ? get_tx_type_16x16(xd) : DCT_DCT;
- scan = get_scan_16x16(tx_type);
+ case TX_16X16:
+ scan = get_scan_16x16(get_tx_type_16x16(type, xd));
default_eob = 256;
band_translate = vp9_coefband_trans_8x8plus;
break;
- }
case TX_32X32:
scan = vp9_default_scan_32x32;
default_eob = 1024;
vp9_short_idct32x32_add(dqcoeff, dst, pd->dst.stride);
break;
case TX_16X16:
- tx_type = plane == 0 ? get_tx_type_16x16(xd) : DCT_DCT;
+ tx_type = get_tx_type_16x16(pd->plane_type, xd);
scan = get_scan_16x16(tx_type);
iscan = get_iscan_16x16(tx_type);
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
}
break;
case TX_8X8:
- tx_type = plane == 0 ? get_tx_type_8x8(xd) : DCT_DCT;
+ tx_type = get_tx_type_8x8(pd->plane_type, xd);
scan = get_scan_8x8(tx_type);
iscan = get_iscan_8x8(tx_type);
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
}
break;
case TX_4X4:
- tx_type = plane == 0 ? get_tx_type_4x4(xd, block) : DCT_DCT;
+ tx_type = get_tx_type_4x4(pd->plane_type, xd, block);
scan = get_scan_4x4(tx_type);
iscan = get_iscan_4x4(tx_type);
if (mbmi->sb_type < BLOCK_SIZE_SB8X8 && plane == 0) {
sizeof(ENTROPY_CONTEXT) * bw);
vpx_memcpy(&args.t_left, pd->left_context,
sizeof(ENTROPY_CONTEXT) * bh);
- get_scan_nb_4x4(get_tx_type_4x4(xd, 0), &args.scan, &args.nb);
+ get_scan_nb_4x4(get_tx_type_4x4(PLANE_TYPE_Y_WITH_DC, xd, 0),
+ &args.scan, &args.nb);
break;
case TX_8X8:
for (i = 0; i < bw; i += 2)
args.t_above[i] = !!*(uint16_t *)&pd->above_context[i];
for (i = 0; i < bh; i += 2)
args.t_left[i] = !!*(uint16_t *)&pd->left_context[i];
- get_scan_nb_8x8(get_tx_type_8x8(xd), &args.scan, &args.nb);
+ get_scan_nb_8x8(get_tx_type_8x8(PLANE_TYPE_Y_WITH_DC, xd),
+ &args.scan, &args.nb);
break;
case TX_16X16:
for (i = 0; i < bw; i += 4)
args.t_above[i] = !!*(uint32_t *)&pd->above_context[i];
for (i = 0; i < bh; i += 4)
args.t_left[i] = !!*(uint32_t *)&pd->left_context[i];
- get_scan_nb_16x16(get_tx_type_16x16(xd), &args.scan, &args.nb);
+ get_scan_nb_16x16(get_tx_type_16x16(PLANE_TYPE_Y_WITH_DC, xd),
+ &args.scan, &args.nb);
break;
case TX_32X32:
for (i = 0; i < bw; i += 8)
src, src_stride,
dst, dst_stride);
- tx_type = get_tx_type_4x4(xd, block);
+ tx_type = get_tx_type_4x4(PLANE_TYPE_Y_WITH_DC, xd, block);
if (tx_type != DCT_DCT) {
vp9_short_fht4x4(src_diff, coeff, 8, tx_type);
x->quantize_b_4x4(x, block, tx_type, 16);
x->quantize_b_4x4(x, block, tx_type, 16);
}
- scan = get_scan_4x4(get_tx_type_4x4(xd, block));
+ scan = get_scan_4x4(get_tx_type_4x4(PLANE_TYPE_Y_WITH_DC, xd, block));
ratey += cost_coeffs(cm, x, 0, block, PLANE_TYPE_Y_WITH_DC,
tempa + idx, templ + idy, TX_4X4, scan,
vp9_get_coef_neighbors_handle(scan));
VP9_COMP *cpi = args->cpi;
MACROBLOCKD *xd = args->xd;
TOKENEXTRA **tp = args->tp;
- PLANE_TYPE type = plane ? PLANE_TYPE_UV : PLANE_TYPE_Y_WITH_DC;
TX_SIZE tx_size = ss_txfrm_size / 2;
int dry_run = args->dry_run;
int c = 0, rc = 0;
TOKENEXTRA *t = *tp; /* store tokens starting here */
const int eob = xd->plane[plane].eobs[block];
+ const PLANE_TYPE type = xd->plane[plane].plane_type;
const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
const BLOCK_SIZE_TYPE sb_type = (mbmi->sb_type < BLOCK_SIZE_SB8X8) ?
BLOCK_SIZE_SB8X8 : mbmi->sb_type;
coef_probs = cpi->common.fc.coef_probs[tx_size];
switch (tx_size) {
default:
- case TX_4X4: {
- const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
- get_tx_type_4x4(xd, block) : DCT_DCT;
+ case TX_4X4:
above_ec = A[0] != 0;
left_ec = L[0] != 0;
seg_eob = 16;
- scan = get_scan_4x4(tx_type);
+ scan = get_scan_4x4(get_tx_type_4x4(type, xd, block));
band_translate = vp9_coefband_trans_4x4;
break;
- }
- case TX_8X8: {
- const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
- get_tx_type_8x8(xd) : DCT_DCT;
+ case TX_8X8:
above_ec = (A[0] + A[1]) != 0;
left_ec = (L[0] + L[1]) != 0;
seg_eob = 64;
- scan = get_scan_8x8(tx_type);
+ scan = get_scan_8x8(get_tx_type_8x8(type, xd));
band_translate = vp9_coefband_trans_8x8plus;
break;
- }
- case TX_16X16: {
- const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
- get_tx_type_16x16(xd) : DCT_DCT;
+ case TX_16X16:
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
seg_eob = 256;
- scan = get_scan_16x16(tx_type);
+ scan = get_scan_16x16(get_tx_type_16x16(type, xd));
band_translate = vp9_coefband_trans_8x8plus;
break;
- }
case TX_32X32:
above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;