shithub: libvpx

Download patch

ref: 204ba94f4b0403a0289a5600fda56e64f89ce67c
parent: fa370c32e710f2024d998c0bb3f2479d1fc3803f
author: angiebird <angiebird@google.com>
date: Wed Dec 11 08:49:39 EST 2019

Cosmetic changes for RATE_CTRL related functions

Move input parameters ahead of output parameters.

Change-Id: I384f69523b6be92224535d05373ebb33467a040e

--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -3643,9 +3643,9 @@
 }
 
 #if CONFIG_RATE_CTRL
-void vp9_get_next_group_of_picture(int *first_is_key_frame, int *use_alt_ref,
-                                   int *coding_frame_count, int *first_show_idx,
-                                   const VP9_COMP *cpi) {
+void vp9_get_next_group_of_picture(const VP9_COMP *cpi, int *first_is_key_frame,
+                                   int *use_alt_ref, int *coding_frame_count,
+                                   int *first_show_idx) {
   // We make a copy of rc here because we want to get information from the
   // encoder without changing its state.
   // TODO(angiebird): Avoid copying rc here.
--- a/vp9/encoder/vp9_firstpass.h
+++ b/vp9/encoder/vp9_firstpass.h
@@ -258,9 +258,10 @@
  * starts or after vp9_get_compressed_data() when the encoding process of
  * the last group of pictures is just finished.
  */
-void vp9_get_next_group_of_picture(int *first_is_key_frame, int *use_alt_ref,
-                                   int *coding_frame_count, int *first_show_idx,
-                                   const struct VP9_COMP *cpi);
+void vp9_get_next_group_of_picture(const struct VP9_COMP *cpi,
+                                   int *first_is_key_frame, int *use_alt_ref,
+                                   int *coding_frame_count,
+                                   int *first_show_idx);
 
 /*!\brief Call this function before coding a new group of pictures to get
  * information about it.
--- a/vp9/simple_encode.cc
+++ b/vp9/simple_encode.cc
@@ -111,9 +111,9 @@
          group_of_picture.encode_frame_list.size();
 }
 
-static void SetGroupOfPicture(GroupOfPicture *group_of_picture,
-                              int first_is_key_frame, int use_alt_ref,
-                              int coding_frame_count, int first_show_idx) {
+static void SetGroupOfPicture(int first_is_key_frame, int use_alt_ref,
+                              int coding_frame_count, int first_show_idx,
+                              GroupOfPicture *group_of_picture) {
   // Clean up the state of previous group of picture.
   group_of_picture->encode_frame_list.clear();
   group_of_picture->encode_frame_index = 0;
@@ -149,16 +149,16 @@
   }
 }
 
-static void UpdateGroupOfPicture(GroupOfPicture *group_of_picture,
-                                 const VP9_COMP *cpi) {
+static void UpdateGroupOfPicture(const VP9_COMP *cpi,
+                                 GroupOfPicture *group_of_picture) {
   int first_is_key_frame;
   int use_alt_ref;
   int coding_frame_count;
   int first_show_idx;
-  vp9_get_next_group_of_picture(&first_is_key_frame, &use_alt_ref,
-                                &coding_frame_count, &first_show_idx, cpi);
-  SetGroupOfPicture(group_of_picture, first_is_key_frame, use_alt_ref,
-                    coding_frame_count, first_show_idx);
+  vp9_get_next_group_of_picture(cpi, &first_is_key_frame, &use_alt_ref,
+                                &coding_frame_count, &first_show_idx);
+  SetGroupOfPicture(first_is_key_frame, use_alt_ref, coding_frame_count,
+                    first_show_idx, group_of_picture);
 }
 
 SimpleEncode::SimpleEncode(int frame_width, int frame_height,
@@ -270,7 +270,7 @@
   impl_ptr_->cpi = init_encoder(&oxcf, impl_ptr_->img_fmt);
   vpx_img_alloc(&impl_ptr_->tmp_img, impl_ptr_->img_fmt, frame_width_,
                 frame_height_, 1);
-  UpdateGroupOfPicture(&group_of_picture_, impl_ptr_->cpi);
+  UpdateGroupOfPicture(impl_ptr_->cpi, &group_of_picture_);
   rewind(file_);
 }
 
@@ -347,7 +347,7 @@
   update_encode_frame_result(encode_frame_result, &encode_frame_info);
   IncreaseGroupOfPictureIndex(&group_of_picture_);
   if (IsGroupOfPictureFinished(group_of_picture_)) {
-    UpdateGroupOfPicture(&group_of_picture_, impl_ptr_->cpi);
+    UpdateGroupOfPicture(impl_ptr_->cpi, &group_of_picture_);
   }
 }