ref: 70e96221850445d82908b3b50f12e176de005974
parent: 529679bd52640010aabafef6a0b879a4196d3163
parent: 40141681c05cd9c988f63ddb19688f0ed7a17173
author: Dmitry Kovalev <[email protected]>
date: Tue Jun 25 06:16:06 EDT 2013
Merge "Removing find_seg_id and using vp9_get_pred_mi_segid instead."
--- a/vp9/common/vp9_pred_common.c
+++ b/vp9/common/vp9_pred_common.c
@@ -501,7 +501,7 @@
// 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 @@
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;
--- a/vp9/common/vp9_pred_common.h
+++ b/vp9/common/vp9_pred_common.h
@@ -48,6 +48,6 @@
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_
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -428,6 +428,7 @@
// 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 @@
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);
}
}
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -455,25 +455,6 @@
}
}
-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 @@
/* 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);
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -139,6 +139,7 @@
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);