videocodec_test_av1.cc (3363B)
1 /* 2 * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include <memory> 12 #include <string> 13 #include <vector> 14 15 #include "api/test/create_videocodec_test_fixture.h" 16 #include "api/test/videocodec_test_fixture.h" 17 #include "api/video_codecs/scalability_mode.h" 18 #include "media/base/media_constants.h" 19 #include "test/gtest.h" 20 #include "test/testsupport/file_utils.h" 21 22 namespace webrtc { 23 namespace test { 24 namespace { 25 // Test clips settings. 26 constexpr int kCifWidth = 352; 27 constexpr int kCifHeight = 288; 28 constexpr int kNumFramesLong = 300; 29 30 VideoCodecTestFixture::Config CreateConfig(std::string filename) { 31 VideoCodecTestFixture::Config config; 32 config.filename = filename; 33 config.filepath = ResourcePath(config.filename, "yuv"); 34 config.num_frames = kNumFramesLong; 35 config.use_single_core = true; 36 return config; 37 } 38 39 TEST(VideoCodecTestAv1, HighBitrate) { 40 auto config = CreateConfig("foreman_cif"); 41 config.SetCodecSettings(kAv1CodecName, 1, 1, 1, false, true, true, kCifWidth, 42 kCifHeight); 43 config.codec_settings.SetScalabilityMode(ScalabilityMode::kL1T1); 44 config.num_frames = kNumFramesLong; 45 auto fixture = CreateVideoCodecTestFixture(config); 46 47 std::vector<RateProfile> rate_profiles = {{500, 30, 0}}; 48 49 std::vector<RateControlThresholds> rc_thresholds = { 50 {12, 1, 0, 1, 0.3, 0.1, 0, 1}}; 51 52 std::vector<QualityThresholds> quality_thresholds = {{37, 34, 0.94, 0.91}}; 53 54 fixture->RunTest(rate_profiles, &rc_thresholds, &quality_thresholds, nullptr); 55 } 56 57 TEST(VideoCodecTestAv1, VeryLowBitrate) { 58 auto config = CreateConfig("foreman_cif"); 59 config.SetCodecSettings(kAv1CodecName, 1, 1, 1, false, true, true, kCifWidth, 60 kCifHeight); 61 config.codec_settings.SetScalabilityMode(ScalabilityMode::kL1T1); 62 auto fixture = CreateVideoCodecTestFixture(config); 63 64 std::vector<RateProfile> rate_profiles = {{50, 30, 0}}; 65 66 std::vector<RateControlThresholds> rc_thresholds = { 67 {15, 8, 75, 2, 2, 2, 2, 1}}; 68 69 std::vector<QualityThresholds> quality_thresholds = {{28, 24.8, 0.70, 0.55}}; 70 71 fixture->RunTest(rate_profiles, &rc_thresholds, &quality_thresholds, nullptr); 72 } 73 74 #if !defined(WEBRTC_ANDROID) 75 constexpr int kHdWidth = 1280; 76 constexpr int kHdHeight = 720; 77 TEST(VideoCodecTestAv1, Hd) { 78 auto config = CreateConfig("ConferenceMotion_1280_720_50"); 79 config.SetCodecSettings(kAv1CodecName, 1, 1, 1, false, true, true, kHdWidth, 80 kHdHeight); 81 config.codec_settings.SetScalabilityMode(ScalabilityMode::kL1T1); 82 config.num_frames = kNumFramesLong; 83 auto fixture = CreateVideoCodecTestFixture(config); 84 85 std::vector<RateProfile> rate_profiles = {{1000, 50, 0}}; 86 87 std::vector<RateControlThresholds> rc_thresholds = { 88 {13, 3, 0, 1, 0.3, 0.1, 0, 1}}; 89 90 std::vector<QualityThresholds> quality_thresholds = { 91 {35.9, 31.5, 0.925, 0.865}}; 92 93 fixture->RunTest(rate_profiles, &rc_thresholds, &quality_thresholds, nullptr); 94 } 95 #endif 96 97 } // namespace 98 } // namespace test 99 } // namespace webrtc