FFmpeg
hdr_dynamic_vivid_metadata.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Limin Wang <lance.lmwang at gmail.com>
3  *
4  * This file is part of FFmpeg.
5  *
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.
10  *
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.
15  *
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
19  */
20 
21 #ifndef AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
22 #define AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H
23 
24 #include "frame.h"
25 #include "rational.h"
26 
27 /**
28  * HDR Vivid three spline params.
29  */
30 typedef struct AVHDRVivid3SplineParams {
31  /**
32  * The mode of three Spline. the value shall be in the range
33  * of 0 to 3, inclusive.
34  */
35  int th_mode;
36 
37  /**
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.
40  *
41  */
43 
44  /**
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.
48  */
50 
51  /**
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.
55  */
57 
58  /**
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.
62  */
64 
65  /**
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.
69  */
72 
73 /**
74  * Color tone mapping parameters at a processing window in a dynamic metadata for
75  * CUVA 005.1:2021.
76  */
78  /**
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.
82  */
84 
85  /**
86  * This flag indicates that transfer the base paramter(for value of 1)
87  */
89 
90  /**
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.
94  */
96 
97  /**
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.
101  */
103 
104  /**
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.
108  */
110 
111  /**
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.
115  */
117 
118  /**
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.
122  */
124 
125  /**
126  * indicates k1_0 in the base parameter,
127  * base_param_k1 <= 1: k1_0 = base_param_k1
128  * base_param_k1 > 1: reserved
129  */
131 
132  /**
133  * indicates k2_0 in the base parameter,
134  * base_param_k2 <= 1: k2_0 = base_param_k2
135  * base_param_k2 > 1: reserved
136  */
138 
139  /**
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
144  */
146 
147  /**
148  * This flag indicates that delta mode of base paramter(for value of 1)
149  */
151 
152  /**
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.
156  */
158 
159  /**
160  * indicates 3Spline_enable_flag in the base parameter,
161  * This flag indicates that transfer three Spline of base paramter(for value of 1)
162  */
164 
165  /**
166  * The number of three Spline. The value shall be in the range
167  * of 1 to 2, inclusive.
168  */
170 
171 #if FF_API_HDR_VIVID_THREE_SPLINE
172  /**
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
176  */
179 
180  /**
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
184  */
187 
188  /**
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
193  */
196 
197  /**
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
202  */
205 
206  /**
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
211  */
214 
215  /**
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
220  */
223 #endif
224 
227 
228 
229 /**
230  * Color transform parameters at a processing window in a dynamic metadata for
231  * CUVA 005.1:2021.
232  */
234  /**
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.
238  */
240 
241  /**
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.
245  */
247 
248  /**
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.
252  */
254 
255  /**
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.
259  */
261 
262  /**
263  * This flag indicates that the metadata for the tone mapping function in
264  * the processing window is present (for value of 1).
265  */
267 
268  /**
269  * The number of tone mapping param. The value shall be in the range
270  * of 1 to 2, inclusive.
271  */
273 
274  /**
275  * The color tone mapping parameters.
276  */
278 
279  /**
280  * This flag indicates that the metadata for the color saturation mapping in
281  * the processing window is present (for value of 1).
282  */
284 
285  /**
286  * The number of color saturation param. The value shall be in the range
287  * of 0 to 7, inclusive.
288  */
290 
291  /**
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.
295  */
298 
299 /**
300  * This struct represents dynamic metadata for color volume transform -
301  * CUVA 005.1:2021 standard
302  *
303  * To be used as payload of a AVFrameSideData or AVPacketSideData with the
304  * appropriate type.
305  *
306  * @note The struct should be allocated with
307  * av_dynamic_hdr_vivid_alloc() and its size is not a part of
308  * the public ABI.
309  */
310 typedef struct AVDynamicHDRVivid {
311  /**
312  * The system start code. The value shall be set to 0x01.
313  */
315 
316  /**
317  * The number of processing windows. The value shall be set to 0x01
318  * if the system_start_code is 0x01.
319  */
320  uint8_t num_windows;
321 
322  /**
323  * The color transform parameters for every processing window.
324  */
327 
328 /**
329  * Allocate an AVDynamicHDRVivid structure and set its fields to
330  * default values. The resulting struct can be freed using av_freep().
331  *
332  * @return An AVDynamicHDRVivid filled with default values or NULL
333  * on failure.
334  */
336 
337 /**
338  * Allocate a complete AVDynamicHDRVivid and add it to the frame.
339  * @param frame The frame which side data is added to.
340  *
341  * @return The AVDynamicHDRVivid structure to be filled by caller or NULL
342  * on failure.
343  */
345 
346 #endif /* AVUTIL_HDR_DYNAMIC_VIVID_METADATA_H */
AVHDRVividColorTransformParams::maximum_maxrgb
AVRational maximum_maxrgb
Indicates the maximum brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:260
AVHDRVividColorToneMappingParams::base_param_k2
int base_param_k2
indicates k2_0 in the base parameter, base_param_k2 <= 1: k2_0 = base_param_k2 base_param_k2 > 1: res...
Definition: hdr_dynamic_vivid_metadata.h:137
AVHDRVividColorToneMappingParams::base_param_Delta
AVRational base_param_Delta
base_param_Delta in the base parameter, in multiples of 1.0/127.
Definition: hdr_dynamic_vivid_metadata.h:157
AVHDRVividColorToneMappingParams::base_enable_flag
int base_enable_flag
This flag indicates that transfer the base paramter(for value of 1)
Definition: hdr_dynamic_vivid_metadata.h:88
AVHDRVividColorToneMappingParams::three_Spline_num
int three_Spline_num
The number of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:169
rational.h
AVHDRVividColorTransformParams::tone_mapping_param_num
int tone_mapping_param_num
The number of tone mapping param.
Definition: hdr_dynamic_vivid_metadata.h:272
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
AVHDRVividColorTransformParams::variance_maxrgb
AVRational variance_maxrgb
Indicates the variance brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:253
AVHDRVivid3SplineParams::enable_strength
AVRational enable_strength
3Spline_enable_Strength of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:70
AVHDRVividColorToneMappingParams::three_Spline_TH_mode
attribute_deprecated int three_Spline_TH_mode
The mode of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:178
AVHDRVivid3SplineParams::th_mode
int th_mode
The mode of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:35
AVHDRVividColorTransformParams::color_saturation_num
int color_saturation_num
The number of color saturation param.
Definition: hdr_dynamic_vivid_metadata.h:289
AVHDRVividColorToneMappingParams::three_Spline_enable_flag
int three_Spline_enable_flag
indicates 3Spline_enable_flag in the base parameter, This flag indicates that transfer three Spline o...
Definition: hdr_dynamic_vivid_metadata.h:163
AVHDRVividColorTransformParams::tm_params
AVHDRVividColorToneMappingParams tm_params[2]
The color tone mapping parameters.
Definition: hdr_dynamic_vivid_metadata.h:277
AVHDRVivid3SplineParams::th_delta1
AVRational th_delta1
3Spline_TH_Delta1 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:56
AVDynamicHDRVivid::num_windows
uint8_t num_windows
The number of processing windows.
Definition: hdr_dynamic_vivid_metadata.h:320
AVHDRVividColorToneMappingParams::three_Spline_TH_Delta1
attribute_deprecated AVRational three_Spline_TH_Delta1
3Spline_TH_Delta1 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:204
av_dynamic_hdr_vivid_alloc
AVDynamicHDRVivid * av_dynamic_hdr_vivid_alloc(size_t *size)
Allocate an AVDynamicHDRVivid structure and set its fields to default values.
Definition: hdr_dynamic_vivid_metadata.c:24
frame
static AVFrame * frame
Definition: demux_decode.c:54
AVHDRVividColorTransformParams::color_saturation_gain
AVRational color_saturation_gain[8]
Indicates the color correction strength parameter.
Definition: hdr_dynamic_vivid_metadata.h:296
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVHDRVividColorToneMappingParams::three_Spline_TH_enable_MB
attribute_deprecated AVRational three_Spline_TH_enable_MB
three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive and in multiples of 1....
Definition: hdr_dynamic_vivid_metadata.h:186
AVDynamicHDRVivid
This struct represents dynamic metadata for color volume transform - CUVA 005.1:2021 standard.
Definition: hdr_dynamic_vivid_metadata.h:310
AVHDRVividColorTransformParams::color_saturation_mapping_flag
int color_saturation_mapping_flag
This flag indicates that the metadata for the color saturation mapping in the processing window is pr...
Definition: hdr_dynamic_vivid_metadata.h:283
AVHDRVividColorTransformParams::tone_mapping_mode_flag
int tone_mapping_mode_flag
This flag indicates that the metadata for the tone mapping function in the processing window is prese...
Definition: hdr_dynamic_vivid_metadata.h:266
av_dynamic_hdr_vivid_create_side_data
AVDynamicHDRVivid * av_dynamic_hdr_vivid_create_side_data(AVFrame *frame)
Allocate a complete AVDynamicHDRVivid and add it to the frame.
Definition: hdr_dynamic_vivid_metadata.c:36
AVHDRVividColorToneMappingParams::three_Spline_TH_Delta2
attribute_deprecated AVRational three_Spline_TH_Delta2
3Spline_TH_Delta2 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:213
size
int size
Definition: twinvq_data.h:10344
AVHDRVividColorTransformParams::average_maxrgb
AVRational average_maxrgb
Indicates the average brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:246
AVHDRVividColorToneMappingParams::three_Spline_enable_Strength
attribute_deprecated AVRational three_Spline_enable_Strength
3Spline_enable_Strength of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:222
AVHDRVividColorToneMappingParams::three_Spline_TH_enable
attribute_deprecated AVRational three_Spline_TH_enable
3Spline_TH_enable of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:195
frame.h
attribute_deprecated
#define attribute_deprecated
Definition: attributes.h:104
AVHDRVividColorToneMappingParams::base_param_k1
int base_param_k1
indicates k1_0 in the base parameter, base_param_k1 <= 1: k1_0 = base_param_k1 base_param_k1 > 1: res...
Definition: hdr_dynamic_vivid_metadata.h:130
AVHDRVividColorToneMappingParams::targeted_system_display_maximum_luminance
AVRational targeted_system_display_maximum_luminance
The nominal maximum display luminance of the targeted system display, in multiples of 1....
Definition: hdr_dynamic_vivid_metadata.h:83
AVHDRVividColorTransformParams
Color transform parameters at a processing window in a dynamic metadata for CUVA 005....
Definition: hdr_dynamic_vivid_metadata.h:233
AVHDRVividColorToneMappingParams::base_param_Delta_enable_mode
int base_param_Delta_enable_mode
This flag indicates that delta mode of base paramter(for value of 1)
Definition: hdr_dynamic_vivid_metadata.h:150
AVHDRVivid3SplineParams
HDR Vivid three spline params.
Definition: hdr_dynamic_vivid_metadata.h:30
AVHDRVividColorTransformParams::minimum_maxrgb
AVRational minimum_maxrgb
Indicates the minimum brightness of the displayed content.
Definition: hdr_dynamic_vivid_metadata.h:239
AVHDRVividColorToneMappingParams::base_param_m_n
AVRational base_param_m_n
base_param_m_n in the base parameter, in multiples of 1.0/10.
Definition: hdr_dynamic_vivid_metadata.h:123
AVHDRVividColorToneMappingParams::base_param_m_a
AVRational base_param_m_a
base_param_m_a in the base parameter, in multiples of 1.0/1023.
Definition: hdr_dynamic_vivid_metadata.h:109
AVHDRVivid3SplineParams::th_enable
AVRational th_enable
3Spline_TH_enable of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:49
AVHDRVividColorToneMappingParams
Color tone mapping parameters at a processing window in a dynamic metadata for CUVA 005....
Definition: hdr_dynamic_vivid_metadata.h:77
AVDynamicHDRVivid::params
AVHDRVividColorTransformParams params[3]
The color transform parameters for every processing window.
Definition: hdr_dynamic_vivid_metadata.h:325
AVDynamicHDRVivid::system_start_code
uint8_t system_start_code
The system start code.
Definition: hdr_dynamic_vivid_metadata.h:314
AVHDRVividColorToneMappingParams::base_param_k3
int base_param_k3
indicates k3_0 in the base parameter, base_param_k3 == 1: k3_0 = base_param_k3 base_param_k3 == 2: k3...
Definition: hdr_dynamic_vivid_metadata.h:145
AVHDRVivid3SplineParams::th_delta2
AVRational th_delta2
3Spline_TH_Delta2 of three Spline.
Definition: hdr_dynamic_vivid_metadata.h:63
AVHDRVivid3SplineParams::th_enable_mb
AVRational th_enable_mb
three_Spline_TH_enable_MB is in the range of 0.0 to 1.0, inclusive and in multiples of 1....
Definition: hdr_dynamic_vivid_metadata.h:42
AVHDRVividColorToneMappingParams::three_spline
AVHDRVivid3SplineParams three_spline[2]
Definition: hdr_dynamic_vivid_metadata.h:225
AVHDRVividColorToneMappingParams::base_param_m_p
AVRational base_param_m_p
base_param_m_p in the base parameter, in multiples of 1.0/16383.
Definition: hdr_dynamic_vivid_metadata.h:95
AVHDRVividColorToneMappingParams::base_param_m_b
AVRational base_param_m_b
base_param_m_b in the base parameter, in multiples of 1/1023.
Definition: hdr_dynamic_vivid_metadata.h:116
AVHDRVividColorToneMappingParams::base_param_m_m
AVRational base_param_m_m
base_param_m_m in the base parameter, in multiples of 1.0/10.
Definition: hdr_dynamic_vivid_metadata.h:102