Kári Tristan Helgason | 9d96e92 | 2018-05-04 11:56:55 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2018 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 | #ifndef API_TEST_VIDEOCODEC_TEST_FIXTURE_H_ |
| 12 | #define API_TEST_VIDEOCODEC_TEST_FIXTURE_H_ |
| 13 | |
| 14 | #include <vector> |
| 15 | |
| 16 | #include "api/video_codecs/video_decoder_factory.h" |
| 17 | #include "api/video_codecs/video_encoder_factory.h" |
| 18 | #include "modules/video_coding/codecs/test/stats.h" |
| 19 | |
| 20 | namespace webrtc { |
| 21 | namespace test { |
| 22 | |
| 23 | // Rates for the encoder and the frame number when to change profile. |
| 24 | struct RateProfile { |
| 25 | size_t target_kbps; |
| 26 | size_t input_fps; |
| 27 | size_t frame_index_rate_update; |
| 28 | }; |
| 29 | |
| 30 | struct RateControlThresholds { |
| 31 | double max_avg_bitrate_mismatch_percent; |
| 32 | double max_time_to_reach_target_bitrate_sec; |
| 33 | // TODO(ssilkin): Use absolute threshold for framerate. |
| 34 | double max_avg_framerate_mismatch_percent; |
| 35 | double max_avg_buffer_level_sec; |
| 36 | double max_max_key_frame_delay_sec; |
| 37 | double max_max_delta_frame_delay_sec; |
| 38 | size_t max_num_spatial_resizes; |
| 39 | size_t max_num_key_frames; |
| 40 | }; |
| 41 | |
| 42 | struct QualityThresholds { |
| 43 | double min_avg_psnr; |
| 44 | double min_min_psnr; |
| 45 | double min_avg_ssim; |
| 46 | double min_min_ssim; |
| 47 | }; |
| 48 | |
| 49 | struct BitstreamThresholds { |
| 50 | size_t max_max_nalu_size_bytes; |
| 51 | }; |
| 52 | |
| 53 | // Should video files be saved persistently to disk for post-run visualization? |
| 54 | struct VisualizationParams { |
| 55 | bool save_encoded_ivf; |
| 56 | bool save_decoded_y4m; |
| 57 | }; |
| 58 | |
| 59 | class VideoCodecTestFixture { |
| 60 | public: |
| 61 | virtual ~VideoCodecTestFixture() = default; |
| 62 | |
| 63 | virtual void RunTest(const std::vector<RateProfile>& rate_profiles, |
| 64 | const std::vector<RateControlThresholds>* rc_thresholds, |
| 65 | const std::vector<QualityThresholds>* quality_thresholds, |
| 66 | const BitstreamThresholds* bs_thresholds, |
| 67 | const VisualizationParams* visualization_params) = 0; |
| 68 | virtual Stats GetStats() = 0; |
| 69 | }; |
| 70 | |
| 71 | } // namespace test |
| 72 | } // namespace webrtc |
| 73 | |
| 74 | #endif // API_TEST_VIDEOCODEC_TEST_FIXTURE_H_ |