Merge "Moved use_prev_in_find_mv_refs check to frame level" into experimental

This commit is contained in:
Scott LaVarnway 2013-05-31 09:35:51 -07:00 committed by Gerrit Code Review
commit 1e025dbfd1
8 changed files with 30 additions and 27 deletions

View File

@ -774,5 +774,4 @@ static void txfrm_block_to_raster_xy(MACROBLOCKD *xd,
*x = (raster_mb & (tx_cols - 1)) << (txwl);
*y = raster_mb >> tx_cols_lg2 << (txwl);
}
#endif // VP9_COMMON_VP9_BLOCKD_H_

View File

@ -53,18 +53,12 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd,
int_mv mv_list[MAX_MV_REF_CANDIDATES];
MODE_INFO *mi = xd->mode_info_context;
MB_MODE_INFO *const mbmi = &mi->mbmi;
int use_prev_in_find_mv_refs;
assert(ref_idx == 0 || ref_idx == 1);
assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier
use_prev_in_find_mv_refs = cm->width == cm->last_width &&
cm->height == cm->last_height &&
!cm->error_resilient_mode &&
cm->last_show_frame;
vp9_find_mv_refs_idx(cm, xd, xd->mode_info_context,
use_prev_in_find_mv_refs ?
xd->prev_mode_info_context : NULL,
xd->prev_mode_info_context,
ref_idx ? mbmi->second_ref_frame : mbmi->ref_frame,
mv_list, cm->ref_frame_sign_bias, block_idx);

View File

@ -327,4 +327,15 @@ static int get_mi_col(const MACROBLOCKD *xd) {
static int get_token_alloc(int mb_rows, int mb_cols) {
return mb_rows * mb_cols * (48 * 16 + 4);
}
static void set_prev_mi(VP9_COMMON *cm) {
const int use_prev_in_find_mv_refs = cm->width == cm->last_width &&
cm->height == cm->last_height &&
!cm->error_resilient_mode &&
cm->last_show_frame;
// Special case: set prev_mi to NULL when the previous mode info
// context cannot be used.
cm->prev_mi = use_prev_in_find_mv_refs ?
cm->prev_mip + cm->mode_info_stride + 1 : NULL;
}
#endif // VP9_COMMON_VP9_ONYXC_INT_H_

View File

@ -490,11 +490,6 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
int bw = 1 << b_width_log2(bsize);
int bh = 1 << b_height_log2(bsize);
const int use_prev_in_find_mv_refs = cm->width == cm->last_width &&
cm->height == cm->last_height &&
!cm->error_resilient_mode &&
cm->last_show_frame;
int mb_to_left_edge, mb_to_right_edge, mb_to_top_edge, mb_to_bottom_edge;
int j, idx, idy;
@ -559,10 +554,8 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
printf("%d %d\n", xd->mode_info_context->mbmi.mv[0].as_mv.row,
xd->mode_info_context->mbmi.mv[0].as_mv.col);
#endif
vp9_find_mv_refs(cm, xd, mi, use_prev_in_find_mv_refs ?
xd->prev_mode_info_context : NULL,
ref_frame, mbmi->ref_mvs[ref_frame],
cm->ref_frame_sign_bias);
vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context, ref_frame,
mbmi->ref_mvs[ref_frame], cm->ref_frame_sign_bias);
vp9_mv_ref_probs(cm, mv_ref_p, mbmi->mb_mode_context[ref_frame]);
@ -610,9 +603,7 @@ static void read_mb_modes_mv(VP9D_COMP *pbi, MODE_INFO *mi, MB_MODE_INFO *mbmi,
if (mbmi->second_ref_frame > 0) {
const MV_REFERENCE_FRAME second_ref_frame = mbmi->second_ref_frame;
vp9_find_mv_refs(cm, xd, mi,
use_prev_in_find_mv_refs ?
xd->prev_mode_info_context : NULL,
vp9_find_mv_refs(cm, xd, mi, xd->prev_mode_info_context,
second_ref_frame, mbmi->ref_mvs[second_ref_frame],
cm->ref_frame_sign_bias);

View File

@ -406,7 +406,10 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE_TYPE bsize,
xd->mode_info_context = cm->mi + mi_idx;
xd->mode_info_context->mbmi.sb_type = bsize;
xd->prev_mode_info_context = cm->prev_mi + mi_idx;
// Special case: if prev_mi is NULL, the previous mode info context
// cannot be used.
xd->prev_mode_info_context = cm->prev_mi ?
cm->prev_mi + mi_idx : NULL;
for (i = 0; i < MAX_MB_PLANE; i++) {
xd->plane[i].above_context = cm->above_context[i] +
@ -1095,6 +1098,8 @@ int vp9_decode_frame(VP9D_COMP *pbi, const uint8_t **p_data_end) {
for (i = 0; i < MAX_MB_PLANE; ++i)
vp9_zero(xd->plane[i].qcoeff);
set_prev_mi(pc);
vp9_decode_mode_mvs_init(pbi, &header_bc);
decode_tiles(pbi, data, first_partition_size, &header_bc, &residual_bc);

View File

@ -558,7 +558,10 @@ static void set_offsets(VP9_COMP *cpi,
x->partition_info = x->pi + idx_str;
xd->mode_info_context = cm->mi + idx_str;
mbmi = &xd->mode_info_context->mbmi;
xd->prev_mode_info_context = cm->prev_mi + idx_str;
// Special case: if prev_mi is NULL, the previous mode info context
// cannot be used.
xd->prev_mode_info_context = cm->prev_mi ?
cm->prev_mi + idx_str : NULL;
// Set up destination pointers
setup_dst_planes(xd, &cm->yv12_fb[dst_fb_idx], mi_row, mi_col);
@ -1571,6 +1574,8 @@ static void encode_frame_internal(VP9_COMP *cpi) {
vpx_memset(cpi->rd_tx_select_diff, 0, sizeof(cpi->rd_tx_select_diff));
vpx_memset(cpi->rd_tx_select_threshes, 0, sizeof(cpi->rd_tx_select_threshes));
set_prev_mi(cm);
{
struct vpx_usec_timer emr_timer;
vpx_usec_timer_start(&emr_timer);

View File

@ -3445,6 +3445,8 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi,
cm->mode_info_stride * (cm->mi_rows + 1) *
sizeof(MODE_INFO));
}
// restore prev_mi
cm->prev_mi = cm->prev_mip + cm->mode_info_stride + 1;
}
static void Pass2Encode(VP9_COMP *cpi, unsigned long *size,

View File

@ -1833,7 +1833,6 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
YV12_BUFFER_CONFIG *yv12 = &cm->yv12_fb[cpi->common.ref_frame_map[idx]];
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mode_info_context->mbmi;
int use_prev_in_find_mv_refs;
// set up scaling factors
scale[frame_type] = cpi->common.active_ref_scale[frame_type - 1];
@ -1850,11 +1849,8 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x,
&scale[frame_type], &scale[frame_type]);
// Gets an initial list of candidate vectors from neighbours and orders them
use_prev_in_find_mv_refs = cm->width == cm->last_width &&
cm->height == cm->last_height &&
!cpi->common.error_resilient_mode;
vp9_find_mv_refs(&cpi->common, xd, xd->mode_info_context,
use_prev_in_find_mv_refs ? xd->prev_mode_info_context : NULL,
xd->prev_mode_info_context,
frame_type,
mbmi->ref_mvs[frame_type],
cpi->common.ref_frame_sign_bias);