Reorder methods and members of HdrMetadata
Bug: webrtc:8651
Change-Id: I67941a5918d5cd31a7b04b11aa20c500d49e9a62
Reviewed-on: https://webrtc-review.googlesource.com/c/114283
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Johannes Kron <kron@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26002}
diff --git a/api/video/hdr_metadata.h b/api/video/hdr_metadata.h
index 3be1d59..e9001a2 100644
--- a/api/video/hdr_metadata.h
+++ b/api/video/hdr_metadata.h
@@ -11,21 +11,14 @@
#ifndef API_VIDEO_HDR_METADATA_H_
#define API_VIDEO_HDR_METADATA_H_
-#include <stdint.h>
-
namespace webrtc {
// SMPTE ST 2086 mastering metadata,
// see https://ieeexplore.ieee.org/document/8353899.
struct HdrMasteringMetadata {
struct Chromaticity {
- // xy chromaticity coordinates must be calculated as specified in ISO
- // 11664-3:2012 Section 7, and must be specified with four decimal places.
- // The x coordinate should be in the range [0.0001, 0.7400] and the y
- // coordinate should be in the range [0.0001, 0.8400]. Valid range [0.0000,
- // 1.0000].
- float x = 0.0f;
- float y = 0.0f;
+ Chromaticity();
+
bool operator==(const Chromaticity& rhs) const {
return x == rhs.x && y == rhs.y;
}
@@ -34,9 +27,31 @@
return x >= 0.0 && x <= 1.0 && y >= 0.0 && y <= 1.0;
}
- Chromaticity();
+ // xy chromaticity coordinates must be calculated as specified in ISO
+ // 11664-3:2012 Section 7, and must be specified with four decimal places.
+ // The x coordinate should be in the range [0.0001, 0.7400] and the y
+ // coordinate should be in the range [0.0001, 0.8400]. Valid range [0.0000,
+ // 1.0000].
+ float x = 0.0f;
+ float y = 0.0f;
};
+ HdrMasteringMetadata();
+
+ bool operator==(const HdrMasteringMetadata& rhs) const {
+ return ((primary_r == rhs.primary_r) && (primary_g == rhs.primary_g) &&
+ (primary_b == rhs.primary_b) && (white_point == rhs.white_point) &&
+ (luminance_max == rhs.luminance_max) &&
+ (luminance_min == rhs.luminance_min));
+ }
+
+ bool Validate() const {
+ return luminance_max >= 0.0 && luminance_max <= 20000.0 &&
+ luminance_min >= 0.0 && luminance_min <= 5.0 &&
+ primary_r.Validate() && primary_g.Validate() &&
+ primary_b.Validate() && white_point.Validate();
+ }
+
// The nominal primaries of the mastering display.
Chromaticity primary_r;
Chromaticity primary_g;
@@ -54,36 +69,12 @@
// in the unit candela/m2. The value should be in the range [0.0001, 5.0000]
// with four decimal places. Valid range [0.0000, 5.0000].
float luminance_min = 0.0f;
-
- HdrMasteringMetadata();
-
- bool operator==(const HdrMasteringMetadata& rhs) const {
- return ((primary_r == rhs.primary_r) && (primary_g == rhs.primary_g) &&
- (primary_b == rhs.primary_b) && (white_point == rhs.white_point) &&
- (luminance_max == rhs.luminance_max) &&
- (luminance_min == rhs.luminance_min));
- }
-
- bool Validate() const {
- return luminance_max >= 0.0 && luminance_max <= 20000.0 &&
- luminance_min >= 0.0 && luminance_min <= 5.0 &&
- primary_r.Validate() && primary_g.Validate() &&
- primary_b.Validate() && white_point.Validate();
- }
};
// High dynamic range (HDR) metadata common for HDR10 and WebM/VP9-based HDR
// formats. This struct replicates the HDRMetadata struct defined in
// https://cs.chromium.org/chromium/src/media/base/hdr_metadata.h
struct HdrMetadata {
- HdrMasteringMetadata mastering_metadata;
- // Max content light level (CLL), i.e. maximum brightness level present in the
- // stream, in nits. 1 nit = 1 candela/m2. Valid range [0, 20000].
- int max_content_light_level = 0;
- // Max frame-average light level (FALL), i.e. maximum average brightness of
- // the brightest frame in the stream, in nits. Valid range [0, 20000].
- int max_frame_average_light_level = 0;
-
HdrMetadata();
bool operator==(const HdrMetadata& rhs) const {
@@ -99,6 +90,14 @@
max_frame_average_light_level <= 20000 &&
mastering_metadata.Validate();
}
+
+ HdrMasteringMetadata mastering_metadata;
+ // Max content light level (CLL), i.e. maximum brightness level present in the
+ // stream, in nits. 1 nit = 1 candela/m2. Valid range [0, 20000].
+ int max_content_light_level = 0;
+ // Max frame-average light level (FALL), i.e. maximum average brightness of
+ // the brightest frame in the stream, in nits. Valid range [0, 20000].
+ int max_frame_average_light_level = 0;
};
} // namespace webrtc