Removing set_refs, adding set_ref function.
Change-Id: I5635c478b106ae4e57d317f1c83d929644307e63
}
}
-static void setup_pre_planes(MACROBLOCKD *xd,
- const YV12_BUFFER_CONFIG *src0,
- const YV12_BUFFER_CONFIG *src1,
+static void setup_pre_planes(MACROBLOCKD *xd, int i,
+ const YV12_BUFFER_CONFIG *src,
int mi_row, int mi_col,
const struct scale_factors *scale,
const struct scale_factors *scale_uv) {
- const YV12_BUFFER_CONFIG *srcs[2] = {src0, src1};
- int i, j;
-
- for (i = 0; i < 2; ++i) {
- const YV12_BUFFER_CONFIG *src = srcs[i];
- if (src) {
- uint8_t* buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
- src->alpha_buffer};
- int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
- src->alpha_stride};
-
- for (j = 0; j < MAX_MB_PLANE; ++j) {
- struct macroblockd_plane *pd = &xd->plane[j];
- const struct scale_factors *sf = j ? scale_uv : scale;
- setup_pred_plane(&pd->pre[i],
- buffers[j], strides[j],
- mi_row, mi_col, sf ? &sf[i] : NULL,
- pd->subsampling_x, pd->subsampling_y);
- }
+ if (src) {
+ int j;
+ uint8_t* buffers[4] = {src->y_buffer, src->u_buffer, src->v_buffer,
+ src->alpha_buffer};
+ int strides[4] = {src->y_stride, src->uv_stride, src->uv_stride,
+ src->alpha_stride};
+
+ for (j = 0; j < MAX_MB_PLANE; ++j) {
+ struct macroblockd_plane *pd = &xd->plane[j];
+ const struct scale_factors *sf = j ? scale_uv : scale;
+ setup_pred_plane(&pd->pre[i], buffers[j], strides[j],
+ mi_row, mi_col, sf, pd->subsampling_x, pd->subsampling_y);
}
}
}
setup_dst_planes(xd, &cm->yv12_fb[cm->new_fb_idx], mi_row, mi_col);
}
-static void set_refs(VP9D_COMP *pbi, int mi_row, int mi_col) {
+static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) {
VP9_COMMON *const cm = &pbi->common;
MACROBLOCKD *const xd = &pbi->mb;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
+ const int ref = mbmi->ref_frame[i] - 1;
- // Select the appropriate reference frame for this MB
- const int fb_idx = cm->active_ref_idx[mbmi->ref_frame[0] - 1];
- const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[fb_idx];
- xd->scale_factor[0] = cm->active_ref_scale[mbmi->ref_frame[0] - 1];
- xd->scale_factor_uv[0] = cm->active_ref_scale[mbmi->ref_frame[0] - 1];
- setup_pre_planes(xd, cfg, NULL, mi_row, mi_col, xd->scale_factor,
- xd->scale_factor_uv);
+ const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->active_ref_idx[ref]];
+ xd->scale_factor[i] = cm->active_ref_scale[ref];
+ xd->scale_factor_uv[i] = cm->active_ref_scale[ref];
+ setup_pre_planes(xd, i, cfg, mi_row, mi_col,
+ &xd->scale_factor[i], &xd->scale_factor_uv[i]);
xd->corrupted |= cfg->corrupted;
-
- if (mbmi->ref_frame[1] > INTRA_FRAME) {
- // Select the appropriate reference frame for this MB
- const int second_fb_idx = cm->active_ref_idx[mbmi->ref_frame[1] - 1];
- const YV12_BUFFER_CONFIG *second_cfg = &cm->yv12_fb[second_fb_idx];
- xd->scale_factor[1] = cm->active_ref_scale[mbmi->ref_frame[1] - 1];
- xd->scale_factor_uv[1] = cm->active_ref_scale[mbmi->ref_frame[1] - 1];
- setup_pre_planes(xd, NULL, second_cfg, mi_row, mi_col, xd->scale_factor,
- xd->scale_factor_uv);
- xd->corrupted |= second_cfg->corrupted;
- }
}
static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col,
} else {
// Inter reconstruction
int eobtotal;
- set_refs(pbi, mi_row, mi_col);
+
+ set_ref(pbi, 0, mi_row, mi_col);
+ if (mbmi->ref_frame[1] > INTRA_FRAME)
+ set_ref(pbi, 1, mi_row, mi_col);
+
vp9_setup_interp_filters(xd, mbmi->interp_filter, cm);
vp9_build_inter_predictors_sb(xd, mi_row, mi_col, bsize);
eobtotal = decode_tokens(pbi, bsize, r);
read_coef_probs(pbi, &header_bc);
// Initialize xd pointers. Any reference should do for xd->pre, so use 0.
- setup_pre_planes(xd, &pc->yv12_fb[pc->active_ref_idx[0]], NULL,
- 0, 0, NULL, NULL);
+ setup_pre_planes(xd, 0, &pc->yv12_fb[pc->active_ref_idx[0]], 0, 0,
+ NULL, NULL);
setup_dst_planes(xd, new_fb, 0, 0);
// Create the segmentation map structure and set to 0
YV12_BUFFER_CONFIG *ref_fb = &cm->yv12_fb[0];
YV12_BUFFER_CONFIG *second_ref_fb = NULL;
- setup_pre_planes(xd, ref_fb, second_ref_fb, mi_row, mi_col,
- xd->scale_factor, xd->scale_factor_uv);
+ setup_pre_planes(xd, 0, ref_fb, mi_row, mi_col,
+ &xd->scale_factor[0], &xd->scale_factor_uv[0]);
+ setup_pre_planes(xd, 1, second_ref_fb, mi_row, mi_col,
+ &xd->scale_factor[1], &xd->scale_factor_uv[1]);
xd->mode_info_context->mbmi.ref_frame[0] = LAST_FRAME;
xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_SB64X64;
vp9_find_best_ref_mvs(xd, m->mbmi.ref_mvs[m->mbmi.ref_frame[0]],
vp9_setup_src_planes(x, cpi->Source, 0, 0);
// TODO(jkoleszar): are these initializations required?
- setup_pre_planes(xd, &cm->yv12_fb[cm->ref_frame_map[cpi->lst_fb_idx]], NULL,
- 0, 0, NULL, NULL );
+ setup_pre_planes(xd, 0, &cm->yv12_fb[cm->ref_frame_map[cpi->lst_fb_idx]],
+ 0, 0, NULL, NULL);
setup_dst_planes(xd, &cm->yv12_fb[cm->new_fb_idx], 0, 0);
setup_block_dptrs(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
assert(cm->frame_type != KEY_FRAME);
- setup_pre_planes(xd, ref_fb, second_ref_fb, mi_row, mi_col,
- xd->scale_factor, xd->scale_factor_uv);
+ setup_pre_planes(xd, 0, ref_fb, mi_row, mi_col,
+ &xd->scale_factor[0], &xd->scale_factor_uv[0]);
+ setup_pre_planes(xd, 1, second_ref_fb, mi_row, mi_col,
+ &xd->scale_factor[1], &xd->scale_factor_uv[1]);
+
vp9_build_inter_predictors_sb(
xd, mi_row, mi_col,
vp9_clear_system_state(); // __asm emms;
vp9_setup_src_planes(x, cpi->Source, 0, 0);
- setup_pre_planes(xd, lst_yv12, NULL, 0, 0, NULL, NULL);
+ setup_pre_planes(xd, 0, lst_yv12, 0, 0, NULL, NULL);
setup_dst_planes(xd, new_yv12, 0, 0);
x->partition_info = x->pi;
for (i = 0; i < MAX_MB_PLANE; i++)
backup_yv12[i] = xd->plane[i].pre[0];
- setup_pre_planes(xd, scaled_ref_frame, NULL, mi_row, mi_col,
- NULL, NULL);
+ setup_pre_planes(xd, 0, scaled_ref_frame, mi_row, mi_col, NULL, NULL);
}
vp9_clamp_mv_min_max(x, &ref_mv);
// motion search code to be used without additional modifications.
for (i = 0; i < MAX_MB_PLANE; i++)
backup_yv12[i] = xd->plane[i].pre[0];
- setup_pre_planes(xd, scaled_ref_frame[0], NULL, mi_row, mi_col,
- NULL, NULL);
+ setup_pre_planes(xd, 0, scaled_ref_frame[0], mi_row, mi_col, NULL, NULL);
}
if (scaled_ref_frame[1]) {
for (i = 0; i < MAX_MB_PLANE; i++)
backup_second_yv12[i] = xd->plane[i].pre[1];
- setup_pre_planes(xd, scaled_ref_frame[1], NULL, mi_row, mi_col,
- NULL, NULL);
+ setup_pre_planes(xd, 0, scaled_ref_frame[1], mi_row, mi_col, NULL, NULL);
}
xd->scale_factor[0].set_scaled_offsets(&xd->scale_factor[0],