aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Jiang <jianj@google.com>2023-12-15 15:49:01 -0500
committerJerome Jiang <jianj@google.com>2023-12-18 12:23:32 -0500
commitb8b6b4d4cc5c51deef4811f9e7d84559b35c16dc (patch)
tree27cdf7b0666e032749e636128be766ae8354a786
parentd0e2c30aa4bf3170e50e3cbbe4c7180d8b9ffe17 (diff)
downloadlibvpx-b8b6b4d4cc5c51deef4811f9e7d84559b35c16dc.tar.gz
Remove VP9E_GET_TPL_STATS
This is never used. A callback in external rc func was added and used instead. Change-Id: Iade6f361072f0c28af98904baf457d2f0e9ca904 (cherry picked from commit 41ced868a69625372c95ff0b2bd5f90987516c3b)
-rw-r--r--test/encode_api_test.cc132
-rw-r--r--vp9/vp9_cx_iface.c19
-rw-r--r--vpx/vp8cx.h14
3 files changed, 0 insertions, 165 deletions
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc
index 0aa8739d6..ee7d8d27c 100644
--- a/test/encode_api_test.cc
+++ b/test/encode_api_test.cc
@@ -912,138 +912,6 @@ TEST(EncodeAPI, Buganizer311294795) {
encoder.Encode(false);
encoder.Encode(false);
}
-
-class EncodeApiGetTplStatsTest
- : public ::libvpx_test::EncoderTest,
- public ::testing::TestWithParam<const libvpx_test::CodecFactory *> {
- public:
- EncodeApiGetTplStatsTest() : EncoderTest(GetParam()), test_io_(false) {}
- ~EncodeApiGetTplStatsTest() override = default;
-
- protected:
- void SetUp() override {
- InitializeConfig();
- SetMode(::libvpx_test::kTwoPassGood);
- }
-
- void PreEncodeFrameHook(::libvpx_test::VideoSource *video,
- ::libvpx_test::Encoder *encoder) override {
- if (video->frame() == 0) {
- encoder->Control(VP9E_SET_TPL, 1);
- }
- }
-
- vpx_codec_err_t AllocateTplList(VpxTplGopStats *data) {
- // Allocate MAX_ARF_GOP_SIZE (50) * sizeof(VpxTplFrameStats) that will be
- // filled by VP9E_GET_TPL_STATS.
- // MAX_ARF_GOP_SIZE is used here because the test doesn't know the size of
- // each GOP before getting TPL stats from the encoder.
- data->size = 50;
- data->frame_stats_list =
- static_cast<VpxTplFrameStats *>(calloc(50, sizeof(VpxTplFrameStats)));
- if (data->frame_stats_list == nullptr) return VPX_CODEC_MEM_ERROR;
- return VPX_CODEC_OK;
- }
-
- void CompareTplGopStats(const VpxTplGopStats &ref_gop_stats,
- const VpxTplGopStats &test_gop_stats) {
- ASSERT_EQ(ref_gop_stats.size, test_gop_stats.size);
- for (int frame = 0; frame < ref_gop_stats.size; frame++) {
- const VpxTplFrameStats &ref_frame_stats =
- ref_gop_stats.frame_stats_list[frame];
- const VpxTplFrameStats &test_frame_stats =
- test_gop_stats.frame_stats_list[frame];
- ASSERT_EQ(ref_frame_stats.num_blocks, test_frame_stats.num_blocks);
- ASSERT_EQ(ref_frame_stats.frame_width, test_frame_stats.frame_width);
- ASSERT_EQ(ref_frame_stats.frame_height, test_frame_stats.frame_height);
- for (int block = 0; block < ref_frame_stats.num_blocks; block++) {
- const VpxTplBlockStats &ref_block_stats =
- ref_frame_stats.block_stats_list[block];
- const VpxTplBlockStats &test_block_stats =
- test_frame_stats.block_stats_list[block];
- ASSERT_EQ(ref_block_stats.inter_cost, test_block_stats.inter_cost);
- ASSERT_EQ(ref_block_stats.intra_cost, test_block_stats.intra_cost);
- ASSERT_EQ(ref_block_stats.mv_c, test_block_stats.mv_c);
- ASSERT_EQ(ref_block_stats.mv_r, test_block_stats.mv_r);
- ASSERT_EQ(ref_block_stats.recrf_dist, test_block_stats.recrf_dist);
- ASSERT_EQ(ref_block_stats.recrf_rate, test_block_stats.recrf_rate);
- ASSERT_EQ(ref_block_stats.ref_frame_index,
- test_block_stats.ref_frame_index);
- }
- }
- }
-
- void PostEncodeFrameHook(::libvpx_test::Encoder *encoder) override {
- ::libvpx_test::CxDataIterator iter = encoder->GetCxData();
- while (const vpx_codec_cx_pkt_t *pkt = iter.Next()) {
- switch (pkt->kind) {
- case VPX_CODEC_CX_FRAME_PKT: {
- VpxTplGopStats tpl_stats;
- EXPECT_EQ(AllocateTplList(&tpl_stats), VPX_CODEC_OK);
- encoder->Control(VP9E_GET_TPL_STATS, &tpl_stats);
- bool stats_not_all_zero = false;
- for (int i = 0; i < tpl_stats.size; i++) {
- VpxTplFrameStats *frame_stats_list = tpl_stats.frame_stats_list;
- if (frame_stats_list[i].frame_width != 0) {
- ASSERT_EQ(frame_stats_list[i].frame_width, width_);
- ASSERT_EQ(frame_stats_list[i].frame_height, height_);
- ASSERT_GT(frame_stats_list[i].num_blocks, 0);
- ASSERT_NE(frame_stats_list[i].block_stats_list, nullptr);
- stats_not_all_zero = true;
- }
- }
- ASSERT_TRUE(stats_not_all_zero);
- if (test_io_ && tpl_stats.size > 0) {
- libvpx_test::TempOutFile *temp_out_file =
- new (std::nothrow) libvpx_test::TempOutFile("w+");
- ASSERT_NE(temp_out_file, nullptr);
- ASSERT_NE(temp_out_file->file(), nullptr);
- vpx_write_tpl_gop_stats(temp_out_file->file(), &tpl_stats);
- rewind(temp_out_file->file());
- VpxTplGopStats gop_stats_io;
- ASSERT_EQ(
- vpx_read_tpl_gop_stats(temp_out_file->file(), &gop_stats_io),
- VPX_CODEC_OK);
- CompareTplGopStats(gop_stats_io, tpl_stats);
- vpx_free_tpl_gop_stats(&gop_stats_io);
- delete temp_out_file;
- }
- free(tpl_stats.frame_stats_list);
- break;
- }
- default: break;
- }
- }
- }
-
- int width_;
- int height_;
- bool test_io_;
-};
-
-TEST_P(EncodeApiGetTplStatsTest, GetTplStats) {
- cfg_.g_lag_in_frames = 25;
- width_ = 352;
- height_ = 288;
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", width_,
- height_, 30, 1, 0, 50);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-TEST_P(EncodeApiGetTplStatsTest, GetTplStatsIO) {
- cfg_.g_lag_in_frames = 25;
- width_ = 352;
- height_ = 288;
- test_io_ = true;
- ::libvpx_test::I420VideoSource video("hantro_collage_w352h288.yuv", width_,
- height_, 30, 1, 0, 50);
- ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
-}
-
-INSTANTIATE_TEST_SUITE_P(
- VP9, EncodeApiGetTplStatsTest,
- ::testing::Values(
- static_cast<const libvpx_test::CodecFactory *>(&libvpx_test::kVP9)));
#endif // CONFIG_VP9_ENCODER
} // namespace
diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c
index d4c41d16f..e738feda0 100644
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -1809,24 +1809,6 @@ static vpx_codec_err_t ctrl_get_svc_ref_frame_config(vpx_codec_alg_priv_t *ctx,
return VPX_CODEC_OK;
}
-static vpx_codec_err_t ctrl_get_tpl_stats(vpx_codec_alg_priv_t *ctx,
- va_list args) {
- VP9_COMP *const cpi = ctx->cpi;
- VpxTplGopStats *data = va_arg(args, VpxTplGopStats *);
- VpxTplFrameStats *frame_stats_list = cpi->tpl_gop_stats.frame_stats_list;
- int i;
- if (data == NULL) {
- return VPX_CODEC_INVALID_PARAM;
- }
- data->size = cpi->tpl_gop_stats.size;
-
- for (i = 0; i < data->size; i++) {
- data->frame_stats_list[i] = frame_stats_list[i];
- }
-
- return VPX_CODEC_OK;
-}
-
static vpx_codec_err_t ctrl_set_svc_ref_frame_config(vpx_codec_alg_priv_t *ctx,
va_list args) {
VP9_COMP *const cpi = ctx->cpi;
@@ -2086,7 +2068,6 @@ static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = {
{ VP9E_GET_ACTIVEMAP, ctrl_get_active_map },
{ VP9E_GET_LEVEL, ctrl_get_level },
{ VP9E_GET_SVC_REF_FRAME_CONFIG, ctrl_get_svc_ref_frame_config },
- { VP9E_GET_TPL_STATS, ctrl_get_tpl_stats },
{ -1, NULL },
};
diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h
index d098c4c98..2875e185e 100644
--- a/vpx/vp8cx.h
+++ b/vpx/vp8cx.h
@@ -768,18 +768,6 @@ enum vp8e_enc_control_id {
*
*/
VP9E_SET_QUANTIZER_ONE_PASS,
-
- /*!\brief Codec control to get TPL stats for the current GOP.
- *
- * Allocation and free of memory of size MAX_ARF_GOP_SIZE (50) *
- * sizeof(VpxTplFrameStats) should be done by applications.
- *
- * VPX_CODEC_INVALID_PARAM will be returned if the pointer passed in is NULL.
- *
- * Supported in codecs: VP9
- *
- */
- VP9E_GET_TPL_STATS,
};
/*!\brief vpx 1-D scaling mode
@@ -1110,8 +1098,6 @@ VPX_CTRL_USE_TYPE(VP8E_SET_RTC_EXTERNAL_RATECTRL, int)
#define VPX_CTRL_VP8E_SET_RTC_EXTERNAL_RATECTRL
VPX_CTRL_USE_TYPE(VP9E_SET_QUANTIZER_ONE_PASS, int)
#define VPX_CTRL_VP9E_SET_QUANTIZER_ONE_PASS
-VPX_CTRL_USE_TYPE(VP9E_GET_TPL_STATS, void *)
-#define VPX_CTRL_VP9E_GET_TPL_STATS
/*!\endcond */
/*! @} - end defgroup vp8_encoder */