Commit 9139ee09 authored by Dmitry Kovalev's avatar Dmitry Kovalev

Adding condition inside get_tx_type_{4x4, 8x8, 16x16}.

Adding plane type check condition because it was always used outside of
get_tx_type_{4x4, 8x8, 16x16}.

Change-Id: I02f0bbfee8063474865bd903eb25b54d26e07230
parent a183f17d
...@@ -359,23 +359,30 @@ static BLOCK_SIZE_TYPE get_subsize(BLOCK_SIZE_TYPE bsize, ...@@ -359,23 +359,30 @@ static BLOCK_SIZE_TYPE get_subsize(BLOCK_SIZE_TYPE bsize,
extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT]; extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT];
static INLINE TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) { static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type,
MODE_INFO *const mi = xd->mode_info_context; const MACROBLOCKD *xd, int ib) {
MB_MODE_INFO *const mbmi = &mi->mbmi; const MODE_INFO *const mi = xd->mode_info_context;
const MB_MODE_INFO *const mbmi = &mi->mbmi;
if (xd->lossless || mbmi->ref_frame[0] != INTRA_FRAME)
if (plane_type != PLANE_TYPE_Y_WITH_DC ||
xd->lossless ||
mbmi->ref_frame[0] != INTRA_FRAME)
return DCT_DCT; return DCT_DCT;
return mode2txfm_map[mbmi->sb_type < BLOCK_SIZE_SB8X8 ? return mode2txfm_map[mbmi->sb_type < BLOCK_SIZE_SB8X8 ?
mi->bmi[ib].as_mode : mbmi->mode]; mi->bmi[ib].as_mode : mbmi->mode];
} }
static INLINE TX_TYPE get_tx_type_8x8(const MACROBLOCKD *xd) { static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type,
return mode2txfm_map[xd->mode_info_context->mbmi.mode]; 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) { static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type,
return mode2txfm_map[xd->mode_info_context->mbmi.mode]; 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) { static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) {
......
...@@ -90,32 +90,32 @@ static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize, ...@@ -90,32 +90,32 @@ static void decode_block(int plane, int block, BLOCK_SIZE_TYPE bsize,
struct macroblockd_plane *pd = &xd->plane[plane]; struct macroblockd_plane *pd = &xd->plane[plane];
int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16); int16_t* const qcoeff = BLOCK_OFFSET(pd->qcoeff, block, 16);
const int stride = pd->dst.stride; const int stride = pd->dst.stride;
const int eob = pd->eobs[block];
const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane, const int raster_block = txfrm_block_to_raster_block(xd, bsize, plane,
block, ss_txfrm_size); block, ss_txfrm_size);
uint8_t* const dst = raster_block_offset_uint8(xd, bsize, plane, uint8_t* const dst = raster_block_offset_uint8(xd, bsize, plane,
raster_block, raster_block,
pd->dst.buf, stride); pd->dst.buf, stride);
TX_TYPE tx_type;
switch (ss_txfrm_size / 2) { switch (ss_txfrm_size / 2) {
case TX_4X4: case TX_4X4: {
tx_type = plane == 0 ? get_tx_type_4x4(xd, raster_block) : DCT_DCT; const TX_TYPE tx_type = get_tx_type_4x4(pd->plane_type, xd, raster_block);
if (tx_type == DCT_DCT) if (tx_type == DCT_DCT)
xd->itxm_add(qcoeff, dst, stride, pd->eobs[block]); xd->itxm_add(qcoeff, dst, stride, eob);
else else
vp9_iht_add_c(tx_type, qcoeff, dst, stride, pd->eobs[block]); vp9_iht_add_c(tx_type, qcoeff, dst, stride, eob);
break; break;
}
case TX_8X8: case TX_8X8:
tx_type = plane == 0 ? get_tx_type_8x8(xd) : DCT_DCT; vp9_iht_add_8x8_c(get_tx_type_8x8(pd->plane_type, xd), qcoeff, dst,
vp9_iht_add_8x8_c(tx_type, qcoeff, dst, stride, pd->eobs[block]); stride, eob);
break; break;
case TX_16X16: case TX_16X16:
tx_type = plane == 0 ? get_tx_type_16x16(xd) : DCT_DCT; vp9_iht_add_16x16_c(get_tx_type_16x16(pd->plane_type, xd), qcoeff, dst,
vp9_iht_add_16x16_c(tx_type, qcoeff, dst, stride, pd->eobs[block]); stride, eob);
break; break;
case TX_32X32: case TX_32X32:
vp9_idct_add_32x32(qcoeff, dst, stride, pd->eobs[block]); vp9_idct_add_32x32(qcoeff, dst, stride, eob);
break; break;
} }
} }
......
...@@ -127,27 +127,21 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, ...@@ -127,27 +127,21 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
switch (txfm_size) { switch (txfm_size) {
default: default:
case TX_4X4: { case TX_4X4: {
const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ? scan = get_scan_4x4(get_tx_type_4x4(type, xd, block_idx));
get_tx_type_4x4(xd, block_idx) : DCT_DCT;
scan = get_scan_4x4(tx_type);
above_ec = A[0] != 0; above_ec = A[0] != 0;
left_ec = L[0] != 0; left_ec = L[0] != 0;
band_translate = vp9_coefband_trans_4x4; band_translate = vp9_coefband_trans_4x4;
break; break;
} }
case TX_8X8: { case TX_8X8: {
const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ? scan = get_scan_8x8(get_tx_type_8x8(type, xd));
get_tx_type_8x8(xd) : DCT_DCT;
scan = get_scan_8x8(tx_type);
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;
band_translate = vp9_coefband_trans_8x8plus; band_translate = vp9_coefband_trans_8x8plus;
break; break;
} }
case TX_16X16: { case TX_16X16: {
const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ? scan = get_scan_16x16(get_tx_type_16x16(type, xd));
get_tx_type_16x16(xd) : DCT_DCT;
scan = get_scan_16x16(tx_type);
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0; above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0; left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
band_translate = vp9_coefband_trans_8x8plus; band_translate = vp9_coefband_trans_8x8plus;
......
...@@ -154,27 +154,21 @@ static void optimize_b(VP9_COMMON *const cm, MACROBLOCK *mb, ...@@ -154,27 +154,21 @@ static void optimize_b(VP9_COMMON *const cm, MACROBLOCK *mb,
qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16); qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
switch (tx_size) { switch (tx_size) {
default: default:
case TX_4X4: { case TX_4X4:
const TX_TYPE tx_type = plane == 0 ? get_tx_type_4x4(xd, ib) : DCT_DCT;
default_eob = 16; 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; band_translate = vp9_coefband_trans_4x4;
break; break;
} case TX_8X8:
case TX_8X8: { scan = get_scan_8x8(get_tx_type_8x8(type, xd));
const TX_TYPE tx_type = plane == 0 ? get_tx_type_8x8(xd) : DCT_DCT;
scan = get_scan_8x8(tx_type);
default_eob = 64; default_eob = 64;
band_translate = vp9_coefband_trans_8x8plus; band_translate = vp9_coefband_trans_8x8plus;
break; break;
} case TX_16X16:
case TX_16X16: { scan = get_scan_16x16(get_tx_type_16x16(type, xd));
const TX_TYPE tx_type = plane == 0 ? get_tx_type_16x16(xd) : DCT_DCT;
scan = get_scan_16x16(tx_type);
default_eob = 256; default_eob = 256;
band_translate = vp9_coefband_trans_8x8plus; band_translate = vp9_coefband_trans_8x8plus;
break; break;
}
case TX_32X32: case TX_32X32:
scan = vp9_default_scan_32x32; scan = vp9_default_scan_32x32;
default_eob = 1024; default_eob = 1024;
...@@ -644,7 +638,7 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, ...@@ -644,7 +638,7 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
vp9_short_idct32x32_add(dqcoeff, dst, pd->dst.stride); vp9_short_idct32x32_add(dqcoeff, dst, pd->dst.stride);
break; break;
case TX_16X16: 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); scan = get_scan_16x16(tx_type);
iscan = get_iscan_16x16(tx_type); iscan = get_iscan_16x16(tx_type);
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
...@@ -673,7 +667,7 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, ...@@ -673,7 +667,7 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
} }
break; break;
case TX_8X8: 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); scan = get_scan_8x8(tx_type);
iscan = get_iscan_8x8(tx_type); iscan = get_iscan_8x8(tx_type);
mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; mode = plane == 0 ? mbmi->mode : mbmi->uv_mode;
...@@ -702,7 +696,7 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize, ...@@ -702,7 +696,7 @@ void encode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
} }
break; break;
case TX_4X4: 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); scan = get_scan_4x4(tx_type);
iscan = get_iscan_4x4(tx_type); iscan = get_iscan_4x4(tx_type);
if (mbmi->sb_type < BLOCK_SIZE_SB8X8 && plane == 0) { if (mbmi->sb_type < BLOCK_SIZE_SB8X8 && plane == 0) {
......
...@@ -794,21 +794,24 @@ static void super_block_yrd_for_txfm(VP9_COMMON *const cm, MACROBLOCK *x, ...@@ -794,21 +794,24 @@ static void super_block_yrd_for_txfm(VP9_COMMON *const cm, MACROBLOCK *x,
sizeof(ENTROPY_CONTEXT) * bw); sizeof(ENTROPY_CONTEXT) * bw);
vpx_memcpy(&args.t_left, pd->left_context, vpx_memcpy(&args.t_left, pd->left_context,
sizeof(ENTROPY_CONTEXT) * bh); 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; break;
case TX_8X8: case TX_8X8:
for (i = 0; i < bw; i += 2) for (i = 0; i < bw; i += 2)
args.t_above[i] = !!*(uint16_t *)&pd->above_context[i]; args.t_above[i] = !!*(uint16_t *)&pd->above_context[i];
for (i = 0; i < bh; i += 2) for (i = 0; i < bh; i += 2)
args.t_left[i] = !!*(uint16_t *)&pd->left_context[i]; 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; break;
case TX_16X16: case TX_16X16:
for (i = 0; i < bw; i += 4) for (i = 0; i < bw; i += 4)
args.t_above[i] = !!*(uint32_t *)&pd->above_context[i]; args.t_above[i] = !!*(uint32_t *)&pd->above_context[i];
for (i = 0; i < bh; i += 4) for (i = 0; i < bh; i += 4)
args.t_left[i] = !!*(uint32_t *)&pd->left_context[i]; 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; break;
case TX_32X32: case TX_32X32:
for (i = 0; i < bw; i += 8) for (i = 0; i < bw; i += 8)
...@@ -1246,7 +1249,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, ...@@ -1246,7 +1249,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
src, src_stride, src, src_stride,
dst, dst_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) { if (tx_type != DCT_DCT) {
vp9_short_fht4x4(src_diff, coeff, 8, tx_type); 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);
...@@ -1255,7 +1258,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, ...@@ -1255,7 +1258,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib,
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, ratey += cost_coeffs(cm, x, 0, block, PLANE_TYPE_Y_WITH_DC,
tempa + idx, templ + idy, TX_4X4, scan, tempa + idx, templ + idy, TX_4X4, scan,
vp9_get_coef_neighbors_handle(scan)); vp9_get_coef_neighbors_handle(scan));
......
...@@ -104,7 +104,6 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize, ...@@ -104,7 +104,6 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
VP9_COMP *cpi = args->cpi; VP9_COMP *cpi = args->cpi;
MACROBLOCKD *xd = args->xd; MACROBLOCKD *xd = args->xd;
TOKENEXTRA **tp = args->tp; TOKENEXTRA **tp = args->tp;
PLANE_TYPE type = plane ? PLANE_TYPE_UV : PLANE_TYPE_Y_WITH_DC;
TX_SIZE tx_size = ss_txfrm_size / 2; TX_SIZE tx_size = ss_txfrm_size / 2;
int dry_run = args->dry_run; int dry_run = args->dry_run;
...@@ -113,6 +112,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize, ...@@ -113,6 +112,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
int c = 0, rc = 0; int c = 0, rc = 0;
TOKENEXTRA *t = *tp; /* store tokens starting here */ TOKENEXTRA *t = *tp; /* store tokens starting here */
const int eob = xd->plane[plane].eobs[block]; const int eob = xd->plane[plane].eobs[block];
const PLANE_TYPE type = xd->plane[plane].plane_type;
const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16); const int16_t *qcoeff_ptr = BLOCK_OFFSET(xd->plane[plane].qcoeff, block, 16);
const BLOCK_SIZE_TYPE sb_type = (mbmi->sb_type < BLOCK_SIZE_SB8X8) ? const BLOCK_SIZE_TYPE sb_type = (mbmi->sb_type < BLOCK_SIZE_SB8X8) ?
BLOCK_SIZE_SB8X8 : mbmi->sb_type; BLOCK_SIZE_SB8X8 : mbmi->sb_type;
...@@ -138,36 +138,27 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize, ...@@ -138,36 +138,27 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE_TYPE bsize,
coef_probs = cpi->common.fc.coef_probs[tx_size]; coef_probs = cpi->common.fc.coef_probs[tx_size];
switch (tx_size) { switch (tx_size) {
default: default:
case TX_4X4: { case TX_4X4:
const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
get_tx_type_4x4(xd, block) : DCT_DCT;
above_ec = A[0] != 0; above_ec = A[0] != 0;
left_ec = L[0] != 0; left_ec = L[0] != 0;
seg_eob = 16; 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; band_translate = vp9_coefband_trans_4x4;
break; break;
} case TX_8X8:
case TX_8X8: {
const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
get_tx_type_8x8(xd) : DCT_DCT;
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;
seg_eob = 64; 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; band_translate = vp9_coefband_trans_8x8plus;
break; break;
} case TX_16X16:
case TX_16X16: {
const TX_TYPE tx_type = type == PLANE_TYPE_Y_WITH_DC ?
get_tx_type_16x16(xd) : DCT_DCT;
above_ec = (A[0] + A[1] + A[2] + A[3]) != 0; above_ec = (A[0] + A[1] + A[2] + A[3]) != 0;
left_ec = (L[0] + L[1] + L[2] + L[3]) != 0; left_ec = (L[0] + L[1] + L[2] + L[3]) != 0;
seg_eob = 256; 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; band_translate = vp9_coefband_trans_8x8plus;
break; break;
}
case TX_32X32: case TX_32X32:
above_ec = (A[0] + A[1] + A[2] + A[3] + A[4] + A[5] + A[6] + A[7]) != 0; 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; left_ec = (L[0] + L[1] + L[2] + L[3] + L[4] + L[5] + L[6] + L[7]) != 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment