Commit 40141681 authored by Dmitry Kovalev's avatar Dmitry Kovalev
Browse files

Removing find_seg_id and using vp9_get_pred_mi_segid instead.

Change-Id: Ia40229903c08f14020e90e94cfdf494aba1be827
parent 7756e989
......@@ -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;
......
......@@ -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_
......@@ -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);
}
}
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment