FFmpeg
hdr_dynamic_metadata.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Mohammad Izadi <moh.izadi 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_METADATA_H
22 #define AVUTIL_HDR_DYNAMIC_METADATA_H
23 
24 #include "frame.h"
25 #include "rational.h"
26 
27 /**
28  * Option for overlapping elliptical pixel selectors in an image.
29  */
33 };
34 
35 /**
36  * Represents the percentile at a specific percentage in
37  * a distribution.
38  */
39 typedef struct AVHDRPlusPercentile {
40  /**
41  * The percentage value corresponding to a specific percentile linearized
42  * RGB value in the processing window in the scene. The value shall be in
43  * the range of 0 to100, inclusive.
44  */
46 
47  /**
48  * The linearized maxRGB value at a specific percentile in the processing
49  * window in the scene. The value shall be in the range of 0 to 1, inclusive
50  * and in multiples of 0.00001.
51  */
54 
55 /**
56  * Color transform parameters at a processing window in a dynamic metadata for
57  * SMPTE 2094-40.
58  */
60  /**
61  * The relative x coordinate of the top left pixel of the processing
62  * window. The value shall be in the range of 0 and 1, inclusive and
63  * in multiples of 1/(width of Picture - 1). The value 1 corresponds
64  * to the absolute coordinate of width of Picture - 1. The value for
65  * first processing window shall be 0.
66  */
68 
69  /**
70  * The relative y coordinate of the top left pixel of the processing
71  * window. The value shall be in the range of 0 and 1, inclusive and
72  * in multiples of 1/(height of Picture - 1). The value 1 corresponds
73  * to the absolute coordinate of height of Picture - 1. The value for
74  * first processing window shall be 0.
75  */
77 
78  /**
79  * The relative x coordinate of the bottom right pixel of the processing
80  * window. The value shall be in the range of 0 and 1, inclusive and
81  * in multiples of 1/(width of Picture - 1). The value 1 corresponds
82  * to the absolute coordinate of width of Picture - 1. The value for
83  * first processing window shall be 1.
84  */
86 
87  /**
88  * The relative y coordinate of the bottom right pixel of the processing
89  * window. The value shall be in the range of 0 and 1, inclusive and
90  * in multiples of 1/(height of Picture - 1). The value 1 corresponds
91  * to the absolute coordinate of height of Picture - 1. The value for
92  * first processing window shall be 1.
93  */
95 
96  /**
97  * The x coordinate of the center position of the concentric internal and
98  * external ellipses of the elliptical pixel selector in the processing
99  * window. The value shall be in the range of 0 to (width of Picture - 1),
100  * inclusive and in multiples of 1 pixel.
101  */
103 
104  /**
105  * The y coordinate of the center position of the concentric internal and
106  * external ellipses of the elliptical pixel selector in the processing
107  * window. The value shall be in the range of 0 to (height of Picture - 1),
108  * inclusive and in multiples of 1 pixel.
109  */
111 
112  /**
113  * The clockwise rotation angle in degree of arc with respect to the
114  * positive direction of the x-axis of the concentric internal and external
115  * ellipses of the elliptical pixel selector in the processing window. The
116  * value shall be in the range of 0 to 180, inclusive and in multiples of 1.
117  */
119 
120  /**
121  * The semi-major axis value of the internal ellipse of the elliptical pixel
122  * selector in amount of pixels in the processing window. The value shall be
123  * in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
124  */
126 
127  /**
128  * The semi-major axis value of the external ellipse of the elliptical pixel
129  * selector in amount of pixels in the processing window. The value
130  * shall not be less than semimajor_axis_internal_ellipse of the current
131  * processing window. The value shall be in the range of 1 to 65535,
132  * inclusive and in multiples of 1 pixel.
133  */
135 
136  /**
137  * The semi-minor axis value of the external ellipse of the elliptical pixel
138  * selector in amount of pixels in the processing window. The value shall be
139  * in the range of 1 to 65535, inclusive and in multiples of 1 pixel.
140  */
142 
143  /**
144  * Overlap process option indicates one of the two methods of combining
145  * rendered pixels in the processing window in an image with at least one
146  * elliptical pixel selector. For overlapping elliptical pixel selectors
147  * in an image, overlap_process_option shall have the same value.
148  */
149  enum AVHDRPlusOverlapProcessOption overlap_process_option;
150 
151  /**
152  * The maximum of the color components of linearized RGB values in the
153  * processing window in the scene. The values should be in the range of 0 to
154  * 1, inclusive and in multiples of 0.00001. maxscl[ 0 ], maxscl[ 1 ], and
155  * maxscl[ 2 ] are corresponding to R, G, B color components respectively.
156  */
157  AVRational maxscl[3];
158 
159  /**
160  * The average of linearized maxRGB values in the processing window in the
161  * scene. The value should be in the range of 0 to 1, inclusive and in
162  * multiples of 0.00001.
163  */
165 
166  /**
167  * The number of linearized maxRGB values at given percentiles in the
168  * processing window in the scene. The maximum value shall be 15.
169  */
171 
172  /**
173  * The linearized maxRGB values at given percentiles in the
174  * processing window in the scene.
175  */
176  AVHDRPlusPercentile distribution_maxrgb[15];
177 
178  /**
179  * The fraction of selected pixels in the image that contains the brightest
180  * pixel in the scene. The value shall be in the range of 0 to 1, inclusive
181  * and in multiples of 0.001.
182  */
184 
185  /**
186  * This flag indicates that the metadata for the tone mapping function in
187  * the processing window is present (for value of 1).
188  */
190 
191  /**
192  * The x coordinate of the separation point between the linear part and the
193  * curved part of the tone mapping function. The value shall be in the range
194  * of 0 to 1, excluding 0 and in multiples of 1/4095.
195  */
197 
198  /**
199  * The y coordinate of the separation point between the linear part and the
200  * curved part of the tone mapping function. The value shall be in the range
201  * of 0 to 1, excluding 0 and in multiples of 1/4095.
202  */
204 
205  /**
206  * The number of the intermediate anchor parameters of the tone mapping
207  * function in the processing window. The maximum value shall be 15.
208  */
210 
211  /**
212  * The intermediate anchor parameters of the tone mapping function in the
213  * processing window in the scene. The values should be in the range of 0
214  * to 1, inclusive and in multiples of 1/1023.
215  */
216  AVRational bezier_curve_anchors[15];
217 
218  /**
219  * This flag shall be equal to 0 in bitstreams conforming to this version of
220  * this Specification. Other values are reserved for future use.
221  */
223 
224  /**
225  * The color saturation gain in the processing window in the scene. The
226  * value shall be in the range of 0 to 63/8, inclusive and in multiples of
227  * 1/8. The default value shall be 1.
228  */
231 
232 /**
233  * This struct represents dynamic metadata for color volume transform -
234  * application 4 of SMPTE 2094-40:2016 standard.
235  *
236  * To be used as payload of a AVFrameSideData or AVPacketSideData with the
237  * appropriate type.
238  *
239  * @note The struct should be allocated with
240  * av_dynamic_hdr_plus_alloc() and its size is not a part of
241  * the public ABI.
242  */
243 typedef struct AVDynamicHDRPlus {
244  /**
245  * Country code by Rec. ITU-T T.35 Annex A. The value shall be 0xB5.
246  */
248 
249  /**
250  * Application version in the application defining document in ST-2094
251  * suite. The value shall be set to 0.
252  */
254 
255  /**
256  * The number of processing windows. The value shall be in the range
257  * of 1 to 3, inclusive.
258  */
260 
261  /**
262  * The color transform parameters for every processing window.
263  */
265 
266  /**
267  * The nominal maximum display luminance of the targeted system display,
268  * in units of 0.0001 candelas per square metre. The value shall be in
269  * the range of 0 to 10000, inclusive.
270  */
272 
273  /**
274  * This flag shall be equal to 0 in bit streams conforming to this version
275  * of this Specification. The value 1 is reserved for future use.
276  */
278 
279  /**
280  * The number of rows in the targeted system_display_actual_peak_luminance
281  * array. The value shall be in the range of 2 to 25, inclusive.
282  */
284 
285  /**
286  * The number of columns in the
287  * targeted_system_display_actual_peak_luminance array. The value shall be
288  * in the range of 2 to 25, inclusive.
289  */
291 
292  /**
293  * The normalized actual peak luminance of the targeted system display. The
294  * values should be in the range of 0 to 1, inclusive and in multiples of
295  * 1/15.
296  */
297  AVRational targeted_system_display_actual_peak_luminance[25][25];
298 
299  /**
300  * This flag shall be equal to 0 in bitstreams conforming to this version of
301  * this Specification. The value 1 is reserved for future use.
302  */
304 
305  /**
306  * The number of rows in the mastering_display_actual_peak_luminance array.
307  * The value shall be in the range of 2 to 25, inclusive.
308  */
310 
311  /**
312  * The number of columns in the mastering_display_actual_peak_luminance
313  * array. The value shall be in the range of 2 to 25, inclusive.
314  */
316 
317  /**
318  * The normalized actual peak luminance of the mastering display used for
319  * mastering the image essence. The values should be in the range of 0 to 1,
320  * inclusive and in multiples of 1/15.
321  */
322  AVRational mastering_display_actual_peak_luminance[25][25];
324 
325 /**
326  * Allocate an AVDynamicHDRPlus structure and set its fields to
327  * default values. The resulting struct can be freed using av_freep().
328  *
329  * @return An AVDynamicHDRPlus filled with default values or NULL
330  * on failure.
331  */
333 
334 /**
335  * Allocate a complete AVDynamicHDRPlus and add it to the frame.
336  * @param frame The frame which side data is added to.
337  *
338  * @return The AVDynamicHDRPlus structure to be filled by caller or NULL
339  * on failure.
340  */
342 
343 #endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */
uint8_t itu_t_t35_country_code
Country code by Rec.
uint8_t color_saturation_mapping_flag
This flag shall be equal to 0 in bitstreams conforming to this version of this Specification.
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
uint8_t tone_mapping_flag
This flag indicates that the metadata for the tone mapping function in the processing window is prese...
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
AVRational window_lower_right_corner_y
The relative y coordinate of the bottom right pixel of the processing window.
uint8_t num_bezier_curve_anchors
The number of the intermediate anchor parameters of the tone mapping function in the processing windo...
uint16_t semiminor_axis_external_ellipse
The semi-minor axis value of the external ellipse of the elliptical pixel selector in amount of pixel...
AVHDRPlusOverlapProcessOption
Option for overlapping elliptical pixel selectors in an image.
AVRational window_upper_left_corner_x
The relative x coordinate of the top left pixel of the processing window.
AVRational targeted_system_display_maximum_luminance
The nominal maximum display luminance of the targeted system display, in units of 0...
AVRational knee_point_x
The x coordinate of the separation point between the linear part and the curved part of the tone mapp...
uint8_t mastering_display_actual_peak_luminance_flag
This flag shall be equal to 0 in bitstreams conforming to this version of this Specification.
uint8_t
AVRational knee_point_y
The y coordinate of the separation point between the linear part and the curved part of the tone mapp...
uint8_t num_cols_targeted_system_display_actual_peak_luminance
The number of columns in the targeted_system_display_actual_peak_luminance array. ...
uint8_t application_version
Application version in the application defining document in ST-2094 suite.
Represents the percentile at a specific percentage in a distribution.
ptrdiff_t size
Definition: opengl_enc.c:100
AVRational fraction_bright_pixels
The fraction of selected pixels in the image that contains the brightest pixel in the scene...
uint8_t percentage
The percentage value corresponding to a specific percentile linearized RGB value in the processing wi...
uint8_t num_rows_mastering_display_actual_peak_luminance
The number of rows in the mastering_display_actual_peak_luminance array.
uint16_t semimajor_axis_external_ellipse
The semi-major axis value of the external ellipse of the elliptical pixel selector in amount of pixel...
AVDynamicHDRPlus * av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
Allocate a complete AVDynamicHDRPlus and add it to the frame.
GLenum GLint * params
Definition: opengl_enc.c:113
AVDynamicHDRPlus * av_dynamic_hdr_plus_alloc(size_t *size)
Allocate an AVDynamicHDRPlus structure and set its fields to default values.
reference-counted frame API
AVRational window_lower_right_corner_x
The relative x coordinate of the bottom right pixel of the processing window.
AVRational window_upper_left_corner_y
The relative y coordinate of the top left pixel of the processing window.
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
AVRational color_saturation_weight
The color saturation gain in the processing window in the scene.
uint8_t num_distribution_maxrgb_percentiles
The number of linearized maxRGB values at given percentiles in the processing window in the scene...
uint16_t center_of_ellipse_x
The x coordinate of the center position of the concentric internal and external ellipses of the ellip...
Rational number (pair of numerator and denominator).
Definition: rational.h:58
uint16_t center_of_ellipse_y
The y coordinate of the center position of the concentric internal and external ellipses of the ellip...
uint8_t num_windows
The number of processing windows.
AVRational average_maxrgb
The average of linearized maxRGB values in the processing window in the scene.
uint8_t num_rows_targeted_system_display_actual_peak_luminance
The number of rows in the targeted system_display_actual_peak_luminance array.
Utilties for rational number calculation.
AVRational percentile
The linearized maxRGB value at a specific percentile in the processing window in the scene...
uint8_t targeted_system_display_actual_peak_luminance_flag
This flag shall be equal to 0 in bit streams conforming to this version of this Specification.
Color transform parameters at a processing window in a dynamic metadata for SMPTE 2094-40...
uint8_t num_cols_mastering_display_actual_peak_luminance
The number of columns in the mastering_display_actual_peak_luminance array.
uint8_t rotation_angle
The clockwise rotation angle in degree of arc with respect to the positive direction of the x-axis of...
uint16_t semimajor_axis_internal_ellipse
The semi-major axis value of the internal ellipse of the elliptical pixel selector in amount of pixel...