summaryrefslogtreecommitdiff
path: root/vp9/decoder
diff options
context:
space:
mode:
authorJames Zern <jzern@google.com>2013-09-09 13:37:01 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-09-09 13:37:01 -0700
commit54a03e20ddffd1fd9abf960daa74572cf173a5c8 (patch)
treef027a652b35c939f2713201890f5e73e6dbc829e /vp9/decoder
parentdae17734ece414091ba1184f7becd0aa6c0004f1 (diff)
downloadlibvpx-54a03e20ddffd1fd9abf960daa74572cf173a5c8.tar
libvpx-54a03e20ddffd1fd9abf960daa74572cf173a5c8.tar.gz
libvpx-54a03e20ddffd1fd9abf960daa74572cf173a5c8.tar.bz2
libvpx-54a03e20ddffd1fd9abf960daa74572cf173a5c8.zip
Revert "New mode_info_context storage"
This reverts commit dae17734ece414091ba1184f7becd0aa6c0004f1 Encode crashes, leaks and increases integer overflow errors. Change-Id: I595aa2649bb8d0b6552ff91652837a74c103fda2
Diffstat (limited to 'vp9/decoder')
-rw-r--r--vp9/decoder/vp9_decodemv.c34
-rw-r--r--vp9/decoder/vp9_decodframe.c29
-rw-r--r--vp9/decoder/vp9_detokenize.c4
-rw-r--r--vp9/decoder/vp9_onyxd_if.c5
4 files changed, 26 insertions, 46 deletions
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 84a29b17a..7f23dc190 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -95,7 +95,7 @@ static int read_intra_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
vp9_reader *r) {
MACROBLOCKD *const xd = &pbi->mb;
struct segmentation *const seg = &pbi->common.seg;
- const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type;
+ const BLOCK_SIZE bsize = xd->mode_info_context->mbmi.sb_type;
int segment_id;
if (!seg->enabled)
@@ -114,7 +114,7 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
struct segmentation *const seg = &cm->seg;
- const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type;
+ const BLOCK_SIZE bsize = xd->mode_info_context->mbmi.sb_type;
int pred_segment_id, segment_id;
if (!seg->enabled)
@@ -128,7 +128,7 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
if (seg->temporal_update) {
const vp9_prob pred_prob = vp9_get_pred_prob_seg_id(seg, xd);
const int pred_flag = vp9_read(r, pred_prob);
- vp9_set_pred_flag_seg_id(xd, pred_flag);
+ vp9_set_pred_flag_seg_id(cm, bsize, mi_row, mi_col, pred_flag);
segment_id = pred_flag ? pred_segment_id
: read_segment_id(r, seg);
} else {
@@ -156,8 +156,7 @@ static void read_intra_frame_mode_info(VP9D_COMP *pbi, MODE_INFO *m,
MACROBLOCKD *const xd = &pbi->mb;
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->mi_8x8[-1];
+ const int mis = cm->mode_info_stride;
mbmi->segment_id = read_intra_segment_id(pbi, mi_row, mi_col, r);
mbmi->skip_coeff = read_skip_coeff(pbi, mbmi->segment_id, r);
@@ -166,9 +165,9 @@ static void read_intra_frame_mode_info(VP9D_COMP *pbi, MODE_INFO *m,
mbmi->ref_frame[1] = NONE;
if (bsize >= BLOCK_8X8) {
- const MB_PREDICTION_MODE A = above_block_mode(m, above_mi, 0);
+ const MB_PREDICTION_MODE A = above_block_mode(m, 0, mis);
const MB_PREDICTION_MODE L = xd->left_available ?
- left_block_mode(m, left_mi, 0) : DC_PRED;
+ left_block_mode(m, 0) : DC_PRED;
mbmi->mode = read_intra_mode(r, vp9_kf_y_mode_prob[A][L]);
} else {
// Only 4x4, 4x8, 8x4 blocks
@@ -179,9 +178,9 @@ static void read_intra_frame_mode_info(VP9D_COMP *pbi, MODE_INFO *m,
for (idy = 0; idy < 2; idy += num_4x4_h) {
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 A = above_block_mode(m, ib, mis);
const MB_PREDICTION_MODE L = (xd->left_available || idx) ?
- left_block_mode(m, left_mi, ib) : DC_PRED;
+ left_block_mode(m, ib) : DC_PRED;
const MB_PREDICTION_MODE b_mode = read_intra_mode(r,
vp9_kf_y_mode_prob[A][L]);
m->bmi[ib].as_mode = b_mode;
@@ -454,8 +453,8 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
ref0 = mbmi->ref_frame[0];
is_compound = has_second_ref(mbmi);
- vp9_find_mv_refs(cm, xd, mi, xd->last_mi, ref0, mbmi->ref_mvs[ref0],
- mi_row, mi_col);
+ vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context,
+ ref0, mbmi->ref_mvs[ref0], mi_row, mi_col);
inter_mode_ctx = mbmi->mode_context[ref0];
@@ -475,7 +474,7 @@ static void read_inter_block_mode_info(VP9D_COMP *pbi, MODE_INFO *mi,
if (is_compound) {
const MV_REFERENCE_FRAME ref1 = mbmi->ref_frame[1];
- vp9_find_mv_refs(cm, xd, mi, xd->last_mi,
+ vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context,
ref1, mbmi->ref_mvs[ref1], mi_row, mi_col);
if (bsize < BLOCK_8X8 || mbmi->mode != ZEROMV) {
@@ -670,21 +669,20 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) {
void vp9_read_mode_info(VP9D_COMP* pbi, int mi_row, int mi_col, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
- MODE_INFO *mi = xd->this_mi;
+ MODE_INFO *mi = xd->mode_info_context;
const BLOCK_SIZE bsize = mi->mbmi.sb_type;
const int bw = 1 << mi_width_log2(bsize);
const int bh = 1 << mi_height_log2(bsize);
const int y_mis = MIN(bh, cm->mi_rows - mi_row);
const int x_mis = MIN(bw, cm->mi_cols - mi_col);
- int x, y, z;
+ int x, y;
if (cm->frame_type == KEY_FRAME || cm->intra_only)
read_intra_frame_mode_info(pbi, mi, mi_row, mi_col, r);
else
read_inter_frame_mode_info(pbi, mi, mi_row, mi_col, r);
- for (y = 0, z = 0; y < y_mis; y++, z += cm->mode_info_stride)
- for (x = !y; x < x_mis; x++) {
- xd->mi_8x8[z + x] = mi;
- }
+ for (y = 0; y < y_mis; y++)
+ for (x = !y; x < x_mis; x++)
+ mi[y * cm->mode_info_stride + x] = *mi;
}
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 34ed0c759..6cb7c094b 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -80,7 +80,6 @@ static void read_tx_probs(struct tx_probs *tx_probs, vp9_reader *r) {
static void setup_plane_dequants(VP9_COMMON *cm, MACROBLOCKD *xd, int q_index) {
int i;
xd->plane[0].dequant = cm->y_dequant[q_index];
-
for (i = 1; i < MAX_MB_PLANE; i++)
xd->plane[i].dequant = cm->uv_dequant[q_index];
}
@@ -125,7 +124,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
TX_SIZE tx_size, void *arg) {
MACROBLOCKD* const xd = arg;
struct macroblockd_plane *const pd = &xd->plane[plane];
- MODE_INFO *const mi = xd->this_mi;
+ MODE_INFO *const mi = xd->mode_info_context;
const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size,
block);
uint8_t* const dst = raster_block_offset_uint8(plane_bsize, raster_block,
@@ -149,7 +148,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize,
static int decode_tokens(VP9D_COMP *pbi, BLOCK_SIZE bsize, vp9_reader *r) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
- MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
+ MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
if (mbmi->skip_coeff) {
reset_skip_context(xd, bsize);
@@ -172,20 +171,12 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize,
const int bw = num_8x8_blocks_wide_lookup[bsize];
const int offset = mi_row * cm->mode_info_stride + mi_col;
+ xd->mode_info_context = cm->mi + offset;
+ xd->mode_info_context->mbmi.sb_type = bsize;
xd->mode_info_stride = cm->mode_info_stride;
-
- xd->mi_8x8 = cm->mi_grid_visible + offset;
- xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset;
-
- // we are using the mode info context stream here
- xd->this_mi =
- xd->mi_8x8[0] = xd->mic_stream_ptr;
- xd->this_mi->mbmi.sb_type = bsize;
- xd->mic_stream_ptr++;
-
// Special case: if prev_mi is NULL, the previous mode info context
// cannot be used.
- xd->last_mi = cm->prev_mi ? xd->prev_mi_8x8[0] : NULL;
+ xd->prev_mode_info_context = cm->prev_mi ? cm->prev_mi + offset : NULL;
set_skip_context(cm, xd, mi_row, mi_col);
set_partition_seg_context(cm, xd, mi_row, mi_col);
@@ -200,7 +191,7 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize,
static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
- MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi;
+ MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
const int ref = mbmi->ref_frame[i] - LAST_FRAME;
const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->active_ref_idx[ref]];
const struct scale_factors *sf = &cm->active_ref_scale[ref];
@@ -231,7 +222,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
bsize = BLOCK_8X8;
// Has to be called after set_offsets
- mbmi = &xd->this_mi->mbmi;
+ mbmi = &xd->mode_info_context->mbmi;
if (!is_inter_block(mbmi)) {
// Intra reconstruction
@@ -255,7 +246,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
assert(mbmi->sb_type == bsize);
if (eobtotal == 0)
// skip loopfilter
- vp9_set_pred_flag_mbskip(xd, bsize, 1);
+ vp9_set_pred_flag_mbskip(cm, bsize, mi_row, mi_col, 1);
else if (eobtotal > 0)
foreach_transformed_block(xd, bsize, decode_block, xd);
}
@@ -969,10 +960,6 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
setup_plane_dequants(cm, &pbi->mb, cm->base_qindex);
- xd->mi_8x8 = cm->mi_grid_visible;
- xd->mic_stream_ptr = cm->mi;
- xd->mode_info_stride = cm->mode_info_stride;
-
cm->fc = cm->frame_contexts[cm->frame_context_idx];
vp9_zero(cm->counts);
diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c
index cd74a0b00..c119093df 100644
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -94,7 +94,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd,
ENTROPY_CONTEXT *A, ENTROPY_CONTEXT *L) {
FRAME_CONTEXT *const fc = &cm->fc;
FRAME_COUNTS *const counts = &cm->counts;
- const int ref = is_inter_block(&xd->this_mi->mbmi);
+ const int ref = is_inter_block(&xd->mode_info_context->mbmi);
int band, c = 0;
vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES] =
fc->coef_probs[tx_size][type][ref];
@@ -224,7 +224,7 @@ static void decode_block(int plane, int block, BLOCK_SIZE plane_bsize,
MACROBLOCKD *xd = &arg->pbi->mb;
struct segmentation *seg = &arg->pbi->common.seg;
struct macroblockd_plane* pd = &xd->plane[plane];
- const int segment_id = xd->this_mi->mbmi.segment_id;
+ const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_eob = get_tx_eob(seg, segment_id, tx_size);
int aoff, loff, eob;
diff --git a/vp9/decoder/vp9_onyxd_if.c b/vp9/decoder/vp9_onyxd_if.c
index 17d5def33..505e9dc5d 100644
--- a/vp9/decoder/vp9_onyxd_if.c
+++ b/vp9/decoder/vp9_onyxd_if.c
@@ -386,17 +386,12 @@ int vp9_receive_compressed_data(VP9D_PTR ptr,
if (cm->show_frame) {
// current mip will be the prev_mip for the next frame
MODE_INFO *temp = cm->prev_mip;
- MODE_INFO **temp2 = cm->prev_mi_grid_base;
cm->prev_mip = cm->mip;
cm->mip = temp;
- cm->prev_mi_grid_base = cm->mi_grid_base;
- cm->mi_grid_base = temp2;
// update the upper left visible macroblock ptrs
cm->mi = cm->mip + cm->mode_info_stride + 1;
cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
- cm->mi_grid_visible = cm->mi_grid_base + cm->mode_info_stride + 1;
- cm->prev_mi_grid_visible = cm->prev_mi_grid_base + cm->mode_info_stride + 1;
cm->current_video_frame++;
}