From 733d356fa77d9f0c9bf7a3070b53de3db961bfd8 Mon Sep 17 00:00:00 2001 From: angiebird Date: Sun, 3 Nov 2019 08:45:39 -0800 Subject: [PATCH] Add frame_rate param to vp9_get_encoder_config Change-Id: I14a3d076d71240b4ed2436947418aa3177911fc1 --- vp9/vp9_cx_iface.c | 13 +++++++------ vp9/vp9_cx_iface.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index e452be96d..46bc739da 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -1831,6 +1831,7 @@ CODEC_INTERFACE(vpx_codec_vp9_cx) = { }; static vpx_codec_enc_cfg_t get_enc_cfg(int frame_width, int frame_height, + vpx_rational_t frame_rate, int target_bitrate, vpx_enc_pass enc_pass) { vpx_codec_enc_cfg_t enc_cfg = encoder_usage_cfg_map[0].cfg; @@ -1838,10 +1839,9 @@ static vpx_codec_enc_cfg_t get_enc_cfg(int frame_width, int frame_height, enc_cfg.g_h = frame_height; enc_cfg.rc_target_bitrate = target_bitrate; enc_cfg.g_pass = enc_pass; - // Use the same default setting as the one used in vpxenc.c - // The default unit time for the encoder is 1/1000 s. - enc_cfg.g_timebase.num = 1; - enc_cfg.g_timebase.den = 1000; + // g_timebase is the inverse of frame_rate + enc_cfg.g_timebase.num = frame_rate.den; + enc_cfg.g_timebase.den = frame_rate.num; return enc_cfg; } @@ -1855,12 +1855,13 @@ static vp9_extracfg get_extra_cfg() { } VP9EncoderConfig vp9_get_encoder_config(int frame_width, int frame_height, + vpx_rational_t frame_rate, int target_bitrate, vpx_enc_pass enc_pass) { VP9EncoderConfig oxcf; vp9_extracfg extra_cfg = get_extra_cfg(); - vpx_codec_enc_cfg_t enc_cfg = - get_enc_cfg(frame_width, frame_height, target_bitrate, enc_pass); + vpx_codec_enc_cfg_t enc_cfg = get_enc_cfg( + frame_width, frame_height, frame_rate, target_bitrate, enc_pass); set_encoder_config(&oxcf, &enc_cfg, &extra_cfg); return oxcf; } diff --git a/vp9/vp9_cx_iface.h b/vp9/vp9_cx_iface.h index 74c6ff331..53215d1c4 100644 --- a/vp9/vp9_cx_iface.h +++ b/vp9/vp9_cx_iface.h @@ -18,6 +18,7 @@ extern "C" { #endif VP9EncoderConfig vp9_get_encoder_config(int frame_width, int frame_height, + vpx_rational_t frame_rate, int target_bitrate, vpx_enc_pass enc_pass); FRAME_INFO vp9_get_frame_info(const VP9EncoderConfig *oxcf); -- 2.40.0