Commit 1efa79d3 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Remove i4x4_pred.

It remains as a local define in rdopt.c so we can distinguish between
split and non-split modes in the RD loop, but disappears outside that
scope in the codec.

Change-Id: I98c18fe5ab7e4fbd1d6620ec5695e2ea20513ce9
parent 9175082c
......@@ -78,7 +78,6 @@ typedef enum {
D27_PRED, // Directional 27 deg = round(arctan(1/2) * 180/pi)
D63_PRED, // Directional 63 deg = round(arctan(2/1) * 180/pi)
TM_PRED, // True-motion
I4X4_PRED, // Each 4x4 subblock has its own mode
NEARESTMV,
NEARMV,
ZEROMV,
......@@ -119,7 +118,7 @@ typedef enum {
ADST_ADST = 3 // ADST in both directions
} TX_TYPE;
#define VP9_YMODES (I4X4_PRED + 1)
#define VP9_YMODES (TM_PRED + 1)
#define VP9_UV_MODES (TM_PRED + 1)
#define VP9_I32X32_MODES (TM_PRED + 1)
......@@ -538,14 +537,16 @@ static TX_TYPE txfm_map(MB_PREDICTION_MODE bmode) {
}
static TX_TYPE get_tx_type_4x4(const MACROBLOCKD *xd, int ib) {
TX_TYPE tx_type = DCT_DCT;
if (xd->lossless)
TX_TYPE tx_type;
MODE_INFO *mi = xd->mode_info_context;
MB_MODE_INFO *const mbmi = &mi->mbmi;
if (xd->lossless || mbmi->ref_frame != INTRA_FRAME)
return DCT_DCT;
if (xd->mode_info_context->mbmi.mode == I4X4_PRED) {
tx_type = txfm_map(
xd->mode_info_context->bmi[ib].as_mode.first);
} else if (xd->mode_info_context->mbmi.mode <= TM_PRED) {
tx_type = txfm_map(xd->mode_info_context->mbmi.mode);
if (mbmi->sb_type < BLOCK_SIZE_SB8X8) {
tx_type = txfm_map(mi->bmi[ib].as_mode.first);
} else {
assert(mbmi->mode <= TM_PRED);
tx_type = txfm_map(mbmi->mode);
}
return tx_type;
}
......
......@@ -15,24 +15,12 @@
#include "vp9/common/vp9_alloccommon.h"
#include "vpx_mem/vpx_mem.h"
static const unsigned int kf_y_mode_cts[8][VP9_YMODES] = {
/* DC V H D45 135 117 153 D27 D63 TM i4X4 */
{12, 6, 5, 5, 5, 5, 5, 5, 5, 2, 200},
{25, 13, 13, 7, 7, 7, 7, 7, 7, 6, 160},
{31, 17, 18, 8, 8, 8, 8, 8, 8, 9, 139},
{40, 22, 23, 8, 8, 8, 8, 8, 8, 12, 116},
{53, 26, 28, 8, 8, 8, 8, 8, 8, 13, 94},
{68, 33, 35, 8, 8, 8, 8, 8, 8, 17, 68},
{78, 38, 38, 8, 8, 8, 8, 8, 8, 19, 52},
{89, 42, 42, 8, 8, 8, 8, 8, 8, 21, 34},
static const unsigned int y_mode_cts[VP9_BINTRAMODES] = {
/* DC V H D45 D135 D117 D153 D27 D63 TM */
98, 19, 15, 14, 14, 14, 14, 12, 12, 13,
};
static const unsigned int y_mode_cts [VP9_YMODES] = {
/* DC V H D45 135 117 153 D27 D63 TM i4X4 */
98, 19, 15, 14, 14, 14, 14, 12, 12, 13, 0
};
static const unsigned int uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
static const unsigned int uv_mode_cts[VP9_YMODES][VP9_UV_MODES] = {
/* DC V H D45 135 117 153 D27 D63 TM */
{ 200, 15, 15, 10, 10, 10, 10, 10, 10, 6}, /* DC */
{ 130, 75, 10, 10, 10, 10, 10, 10, 10, 6}, /* V */
......@@ -44,10 +32,9 @@ static const unsigned int uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
{ 150, 15, 10, 10, 10, 10, 10, 75, 10, 6}, /* D27 */
{ 150, 15, 10, 10, 10, 10, 10, 10, 75, 6}, /* D63 */
{ 160, 30, 30, 10, 10, 10, 10, 10, 10, 16}, /* TM */
{ 150, 35, 41, 10, 10, 10, 10, 10, 10, 10}, /* i4X4 */
};
static const unsigned int kf_uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
static const unsigned int kf_uv_mode_cts[VP9_YMODES][VP9_UV_MODES] = {
// DC V H D45 135 117 153 D27 D63 TM
{ 160, 24, 24, 20, 20, 20, 20, 20, 20, 8}, /* DC */
{ 102, 64, 30, 20, 20, 20, 20, 20, 20, 10}, /* V */
......@@ -59,12 +46,6 @@ static const unsigned int kf_uv_mode_cts [VP9_YMODES] [VP9_UV_MODES] = {
{ 102, 33, 20, 20, 20, 20, 20, 64, 20, 14}, /* D27 */
{ 102, 33, 20, 20, 20, 20, 20, 20, 64, 14}, /* D63 */
{ 132, 36, 30, 20, 20, 20, 20, 20, 20, 18}, /* TM */
{ 122, 41, 35, 20, 20, 20, 20, 20, 20, 18}, /* I4X4 */
};
static const unsigned int bmode_cts[VP9_BINTRAMODES] = {
/* DC V H D45 D135 D117 D153 D27 D63 TM */
43891, 10036, 3920, 3363, 2546, 5119, 2471, 1723, 3221, 17694
};
const vp9_prob vp9_partition_probs[NUM_PARTITION_CONTEXTS]
......
......@@ -87,12 +87,12 @@ static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb, int b) {
/* On L edge, get from MB to left of us */
--cur_mb;
if (cur_mb->mbmi.mode <= TM_PRED) {
return cur_mb->mbmi.mode;
} else if (cur_mb->mbmi.mode == I4X4_PRED) {
if (cur_mb->mbmi.ref_frame != INTRA_FRAME) {
return DC_PRED;
} else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
return ((cur_mb->bmi + 1 + b)->as_mode.first);
} else {
return DC_PRED;
return cur_mb->mbmi.mode;
}
}
assert(b == 1 || b == 3);
......@@ -105,12 +105,12 @@ static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
/* On top edge, get from MB above us */
cur_mb -= mi_stride;
if (cur_mb->mbmi.mode <= TM_PRED) {
return cur_mb->mbmi.mode;
} else if (cur_mb->mbmi.mode == I4X4_PRED) {
if (cur_mb->mbmi.ref_frame != INTRA_FRAME) {
return DC_PRED;
} else if (cur_mb->mbmi.sb_type < BLOCK_SIZE_SB8X8) {
return ((cur_mb->bmi + 2 + b)->as_mode.first);
} else {
return DC_PRED;
return cur_mb->mbmi.mode;
}
}
......
......@@ -26,7 +26,6 @@ static void lf_init_lut(loop_filter_info_n *lfi) {
lfi->mode_lf_lut[V_PRED] = 1;
lfi->mode_lf_lut[H_PRED] = 1;
lfi->mode_lf_lut[TM_PRED] = 1;
lfi->mode_lf_lut[I4X4_PRED] = 0;
lfi->mode_lf_lut[ZEROMV] = 1;
lfi->mode_lf_lut[NEARESTMV] = 2;
lfi->mode_lf_lut[NEARMV] = 2;
......
......@@ -124,7 +124,6 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
int bw = 1 << b_width_log2(m->mbmi.sb_type);
int bh = 1 << b_height_log2(m->mbmi.sb_type);
m->mbmi.mode = I4X4_PRED;
for (idy = 0; idy < 2; idy += bh) {
for (idx = 0; idx < 2; idx += bw) {
int ib = idy * 2 + idx;
......@@ -140,6 +139,7 @@ static void kfread_modes(VP9D_COMP *pbi, MODE_INFO *m,
m->bmi[ib + k].as_mode.first = m->bmi[ib].as_mode.first;
}
}
m->mbmi.mode = m->bmi[3].as_mode.first;
}
m->mbmi.uv_mode = read_intra_mode(r, cm->kf_uv_mode_prob[m->mbmi.mode]);
......@@ -773,7 +773,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
cm->fc.y_mode_counts[mbmi->mode]++;
} else {
int idx, idy;
mbmi->mode = I4X4_PRED;
for (idy = 0; idy < 2; idy += bh) {
for (idx = 0; idx < 2; idx += bw) {
int ib = idy * 2 + idx, k;
......@@ -786,6 +785,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
mi->bmi[ib + k].as_mode.first = m;
}
}
mbmi->mode = mi->bmi[3].as_mode.first;
}
mbmi->uv_mode = read_intra_mode(r, cm->fc.uv_mode_prob[mbmi->mode]);
......
......@@ -259,10 +259,12 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE_TYPE bsize,
mode = plane == 0? xd->mode_info_context->mbmi.mode:
xd->mode_info_context->mbmi.uv_mode;
if (bsize <= BLOCK_SIZE_SB8X8 && mode == I4X4_PRED && plane == 0)
if (xd->mode_info_context->mbmi.sb_type < BLOCK_SIZE_SB8X8 && plane == 0) {
assert(bsize == BLOCK_SIZE_SB8X8);
b_mode = xd->mode_info_context->bmi[raster_block].as_mode.first;
else
} else {
b_mode = mode;
}
plane_b_size = b_width_log2(bsize) - xd->plane[plane].subsampling_x;
vp9_predict_intra_block(xd, tx_ib, plane_b_size, tx_size,
......
......@@ -523,6 +523,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
xd->left_available = (mb_col != 0);
xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_MB16X16;
xd->mode_info_context->mbmi.ref_frame = INTRA_FRAME;
// do intra 16x16 prediction
this_error = vp9_encode_intra(cpi, x, use_dc_pred);
......@@ -619,6 +620,7 @@ void vp9_first_pass(VP9_COMP *cpi) {
this_error = motion_error;
vp9_set_mbmode_and_mvs(x, NEWMV, &mv);
xd->mode_info_context->mbmi.txfm_size = TX_4X4;
xd->mode_info_context->mbmi.ref_frame = LAST_FRAME;
vp9_build_inter_predictors_sby(xd, mb_row << 1,
mb_col << 1,
BLOCK_SIZE_MB16X16);
......
......@@ -49,6 +49,8 @@
DECLARE_ALIGNED(16, extern const uint8_t,
vp9_pt_energy_class[MAX_ENTROPY_TOKENS]);
#define I4X4_PRED 0x8000
const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{ZEROMV, LAST_FRAME, NONE},
{DC_PRED, INTRA_FRAME, NONE},
......@@ -84,7 +86,7 @@ const MODE_DEFINITION vp9_mode_order[MAX_MODES] = {
{SPLITMV, GOLDEN_FRAME, NONE},
{SPLITMV, ALTREF_FRAME, NONE},
{I4X4_PRED, INTRA_FRAME, NONE},
{I4X4_PRED, INTRA_FRAME, NONE},
/* compound prediction modes */
{ZEROMV, LAST_FRAME, GOLDEN_FRAME},
......@@ -783,16 +785,15 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb,
int64_t total_rd = 0;
ENTROPY_CONTEXT t_above[4], t_left[4];
int *bmode_costs;
MODE_INFO *const mic = xd->mode_info_context;
vpx_memcpy(t_above, xd->plane[0].above_context, sizeof(t_above));
vpx_memcpy(t_left, xd->plane[0].left_context, sizeof(t_left));
xd->mode_info_context->mbmi.mode = I4X4_PRED;
bmode_costs = mb->mbmode_cost;
for (idy = 0; idy < 2; idy += bh) {
for (idx = 0; idx < 2; idx += bw) {
MODE_INFO *const mic = xd->mode_info_context;
const int mis = xd->mode_info_stride;
MB_PREDICTION_MODE UNINITIALIZED_IS_SAFE(best_mode);
int UNINITIALIZED_IS_SAFE(r), UNINITIALIZED_IS_SAFE(ry);
......@@ -831,6 +832,7 @@ static int64_t rd_pick_intra4x4mby_modes(VP9_COMP *cpi, MACROBLOCK *mb,
*Rate = cost;
*rate_y = tot_rate_y;
*Distortion = distortion;
xd->mode_info_context->mbmi.mode = mic->bmi[3].as_mode.first;
return RDCOST(mb->rdmult, mb->rddiv, cost, distortion);
}
......@@ -2989,14 +2991,16 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
best_mode = this_mode;
}
// Store the respective mode distortions for later use.
if (mode_distortions[this_mode] == -1
|| distortion2 < mode_distortions[this_mode]) {
mode_distortions[this_mode] = distortion2;
}
if (frame_distortions[mbmi->ref_frame] == -1
|| distortion2 < frame_distortions[mbmi->ref_frame]) {
frame_distortions[mbmi->ref_frame] = distortion2;
if (this_mode != I4X4_PRED) {
// Store the respective mode distortions for later use.
if (mode_distortions[this_mode] == -1
|| distortion2 < mode_distortions[this_mode]) {
mode_distortions[this_mode] = distortion2;
}
if (frame_distortions[mbmi->ref_frame] == -1
|| distortion2 < frame_distortions[mbmi->ref_frame]) {
frame_distortions[mbmi->ref_frame] = distortion2;
}
}
// Did this mode help.. i.e. is it the new best mode
......@@ -3005,7 +3009,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// Note index of best mode so far
best_mode_index = mode_index;
if (this_mode <= I4X4_PRED) {
if (ref_frame == INTRA_FRAME) {
/* required for left and above block mv */
mbmi->mv[0].as_int = 0;
}
......@@ -3128,7 +3132,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
assert((cm->mcomp_filter_type == SWITCHABLE) ||
(cm->mcomp_filter_type == best_mbmode.interp_filter) ||
(best_mbmode.mode <= I4X4_PRED));
(best_mbmode.ref_frame == INTRA_FRAME));
// Accumulate filter usage stats
// TODO(agrange): Use RD criteria to select interpolation filter mode.
......@@ -3180,7 +3184,8 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x,
// macroblock modes
vpx_memcpy(mbmi, &best_mbmode, sizeof(MB_MODE_INFO));
if (best_mbmode.mode == I4X4_PRED) {
if (best_mbmode.ref_frame == INTRA_FRAME &&
best_mbmode.sb_type < BLOCK_SIZE_SB8X8) {
for (i = 0; i < 4; i++) {
xd->mode_info_context->bmi[i].as_mode = best_bmodes[i].as_mode;
}
......
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