summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kovalev <dkovalev@google.com>2013-10-03 15:09:49 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-10-03 15:09:49 -0700
commit3b7794f9eb28bf4e70b4ac2bd0e5f1c730c10724 (patch)
tree744e06e60c63c4be1f7e18c1119240f4351f200e
parent4093192ec9b2168528e7747de581a8d656de6ab9 (diff)
parent0e23048303be2691da9d4f880982fe4982be2eff (diff)
downloadlibvpx-3b7794f9eb28bf4e70b4ac2bd0e5f1c730c10724.tar
libvpx-3b7794f9eb28bf4e70b4ac2bd0e5f1c730c10724.tar.gz
libvpx-3b7794f9eb28bf4e70b4ac2bd0e5f1c730c10724.tar.bz2
libvpx-3b7794f9eb28bf4e70b4ac2bd0e5f1c730c10724.zip
Merge "BITSTREAM - "update_map" SEMANTICS BROKEN IN 398ddafb629b7f49cf255bf09d3e38b4abd0bb95"
-rw-r--r--vp9/decoder/vp9_decodemv.c32
-rw-r--r--vp9/decoder/vp9_decodframe.c11
2 files changed, 28 insertions, 15 deletions
diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c
index 18e6ea0ef..2f634c84b 100644
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -91,9 +91,28 @@ static TX_SIZE read_tx_size(VP9D_COMP *pbi, TX_MODE tx_mode,
return TX_4X4;
}
+static void set_segment_id(VP9_COMMON *cm, BLOCK_SIZE bsize,
+ int mi_row, int mi_col, int segment_id) {
+ const int mi_offset = mi_row * cm->mi_cols + mi_col;
+ const int bw = 1 << mi_width_log2(bsize);
+ const int bh = 1 << mi_height_log2(bsize);
+ const int xmis = MIN(cm->mi_cols - mi_col, bw);
+ const int ymis = MIN(cm->mi_rows - mi_row, bh);
+ int x, y;
+
+ assert(segment_id >= 0 && segment_id < MAX_SEGMENTS);
+
+ for (y = 0; y < ymis; y++)
+ for (x = 0; x < xmis; x++)
+ cm->last_frame_seg_map[mi_offset + y * cm->mi_cols + x] = segment_id;
+}
+
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;
+ int segment_id;
if (!seg->enabled)
return 0; // Default for disabled segmentation
@@ -101,7 +120,9 @@ static int read_intra_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
if (!seg->update_map)
return 0;
- return read_segment_id(r, seg);
+ segment_id = read_segment_id(r, seg);
+ set_segment_id(&pbi->common, bsize, mi_row, mi_col, segment_id);
+ return segment_id;
}
static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
@@ -110,7 +131,7 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
MACROBLOCKD *const xd = &pbi->mb;
struct segmentation *const seg = &cm->seg;
const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type;
- int pred_segment_id;;
+ int pred_segment_id, segment_id;
if (!seg->enabled)
return 0; // Default for disabled segmentation
@@ -124,10 +145,13 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col,
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);
- return pred_flag ? pred_segment_id : read_segment_id(r, seg);
+ segment_id = pred_flag ? pred_segment_id
+ : read_segment_id(r, seg);
} else {
- return read_segment_id(r, seg);
+ segment_id = read_segment_id(r, seg);
}
+ set_segment_id(cm, bsize, mi_row, mi_col, segment_id);
+ return segment_id;
}
static uint8_t read_skip_coeff(VP9D_COMP *pbi, int segment_id, vp9_reader *r) {
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index 4f19b83de..de3b18fad 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -945,15 +945,6 @@ void vp9_init_dequantizer(VP9_COMMON *cm) {
}
}
-static void update_segmentation_map(VP9_COMMON *cm) {
- int i, j;
-
- for (i = 0; i < cm->mi_rows; ++i)
- for (j = 0; j < cm->mi_cols; ++j)
- cm->last_frame_seg_map[i * cm->mi_cols + j] =
- cm->mi_grid_visible[i * cm->mode_info_stride + j]->mbmi.segment_id;
-}
-
int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
int i;
VP9_COMMON *const cm = &pbi->common;
@@ -1033,7 +1024,5 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
if (cm->refresh_frame_context)
cm->frame_contexts[cm->frame_context_idx] = cm->fc;
- update_segmentation_map(cm);
-
return 0;
}