summaryrefslogtreecommitdiffstats
path: root/encoder
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2015-06-27 20:56:24 +0300
committerMarco Nelissen <marcone@google.com>2015-07-31 18:49:17 +0000
commita6bcaf36906f08e7670272302e3b686b8535e4c5 (patch)
treee73ab1acaf9da0faad5d71b6bcf17426308ccb07 /encoder
parent01168dc07ef45e649e1b67a32f8f8ef1ca3a27e0 (diff)
downloadandroid_external_libavc-a6bcaf36906f08e7670272302e3b686b8535e4c5.tar.gz
android_external_libavc-a6bcaf36906f08e7670272302e3b686b8535e4c5.tar.bz2
android_external_libavc-a6bcaf36906f08e7670272302e3b686b8535e4c5.zip
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
Diffstat (limited to 'encoder')
-rw-r--r--encoder/ih264e_utils.c3
1 files changed, 2 insertions, 1 deletions
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 */