shithub: libvpx

Download patch

ref: 9857515cd6deae3e981792c74613e0dac624db56
parent: 705bf9de8c96cfe5301451f1d7e5c90a41c64e5f
author: angiebird <angiebird@google.com>
date: Fri Oct 9 13:47:02 EDT 2020

Call vp9_extrc_send_firstpass_stats() properly

Change-Id: I28db5010ba647cc91b8c0aa59309d7e953cd1216

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -2463,6 +2463,8 @@
 
   cpi->allow_encode_breakout = ENCODE_BREAKOUT_ENABLED;
 
+  vp9_extrc_init(&cpi->ext_ratectrl);
+
 #if !CONFIG_REALTIME_ONLY
   if (oxcf->pass == 1) {
     vp9_init_first_pass(cpi);
@@ -2536,6 +2538,8 @@
       num_frames = packets - 1;
       fps_init_first_pass_info(&cpi->twopass.first_pass_info,
                                oxcf->two_pass_stats_in.buf, num_frames);
+      vp9_extrc_send_firstpass_stats(&cpi->ext_ratectrl,
+                                     &cpi->twopass.first_pass_info);
 
       vp9_init_second_pass(cpi);
     }
@@ -2664,7 +2668,6 @@
   motion_vector_info_init(cpi);
   fp_motion_vector_info_init(cpi);
 #endif
-  vp9_extrc_init(&cpi->ext_ratectrl);
 
   return cpi;
 }
--- a/vp9/encoder/vp9_ext_ratectrl.c
+++ b/vp9/encoder/vp9_ext_ratectrl.c
@@ -66,8 +66,8 @@
   rc_frame_stats->count = stats->count;
 }
 
-void vp9_extrc_send_firstpass_stats(const FIRST_PASS_INFO *first_pass_info,
-                                    EXT_RATECTRL *ext_ratectrl) {
+void vp9_extrc_send_firstpass_stats(EXT_RATECTRL *ext_ratectrl,
+                                    const FIRST_PASS_INFO *first_pass_info) {
   if (ext_ratectrl->ready) {
     vpx_rc_firstpass_stats_t *rc_firstpass_stats =
         &ext_ratectrl->rc_firstpass_stats;
--- a/vp9/encoder/vp9_ext_ratectrl.h
+++ b/vp9/encoder/vp9_ext_ratectrl.h
@@ -29,7 +29,7 @@
 
 void vp9_extrc_delete(EXT_RATECTRL *ext_ratectrl);
 
-void vp9_extrc_send_firstpass_stats(const FIRST_PASS_INFO *first_pass_info,
-                                    EXT_RATECTRL *ext_ratectrl);
+void vp9_extrc_send_firstpass_stats(EXT_RATECTRL *ext_ratectrl,
+                                    const FIRST_PASS_INFO *first_pass_info);
 
 #endif  // VPX_VP9_ENCODER_VP9_EXT_RATECTRL_H_