summaryrefslogtreecommitdiff
path: root/media/libaom/src/test/encode_perf_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'media/libaom/src/test/encode_perf_test.cc')
-rw-r--r--media/libaom/src/test/encode_perf_test.cc38
1 files changed, 17 insertions, 21 deletions
diff --git a/media/libaom/src/test/encode_perf_test.cc b/media/libaom/src/test/encode_perf_test.cc
index fe649b153..390a6e0e6 100644
--- a/media/libaom/src/test/encode_perf_test.cc
+++ b/media/libaom/src/test/encode_perf_test.cc
@@ -123,32 +123,29 @@ class AV1EncodePerfTest
};
TEST_P(AV1EncodePerfTest, PerfTest) {
- for (size_t i = 0; i < NELEMENTS(kAV1EncodePerfTestVectors); ++i) {
- for (size_t j = 0; j < NELEMENTS(kEncodePerfTestSpeeds); ++j) {
- for (size_t k = 0; k < NELEMENTS(kEncodePerfTestThreads); ++k) {
- if (kAV1EncodePerfTestVectors[i].width < 512 &&
- kEncodePerfTestThreads[k] > 1)
+ for (const EncodePerfTestVideo &test_video : kAV1EncodePerfTestVectors) {
+ for (int speed : kEncodePerfTestSpeeds) {
+ for (int threads : kEncodePerfTestThreads) {
+ if (test_video.width < 512 && threads > 1)
continue;
- else if (kAV1EncodePerfTestVectors[i].width < 1024 &&
- kEncodePerfTestThreads[k] > 2)
+ else if (test_video.width < 1024 && threads > 2)
continue;
- set_threads(kEncodePerfTestThreads[k]);
+ set_threads(threads);
SetUp();
const aom_rational timebase = { 33333333, 1000000000 };
cfg_.g_timebase = timebase;
- cfg_.rc_target_bitrate = kAV1EncodePerfTestVectors[i].bitrate;
+ cfg_.rc_target_bitrate = test_video.bitrate;
init_flags_ = AOM_CODEC_USE_PSNR;
- const unsigned frames = kAV1EncodePerfTestVectors[i].frames;
- const char *video_name = kAV1EncodePerfTestVectors[i].name;
- libaom_test::I420VideoSource video(
- video_name, kAV1EncodePerfTestVectors[i].width,
- kAV1EncodePerfTestVectors[i].height, timebase.den, timebase.num, 0,
- kAV1EncodePerfTestVectors[i].frames);
- set_speed(kEncodePerfTestSpeeds[j]);
+ const unsigned frames = test_video.frames;
+ const char *video_name = test_video.name;
+ libaom_test::I420VideoSource video(video_name, test_video.width,
+ test_video.height, timebase.den,
+ timebase.num, 0, test_video.frames);
+ set_speed(speed);
aom_usec_timer t;
aom_usec_timer_start(&t);
@@ -160,10 +157,9 @@ TEST_P(AV1EncodePerfTest, PerfTest) {
const double fps = frames / elapsed_secs;
const double minimum_psnr = min_psnr();
std::string display_name(video_name);
- if (kEncodePerfTestThreads[k] > 1) {
+ if (threads > 1) {
char thread_count[32];
- snprintf(thread_count, sizeof(thread_count), "_t-%d",
- kEncodePerfTestThreads[k]);
+ snprintf(thread_count, sizeof(thread_count), "_t-%d", threads);
display_name += thread_count;
}
@@ -175,8 +171,8 @@ TEST_P(AV1EncodePerfTest, PerfTest) {
printf("\t\"totalFrames\" : %u,\n", frames);
printf("\t\"framesPerSecond\" : %f,\n", fps);
printf("\t\"minPsnr\" : %f,\n", minimum_psnr);
- printf("\t\"speed\" : %d,\n", kEncodePerfTestSpeeds[j]);
- printf("\t\"threads\" : %d\n", kEncodePerfTestThreads[k]);
+ printf("\t\"speed\" : %d,\n", speed);
+ printf("\t\"threads\" : %d\n", threads);
printf("}\n");
}
}