shithub: libvpx

Download patch

ref: 3a38edea2cd114d53914cab017cab2e43a600031
parent: 67b1d7f1740158e795a26a722491424e6257c0dc
author: Angie Chiang <[email protected]>
date: Thu Dec 17 13:09:55 EST 2020

Fix show_index in vp9_extrc_encodeframe_decision()

Change-Id: I93bb1fb3c14126d881d3f691d30875a0062e436c

--- a/test/vp9_ext_ratectrl_test.cc
+++ b/test/vp9_ext_ratectrl_test.cc
@@ -73,6 +73,7 @@
   EXPECT_EQ(encode_frame_info->coding_index, toy_rate_ctrl->coding_index);
 
   if (encode_frame_info->coding_index == 0) {
+    EXPECT_EQ(encode_frame_info->show_index, 0);
     EXPECT_EQ(encode_frame_info->gop_index, 0);
     EXPECT_EQ(encode_frame_info->frame_type, 0 /*kFrameTypeKey*/);
     EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
@@ -84,6 +85,7 @@
   }
 
   if (encode_frame_info->coding_index == 1) {
+    EXPECT_EQ(encode_frame_info->show_index, 4);
     EXPECT_EQ(encode_frame_info->gop_index, 1);
     EXPECT_EQ(encode_frame_info->frame_type, 2 /*kFrameTypeAltRef*/);
     EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
@@ -104,6 +106,7 @@
   }
 
   if (encode_frame_info->coding_index == 5) {
+    EXPECT_EQ(encode_frame_info->show_index, 4);
     EXPECT_EQ(encode_frame_info->gop_index, 0);
     EXPECT_EQ(encode_frame_info->frame_type, 3 /*kFrameTypeOverlay*/);
     EXPECT_EQ(encode_frame_info->ref_frame_valid_list[0],
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -4508,9 +4508,11 @@
       FRAME_UPDATE_TYPE update_type = gf_group->update_type[gf_group->index];
       const int ref_frame_flags = get_ref_frame_flags(cpi);
       RefCntBuffer *ref_frame_bufs[MAX_INTER_REF_FRAMES];
+      const RefCntBuffer *curr_frame_buf =
+          get_ref_cnt_buffer(cm, cm->new_fb_idx);
       get_ref_frame_bufs(cpi, ref_frame_bufs);
       vp9_extrc_get_encodeframe_decision(
-          &cpi->ext_ratectrl, cm->current_video_frame,
+          &cpi->ext_ratectrl, curr_frame_buf->frame_index,
           cm->current_frame_coding_index, gf_group->index, update_type,
           ref_frame_bufs, ref_frame_flags, &encode_frame_decision);
       q = encode_frame_decision.q_index;