diff options
author | Ronghua Wu <ronghuawu@google.com> | 2015-08-03 18:07:01 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-03 18:07:01 +0000 |
commit | 374e7a8984f0674662016c27fe9f4b1eba15810c (patch) | |
tree | 182c0fb5ce424f629aee845516aa88457fbd9023 | |
parent | 8a50328131307b53ebde95e9af87a408c4011559 (diff) | |
parent | bb1543bd8596700ab12a5968e73a9794e26fd4de (diff) | |
download | android_external_libavc-374e7a8984f0674662016c27fe9f4b1eba15810c.tar.gz android_external_libavc-374e7a8984f0674662016c27fe9f4b1eba15810c.tar.bz2 android_external_libavc-374e7a8984f0674662016c27fe9f4b1eba15810c.zip |
Merge "Encoder: Fixed an issue in handling FPS greater than 60" into mnc-dev
-rw-r--r-- | encoder/ih264e_time_stamp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/encoder/ih264e_time_stamp.c b/encoder/ih264e_time_stamp.c index cd829b5..85b75a3 100644 --- a/encoder/ih264e_time_stamp.c +++ b/encoder/ih264e_time_stamp.c @@ -84,6 +84,7 @@ #include "ih264e_structs.h" #include "ih264e_rc_mem_interface.h" #include "ih264e_time_stamp.h" +#include "irc_common.h" #include "irc_rate_control_api.h" @@ -278,8 +279,15 @@ void ih264e_init_frame_time(frame_time_t *ps_frame_time, * frame times increase */ WORD32 i4_gcd = gcd(u4_src_frm_rate, u4_tgt_frm_rate); - ps_frame_time->common_time_base = (u4_src_frm_rate * u4_tgt_frm_rate) - / i4_gcd; + /* Avoiding overflow by doing calculations in float */ + number_t s_src_frm_rate, s_tgt_frm_rate, s_gcd, s_common_time_base, s_numerator; + + SET_VAR_Q(s_src_frm_rate, u4_src_frm_rate, 0); + SET_VAR_Q(s_tgt_frm_rate, u4_tgt_frm_rate, 0); + SET_VAR_Q(s_gcd, i4_gcd, 0); + mult32_var_q(s_src_frm_rate, s_tgt_frm_rate, &s_numerator); + div32_var_q(s_numerator, s_gcd, &s_common_time_base); + number_t_to_word32(s_common_time_base, &(ps_frame_time->common_time_base)); /* The source and target increment per vop is initialized */ ps_frame_time->u4_src_frm_time_incr = ps_frame_time->common_time_base |