L2E: rename 'gop_index' to 'gop_global_index'
authorCheng Chen <chengchen@google.com>
Mon, 6 Jun 2022 22:46:41 +0000 (15:46 -0700)
committerCheng Chen <chengchen@google.com>
Tue, 7 Jun 2022 05:38:10 +0000 (22:38 -0700)
'gop_index' has already been used in vpx_rc_encodeframe_info_t,
which represents the frame index inside the current
group of picture (gop).

We therefore use 'gop_global_index' to represent the index of
the current gop to avoid duplicate names.

Change-Id: I3eb8987dd878f650649b013e0036e23d0846b5f0

test/vp9_ext_ratectrl_test.cc
vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_ratectrl.h
vpx/vpx_ext_ratectrl.h

index 1289e2d..a3af4e9 100644 (file)
@@ -44,7 +44,7 @@ struct ToyRateCtrl {
   int magic_number;
   int coding_index;
 
-  int gop_index;
+  int gop_global_index;
   int frames_since_key;
   int show_index;
 };
@@ -73,7 +73,7 @@ vpx_rc_status_t rc_create_model_gop(void *priv,
   ToyRateCtrl *toy_rate_ctrl = new (std::nothrow) ToyRateCtrl;
   if (toy_rate_ctrl == nullptr) return VPX_RC_ERROR;
   toy_rate_ctrl->magic_number = kModelMagicNumber;
-  toy_rate_ctrl->gop_index = 0;
+  toy_rate_ctrl->gop_global_index = 0;
   toy_rate_ctrl->frames_since_key = 0;
   toy_rate_ctrl->show_index = 0;
   toy_rate_ctrl->coding_index = 0;
@@ -198,13 +198,13 @@ vpx_rc_status_t rc_get_gop_decision(vpx_rc_model_t rate_ctrl_model,
   if (gop_info->is_key_frame) {
     EXPECT_EQ(gop_info->last_gop_use_alt_ref, 0);
     EXPECT_EQ(gop_info->frames_since_key, 0);
-    EXPECT_EQ(gop_info->gop_index, 0);
-    toy_rate_ctrl->gop_index = 0;
+    EXPECT_EQ(gop_info->gop_global_index, 0);
+    toy_rate_ctrl->gop_global_index = 0;
     toy_rate_ctrl->frames_since_key = 0;
   } else {
     EXPECT_EQ(gop_info->last_gop_use_alt_ref, 1);
   }
-  EXPECT_EQ(gop_info->gop_index, toy_rate_ctrl->gop_index);
+  EXPECT_EQ(gop_info->gop_global_index, toy_rate_ctrl->gop_global_index);
   EXPECT_EQ(gop_info->frames_since_key, toy_rate_ctrl->frames_since_key);
   EXPECT_EQ(gop_info->show_index, toy_rate_ctrl->show_index);
   EXPECT_EQ(gop_info->coding_index, toy_rate_ctrl->coding_index);
@@ -217,7 +217,7 @@ vpx_rc_status_t rc_get_gop_decision(vpx_rc_model_t rate_ctrl_model,
   toy_rate_ctrl->show_index +=
       gop_decision->gop_coding_frames - gop_decision->use_alt_ref;
   toy_rate_ctrl->coding_index += gop_decision->gop_coding_frames;
-  ++toy_rate_ctrl->gop_index;
+  ++toy_rate_ctrl->gop_global_index;
   return VPX_RC_OK;
 }
 
index 44a4cec..e121ac8 100644 (file)
@@ -2714,9 +2714,9 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) {
   // frame in which case it will already have been done.
   if (is_key_frame == 0) {
     vp9_zero(twopass->gf_group);
-    ++rc->gop_index;
+    ++rc->gop_global_index;
   } else {
-    rc->gop_index = 0;
+    rc->gop_global_index = 0;
   }
 
   vpx_clear_system_state();
@@ -2772,7 +2772,7 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) {
     gop_info.lag_in_frames = cpi->oxcf.lag_in_frames;
     gop_info.show_index = cm->current_video_frame;
     gop_info.coding_index = cm->current_frame_coding_index;
-    gop_info.gop_index = rc->gop_index;
+    gop_info.gop_global_index = rc->gop_global_index;
 
     codec_status = vp9_extrc_get_gop_decision(&cpi->ext_ratectrl, &gop_info,
                                               &gop_decision);
index 48a21bd..96a8fd3 100644 (file)
@@ -214,7 +214,7 @@ typedef struct {
 
   // The index of the current GOP. Start from zero.
   // When a key frame is inserted, it resets to zero.
-  int gop_index;
+  int gop_global_index;
 } RATE_CONTROL;
 
 struct VP9_COMP;
index c3feac5..6e41aba 100644 (file)
@@ -81,7 +81,7 @@ typedef struct vpx_rc_encodeframe_info {
   int show_index;   /**< display index, starts from zero*/
   int coding_index; /**< coding index, starts from zero*/
   /*!
-   * index in group of picture, starts from zero.
+   * index of the current frame in this group of picture, starts from zero.
    */
   int gop_index;
   int ref_frame_coding_indexes[3]; /**< three reference frames' coding indices*/
@@ -323,7 +323,7 @@ typedef struct vpx_rc_gop_info {
    * The index of the current gop, starts from zero, resets to zero
    * when a keyframe is set.
    */
-  int gop_index;
+  int gop_global_index;
 } vpx_rc_gop_info_t;
 
 /*!\brief The decision made by the external rate control model to set the