summaryrefslogtreecommitdiff
path: root/vp9/decoder/vp9_decodframe.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2013-04-05 16:03:25 -0700
committerGerrit Code Review <gerrit@gerrit.golo.chromium.org>2013-04-05 16:03:25 -0700
commit8bbabbea701d9e1ee6692707de3846333f03ef89 (patch)
tree08fb0bd55db87556439c33301f8a28bacafaf179 /vp9/decoder/vp9_decodframe.c
parentfa135d7b9e1ce14789e12a4e76e6f564b7d6799d (diff)
parent2c42499513d00a839cb79d142650f9ce1ee9983f (diff)
downloadlibvpx-8bbabbea701d9e1ee6692707de3846333f03ef89.tar
libvpx-8bbabbea701d9e1ee6692707de3846333f03ef89.tar.gz
libvpx-8bbabbea701d9e1ee6692707de3846333f03ef89.tar.bz2
libvpx-8bbabbea701d9e1ee6692707de3846333f03ef89.zip
Merge "Segmentation code cleanup." into experimental
Diffstat (limited to 'vp9/decoder/vp9_decodframe.c')
-rw-r--r--vp9/decoder/vp9_decodframe.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c
index b8ec07001..11a4338dd 100644
--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -1272,8 +1272,8 @@ static void update_frame_size(VP9D_COMP *pbi) {
const int width = multiple16(cm->width);
const int height = multiple16(cm->height);
- cm->mb_rows = height >> 4;
- cm->mb_cols = width >> 4;
+ cm->mb_rows = height / 16;
+ cm->mb_cols = width / 16;
cm->MBs = cm->mb_rows * cm->mb_cols;
cm->mode_info_stride = cm->mb_cols + 1;
memset(cm->mip, 0,
@@ -1294,7 +1294,6 @@ static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
// this frame.
xd->update_mb_segmentation_map = vp9_read_bit(r);
- // If so what method will be used.
if (xd->update_mb_segmentation_map) {
// Which macro block level features are enabled. Read the probs used to
// decode the segment id for each macro block.
@@ -1303,15 +1302,10 @@ static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
// Read the prediction probs needed to decode the segment id
pc->temporal_update = vp9_read_bit(r);
- for (i = 0; i < PREDICTION_PROBS; i++) {
- pc->segment_pred_probs[i] = pc->temporal_update
- ? (vp9_read_bit(r) ? vp9_read_prob(r) : 255)
- : 255;
- }
-
if (pc->temporal_update) {
const vp9_prob *p = xd->mb_segment_tree_probs;
vp9_prob *p_mod = xd->mb_segment_mispred_tree_probs;
+
const int c0 = p[0] * p[1];
const int c1 = p[0] * (256 - p[1]);
const int c2 = (256 - p[0]) * p[2];
@@ -1321,6 +1315,12 @@ static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
p_mod[1] = get_binary_prob(c0, c2 + c3);
p_mod[2] = get_binary_prob(c0 + c1, c3);
p_mod[3] = get_binary_prob(c0 + c1, c2);
+
+ for (i = 0; i < PREDICTION_PROBS; i++)
+ pc->segment_pred_probs[i] = vp9_read_bit(r) ? vp9_read_prob(r) : 255;
+ } else {
+ for (i = 0; i < PREDICTION_PROBS; i++)
+ pc->segment_pred_probs[i] = 255;
}
}
@@ -1330,25 +1330,17 @@ static void setup_segmentation(VP9_COMMON *pc, MACROBLOCKD *xd, vp9_reader *r) {
vp9_clearall_segfeatures(xd);
- // For each segmentation...
for (i = 0; i < MAX_MB_SEGMENTS; i++) {
- // For each of the segments features...
for (j = 0; j < SEG_LVL_MAX; j++) {
- int data;
- // Is the feature enabled
- if (vp9_read_bit(r)) {
- // Update the feature data and mask
+ int data = 0;
+ const int feature_enabled = vp9_read_bit(r);
+ if (feature_enabled) {
vp9_enable_segfeature(xd, i, j);
-
data = vp9_decode_unsigned_max(r, vp9_seg_feature_data_max(j));
- // Is the segment data signed.
if (vp9_is_segfeature_signed(j) && vp9_read_bit(r)) {
data = -data;
}
- } else {
- data = 0;
}
-
vp9_set_segdata(xd, i, j, data);
}
}