From eddf6a33fe731e0dbba56092d5020cc8edc14ca5 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Mon, 29 Jun 2015 22:43:50 +0300 Subject: 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 --- encoder/ih264e_me.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'encoder') diff --git a/encoder/ih264e_me.c b/encoder/ih264e_me.c index a97df3d..3d12a1b 100644 --- a/encoder/ih264e_me.c +++ b/encoder/ih264e_me.c @@ -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]; -- cgit v1.2.3