Commit 319f7c4d authored by John Koleszar's avatar John Koleszar Committed by Gerrit Code Review

Merge changes I17e1a348,Iad710941

* changes:
  Correct clamping in use of vp8_find_near_mvs()
  Revert "Multithreaded encoder, late sync loopfilter"
parents 294aa377 83cef816
......@@ -134,13 +134,51 @@ void vp8_find_near_mvs
best_mv->as_int = near_mvs[0].as_int;
nearest->as_int = near_mvs[CNT_NEAREST].as_int;
nearby->as_int = near_mvs[CNT_NEAR].as_int;
}
//TODO: move clamp outside findnearmv
vp8_clamp_mv2(nearest, xd);
vp8_clamp_mv2(nearby, xd);
vp8_clamp_mv2(best_mv, xd);
static void invert_and_clamp_mvs(int_mv *inv, int_mv *src, MACROBLOCKD *xd)
{
inv->as_mv.row = src->as_mv.row * -1;
inv->as_mv.col = src->as_mv.col * -1;
vp8_clamp_mv2(inv, xd);
vp8_clamp_mv2(src, xd);
}
int vp8_find_near_mvs_bias
(
MACROBLOCKD *xd,
const MODE_INFO *here,
int_mv mode_mv_sb[2][MB_MODE_COUNT],
int_mv best_mv_sb[2],
int cnt[4],
int refframe,
int *ref_frame_sign_bias
)
{
int sign_bias = ref_frame_sign_bias[refframe];
vp8_find_near_mvs(xd,
here,
&mode_mv_sb[sign_bias][NEARESTMV],
&mode_mv_sb[sign_bias][NEARMV],
&best_mv_sb[sign_bias],
cnt,
refframe,
ref_frame_sign_bias);
invert_and_clamp_mvs(&mode_mv_sb[!sign_bias][NEARESTMV],
&mode_mv_sb[sign_bias][NEARESTMV], xd);
invert_and_clamp_mvs(&mode_mv_sb[!sign_bias][NEARMV],
&mode_mv_sb[sign_bias][NEARMV], xd);
invert_and_clamp_mvs(&best_mv_sb[!sign_bias],
&best_mv_sb[sign_bias], xd);
return sign_bias;
}
vp8_prob *vp8_mv_ref_probs(
vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
)
......
......@@ -77,6 +77,19 @@ void vp8_find_near_mvs
int *ref_frame_sign_bias
);
int vp8_find_near_mvs_bias
(
MACROBLOCKD *xd,
const MODE_INFO *here,
int_mv mode_mv_sb[2][MB_MODE_COUNT],
int_mv best_mv_sb[2],
int cnt[4],
int refframe,
int *ref_frame_sign_bias
);
vp8_prob *vp8_mv_ref_probs(
vp8_prob p[VP8_MVREFS-1], const int near_mv_ref_ct[4]
);
......
......@@ -1013,6 +1013,8 @@ static void pack_inter_mode_mvs(VP8_COMP *const cpi)
int ct[4];
vp8_find_near_mvs(xd, m, &n1, &n2, &best_mv, ct, rf, cpi->common.ref_frame_sign_bias);
vp8_clamp_mv2(&best_mv, xd);
vp8_mv_ref_probs(mv_ref_p, ct);
#ifdef ENTROPY_STATS
......
......@@ -3733,17 +3733,6 @@ static void encode_frame_to_data_rate
vp8_setup_key_frame(cpi);
}
#if CONFIG_MULTITHREAD
/* wait for loopfilter thread done (for last picture)
* don't do it for first frame, re-code and when PSNR is calculated
*/
if (cpi->b_multi_threaded && cm->current_video_frame && (!Loop) &&
(!cpi->b_calculate_psnr))
{
sem_wait(&cpi->h_event_end_lpf);
}
#endif
// transform / motion compensation build reconstruction frame
vp8_encode_frame(cpi);
......@@ -4128,8 +4117,8 @@ static void encode_frame_to_data_rate
vp8_pack_bitstream(cpi, dest, dest_end, size);
#if CONFIG_MULTITHREAD
/* if PSNR packets are generated we have to wait for the lpf */
if (cpi->b_multi_threaded && cpi->b_calculate_psnr)
/* wait for loopfilter thread done */
if (cpi->b_multi_threaded)
{
sem_wait(&cpi->h_event_end_lpf);
}
......
......@@ -469,8 +469,10 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
MACROBLOCKD *xd = &x->e_mbd;
MB_MODE_INFO best_mbmode;
int_mv best_ref_mv_sb[2];
int_mv mode_mv_sb[2][MB_MODE_COUNT];
int_mv best_ref_mv;
int_mv mode_mv[MB_MODE_COUNT];
int_mv *mode_mv;
MB_PREDICTION_MODE this_mode;
int num00;
int mdcounts[4];
......@@ -508,7 +510,9 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
&parent_mode, &parent_ref_mv, mb_row, mb_col);
#endif
vpx_memset(mode_mv, 0, sizeof(mode_mv));
mode_mv = mode_mv_sb[sign_bias];
best_ref_mv.as_int = 0;
vpx_memset(mode_mv_sb, 0, sizeof(mode_mv_sb));
vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
/* Setup search priorities */
......@@ -519,15 +523,16 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
*/
if (ref_frame_map[1] > 0)
{
vp8_find_near_mvs(&x->e_mbd,
x->e_mbd.mode_info_context,
&mode_mv[NEARESTMV], &mode_mv[NEARMV],
&best_ref_mv,
mdcounts,
ref_frame_map[1],
cpi->common.ref_frame_sign_bias);
sign_bias = cpi->common.ref_frame_sign_bias[ref_frame_map[1]];
sign_bias = vp8_find_near_mvs_bias(&x->e_mbd,
x->e_mbd.mode_info_context,
mode_mv_sb,
best_ref_mv_sb,
mdcounts,
ref_frame_map[1],
cpi->common.ref_frame_sign_bias);
mode_mv = mode_mv_sb[sign_bias];
best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
}
get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
......@@ -578,17 +583,11 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
if (sign_bias !=
cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame])
if (sign_bias != cpi->common.ref_frame_sign_bias[this_ref_frame])
{
mode_mv[NEARESTMV].as_mv.row *= -1;
mode_mv[NEARESTMV].as_mv.col *= -1;
mode_mv[NEARMV].as_mv.row *= -1;
mode_mv[NEARMV].as_mv.col *= -1;
best_ref_mv.as_mv.row *= -1;
best_ref_mv.as_mv.col *= -1;
sign_bias
= cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame];
sign_bias = cpi->common.ref_frame_sign_bias[this_ref_frame];
mode_mv = mode_mv_sb[sign_bias];
best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
}
#if CONFIG_MULTI_RES_ENCODING
......@@ -1049,10 +1048,7 @@ void vp8_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
if (sign_bias
!= cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame])
{
best_ref_mv.as_mv.row *= -1;
best_ref_mv.as_mv.col *= -1;
}
best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int;
update_mvcount(cpi, &x->e_mbd, &best_ref_mv);
}
......
......@@ -1726,8 +1726,10 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
union b_mode_info best_bmodes[16];
MB_MODE_INFO best_mbmode;
PARTITION_INFO best_partition;
int_mv best_ref_mv_sb[2];
int_mv mode_mv_sb[2][MB_MODE_COUNT];
int_mv best_ref_mv;
int_mv mode_mv[MB_MODE_COUNT];
int_mv *mode_mv;
MB_PREDICTION_MODE this_mode;
int num00;
int best_mode_index = 0;
......@@ -1755,7 +1757,9 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
int ref_frame_map[4];
int sign_bias = 0;
vpx_memset(mode_mv, 0, sizeof(mode_mv));
mode_mv = mode_mv_sb[sign_bias];
best_ref_mv.as_int = 0;
vpx_memset(mode_mv_sb, 0, sizeof(mode_mv_sb));
vpx_memset(&best_mbmode, 0, sizeof(best_mbmode));
vpx_memset(&best_bmodes, 0, sizeof(best_bmodes));
......@@ -1767,15 +1771,16 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
*/
if (ref_frame_map[1] > 0)
{
vp8_find_near_mvs(&x->e_mbd,
x->e_mbd.mode_info_context,
&mode_mv[NEARESTMV], &mode_mv[NEARMV],
&best_ref_mv,
mdcounts,
ref_frame_map[1],
cpi->common.ref_frame_sign_bias);
sign_bias = cpi->common.ref_frame_sign_bias[ref_frame_map[1]];
sign_bias = vp8_find_near_mvs_bias(&x->e_mbd,
x->e_mbd.mode_info_context,
mode_mv_sb,
best_ref_mv_sb,
mdcounts,
ref_frame_map[1],
cpi->common.ref_frame_sign_bias);
mode_mv = mode_mv_sb[sign_bias];
best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
}
get_predictor_pointers(cpi, plane, recon_yoffset, recon_uvoffset);
......@@ -1829,17 +1834,11 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
x->e_mbd.pre.u_buffer = plane[this_ref_frame][1];
x->e_mbd.pre.v_buffer = plane[this_ref_frame][2];
if (sign_bias !=
cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame])
if (sign_bias != cpi->common.ref_frame_sign_bias[this_ref_frame])
{
mode_mv[NEARESTMV].as_mv.row *= -1;
mode_mv[NEARESTMV].as_mv.col *= -1;
mode_mv[NEARMV].as_mv.row *= -1;
mode_mv[NEARMV].as_mv.col *= -1;
best_ref_mv.as_mv.row *= -1;
best_ref_mv.as_mv.col *= -1;
sign_bias
= cpi->common.ref_frame_sign_bias[x->e_mbd.mode_info_context->mbmi.ref_frame];
sign_bias = cpi->common.ref_frame_sign_bias[this_ref_frame];
mode_mv = mode_mv_sb[sign_bias];
best_ref_mv.as_int = best_ref_mv_sb[sign_bias].as_int;
}
}
......@@ -2372,10 +2371,7 @@ void vp8_rd_pick_inter_mode(VP8_COMP *cpi, MACROBLOCK *x, int recon_yoffset,
if (sign_bias
!= cpi->common.ref_frame_sign_bias[xd->mode_info_context->mbmi.ref_frame])
{
best_ref_mv.as_mv.row *= -1;
best_ref_mv.as_mv.col *= -1;
}
best_ref_mv.as_int = best_ref_mv_sb[!sign_bias].as_int;
rd_update_mvcount(cpi, x, &best_ref_mv);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment