2 * Copyright (c) 2021 Limin Wang <lance.lmwang at gmail.com>
4 * This file is part of FFmpeg.
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
22 #define AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
28 * HDR Vivid three spline params.
30 typedef struct AVHDRVivid3SplineParams
{
32 * The mode of three Spline. the value shall be in the range
33 * of 0 to 3, inclusive.
38 * three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive
39 * and in multiples of 1.0/255.
42 AVRational th_enable_mb
;
45 * 3Spline_TH_enable of three Spline.
46 * The value shall be in the range of 0.0 to 1.0, inclusive.
47 * and in multiples of 1.0/4095.
52 * 3Spline_TH_Delta1 of three Spline.
53 * The value shall be in the range of 0.0 to 0.25, inclusive,
54 * and in multiples of 0.25/1023.
59 * 3Spline_TH_Delta2 of three Spline.
60 * The value shall be in the range of 0.0 to 0.25, inclusive,
61 * and in multiples of 0.25/1023.
66 * 3Spline_enable_Strength of three Spline.
67 * The value shall be in the range of 0.0 to 1.0, inclusive,
68 * and in multiples of 1.0/255.
70 AVRational enable_strength
;
71 } AVHDRVivid3SplineParams
;
74 * Color tone mapping parameters at a processing window in a dynamic metadata for
77 typedef struct AVHDRVividColorToneMappingParams
{
79 * The nominal maximum display luminance of the targeted system display,
80 * in multiples of 1.0/4095 candelas per square metre. The value shall be in
81 * the range of 0.0 to 1.0, inclusive.
83 AVRational targeted_system_display_maximum_luminance
;
86 * This flag indicates that transfer the base paramter(for value of 1)
91 * base_param_m_p in the base parameter,
92 * in multiples of 1.0/16383. The value shall be in
93 * the range of 0.0 to 1.0, inclusive.
95 AVRational base_param_m_p
;
98 * base_param_m_m in the base parameter,
99 * in multiples of 1.0/10. The value shall be in
100 * the range of 0.0 to 6.3, inclusive.
102 AVRational base_param_m_m
;
105 * base_param_m_a in the base parameter,
106 * in multiples of 1.0/1023. The value shall be in
107 * the range of 0.0 to 1.0 inclusive.
109 AVRational base_param_m_a
;
112 * base_param_m_b in the base parameter,
113 * in multiples of 1/1023. The value shall be in
114 * the range of 0.0 to 1.0, inclusive.
116 AVRational base_param_m_b
;
119 * base_param_m_n in the base parameter,
120 * in multiples of 1.0/10. The value shall be in
121 * the range of 0.0 to 6.3, inclusive.
123 AVRational base_param_m_n
;
126 * indicates k1_0 in the base parameter,
127 * base_param_k1 <= 1: k1_0 = base_param_k1
128 * base_param_k1 > 1: reserved
133 * indicates k2_0 in the base parameter,
134 * base_param_k2 <= 1: k2_0 = base_param_k2
135 * base_param_k2 > 1: reserved
140 * indicates k3_0 in the base parameter,
141 * base_param_k3 == 1: k3_0 = base_param_k3
142 * base_param_k3 == 2: k3_0 = maximum_maxrgb
143 * base_param_k3 > 2: reserved
148 * This flag indicates that delta mode of base paramter(for value of 1)
150 int base_param_Delta_enable_mode
;
153 * base_param_Delta in the base parameter,
154 * in multiples of 1.0/127. The value shall be in
155 * the range of 0.0 to 1.0, inclusive.
157 AVRational base_param_Delta
;
160 * indicates 3Spline_enable_flag in the base parameter,
161 * This flag indicates that transfer three Spline of base paramter(for value of 1)
163 int three_Spline_enable_flag
;
166 * The number of three Spline. The value shall be in the range
167 * of 1 to 2, inclusive.
169 int three_Spline_num
;
171 #if FF_API_HDR_VIVID_THREE_SPLINE
173 * The mode of three Spline. the value shall be in the range
174 * of 0 to 3, inclusive.
175 * @deprecated Use three_spline instead
178 int three_Spline_TH_mode
;
181 * three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive
182 * and in multiples of 1.0/255.
183 * @deprecated Use three_spline instead
186 AVRational three_Spline_TH_enable_MB
;
189 * 3Spline_TH_enable of three Spline.
190 * The value shall be in the range of 0.0 to 1.0, inclusive.
191 * and in multiples of 1.0/4095.
192 * @deprecated Use three_spline instead
195 AVRational three_Spline_TH_enable
;
198 * 3Spline_TH_Delta1 of three Spline.
199 * The value shall be in the range of 0.0 to 0.25, inclusive,
200 * and in multiples of 0.25/1023.
201 * @deprecated Use three_spline instead
204 AVRational three_Spline_TH_Delta1
;
207 * 3Spline_TH_Delta2 of three Spline.
208 * The value shall be in the range of 0.0 to 0.25, inclusive,
209 * and in multiples of 0.25/1023.
210 * @deprecated Use three_spline instead
213 AVRational three_Spline_TH_Delta2
;
216 * 3Spline_enable_Strength of three Spline.
217 * The value shall be in the range of 0.0 to 1.0, inclusive,
218 * and in multiples of 1.0/255.
219 * @deprecated Use three_spline instead
222 AVRational three_Spline_enable_Strength
;
225 AVHDRVivid3SplineParams three_spline
[2];
226 } AVHDRVividColorToneMappingParams
;
230 * Color transform parameters at a processing window in a dynamic metadata for
233 typedef struct AVHDRVividColorTransformParams
{
235 * Indicates the minimum brightness of the displayed content.
236 * The values should be in the range of 0.0 to 1.0,
237 * inclusive and in multiples of 1/4095.
239 AVRational minimum_maxrgb
;
242 * Indicates the average brightness of the displayed content.
243 * The values should be in the range of 0.0 to 1.0,
244 * inclusive and in multiples of 1/4095.
246 AVRational average_maxrgb
;
249 * Indicates the variance brightness of the displayed content.
250 * The values should be in the range of 0.0 to 1.0,
251 * inclusive and in multiples of 1/4095.
253 AVRational variance_maxrgb
;
256 * Indicates the maximum brightness of the displayed content.
257 * The values should be in the range of 0.0 to 1.0, inclusive
258 * and in multiples of 1/4095.
260 AVRational maximum_maxrgb
;
263 * This flag indicates that the metadata for the tone mapping function in
264 * the processing window is present (for value of 1).
266 int tone_mapping_mode_flag
;
269 * The number of tone mapping param. The value shall be in the range
270 * of 1 to 2, inclusive.
272 int tone_mapping_param_num
;
275 * The color tone mapping parameters.
277 AVHDRVividColorToneMappingParams tm_params
[2];
280 * This flag indicates that the metadata for the color saturation mapping in
281 * the processing window is present (for value of 1).
283 int color_saturation_mapping_flag
;
286 * The number of color saturation param. The value shall be in the range
287 * of 0 to 7, inclusive.
289 int color_saturation_num
;
292 * Indicates the color correction strength parameter.
293 * The values should be in the range of 0.0 to 2.0, inclusive
294 * and in multiples of 1/128.
296 AVRational color_saturation_gain
[8];
297 } AVHDRVividColorTransformParams
;
300 * This struct represents dynamic metadata for color volume transform -
301 * CUVA 005.1:2021 standard
303 * To be used as payload of a AVFrameSideData or AVPacketSideData with the
306 * @note The struct should be allocated with
307 * av_dynamic_hdr_vivid_alloc() and its size is not a part of
310 typedef struct AVDynamicHDRVivid
{
312 * The system start code. The value shall be set to 0x01.
314 uint8_t system_start_code
;
317 * The number of processing windows. The value shall be set to 0x01
318 * if the system_start_code is 0x01.
323 * The color transform parameters for every processing window.
325 AVHDRVividColorTransformParams params
[3];
329 * Allocate an AVDynamicHDRVivid structure and set its fields to
330 * default values. The resulting struct can be freed using av_freep().
332 * @return An AVDynamicHDRVivid filled with default values or NULL
335 AVDynamicHDRVivid
*av_dynamic_hdr_vivid_alloc(size_t *size
);
338 * Allocate a complete AVDynamicHDRVivid and add it to the frame.
339 * @param frame The frame which side data is added to.
341 * @return The AVDynamicHDRVivid structure to be filled by caller or NULL
344 AVDynamicHDRVivid
*av_dynamic_hdr_vivid_create_side_data(AVFrame
*frame
);
346 #endif /* AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H */