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 #include "common_video/test/utilities.h" 11 12 #include <utility> 13 14 namespace webrtc { 15 CreateTestHdrMetadata()16HdrMetadata CreateTestHdrMetadata() { 17 // Random but reasonable (in the sense of a valid range) HDR metadata. 18 HdrMetadata hdr_metadata; 19 hdr_metadata.mastering_metadata.luminance_max = 2000.0; 20 hdr_metadata.mastering_metadata.luminance_min = 2.0001; 21 hdr_metadata.mastering_metadata.primary_r.x = 0.3003; 22 hdr_metadata.mastering_metadata.primary_r.y = 0.4004; 23 hdr_metadata.mastering_metadata.primary_g.x = 0.3201; 24 hdr_metadata.mastering_metadata.primary_g.y = 0.4604; 25 hdr_metadata.mastering_metadata.primary_b.x = 0.3409; 26 hdr_metadata.mastering_metadata.primary_b.y = 0.4907; 27 hdr_metadata.mastering_metadata.white_point.x = 0.4103; 28 hdr_metadata.mastering_metadata.white_point.y = 0.4806; 29 hdr_metadata.max_content_light_level = 2345; 30 hdr_metadata.max_frame_average_light_level = 1789; 31 return hdr_metadata; 32 } 33 CreateTestColorSpace(bool with_hdr_metadata)34ColorSpace CreateTestColorSpace(bool with_hdr_metadata) { 35 HdrMetadata hdr_metadata = CreateTestHdrMetadata(); 36 return ColorSpace( 37 ColorSpace::PrimaryID::kBT709, ColorSpace::TransferID::kGAMMA22, 38 ColorSpace::MatrixID::kSMPTE2085, ColorSpace::RangeID::kFull, 39 ColorSpace::ChromaSiting::kCollocated, 40 ColorSpace::ChromaSiting::kCollocated, 41 with_hdr_metadata ? &hdr_metadata : nullptr); 42 } 43 CreatePacketInfos(size_t count)44RtpPacketInfos CreatePacketInfos(size_t count) { 45 return RtpPacketInfos(RtpPacketInfos::vector_type(count)); 46 } 47 48 } // namespace webrtc 49