test/*.cc: remove use of GTEST_ARRAY_SIZE_()
this macro is deprecated and will be removed in a future release.
fwd_kf_test.cc: instead of an index, just pass the values to the test as
parameters
{intrabc_test,resize_test}.cc: use range based for loops now that c++11
is mandatory
Change-Id: I4e31cca01682c1f5c00b873400ed4839b40acc7e
diff --git a/test/fwd_kf_test.cc b/test/fwd_kf_test.cc
index 3fd593c..9f6f7ef 100644
--- a/test/fwd_kf_test.cc
+++ b/test/fwd_kf_test.cc
@@ -27,15 +27,14 @@
{ 12, 33.6 }, { 16, 33.5 }, { 18, 33.1 }
};
-// Params: encoding mode and index into the kMaxKfDists array to control
-// kf-max-dist
class ForwardKeyTest
- : public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode, int>,
+ : public ::libaom_test::CodecTestWith2Params<libaom_test::TestMode,
+ FwdKfTestParam>,
public ::libaom_test::EncoderTest {
protected:
ForwardKeyTest()
: EncoderTest(GET_PARAM(0)), encoding_mode_(GET_PARAM(1)),
- kf_max_dist_ind_(GET_PARAM(2)) {}
+ kf_max_dist_param_(GET_PARAM(2)) {}
virtual ~ForwardKeyTest() {}
virtual void SetUp() {
@@ -44,8 +43,8 @@
const aom_rational timebase = { 1, 30 };
cfg_.g_timebase = timebase;
cpu_used_ = 2;
- kf_max_dist_ = kTestParams[kf_max_dist_ind_].max_kf_dist;
- psnr_threshold_ = kTestParams[kf_max_dist_ind_].psnr_thresh;
+ kf_max_dist_ = kf_max_dist_param_.max_kf_dist;
+ psnr_threshold_ = kf_max_dist_param_.psnr_thresh;
cfg_.rc_end_usage = AOM_VBR;
cfg_.rc_target_bitrate = 200;
cfg_.g_lag_in_frames = 10;
@@ -85,7 +84,7 @@
double GetPsnrThreshold() { return psnr_threshold_; }
::libaom_test::TestMode encoding_mode_;
- const int kf_max_dist_ind_;
+ const FwdKfTestParam kf_max_dist_param_;
double psnr_threshold_;
int kf_max_dist_;
int cpu_used_;
@@ -104,7 +103,7 @@
<< "kf max dist = " << kf_max_dist_;
}
-AV1_INSTANTIATE_TEST_CASE(
- ForwardKeyTest, ::testing::Values(::libaom_test::kTwoPassGood),
- ::testing::Range(0, static_cast<int>(GTEST_ARRAY_SIZE_(kTestParams))));
+AV1_INSTANTIATE_TEST_CASE(ForwardKeyTest,
+ ::testing::Values(::libaom_test::kTwoPassGood),
+ ::testing::ValuesIn(kTestParams));
} // namespace
diff --git a/test/intrabc_test.cc b/test/intrabc_test.cc
index 3ea4217..6ef0a50 100644
--- a/test/intrabc_test.cc
+++ b/test/intrabc_test.cc
@@ -156,13 +156,12 @@
AV1_COMMON cm;
memset(&cm, 0, sizeof(cm));
- for (int i = 0; i < static_cast<int>(GTEST_ARRAY_SIZE_(kDvCases)); ++i) {
- EXPECT_EQ(static_cast<int>(kDvCases[i].valid),
- av1_is_dv_valid(kDvCases[i].dv, &cm, &xd,
- xd.tile.mi_row_start + kDvCases[i].mi_row_offset,
- xd.tile.mi_col_start + kDvCases[i].mi_col_offset,
- kDvCases[i].bsize, MAX_MIB_SIZE_LOG2))
- << "DvCases[" << i << "]";
+ for (const DvTestCase &dv_case : kDvCases) {
+ EXPECT_EQ(static_cast<int>(dv_case.valid),
+ av1_is_dv_valid(dv_case.dv, &cm, &xd,
+ xd.tile.mi_row_start + dv_case.mi_row_offset,
+ xd.tile.mi_col_start + dv_case.mi_col_offset,
+ dv_case.bsize, MAX_MIB_SIZE_LOG2));
}
}
} // namespace
diff --git a/test/resize_test.cc b/test/resize_test.cc
index 140de69..bcf6794 100644
--- a/test/resize_test.cc
+++ b/test/resize_test.cc
@@ -618,12 +618,12 @@
TEST_P(ResizeCspTest, TestResizeCspWorks) {
#endif
const aom_img_fmt_t image_formats[] = { AOM_IMG_FMT_I420, AOM_IMG_FMT_I444 };
- for (size_t i = 0; i < GTEST_ARRAY_SIZE_(image_formats); ++i) {
- ResizingCspVideoSource video(image_formats[i]);
+ for (const aom_img_fmt_t &img_format : image_formats) {
+ ResizingCspVideoSource video(img_format);
init_flags_ = AOM_CODEC_USE_PSNR;
cfg_.rc_min_quantizer = cfg_.rc_max_quantizer = 48;
cfg_.g_lag_in_frames = 0;
- cfg_.g_profile = (image_formats[i] == AOM_IMG_FMT_I420) ? 0 : 1;
+ cfg_.g_profile = (img_format == AOM_IMG_FMT_I420) ? 0 : 1;
ASSERT_NO_FATAL_FAILURE(RunLoop(&video));
// Check we decoded the same number of frames as we attempted to encode