diff options
-rw-r--r-- | vp9/common/vp9_pred_common.c | 4 | ||||
-rw-r--r-- | vp9/common/vp9_pred_common.h | 2 | ||||
-rw-r--r-- | vp9/decoder/vp9_decodemv.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 27 | ||||
-rw-r--r-- | vp9/encoder/vp9_segmentation.c | 1 |
5 files changed, 10 insertions, 28 deletions
diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c index 17da4f215..d921a1197 100644 --- a/vp9/common/vp9_pred_common.c +++ b/vp9/common/vp9_pred_common.c @@ -501,7 +501,7 @@ void vp9_set_pred_flag(MACROBLOCKD *const xd, // Macroblock segment id prediction function int vp9_get_pred_mi_segid(VP9_COMMON *cm, BLOCK_SIZE_TYPE sb_type, - int mi_row, int mi_col) { + uint8_t *segment_ids, int mi_row, int mi_col) { const int mi_index = mi_row * cm->mi_cols + mi_col; const int bw = 1 << mi_width_log2(sb_type); const int bh = 1 << mi_height_log2(sb_type); @@ -513,7 +513,7 @@ int vp9_get_pred_mi_segid(VP9_COMMON *cm, BLOCK_SIZE_TYPE sb_type, for (y = 0; y < ymis; y++) { for (x = 0; x < xmis; x++) { const int index = mi_index + (y * cm->mi_cols + x); - segment_id = MIN(segment_id, cm->last_frame_seg_map[index]); + segment_id = MIN(segment_id, segment_ids[index]); } } return segment_id; diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h index b728724b7..100102b61 100644 --- a/vp9/common/vp9_pred_common.h +++ b/vp9/common/vp9_pred_common.h @@ -48,6 +48,6 @@ void vp9_set_pred_flag(MACROBLOCKD *const xd, int vp9_get_pred_mi_segid(VP9_COMMON *cm, BLOCK_SIZE_TYPE sb_type, - int mi_row, int mi_col); + uint8_t *segment_ids, int mi_row, int mi_col); #endif // VP9_COMMON_VP9_PRED_COMMON_H_ diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index d8836c962..ac97e5c21 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -428,6 +428,7 @@ static int read_mb_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col, // If the value is flagged as correctly predicted // then use the predicted value, otherwise decode it explicitly segment_id = pred_flag ? vp9_get_pred_mi_segid(cm, mbmi->sb_type, + cm->last_frame_seg_map, mi_row, mi_col) : read_mb_segid(r, xd); } else { @@ -437,7 +438,8 @@ static int read_mb_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col, set_segment_id(cm, mbmi, mi_row, mi_col, segment_id); // Side effect return segment_id; } else { - return vp9_get_pred_mi_segid(cm, mbmi->sb_type, mi_row, mi_col); + return vp9_get_pred_mi_segid(cm, mbmi->sb_type, cm->last_frame_seg_map, + mi_row, mi_col); } } diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 35e1d646b..e7b5476d9 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -455,25 +455,6 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx, } } -static unsigned find_seg_id(VP9_COMMON *cm, uint8_t *buf, BLOCK_SIZE_TYPE bsize, - int start_y, int height, int start_x, int width) { - const int bw = 1 << mi_width_log2(bsize), bh = 1 << mi_height_log2(bsize); - const int end_x = MIN(start_x + bw, width); - const int end_y = MIN(start_y + bh, height); - int x, y; - unsigned seg_id = -1; - - buf += width * start_y; - assert(start_y < cm->mi_rows && start_x < cm->cur_tile_mi_col_end); - for (y = start_y; y < end_y; y++, buf += width) { - for (x = start_x; x < end_x; x++) { - seg_id = MIN(seg_id, buf[x]); - } - } - - return seg_id; -} - void vp9_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src, int mb_row, int mb_col) { uint8_t *buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer, src @@ -551,11 +532,9 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col, /* segment ID */ if (xd->segmentation_enabled) { - uint8_t *map = - xd->update_mb_segmentation_map ? - cpi->segmentation_map : cm->last_frame_seg_map; - mbmi->segment_id = find_seg_id(cm, map, bsize, mi_row, cm->mi_rows, mi_col, - cm->mi_cols); + uint8_t *map = xd->update_mb_segmentation_map ? cpi->segmentation_map + : cm->last_frame_seg_map; + mbmi->segment_id = vp9_get_pred_mi_segid(cm, bsize, map, mi_row, mi_col); assert(mbmi->segment_id <= (MAX_MB_SEGMENTS-1)); vp9_mb_init_quantizer(cpi, x); diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c index fe995ad72..af218b7d6 100644 --- a/vp9/encoder/vp9_segmentation.c +++ b/vp9/encoder/vp9_segmentation.c @@ -139,6 +139,7 @@ static void count_segs(VP9_COMP *cpi, if (cm->frame_type != KEY_FRAME) { // Test to see if the segment id matches the predicted value. const int pred_seg_id = vp9_get_pred_mi_segid(cm, mi->mbmi.sb_type, + cm->last_frame_seg_map, mi_row, mi_col); const int seg_predicted = (segment_id == pred_seg_id); |