From a6bcaf36906f08e7670272302e3b686b8535e4c5 Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Sat, 27 Jun 2015 20:56:24 +0300 Subject: Check the width/height and adjust level used for RC Since 6cb6772805, the actual level used is MAX(u4_max_level, ih264e_get_min_level()), which means that it isn't a fatal error to set u4_max_level to a too low level (if the caller doesn't know or care). Despite this, the actual value set by the caller was still used for initializing the RC. This allows the caller to not have to set u4_max_level (currently every caller has to duplicate a table or code snippet for determining the right level for each resolution). The caller still can set it to a higher value if he wants to explicitly use a higher level than what is necessary. This makes sure that the output is identical even if u4_max_level is set too low. Bug: 22860270 Change-Id: Icdc6c0652a97568d1eafc050226357a9d643d809 --- encoder/ih264e_utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'encoder') diff --git a/encoder/ih264e_utils.c b/encoder/ih264e_utils.c index 2e5b812..8623949 100644 --- a/encoder/ih264e_utils.c +++ b/encoder/ih264e_utils.c @@ -1330,7 +1330,8 @@ IH264E_ERROR_T ih264e_codec_init(codec_t *ps_codec) ps_codec->s_cfg.u4_i_frm_interval, ps_codec->s_cfg.u4_num_bframes + 1, au1_init_qp, ps_codec->s_cfg.u4_num_bframes + 2 , au1_min_max_qp, - ps_codec->s_cfg.u4_max_level); + MAX(ps_codec->s_cfg.u4_max_level, + (UWORD32)ih264e_get_min_level(ps_codec->s_cfg.u4_max_wd, ps_codec->s_cfg.u4_max_ht))); } /* recon stride */ -- cgit v1.2.3