// 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);
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;
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_
// 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 {
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);
}
}
}
}
-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
/* 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);
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);