ref: c46538d45e12b52791bfee92a63ee9b93d02711c
parent: a84029ad9ca9eb39f1fc66721f10b43600db77e6
author: Marco Paniconi <marpan@google.com>
date: Wed Jan 8 07:34:18 EST 2014
Don't use gf_update by default for 1-pass CBR. Change-Id: I5df6abceb0a2a69706feadeb820b593cae88f573
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -2024,6 +2024,22 @@
}
}
+void vp9_get_one_pass_cbr_params(VP9_COMP *cpi) {
+ VP9_COMMON *const cm = &cpi->common;
+ if ((cm->current_video_frame == 0 ||
+ cm->frame_flags & FRAMEFLAGS_KEY ||
+ cpi->rc.frames_to_key == 0 ||
+ (cpi->oxcf.auto_key && test_for_kf_one_pass(cpi)))) {
+ cm->frame_type = KEY_FRAME;
+ cpi->rc.frames_to_key = cpi->key_frame_frequency;
+ } else {
+ cm->frame_type = INTER_FRAME;
+ }
+ // Don't use gf_update by default in CBR mode.
+ cpi->rc.frames_till_gf_update_due = INT_MAX;
+ cpi->rc.baseline_gf_interval = INT_MAX;
+}
+
void vp9_get_first_pass_params(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
if (!cpi->refresh_alt_ref_frame &&
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -22,6 +22,7 @@
void vp9_get_first_pass_params(VP9_COMP *cpi);
void vp9_get_one_pass_params(VP9_COMP *cpi);
+void vp9_get_one_pass_cbr_params(VP9_COMP *cpi);
void vp9_get_svc_params(VP9_COMP *cpi);
#endif // VP9_ENCODER_VP9_FIRSTPASS_H_
--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -3313,7 +3313,11 @@
static void Pass0Encode(VP9_COMP *cpi, size_t *size, uint8_t *dest,
unsigned int *frame_flags) {
- vp9_get_one_pass_params(cpi);
+ if (cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) {
+ vp9_get_one_pass_cbr_params(cpi);
+ } else {
+ vp9_get_one_pass_params(cpi);
+ }
encode_frame_to_data_rate(cpi, size, dest, frame_flags);
}
--
⑨