ref: 7b54556008834a20a48f467c9a9a2705c9672452
parent: a82001b1cfd688601bbda9b08b3d20e9b46b14d4
parent: c807949408254556dfddfb365a3ad67db650df7d
author: Jingning Han <[email protected]>
date: Tue Oct 22 05:37:17 EDT 2013
Merge "Prevent left_block_mode stepping into left tile"
--- a/vp9/common/vp9_findnearmv.h
+++ b/vp9/common/vp9_findnearmv.h
@@ -41,26 +41,24 @@
int block_idx, int ref_idx,
int mi_row, int mi_col);
-static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mb,
- const MODE_INFO *left_mb, int b) {
+static MB_PREDICTION_MODE left_block_mode(const MODE_INFO *cur_mi,
+ const MODE_INFO *left_mi, int b) {
// FIXME(rbultje, jingning): temporary hack because jenkins doesn't
// understand this condition. This will go away soon.
- const MODE_INFO *mi = cur_mb;
if (b == 0 || b == 2) {
/* On L edge, get from MB to left of us */
- mi = left_mb;
- if (!mi)
+ if (!left_mi)
return DC_PRED;
- if (is_inter_block(&mi->mbmi))
+ if (is_inter_block(&left_mi->mbmi))
return DC_PRED;
else
- return mi->mbmi.sb_type < BLOCK_8X8 ? (mi->bmi + 1 + b)->as_mode
- : mi->mbmi.mode;
+ return left_mi->mbmi.sb_type < BLOCK_8X8 ? left_mi->bmi[b + 1].as_mode
+ : left_mi->mbmi.mode;
}
assert(b == 1 || b == 3);
- return (mi->bmi + b - 1)->as_mode;
+ return cur_mi->bmi[b - 1].as_mode;
}
static MB_PREDICTION_MODE above_block_mode(const MODE_INFO *cur_mb,
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -169,6 +169,7 @@
MB_MODE_INFO *const mbmi = &m->mbmi;
const BLOCK_SIZE bsize = mbmi->sb_type;
const MODE_INFO *above_mi = xd->mi_8x8[-cm->mode_info_stride];
+ const MODE_INFO *left_mi = xd->left_available ? xd->mi_8x8[-1] : NULL;
mbmi->segment_id = read_intra_segment_id(cm, xd, mi_row, mi_col, r);
mbmi->skip_coeff = read_skip_coeff(cm, xd, mbmi->segment_id, r);
@@ -178,9 +179,7 @@
if (bsize >= BLOCK_8X8) {
const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, 0);
- const MB_PREDICTION_MODE L = xd->left_available
- ? left_block_mode(m, xd->mi_8x8[-1], 0)
- : DC_PRED;
+ const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, 0);
mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]);
} else {
// Only 4x4, 4x8, 8x4 blocks
@@ -192,9 +191,7 @@
for (idx = 0; idx < 2; idx += num_4x4_w) {
const int ib = idy * 2 + idx;
const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, ib);
- const MB_PREDICTION_MODE L = (xd->left_available || idx)
- ? left_block_mode(m, xd->mi_8x8[-1], ib)
- : DC_PRED;
+ const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, ib);
const MB_PREDICTION_MODE b_mode = read_intra_mode(r,
vp9_kf_y_mode_prob[A][L]);
m->bmi[ib].as_mode = b_mode;
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -526,7 +526,7 @@
const int ym = m->mbmi.mode;
const int segment_id = m->mbmi.segment_id;
MODE_INFO *above_mi = mi_8x8[-xd->mode_info_stride];
- MODE_INFO *left_mi = mi_8x8[-1];
+ MODE_INFO *left_mi = xd->left_available ? mi_8x8[-1] : NULL;
if (seg->update_map)
write_segment_id(bc, seg, m->mbmi.segment_id);
@@ -538,8 +538,7 @@
if (m->mbmi.sb_type >= BLOCK_8X8) {
const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, 0);
- const MB_PREDICTION_MODE L = xd->left_available ?
- left_block_mode(m, left_mi, 0) : DC_PRED;
+ const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, 0);
write_intra_mode(bc, ym, vp9_kf_y_mode_prob[A][L]);
} else {
int idx, idy;
@@ -549,8 +548,7 @@
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
int i = idy * 2 + idx;
const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, i);
- const MB_PREDICTION_MODE L = (xd->left_available || idx) ?
- left_block_mode(m, left_mi, i) : DC_PRED;
+ const MB_PREDICTION_MODE L = left_block_mode(m, left_mi, i);
const int bm = m->bmi[i].as_mode;
#ifdef ENTROPY_STATS
++intra_mode_stats[A][L][bm];
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1150,7 +1150,7 @@
MACROBLOCKD *const xd = &mb->e_mbd;
MODE_INFO *const mic = xd->mi_8x8[0];
const MODE_INFO *above_mi = xd->mi_8x8[-xd->mode_info_stride];
- const MODE_INFO *left_mi = xd->mi_8x8[-1];
+ const MODE_INFO *left_mi = xd->left_available ? xd->mi_8x8[-1] : NULL;
const BLOCK_SIZE bsize = xd->mi_8x8[0]->mbmi.sb_type;
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
@@ -1176,9 +1176,7 @@
i = idy * 2 + idx;
if (cpi->common.frame_type == KEY_FRAME) {
const MB_PREDICTION_MODE A = above_block_mode(mic, above_mi, i);
- const MB_PREDICTION_MODE L = (xd->left_available || idx) ?
- left_block_mode(mic, left_mi, i) :
- DC_PRED;
+ const MB_PREDICTION_MODE L = left_block_mode(mic, left_mi, i);
bmode_costs = mb->y_mode_costs[A][L];
}
@@ -1237,7 +1235,7 @@
for (mode = DC_PRED; mode <= TM_PRED; mode++) {
int64_t local_tx_cache[TX_MODES];
MODE_INFO *above_mi = xd->mi_8x8[-xd->mode_info_stride];
- MODE_INFO *left_mi = xd->mi_8x8[-1];
+ MODE_INFO *left_mi = xd->left_available ? xd->mi_8x8[-1] : NULL;
if (!(cpi->sf.intra_y_mode_mask[max_txsize_lookup[bsize]] & (1 << mode)))
continue;
@@ -1244,8 +1242,7 @@
if (cpi->common.frame_type == KEY_FRAME) {
const MB_PREDICTION_MODE A = above_block_mode(mic, above_mi, 0);
- const MB_PREDICTION_MODE L = xd->left_available ?
- left_block_mode(mic, left_mi, 0) : DC_PRED;
+ const MB_PREDICTION_MODE L = left_block_mode(mic, left_mi, 0);
bmode_costs = x->y_mode_costs[A][L];
}