Offset sub8x8 chroma component buffer pointers
Offset the buffer pointers of sub8x8 chroma components to support
the coding process at bottom right 8x8 block.
Change-Id: Ide17ee31ce064484371194cbbade88603d114a2e
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 2f345d1..cac1aaf 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -285,7 +285,8 @@
#endif
// Set up destination pointers.
- av1_setup_dst_planes(xd->plane, get_frame_new_buffer(cm), mi_row, mi_col);
+ av1_setup_dst_planes(xd->plane, bsize, get_frame_new_buffer(cm), mi_row,
+ mi_col);
// Set up limit values for MV components.
// Mv beyond the range do not produce new/different prediction block.
@@ -1829,8 +1830,8 @@
x->e_mbd.cur_buf = src;
for (i = 0; i < MAX_MB_PLANE; i++)
- setup_pred_plane(&x->plane[i].src, buffers[i], widths[i], heights[i],
- strides[i], mi_row, mi_col, NULL,
+ setup_pred_plane(&x->plane[i].src, x->e_mbd.mi[0]->mbmi.sb_type, buffers[i],
+ widths[i], heights[i], strides[i], mi_row, mi_col, NULL,
x->e_mbd.plane[i].subsampling_x,
x->e_mbd.plane[i].subsampling_y);
}
@@ -2473,8 +2474,8 @@
check_ncobmc = is_inter_block(mbmi) && motion_allowed >= OBMC_CAUSAL;
if (!dry_run && check_ncobmc) {
av1_check_ncobmc_rd(cpi, x, mi_row, mi_col);
- av1_setup_dst_planes(x->e_mbd.plane, get_frame_new_buffer(&cpi->common),
- mi_row, mi_col);
+ av1_setup_dst_planes(x->e_mbd.plane, bsize,
+ get_frame_new_buffer(&cpi->common), mi_row, mi_col);
}
#endif
encode_superblock(cpi, td, tp, dry_run, mi_row, mi_col, bsize, ctx, rate);
@@ -2539,7 +2540,8 @@
update_state_sb_supertx(cpi, td, tile, mi_row, mi_col, bsize, dry_run,
pc_tree);
- av1_setup_dst_planes(xd->plane, get_frame_new_buffer(cm), mi_row, mi_col);
+ av1_setup_dst_planes(xd->plane, bsize, get_frame_new_buffer(cm), mi_row,
+ mi_col);
for (i = 0; i < MAX_MB_PLANE; i++) {
dst_buf[i] = xd->plane[i].dst.buf;
dst_stride[i] = xd->plane[i].dst.stride;
@@ -7009,7 +7011,8 @@
set_skip_context(xd, mi_row, mi_col);
set_mode_info_offsets(cpi, x, xd, mi_row, mi_col);
update_state_sb_supertx(cpi, td, tile, mi_row, mi_col, bsize, 1, pc_tree);
- av1_setup_dst_planes(xd->plane, get_frame_new_buffer(cm), mi_row, mi_col);
+ av1_setup_dst_planes(xd->plane, bsize, get_frame_new_buffer(cm), mi_row,
+ mi_col);
for (plane = 0; plane < MAX_MB_PLANE; plane++) {
dst_buf[plane] = xd->plane[plane].dst.buf;
dst_stride[plane] = xd->plane[plane].dst.stride;
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index 4d3425f..e35a54e 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -518,6 +518,10 @@
aom_clear_system_state();
+ xd->mi = cm->mi_grid_visible;
+ xd->mi[0] = cm->mi;
+ x->e_mbd.mi[0]->mbmi.sb_type = BLOCK_16X16;
+
intra_factor = 0.0;
brightness_factor = 0.0;
neutral_count = 0.0;
@@ -528,7 +532,7 @@
av1_setup_block_planes(&x->e_mbd, cm->subsampling_x, cm->subsampling_y);
av1_setup_src_planes(x, cpi->source, 0, 0);
- av1_setup_dst_planes(xd->plane, new_yv12, 0, 0);
+ av1_setup_dst_planes(xd->plane, cm->sb_size, new_yv12, 0, 0);
if (!frame_is_intra_only(cm)) {
av1_setup_pre_planes(xd, 0, first_ref_buf, 0, 0, NULL);
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c
index ae8f04e..d069eef 100644
--- a/av1/encoder/mcomp.c
+++ b/av1/encoder/mcomp.c
@@ -2573,10 +2573,11 @@
if (use_upsampled_ref) {
int ref = xd->mi[0]->mbmi.ref_frame[is_second];
const YV12_BUFFER_CONFIG *upsampled_ref = get_upsampled_ref(cpi, ref);
- setup_pred_plane(&pd->pre[is_second], upsampled_ref->y_buffer,
- upsampled_ref->y_crop_width, upsampled_ref->y_crop_height,
- upsampled_ref->y_stride, (mi_row << 3), (mi_col << 3),
- NULL, pd->subsampling_x, pd->subsampling_y);
+ setup_pred_plane(&pd->pre[is_second], mbmi->sb_type,
+ upsampled_ref->y_buffer, upsampled_ref->y_crop_width,
+ upsampled_ref->y_crop_height, upsampled_ref->y_stride,
+ (mi_row << 3), (mi_col << 3), NULL, pd->subsampling_x,
+ pd->subsampling_y);
}
y = pd->pre[is_second].buf;
y_stride = pd->pre[is_second].stride;
@@ -3073,10 +3074,11 @@
if (use_upsampled_ref) {
int ref = xd->mi[0]->mbmi.ref_frame[is_second];
const YV12_BUFFER_CONFIG *upsampled_ref = get_upsampled_ref(cpi, ref);
- setup_pred_plane(&pd->pre[is_second], upsampled_ref->y_buffer,
- upsampled_ref->y_crop_width, upsampled_ref->y_crop_height,
- upsampled_ref->y_stride, (mi_row << 3), (mi_col << 3),
- NULL, pd->subsampling_x, pd->subsampling_y);
+ setup_pred_plane(&pd->pre[is_second], mbmi->sb_type,
+ upsampled_ref->y_buffer, upsampled_ref->y_crop_width,
+ upsampled_ref->y_crop_height, upsampled_ref->y_stride,
+ (mi_row << 3), (mi_col << 3), NULL, pd->subsampling_x,
+ pd->subsampling_y);
}
y = pd->pre[is_second].buf;
y_stride = pd->pre[is_second].stride;
diff --git a/av1/encoder/pickcdef.c b/av1/encoder/pickcdef.c
index bafc554..da64fb4 100644
--- a/av1/encoder/pickcdef.c
+++ b/av1/encoder/pickcdef.c
@@ -312,7 +312,7 @@
av1_ac_quant(cm->base_qindex, 0, cm->bit_depth) >> (cm->bit_depth - 8);
lambda = .12 * quantizer * quantizer / 256.;
- av1_setup_dst_planes(xd->plane, frame, 0, 0);
+ av1_setup_dst_planes(xd->plane, cm->sb_size, frame, 0, 0);
mse[0] = aom_malloc(sizeof(**mse) * nvsb * nhsb);
mse[1] = aom_malloc(sizeof(**mse) * nvsb * nhsb);
for (pli = 0; pli < nplanes; pli++) {
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 0663ed8..f06e569 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -799,7 +799,7 @@
dst[1].stride = dst[2].stride = src->uv_stride;
for (i = 0; i < MAX_MB_PLANE; ++i) {
- setup_pred_plane(dst + i, dst[i].buf,
+ setup_pred_plane(dst + i, xd->mi[0]->mbmi.sb_type, dst[i].buf,
i ? src->uv_crop_width : src->y_crop_width,
i ? src->uv_crop_height : src->y_crop_height,
dst[i].stride, mi_row, mi_col, i ? scale_uv : scale,
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index ff05537..5c69d9f 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -5658,7 +5658,7 @@
get_upsampled_ref(cpi, refs[id]);
// Set pred for Y plane
- setup_pred_plane(&pd->pre[0], upsampled_ref->y_buffer,
+ setup_pred_plane(&pd->pre[0], bsize, upsampled_ref->y_buffer,
upsampled_ref->y_crop_width,
upsampled_ref->y_crop_height, upsampled_ref->y_stride,
(mi_row << 3), (mi_col << 3), NULL, pd->subsampling_x,
@@ -6102,7 +6102,7 @@
// Set pred for Y plane
setup_pred_plane(
- &pd->pre[0], upsampled_ref->y_buffer,
+ &pd->pre[0], bsize, upsampled_ref->y_buffer,
upsampled_ref->y_crop_width, upsampled_ref->y_crop_height,
upsampled_ref->y_stride, (mi_row << 3), (mi_col << 3), NULL,
pd->subsampling_x, pd->subsampling_y);
@@ -7025,7 +7025,7 @@
// Set pred for Y plane
setup_pred_plane(
- &pd->pre[ref_idx], upsampled_ref->y_buffer,
+ &pd->pre[ref_idx], bsize, upsampled_ref->y_buffer,
upsampled_ref->y_crop_width, upsampled_ref->y_crop_height,
upsampled_ref->y_stride, (mi_row << 3), (mi_col << 3), NULL,
pd->subsampling_x, pd->subsampling_y);
@@ -9840,7 +9840,8 @@
av1_build_prediction_by_left_preds(cm, xd, mi_row, mi_col,
args.left_pred_buf, dst_width2,
dst_height2, args.left_pred_stride);
- av1_setup_dst_planes(xd->plane, get_frame_new_buffer(cm), mi_row, mi_col);
+ av1_setup_dst_planes(xd->plane, bsize, get_frame_new_buffer(cm), mi_row,
+ mi_col);
x->mask_buf = mask2d_buf;
x->wsrc_buf = weighted_src_buf;
calc_target_weighted_pred(cm, x, xd, mi_row, mi_col, args.above_pred_buf[0],
@@ -12656,8 +12657,8 @@
av1_setup_pre_planes(xd, ref, cfg, mi_row, mi_col,
&xd->block_refs[ref]->sf);
}
- av1_setup_dst_planes(x->e_mbd.plane, get_frame_new_buffer(&cpi->common),
- mi_row, mi_col);
+ av1_setup_dst_planes(x->e_mbd.plane, bsize,
+ get_frame_new_buffer(&cpi->common), mi_row, mi_col);
av1_build_inter_predictors_sb(xd, mi_row, mi_col, NULL, bsize);