Commit 6125a1ed authored by John Koleszar's avatar John Koleszar
Browse files

Pass macroblock index to pick inter functions

Pass the current mb row and column around rather than the
recon_yoffset and recon_uvoffset, since those offsets will
change from predictor to predictor, based on the reference
frame selection.

Change-Id: If3f9df059e00f5048ca729d3d083ff428e1859c1
parent 6dfc95fe
...@@ -323,9 +323,7 @@ typedef struct macroblockd { ...@@ -323,9 +323,7 @@ typedef struct macroblockd {
int fullpixel_mask; int fullpixel_mask;
YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */ YV12_BUFFER_CONFIG pre; /* Filtered copy of previous frame reconstruction */
struct { YV12_BUFFER_CONFIG second_pre;
uint8_t *y_buffer, *u_buffer, *v_buffer;
} second_pre;
YV12_BUFFER_CONFIG dst; YV12_BUFFER_CONFIG dst;
MODE_INFO *prev_mode_info_context; MODE_INFO *prev_mode_info_context;
......
...@@ -47,15 +47,12 @@ int enc_debug = 0; ...@@ -47,15 +47,12 @@ int enc_debug = 0;
extern void select_interp_filter_type(VP9_COMP *cpi); extern void select_interp_filter_type(VP9_COMP *cpi);
static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t, static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
int recon_yoffset, int recon_uvoffset,
int output_enabled, int mb_row, int mb_col); int output_enabled, int mb_row, int mb_col);
static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t, static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
int recon_yoffset, int recon_uvoffset,
int output_enabled, int mb_row, int mb_col); int output_enabled, int mb_row, int mb_col);
static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t, static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
int recon_yoffset, int recon_uvoffset,
int output_enabled, int mb_row, int mb_col); int output_enabled, int mb_row, int mb_col);
static void adjust_act_zbin(VP9_COMP *cpi, MACROBLOCK *x); static void adjust_act_zbin(VP9_COMP *cpi, MACROBLOCK *x);
...@@ -623,24 +620,12 @@ static unsigned find_seg_id(uint8_t *buf, int block_size, ...@@ -623,24 +620,12 @@ static unsigned find_seg_id(uint8_t *buf, int block_size,
} }
static void set_offsets(VP9_COMP *cpi, static void set_offsets(VP9_COMP *cpi,
int mb_row, int mb_col, int block_size, int mb_row, int mb_col, int block_size) {
int *ref_yoffset, int *ref_uvoffset) {
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi; MB_MODE_INFO *mbmi;
const int dst_fb_idx = cm->new_fb_idx; const int dst_fb_idx = cm->new_fb_idx;
const int recon_y_stride = cm->yv12_fb[dst_fb_idx].y_stride;
const int recon_uv_stride = cm->yv12_fb[dst_fb_idx].uv_stride;
const int recon_yoffset = 16 * mb_row * recon_y_stride + 16 * mb_col;
const int recon_uvoffset = 8 * mb_row * recon_uv_stride + 8 * mb_col;
const int src_y_stride = x->src.y_stride;
const int src_uv_stride = x->src.uv_stride;
const int src_yoffset = 16 * mb_row * src_y_stride + 16 * mb_col;
const int src_uvoffset = 8 * mb_row * src_uv_stride + 8 * mb_col;
const int ref_fb_idx = cm->active_ref_idx[cpi->lst_fb_idx];
const int ref_y_stride = cm->yv12_fb[ref_fb_idx].y_stride;
const int ref_uv_stride = cm->yv12_fb[ref_fb_idx].uv_stride;
const int idx_map = mb_row * cm->mb_cols + mb_col; const int idx_map = mb_row * cm->mb_cols + mb_col;
const int idx_str = xd->mode_info_stride * mb_row + mb_col; const int idx_str = xd->mode_info_stride * mb_row + mb_col;
...@@ -666,9 +651,9 @@ static void set_offsets(VP9_COMP *cpi, ...@@ -666,9 +651,9 @@ static void set_offsets(VP9_COMP *cpi,
xd->prev_mode_info_context = cm->prev_mi + idx_str; xd->prev_mode_info_context = cm->prev_mi + idx_str;
// Set up destination pointers // Set up destination pointers
xd->dst.y_buffer = cm->yv12_fb[dst_fb_idx].y_buffer + recon_yoffset; setup_pred_block(&xd->dst,
xd->dst.u_buffer = cm->yv12_fb[dst_fb_idx].u_buffer + recon_uvoffset; &cm->yv12_fb[dst_fb_idx],
xd->dst.v_buffer = cm->yv12_fb[dst_fb_idx].v_buffer + recon_uvoffset; mb_row, mb_col);
/* Set up limit values for MV components to prevent them from /* Set up limit values for MV components to prevent them from
* extending beyond the UMV borders assuming 16x16 block size */ * extending beyond the UMV borders assuming 16x16 block size */
...@@ -692,14 +677,8 @@ static void set_offsets(VP9_COMP *cpi, ...@@ -692,14 +677,8 @@ static void set_offsets(VP9_COMP *cpi,
xd->left_available = (mb_col > cm->cur_tile_mb_col_start); xd->left_available = (mb_col > cm->cur_tile_mb_col_start);
xd->right_available = (mb_col + block_size < cm->cur_tile_mb_col_end); xd->right_available = (mb_col + block_size < cm->cur_tile_mb_col_end);
/* Reference buffer offsets */
*ref_yoffset = (mb_row * ref_y_stride * 16) + (mb_col * 16);
*ref_uvoffset = (mb_row * ref_uv_stride * 8) + (mb_col * 8);
/* set up source buffers */ /* set up source buffers */
x->src.y_buffer = cpi->Source->y_buffer + src_yoffset; setup_pred_block(&x->src, cpi->Source, mb_row, mb_col);
x->src.u_buffer = cpi->Source->u_buffer + src_uvoffset;
x->src.v_buffer = cpi->Source->v_buffer + src_uvoffset;
/* R/D setup */ /* R/D setup */
x->rddiv = cpi->RDDIV; x->rddiv = cpi->RDDIV;
...@@ -742,8 +721,8 @@ static void set_offsets(VP9_COMP *cpi, ...@@ -742,8 +721,8 @@ static void set_offsets(VP9_COMP *cpi,
} }
static int pick_mb_modes(VP9_COMP *cpi, static int pick_mb_modes(VP9_COMP *cpi,
int mb_row, int mb_row0,
int mb_col, int mb_col0,
TOKENEXTRA **tp, TOKENEXTRA **tp,
int *totalrate, int *totalrate,
int *totaldist) { int *totaldist) {
...@@ -751,16 +730,15 @@ static int pick_mb_modes(VP9_COMP *cpi, ...@@ -751,16 +730,15 @@ static int pick_mb_modes(VP9_COMP *cpi,
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
int i; int i;
int recon_yoffset, recon_uvoffset;
int splitmodes_used = 0; int splitmodes_used = 0;
ENTROPY_CONTEXT_PLANES left_context[2]; ENTROPY_CONTEXT_PLANES left_context[2];
ENTROPY_CONTEXT_PLANES above_context[2]; ENTROPY_CONTEXT_PLANES above_context[2];
ENTROPY_CONTEXT_PLANES *initial_above_context_ptr = cm->above_context ENTROPY_CONTEXT_PLANES *initial_above_context_ptr = cm->above_context
+ mb_col; + mb_col0;
/* Function should not modify L & A contexts; save and restore on exit */ /* Function should not modify L & A contexts; save and restore on exit */
vpx_memcpy(left_context, vpx_memcpy(left_context,
cm->left_context + (mb_row & 2), cm->left_context + (mb_row0 & 2),
sizeof(left_context)); sizeof(left_context));
vpx_memcpy(above_context, vpx_memcpy(above_context,
initial_above_context_ptr, initial_above_context_ptr,
...@@ -769,17 +747,18 @@ static int pick_mb_modes(VP9_COMP *cpi, ...@@ -769,17 +747,18 @@ static int pick_mb_modes(VP9_COMP *cpi,
/* Encode MBs in raster order within the SB */ /* Encode MBs in raster order within the SB */
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
const int x_idx = i & 1, y_idx = i >> 1; const int x_idx = i & 1, y_idx = i >> 1;
const int mb_row = mb_row0 + y_idx;
const int mb_col = mb_col0 + x_idx;
MB_MODE_INFO *mbmi; MB_MODE_INFO *mbmi;
if ((mb_row + y_idx >= cm->mb_rows) || (mb_col + x_idx >= cm->mb_cols)) { if ((mb_row >= cm->mb_rows) || (mb_col >= cm->mb_cols)) {
// MB lies outside frame, move on // MB lies outside frame, move on
continue; continue;
} }
// Index of the MB in the SB 0..3 // Index of the MB in the SB 0..3
xd->mb_index = i; xd->mb_index = i;
set_offsets(cpi, mb_row + y_idx, mb_col + x_idx, 16, set_offsets(cpi, mb_row, mb_col, 16);
&recon_yoffset, &recon_uvoffset);
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
vp9_activity_masking(cpi, x); vp9_activity_masking(cpi, x);
...@@ -800,8 +779,8 @@ static int pick_mb_modes(VP9_COMP *cpi, ...@@ -800,8 +779,8 @@ static int pick_mb_modes(VP9_COMP *cpi,
*totaldist += d; *totaldist += d;
// Dummy encode, do not do the tokenization // Dummy encode, do not do the tokenization
encode_macroblock(cpi, tp, recon_yoffset, recon_uvoffset, 0, encode_macroblock(cpi, tp, 0, mb_row, mb_col);
mb_row + y_idx, mb_col + x_idx);
// Note the encoder may have changed the segment_id // Note the encoder may have changed the segment_id
// Save the coding context // Save the coding context
...@@ -814,16 +793,14 @@ static int pick_mb_modes(VP9_COMP *cpi, ...@@ -814,16 +793,14 @@ static int pick_mb_modes(VP9_COMP *cpi,
if (enc_debug) if (enc_debug)
printf("inter pick_mb_modes %d %d\n", mb_row, mb_col); printf("inter pick_mb_modes %d %d\n", mb_row, mb_col);
#endif #endif
vp9_pick_mode_inter_macroblock(cpi, x, recon_yoffset, vp9_pick_mode_inter_macroblock(cpi, x, mb_row, mb_col, &r, &d);
recon_uvoffset, &r, &d);
*totalrate += r; *totalrate += r;
*totaldist += d; *totaldist += d;
splitmodes_used += (mbmi->mode == SPLITMV); splitmodes_used += (mbmi->mode == SPLITMV);
// Dummy encode, do not do the tokenization // Dummy encode, do not do the tokenization
encode_macroblock(cpi, tp, recon_yoffset, recon_uvoffset, 0, encode_macroblock(cpi, tp, 0, mb_row, mb_col);
mb_row + y_idx, mb_col + x_idx);
seg_id = mbmi->segment_id; seg_id = mbmi->segment_id;
if (cpi->mb.e_mbd.segmentation_enabled && seg_id == 0) { if (cpi->mb.e_mbd.segmentation_enabled && seg_id == 0) {
...@@ -846,7 +823,7 @@ static int pick_mb_modes(VP9_COMP *cpi, ...@@ -846,7 +823,7 @@ static int pick_mb_modes(VP9_COMP *cpi,
} }
/* Restore L & A coding context to those in place on entry */ /* Restore L & A coding context to those in place on entry */
vpx_memcpy(cm->left_context + (mb_row & 2), vpx_memcpy(cm->left_context + (mb_row0 & 2),
left_context, left_context,
sizeof(left_context)); sizeof(left_context));
vpx_memcpy(initial_above_context_ptr, vpx_memcpy(initial_above_context_ptr,
...@@ -865,9 +842,8 @@ static void pick_sb_modes(VP9_COMP *cpi, ...@@ -865,9 +842,8 @@ static void pick_sb_modes(VP9_COMP *cpi,
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
int recon_yoffset, recon_uvoffset;
set_offsets(cpi, mb_row, mb_col, 32, &recon_yoffset, &recon_uvoffset); set_offsets(cpi, mb_row, mb_col, 32);
xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_SB32X32; xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_SB32X32;
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
vp9_activity_masking(cpi, x); vp9_activity_masking(cpi, x);
...@@ -883,11 +859,7 @@ static void pick_sb_modes(VP9_COMP *cpi, ...@@ -883,11 +859,7 @@ static void pick_sb_modes(VP9_COMP *cpi,
vpx_memcpy(&x->sb32_context[xd->sb_index].mic, xd->mode_info_context, vpx_memcpy(&x->sb32_context[xd->sb_index].mic, xd->mode_info_context,
sizeof(MODE_INFO)); sizeof(MODE_INFO));
} else { } else {
vp9_rd_pick_inter_mode_sb32(cpi, x, vp9_rd_pick_inter_mode_sb32(cpi, x, mb_row, mb_col, totalrate, totaldist);
recon_yoffset,
recon_uvoffset,
totalrate,
totaldist);
} }
} }
...@@ -900,9 +872,8 @@ static void pick_sb64_modes(VP9_COMP *cpi, ...@@ -900,9 +872,8 @@ static void pick_sb64_modes(VP9_COMP *cpi,
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
int recon_yoffset, recon_uvoffset;
set_offsets(cpi, mb_row, mb_col, 64, &recon_yoffset, &recon_uvoffset); set_offsets(cpi, mb_row, mb_col, 64);
xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_SB64X64; xd->mode_info_context->mbmi.sb_type = BLOCK_SIZE_SB64X64;
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
vp9_activity_masking(cpi, x); vp9_activity_masking(cpi, x);
...@@ -918,11 +889,7 @@ static void pick_sb64_modes(VP9_COMP *cpi, ...@@ -918,11 +889,7 @@ static void pick_sb64_modes(VP9_COMP *cpi,
vpx_memcpy(&x->sb64_context.mic, xd->mode_info_context, vpx_memcpy(&x->sb64_context.mic, xd->mode_info_context,
sizeof(MODE_INFO)); sizeof(MODE_INFO));
} else { } else {
vp9_rd_pick_inter_mode_sb64(cpi, x, vp9_rd_pick_inter_mode_sb64(cpi, x, mb_row, mb_col, totalrate, totaldist);
recon_yoffset,
recon_uvoffset,
totalrate,
totaldist);
} }
} }
...@@ -990,14 +957,13 @@ static void encode_sb(VP9_COMP *cpi, ...@@ -990,14 +957,13 @@ static void encode_sb(VP9_COMP *cpi,
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
int recon_yoffset, recon_uvoffset;
cpi->sb32_count[is_sb]++; cpi->sb32_count[is_sb]++;
if (is_sb) { if (is_sb) {
set_offsets(cpi, mb_row, mb_col, 32, &recon_yoffset, &recon_uvoffset); set_offsets(cpi, mb_row, mb_col, 32);
update_state(cpi, &x->sb32_context[xd->sb_index], 32, output_enabled); update_state(cpi, &x->sb32_context[xd->sb_index], 32, output_enabled);
encode_superblock32(cpi, tp, recon_yoffset, recon_uvoffset, encode_superblock32(cpi, tp,
output_enabled, mb_row, mb_col); output_enabled, mb_row, mb_col);
if (output_enabled) if (output_enabled)
update_stats(cpi); update_stats(cpi);
...@@ -1019,15 +985,14 @@ static void encode_sb(VP9_COMP *cpi, ...@@ -1019,15 +985,14 @@ static void encode_sb(VP9_COMP *cpi,
continue; continue;
} }
set_offsets(cpi, mb_row + y_idx, mb_col + x_idx, 16, set_offsets(cpi, mb_row + y_idx, mb_col + x_idx, 16);
&recon_yoffset, &recon_uvoffset);
xd->mb_index = i; xd->mb_index = i;
update_state(cpi, &x->mb_context[xd->sb_index][i], 16, output_enabled); update_state(cpi, &x->mb_context[xd->sb_index][i], 16, output_enabled);
if (cpi->oxcf.tuning == VP8_TUNE_SSIM) if (cpi->oxcf.tuning == VP8_TUNE_SSIM)
vp9_activity_masking(cpi, x); vp9_activity_masking(cpi, x);
encode_macroblock(cpi, tp, recon_yoffset, recon_uvoffset, encode_macroblock(cpi, tp,
output_enabled, mb_row + y_idx, mb_col + x_idx); output_enabled, mb_row + y_idx, mb_col + x_idx);
if (output_enabled) if (output_enabled)
update_stats(cpi); update_stats(cpi);
...@@ -1062,11 +1027,9 @@ static void encode_sb64(VP9_COMP *cpi, ...@@ -1062,11 +1027,9 @@ static void encode_sb64(VP9_COMP *cpi,
cpi->sb64_count[is_sb[0] == 2]++; cpi->sb64_count[is_sb[0] == 2]++;
if (is_sb[0] == 2) { if (is_sb[0] == 2) {
int recon_yoffset, recon_uvoffset; set_offsets(cpi, mb_row, mb_col, 64);
set_offsets(cpi, mb_row, mb_col, 64, &recon_yoffset, &recon_uvoffset);
update_state(cpi, &x->sb64_context, 64, 1); update_state(cpi, &x->sb64_context, 64, 1);
encode_superblock64(cpi, tp, recon_yoffset, recon_uvoffset, encode_superblock64(cpi, tp,
1, mb_row, mb_col); 1, mb_row, mb_col);
update_stats(cpi); update_stats(cpi);
...@@ -2025,7 +1988,6 @@ static void update_sb64_skip_coeff_state(VP9_COMP *cpi, ...@@ -2025,7 +1988,6 @@ static void update_sb64_skip_coeff_state(VP9_COMP *cpi,
} }
static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t, static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
int recon_yoffset, int recon_uvoffset,
int output_enabled, int output_enabled,
int mb_row, int mb_col) { int mb_row, int mb_col) {
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
...@@ -2122,9 +2084,9 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2122,9 +2084,9 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
else else
ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx]; ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx];
xd->pre.y_buffer = cpi->common.yv12_fb[ref_fb_idx].y_buffer + recon_yoffset; setup_pred_block(&xd->pre,
xd->pre.u_buffer = cpi->common.yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset; &cpi->common.yv12_fb[ref_fb_idx],
xd->pre.v_buffer = cpi->common.yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset; mb_row, mb_col);
if (mbmi->second_ref_frame > 0) { if (mbmi->second_ref_frame > 0) {
int second_ref_fb_idx; int second_ref_fb_idx;
...@@ -2136,12 +2098,9 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2136,12 +2098,9 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
else else
second_ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx]; second_ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx];
xd->second_pre.y_buffer = cpi->common.yv12_fb[second_ref_fb_idx].y_buffer + setup_pred_block(&xd->second_pre,
recon_yoffset; &cpi->common.yv12_fb[second_ref_fb_idx],
xd->second_pre.u_buffer = cpi->common.yv12_fb[second_ref_fb_idx].u_buffer + mb_row, mb_col);
recon_uvoffset;
xd->second_pre.v_buffer = cpi->common.yv12_fb[second_ref_fb_idx].v_buffer +
recon_uvoffset;
} }
if (!x->skip) { if (!x->skip) {
...@@ -2282,7 +2241,6 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2282,7 +2241,6 @@ static void encode_macroblock(VP9_COMP *cpi, TOKENEXTRA **t,
} }
static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t, static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
int recon_yoffset, int recon_uvoffset,
int output_enabled, int mb_row, int mb_col) { int output_enabled, int mb_row, int mb_col) {
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
...@@ -2361,9 +2319,9 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2361,9 +2319,9 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
else else
ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx]; ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx];
xd->pre.y_buffer = cpi->common.yv12_fb[ref_fb_idx].y_buffer + recon_yoffset; setup_pred_block(&xd->pre,
xd->pre.u_buffer = cpi->common.yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset; &cpi->common.yv12_fb[ref_fb_idx],
xd->pre.v_buffer = cpi->common.yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset; mb_row, mb_col);
if (xd->mode_info_context->mbmi.second_ref_frame > 0) { if (xd->mode_info_context->mbmi.second_ref_frame > 0) {
int second_ref_fb_idx; int second_ref_fb_idx;
...@@ -2375,12 +2333,9 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2375,12 +2333,9 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
else else
second_ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx]; second_ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx];
xd->second_pre.y_buffer = cpi->common.yv12_fb[second_ref_fb_idx].y_buffer + setup_pred_block(&xd->second_pre,
recon_yoffset; &cpi->common.yv12_fb[second_ref_fb_idx],
xd->second_pre.u_buffer = cpi->common.yv12_fb[second_ref_fb_idx].u_buffer + mb_row, mb_col);
recon_uvoffset;
xd->second_pre.v_buffer = cpi->common.yv12_fb[second_ref_fb_idx].v_buffer +
recon_uvoffset;
} }
vp9_build_inter32x32_predictors_sb(xd, xd->dst.y_buffer, vp9_build_inter32x32_predictors_sb(xd, xd->dst.y_buffer,
...@@ -2513,7 +2468,6 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2513,7 +2468,6 @@ static void encode_superblock32(VP9_COMP *cpi, TOKENEXTRA **t,
} }
static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t, static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
int recon_yoffset, int recon_uvoffset,
int output_enabled, int mb_row, int mb_col) { int output_enabled, int mb_row, int mb_col) {
VP9_COMMON *const cm = &cpi->common; VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb; MACROBLOCK *const x = &cpi->mb;
...@@ -2591,12 +2545,9 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2591,12 +2545,9 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
else else
ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx]; ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx];
xd->pre.y_buffer = setup_pred_block(&xd->pre,
cpi->common.yv12_fb[ref_fb_idx].y_buffer + recon_yoffset; &cpi->common.yv12_fb[ref_fb_idx],
xd->pre.u_buffer = mb_row, mb_col);
cpi->common.yv12_fb[ref_fb_idx].u_buffer + recon_uvoffset;
xd->pre.v_buffer =
cpi->common.yv12_fb[ref_fb_idx].v_buffer + recon_uvoffset;
if (xd->mode_info_context->mbmi.second_ref_frame > 0) { if (xd->mode_info_context->mbmi.second_ref_frame > 0) {
int second_ref_fb_idx; int second_ref_fb_idx;
...@@ -2608,12 +2559,9 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t, ...@@ -2608,12 +2559,9 @@ static void encode_superblock64(VP9_COMP *cpi, TOKENEXTRA **t,
else else
second_ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx]; second_ref_fb_idx = cpi->common.active_ref_idx[cpi->alt_fb_idx];
xd->second_pre.y_buffer = setup_pred_block(&xd->second_pre,
cpi->common.yv12_fb[second_ref_fb_idx].y_buffer + recon_yoffset; &cpi->common.yv12_fb[second_ref_fb_idx],
xd->second_pre.u_buffer = mb_row, mb_col);
cpi->common.yv12_fb[second_ref_fb_idx].u_buffer + recon_uvoffset;
xd->second_pre.v_buffer =
cpi->common.yv12_fb[second_ref_fb_idx].v_buffer + recon_uvoffset;
} }
vp9_build_inter64x64_predictors_sb(xd, xd->dst.y_buffer, vp9_build_inter64x64_predictors_sb(xd, xd->dst.y_buffer,
......
...@@ -3167,20 +3167,16 @@ static void inter_mode_cost(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -3167,20 +3167,16 @@ static void inter_mode_cost(VP9_COMP *cpi, MACROBLOCK *x,
static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
int idx, MV_REFERENCE_FRAME frame_type, int idx, MV_REFERENCE_FRAME frame_type,
int block_size, int block_size,
int recon_yoffset, int recon_uvoffset, int mb_row, int mb_col,
int_mv frame_nearest_mv[MAX_REF_FRAMES], int_mv frame_nearest_mv[MAX_REF_FRAMES],
int_mv frame_near_mv[MAX_REF_FRAMES], int_mv frame_near_mv[MAX_REF_FRAMES],
int frame_mdcounts[4][4], int frame_mdcounts[4][4],
uint8_t *y_buffer[4], YV12_BUFFER_CONFIG yv12_mb[4]) {
uint8_t *u_buffer[4],
uint8_t *v_buffer[4]) {
YV12_BUFFER_CONFIG *yv12 = &cpi->common.yv12_fb[idx]; YV12_BUFFER_CONFIG *yv12 = &cpi->common.yv12_fb[idx];
MACROBLOCKD *const xd = &x->e_mbd; MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi; MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
y_buffer[frame_type] = yv12->y_buffer + recon_yoffset; setup_pred_block(&yv12_mb[frame_type], yv12, mb_row, mb_col);
u_buffer[frame_type] = yv12->u_buffer + recon_uvoffset;
v_buffer[frame_type] = yv12->v_buffer + recon_uvoffset;
// Gets an initial list of candidate vectors from neighbours and orders them // Gets an initial list of candidate vectors from neighbours and orders them
vp9_find_mv_refs(&cpi->common, xd, xd->mode_info_context, vp9_find_mv_refs(&cpi->common, xd, xd->mode_info_context,
...@@ -3194,7 +3190,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -3194,7 +3190,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
vp9_find_best_ref_mvs(xd, vp9_find_best_ref_mvs(xd,
cpi->common.error_resilient_mode || cpi->common.error_resilient_mode ||
cpi->common.frame_parallel_decoding_mode ? cpi->common.frame_parallel_decoding_mode ?
0 : y_buffer[frame_type], 0 : yv12_mb[frame_type].y_buffer,
yv12->y_stride, yv12->y_stride,
mbmi->ref_mvs[frame_type], mbmi->ref_mvs[frame_type],
&frame_nearest_mv[frame_type], &frame_nearest_mv[frame_type],
...@@ -3202,7 +3198,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, ...@@ -3202,7 +3198,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
// Further refinement that is encode side only to test the top few candidates // Further refinement that is encode side only to test the top few candidates
// in full and choose the best as the centre point for subsequent searches. // in full and choose the best as the centre point for subsequent searches.
mv_pred(cpi, x, y_buffer[frame_type], yv12->y_stride, mv_pred(cpi, x, yv12_mb[frame_type].y_buffer, yv12->y_stride,