1 // Copyright 2024 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 use crate::decoder::Image;
16 use crate::image::YuvRange;
17 use crate::internal_utils::*;
18 use crate::parser::mp4box::ContentLightLevelInformation;
19 use crate::*;
20 
21 #[derive(Debug, Default)]
22 pub struct GainMapMetadata {
23     pub min: [Fraction; 3],
24     pub max: [Fraction; 3],
25     pub gamma: [UFraction; 3],
26     pub base_offset: [Fraction; 3],
27     pub alternate_offset: [Fraction; 3],
28     pub base_hdr_headroom: UFraction,
29     pub alternate_hdr_headroom: UFraction,
30     pub use_base_color_space: bool,
31 }
32 
33 #[derive(Default)]
34 pub struct GainMap {
35     pub image: Image,
36     pub metadata: GainMapMetadata,
37 
38     pub alt_icc: Vec<u8>,
39     pub alt_color_primaries: ColorPrimaries,
40     pub alt_transfer_characteristics: TransferCharacteristics,
41     pub alt_matrix_coefficients: MatrixCoefficients,
42     pub alt_yuv_range: YuvRange,
43 
44     pub alt_plane_count: u8,
45     pub alt_plane_depth: u8,
46 
47     pub alt_clli: ContentLightLevelInformation,
48 }
49