Use INT_MAX as i4_max_sad in ih264e_evaluate_bipred

The stored i4_mb_distortion that was used as i4_max_sad previously
might come from a different coding mode - even if
pf_ime_compute_sad_16x16 returns early when i4_mb_distortion is
larger than ps_mb_ctxt_bi->i4_mb_distortion, the calculated i4_mb_cost
can still end up smaller than ps_mb_ctxt_bi->i4_mb_cost.

Therefore, set i4_max_sad to INT_MAX to avoid the early exit in
pf_ime_compute_sad_16x16 here, since it can't be used reliably (and
returning early can end up choosing a suboptimal mode).

This makes sure that the encoded output is identical when the SIMD
optimized routines are disabled, when using B-frames.

Bug: 22860270

Change-Id: I9b8d524f88020e557541700133c7a0b48fe6a3b8
This commit is contained in:
Martin Storsjo 2015-06-29 22:43:50 +03:00 committed by Marco Nelissen
parent 6fb90f8fec
commit eddf6a33fe

View file

@ -1733,7 +1733,7 @@ void ih264e_evaluate_bipred(me_ctxt_t *ps_me_ctxt,
ps_me_ctxt->pf_ime_compute_sad_16x16[u4_fast_sad](
ps_me_ctxt->pu1_src_buf_luma, pu1_dst_buf,
ps_me_ctxt->i4_src_strd, ps_me_ctxt->u4_subpel_buf_strd,
ps_mb_ctxt_bi->i4_mb_distortion, &i4_mb_distortion);
INT_MAX, &i4_mb_distortion);
/* compute cost */
i4_mb_cost = ps_me_ctxt->pu1_mv_bits[( s_l0_mv.i2_mvy << 2 ) - ps_l0_pred_mv->i2_mvx];