From e753d4930f3b2859968068ffb77f6a6159b2f3c6 Mon Sep 17 00:00:00 2001 From: angiebird Date: Thu, 11 Jun 2020 15:10:38 -0700 Subject: [PATCH] Let SetExternalGroupOfPicturesMap use c-style arr Change-Id: Ic92ce5a3cc5bb74120eb32fc6219e43b1b861f14 --- test/simple_encode_test.cc | 4 ++-- vp9/simple_encode.cc | 7 +++++-- vp9/simple_encode.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/test/simple_encode_test.cc b/test/simple_encode_test.cc index a85675133..69bed5a51 100644 --- a/test/simple_encode_test.cc +++ b/test/simple_encode_test.cc @@ -389,7 +389,7 @@ TEST_F(SimpleEncodeTest, EncodeConsistencySetExternalGroupOfPicturesMap) { frame_rate_den_, target_bitrate_, num_frames_, in_file_path_str_.c_str()); simple_encode.ComputeFirstPassStats(); - simple_encode.SetExternalGroupOfPicturesMap(gop_map); + simple_encode.SetExternalGroupOfPicturesMap(gop_map.data(), gop_map.size()); const int num_coding_frames = simple_encode.GetCodingFrameNum(); EXPECT_EQ(static_cast(num_coding_frames), quantize_index_list.size()); @@ -427,7 +427,7 @@ TEST_F(SimpleEncodeTest, SetExternalGroupOfPicturesMap) { // Last gop group. gop_map[14] |= kGopMapFlagStart | kGopMapFlagUseAltRef; - simple_encode.SetExternalGroupOfPicturesMap(gop_map); + simple_encode.SetExternalGroupOfPicturesMap(gop_map.data(), gop_map.size()); std::vector observed_gop_map = simple_encode.ObserveExternalGroupOfPicturesMap(); diff --git a/vp9/simple_encode.cc b/vp9/simple_encode.cc index bce52e28c..7bce91f7f 100644 --- a/vp9/simple_encode.cc +++ b/vp9/simple_encode.cc @@ -806,8 +806,11 @@ std::vector> SimpleEncode::ObserveFirstPassStats() { return output_stats; } -void SimpleEncode::SetExternalGroupOfPicturesMap(std::vector gop_map) { - gop_map_ = gop_map; +void SimpleEncode::SetExternalGroupOfPicturesMap(int *gop_map, + int gop_map_size) { + for (int i = 0; i < gop_map_size; ++i) { + gop_map_.push_back(gop_map[i]); + } // The following will check and modify gop_map_ to make sure the // gop_map_ satisfies the constraints. // 1) Each key frame position should be at the start of a gop. diff --git a/vp9/simple_encode.h b/vp9/simple_encode.h index d7c9dfa14..b21732070 100644 --- a/vp9/simple_encode.h +++ b/vp9/simple_encode.h @@ -335,7 +335,7 @@ class SimpleEncode { // constraints. // 1) Each key frame position should be at the start of a gop. // 2) The last gop should not use an alt ref. - void SetExternalGroupOfPicturesMap(std::vector gop_map); + void SetExternalGroupOfPicturesMap(int *gop_map, int gop_map_size); // Observe the group of pictures map set through // SetExternalGroupOfPicturesMap(). This function should be called after -- 2.40.0