FFmpeg
hdr_dynamic_metadata.c
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 #include "hdr_dynamic_metadata.h"
22 #include "mem.h"
23 #include "libavcodec/defs.h"
24 #include "libavcodec/get_bits.h"
25 #include "libavcodec/put_bits.h"
26 
27 #define T35_PAYLOAD_MAX_SIZE 907
28 
29 static const int64_t luminance_den = 1;
30 static const int32_t peak_luminance_den = 15;
31 static const int64_t rgb_den = 100000;
32 static const int32_t fraction_pixel_den = 1000;
33 static const int32_t knee_point_den = 4095;
34 static const int32_t bezier_anchor_den = 1023;
35 static const int32_t saturation_weight_den = 8;
36 
38 {
39  AVDynamicHDRPlus *hdr_plus = av_mallocz(sizeof(AVDynamicHDRPlus));
40  if (!hdr_plus)
41  return NULL;
42 
43  if (size)
44  *size = sizeof(*hdr_plus);
45 
46  return hdr_plus;
47 }
48 
50 {
53  sizeof(AVDynamicHDRPlus));
54  if (!side_data)
55  return NULL;
56 
57  memset(side_data->data, 0, sizeof(AVDynamicHDRPlus));
58 
59  return (AVDynamicHDRPlus *)side_data->data;
60 }
61 
63  size_t size)
64 {
66  GetBitContext gbc, *gb = &gbc;
67  int ret;
68 
69  if (!s)
70  return AVERROR(ENOMEM);
71 
73  return AVERROR(EINVAL);
74 
75  memcpy(padded_buf, data, size);
76  // Zero-initialize the buffer padding to avoid overreads into uninitialized data.
77  memset(padded_buf + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
78 
79  ret = init_get_bits8(gb, padded_buf, size);
80  if (ret < 0)
81  return ret;
82 
83  if (get_bits_left(gb) < 10)
84  return AVERROR_INVALIDDATA;
85 
86  s->application_version = get_bits(gb, 8);
87  s->num_windows = get_bits(gb, 2);
88 
89  if (s->num_windows < 1 || s->num_windows > 3) {
90  return AVERROR_INVALIDDATA;
91  }
92 
93  if (get_bits_left(gb) < ((19 * 8 + 1) * (s->num_windows - 1)))
94  return AVERROR_INVALIDDATA;
95 
96  for (int w = 1; w < s->num_windows; w++) {
97  // The corners are set to absolute coordinates here. They should be
98  // converted to the relative coordinates (in [0, 1]) in the decoder.
99  AVHDRPlusColorTransformParams *params = &s->params[w];
101  (AVRational){get_bits(gb, 16), 1};
103  (AVRational){get_bits(gb, 16), 1};
105  (AVRational){get_bits(gb, 16), 1};
107  (AVRational){get_bits(gb, 16), 1};
108 
109  params->center_of_ellipse_x = get_bits(gb, 16);
110  params->center_of_ellipse_y = get_bits(gb, 16);
111  params->rotation_angle = get_bits(gb, 8);
112  params->semimajor_axis_internal_ellipse = get_bits(gb, 16);
113  params->semimajor_axis_external_ellipse = get_bits(gb, 16);
114  params->semiminor_axis_external_ellipse = get_bits(gb, 16);
115  params->overlap_process_option = get_bits1(gb);
116  }
117 
118  if (get_bits_left(gb) < 28)
119  return AVERROR_INVALIDDATA;
120 
121  s->targeted_system_display_maximum_luminance =
123  s->targeted_system_display_actual_peak_luminance_flag = get_bits1(gb);
124 
125  if (s->targeted_system_display_actual_peak_luminance_flag) {
126  int rows, cols;
127  if (get_bits_left(gb) < 10)
128  return AVERROR_INVALIDDATA;
129  rows = get_bits(gb, 5);
130  cols = get_bits(gb, 5);
131  if (((rows < 2) || (rows > 25)) || ((cols < 2) || (cols > 25))) {
132  return AVERROR_INVALIDDATA;
133  }
134  s->num_rows_targeted_system_display_actual_peak_luminance = rows;
135  s->num_cols_targeted_system_display_actual_peak_luminance = cols;
136 
137  if (get_bits_left(gb) < (rows * cols * 4))
138  return AVERROR_INVALIDDATA;
139 
140  for (int i = 0; i < rows; i++) {
141  for (int j = 0; j < cols; j++) {
142  s->targeted_system_display_actual_peak_luminance[i][j] =
144  }
145  }
146  }
147  for (int w = 0; w < s->num_windows; w++) {
148  AVHDRPlusColorTransformParams *params = &s->params[w];
149  if (get_bits_left(gb) < (3 * 17 + 17 + 4))
150  return AVERROR_INVALIDDATA;
151 
152  for (int i = 0; i < 3; i++) {
153  params->maxscl[i] =
154  (AVRational){get_bits(gb, 17), rgb_den};
155  }
156  params->average_maxrgb =
157  (AVRational){get_bits(gb, 17), rgb_den};
159 
160  if (get_bits_left(gb) <
162  return AVERROR_INVALIDDATA;
163 
164  for (int i = 0; i < params->num_distribution_maxrgb_percentiles; i++) {
165  params->distribution_maxrgb[i].percentage = get_bits(gb, 7);
166  params->distribution_maxrgb[i].percentile =
167  (AVRational){get_bits(gb, 17), rgb_den};
168  }
169 
170  if (get_bits_left(gb) < 10)
171  return AVERROR_INVALIDDATA;
172 
174  }
175  if (get_bits_left(gb) < 1)
176  return AVERROR_INVALIDDATA;
177  s->mastering_display_actual_peak_luminance_flag = get_bits1(gb);
178  if (s->mastering_display_actual_peak_luminance_flag) {
179  int rows, cols;
180  if (get_bits_left(gb) < 10)
181  return AVERROR_INVALIDDATA;
182  rows = get_bits(gb, 5);
183  cols = get_bits(gb, 5);
184  if (((rows < 2) || (rows > 25)) || ((cols < 2) || (cols > 25))) {
185  return AVERROR_INVALIDDATA;
186  }
187  s->num_rows_mastering_display_actual_peak_luminance = rows;
188  s->num_cols_mastering_display_actual_peak_luminance = cols;
189 
190  if (get_bits_left(gb) < (rows * cols * 4))
191  return AVERROR_INVALIDDATA;
192 
193  for (int i = 0; i < rows; i++) {
194  for (int j = 0; j < cols; j++) {
195  s->mastering_display_actual_peak_luminance[i][j] =
197  }
198  }
199  }
200 
201  for (int w = 0; w < s->num_windows; w++) {
202  AVHDRPlusColorTransformParams *params = &s->params[w];
203  if (get_bits_left(gb) < 1)
204  return AVERROR_INVALIDDATA;
205 
206  params->tone_mapping_flag = get_bits1(gb);
207  if (params->tone_mapping_flag) {
208  if (get_bits_left(gb) < 28)
209  return AVERROR_INVALIDDATA;
210 
211  params->knee_point_x =
212  (AVRational){get_bits(gb, 12), knee_point_den};
213  params->knee_point_y =
214  (AVRational){get_bits(gb, 12), knee_point_den};
215  params->num_bezier_curve_anchors = get_bits(gb, 4);
216 
217  if (get_bits_left(gb) < (params->num_bezier_curve_anchors * 10))
218  return AVERROR_INVALIDDATA;
219 
220  for (int i = 0; i < params->num_bezier_curve_anchors; i++) {
221  params->bezier_curve_anchors[i] =
223  }
224  }
225 
226  if (get_bits_left(gb) < 1)
227  return AVERROR_INVALIDDATA;
229  if (params->color_saturation_mapping_flag) {
230  if (get_bits_left(gb) < 6)
231  return AVERROR_INVALIDDATA;
232  params->color_saturation_weight =
234  }
235  }
236 
237  return 0;
238 }
239 
240 int av_dynamic_hdr_plus_to_t35(const AVDynamicHDRPlus *s, uint8_t **data, size_t *size)
241 {
242  uint8_t *buf;
243  size_t size_bits, size_bytes;
244  PutBitContext pbc, *pb = &pbc;
245 
246  if (!s || !data)
247  return AVERROR(EINVAL);
248 
249  /**
250  * Buffer size per CTA-861-H p.253-254:
251  * 48 header bits (excluded from the serialized payload)
252  * 8 bits for application_mode
253  * 2 bits for num_windows
254  * 153 bits for window geometry, for each window above 1
255  * 27 bits for targeted_system_display_maximum_luminance
256  * 1-2511 bits for targeted system display peak luminance information
257  * 82-442 bits per window for pixel distribution information
258  * 1-2511 bits for mastering display peak luminance information
259  * 1-179 bits per window for tonemapping information
260  * 1-7 bits per window for color saturation mapping information
261  * Total: 123-7249 bits, excluding trimmed header bits
262  */
263  size_bits = 8;
264 
265  size_bits += 2;
266 
267  for (int w = 1; w < s->num_windows; w++)
268  size_bits += 153;
269 
270  size_bits += 27;
271 
272  size_bits += 1;
273  if (s->targeted_system_display_actual_peak_luminance_flag)
274  size_bits += 10 +
275  s->num_rows_targeted_system_display_actual_peak_luminance *
276  s->num_cols_targeted_system_display_actual_peak_luminance * 4;
277 
278  for (int w = 0; w < s->num_windows; w++)
279  size_bits += 72 + s->params[w].num_distribution_maxrgb_percentiles * 24 + 10;
280 
281  size_bits += 1;
282  if (s->mastering_display_actual_peak_luminance_flag)
283  size_bits += 10 +
284  s->num_rows_mastering_display_actual_peak_luminance *
285  s->num_cols_mastering_display_actual_peak_luminance * 4;
286 
287  for (int w = 0; w < s->num_windows; w++) {
288  size_bits += 1;
289  if (s->params[w].tone_mapping_flag)
290  size_bits += 28 + s->params[w].num_bezier_curve_anchors * 10;
291 
292  size_bits += 1;
293  if (s->params[w].color_saturation_mapping_flag)
294  size_bits += 6;
295  }
296 
297  size_bytes = (size_bits + 7) / 8;
298 
299  buf = av_mallocz(size_bytes);
300  if (!buf)
301  return AVERROR(ENOMEM);
302 
303  init_put_bits(pb, buf, size_bytes);
304 
305  // application_mode is set to Application Version 1
306  put_bits(pb, 8, 1);
307 
308  // Payload as per CTA-861-H p.253-254
309  put_bits(pb, 2, s->num_windows);
310 
311  for (int w = 1; w < s->num_windows; w++) {
312  put_bits(pb, 16, s->params[w].window_upper_left_corner_x.num / s->params[w].window_upper_left_corner_x.den);
313  put_bits(pb, 16, s->params[w].window_upper_left_corner_y.num / s->params[w].window_upper_left_corner_y.den);
314  put_bits(pb, 16, s->params[w].window_lower_right_corner_x.num / s->params[w].window_lower_right_corner_x.den);
315  put_bits(pb, 16, s->params[w].window_lower_right_corner_y.num / s->params[w].window_lower_right_corner_y.den);
316  put_bits(pb, 16, s->params[w].center_of_ellipse_x);
317  put_bits(pb, 16, s->params[w].center_of_ellipse_y);
318  put_bits(pb, 8, s->params[w].rotation_angle);
319  put_bits(pb, 16, s->params[w].semimajor_axis_internal_ellipse);
320  put_bits(pb, 16, s->params[w].semimajor_axis_external_ellipse);
321  put_bits(pb, 16, s->params[w].semiminor_axis_external_ellipse);
322  put_bits(pb, 1, s->params[w].overlap_process_option);
323  }
324 
325  put_bits(pb, 27, s->targeted_system_display_maximum_luminance.num * luminance_den /
326  s->targeted_system_display_maximum_luminance.den);
327  put_bits(pb, 1, s->targeted_system_display_actual_peak_luminance_flag);
328  if (s->targeted_system_display_actual_peak_luminance_flag) {
329  put_bits(pb, 5, s->num_rows_targeted_system_display_actual_peak_luminance);
330  put_bits(pb, 5, s->num_cols_targeted_system_display_actual_peak_luminance);
331  for (int i = 0; i < s->num_rows_targeted_system_display_actual_peak_luminance; i++) {
332  for (int j = 0; j < s->num_cols_targeted_system_display_actual_peak_luminance; j++)
333  put_bits(pb, 4, s->targeted_system_display_actual_peak_luminance[i][j].num * peak_luminance_den /
334  s->targeted_system_display_actual_peak_luminance[i][j].den);
335  }
336  }
337 
338  for (int w = 0; w < s->num_windows; w++) {
339  for (int i = 0; i < 3; i++)
340  put_bits(pb, 17, s->params[w].maxscl[i].num * rgb_den / s->params[w].maxscl[i].den);
341  put_bits(pb, 17, s->params[w].average_maxrgb.num * rgb_den / s->params[w].average_maxrgb.den);
342  put_bits(pb, 4, s->params[w].num_distribution_maxrgb_percentiles);
343  for (int i = 0; i < s->params[w].num_distribution_maxrgb_percentiles; i++) {
344  put_bits(pb, 7, s->params[w].distribution_maxrgb[i].percentage);
345  put_bits(pb, 17, s->params[w].distribution_maxrgb[i].percentile.num * rgb_den /
346  s->params[w].distribution_maxrgb[i].percentile.den);
347  }
348  put_bits(pb, 10, s->params[w].fraction_bright_pixels.num * fraction_pixel_den /
349  s->params[w].fraction_bright_pixels.den);
350  }
351 
352  put_bits(pb, 1, s->mastering_display_actual_peak_luminance_flag);
353  if (s->mastering_display_actual_peak_luminance_flag) {
354  put_bits(pb, 5, s->num_rows_mastering_display_actual_peak_luminance);
355  put_bits(pb, 5, s->num_cols_mastering_display_actual_peak_luminance);
356  for (int i = 0; i < s->num_rows_mastering_display_actual_peak_luminance; i++) {
357  for (int j = 0; j < s->num_cols_mastering_display_actual_peak_luminance; j++)
358  put_bits(pb, 4, s->mastering_display_actual_peak_luminance[i][j].num * peak_luminance_den /
359  s->mastering_display_actual_peak_luminance[i][j].den);
360  }
361  }
362 
363  for (int w = 0; w < s->num_windows; w++) {
364  put_bits(pb, 1, s->params[w].tone_mapping_flag);
365  if (s->params[w].tone_mapping_flag) {
366  put_bits(pb, 12, s->params[w].knee_point_x.num * knee_point_den / s->params[w].knee_point_x.den);
367  put_bits(pb, 12, s->params[w].knee_point_y.num * knee_point_den / s->params[w].knee_point_y.den);
368  put_bits(pb, 4, s->params[w].num_bezier_curve_anchors);
369  for (int i = 0; i < s->params[w].num_bezier_curve_anchors; i++)
370  put_bits(pb, 10, s->params[w].bezier_curve_anchors[i].num * bezier_anchor_den /
371  s->params[w].bezier_curve_anchors[i].den);
372  put_bits(pb, 1, s->params[w].color_saturation_mapping_flag);
373  if (s->params[w].color_saturation_mapping_flag)
374  put_bits(pb, 6, s->params[w].color_saturation_weight.num * saturation_weight_den /
375  s->params[w].color_saturation_weight.den);
376  }
377  }
378 
379  flush_put_bits(pb);
380 
381  *data = buf;
382  if (size)
383  *size = size_bytes;
384  return 0;
385 }
AVHDRPlusColorTransformParams::average_maxrgb
AVRational average_maxrgb
The average of linearized maxRGB values in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:164
get_bits_left
static int get_bits_left(GetBitContext *gb)
Definition: get_bits.h:664
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
T35_PAYLOAD_MAX_SIZE
#define T35_PAYLOAD_MAX_SIZE
Copyright (c) 2018 Mohammad Izadi <moh.izadi at gmail.com>
Definition: hdr_dynamic_metadata.c:27
AVHDRPlusColorTransformParams::rotation_angle
uint8_t rotation_angle
The clockwise rotation angle in degree of arc with respect to the positive direction of the x-axis of...
Definition: hdr_dynamic_metadata.h:118
av_frame_new_side_data
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
Definition: frame.c:674
AVHDRPlusPercentile::percentile
AVRational percentile
The linearized maxRGB value at a specific percentile in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:52
get_bits_long
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
Definition: get_bits.h:411
init_put_bits
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
Definition: put_bits.h:62
AVHDRPlusColorTransformParams::semimajor_axis_external_ellipse
uint16_t semimajor_axis_external_ellipse
The semi-major axis value of the external ellipse of the elliptical pixel selector in amount of pixel...
Definition: hdr_dynamic_metadata.h:134
AVHDRPlusColorTransformParams
Color transform parameters at a processing window in a dynamic metadata for SMPTE 2094-40.
Definition: hdr_dynamic_metadata.h:59
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:330
put_bits
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
Definition: j2kenc.c:221
w
uint8_t w
Definition: llviddspenc.c:38
av_dynamic_hdr_plus_to_t35
int av_dynamic_hdr_plus_to_t35(const AVDynamicHDRPlus *s, uint8_t **data, size_t *size)
Serialize dynamic HDR10+ metadata to a user data registered ITU-T T.35 buffer, excluding the first 48...
Definition: hdr_dynamic_metadata.c:240
data
const char data[16]
Definition: mxf.c:146
AVHDRPlusColorTransformParams::tone_mapping_flag
uint8_t tone_mapping_flag
This flag indicates that the metadata for the tone mapping function in the processing window is prese...
Definition: hdr_dynamic_metadata.h:189
luminance_den
static const int64_t luminance_den
Definition: hdr_dynamic_metadata.c:29
AVHDRPlusColorTransformParams::distribution_maxrgb
AVHDRPlusPercentile distribution_maxrgb[15]
The linearized maxRGB values at given percentiles in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:176
AVHDRPlusColorTransformParams::knee_point_x
AVRational knee_point_x
The x coordinate of the separation point between the linear part and the curved part of the tone mapp...
Definition: hdr_dynamic_metadata.h:196
get_bits
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:325
AVHDRPlusColorTransformParams::color_saturation_mapping_flag
uint8_t color_saturation_mapping_flag
This flag shall be equal to 0 in bitstreams conforming to this version of this Specification.
Definition: hdr_dynamic_metadata.h:222
AVHDRPlusColorTransformParams::center_of_ellipse_x
uint16_t center_of_ellipse_x
The x coordinate of the center position of the concentric internal and external ellipses of the ellip...
Definition: hdr_dynamic_metadata.h:102
GetBitContext
Definition: get_bits.h:107
AVHDRPlusColorTransformParams::knee_point_y
AVRational knee_point_y
The y coordinate of the separation point between the linear part and the curved part of the tone mapp...
Definition: hdr_dynamic_metadata.h:203
AVHDRPlusColorTransformParams::num_bezier_curve_anchors
uint8_t num_bezier_curve_anchors
The number of the intermediate anchor parameters of the tone mapping function in the processing windo...
Definition: hdr_dynamic_metadata.h:209
init_get_bits8
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:524
s
#define s(width, name)
Definition: cbs_vp9.c:256
AVHDRPlusColorTransformParams::semiminor_axis_external_ellipse
uint16_t semiminor_axis_external_ellipse
The semi-minor axis value of the external ellipse of the elliptical pixel selector in amount of pixel...
Definition: hdr_dynamic_metadata.h:141
AVHDRPlusColorTransformParams::window_upper_left_corner_y
AVRational window_upper_left_corner_y
The relative y coordinate of the top left pixel of the processing window.
Definition: hdr_dynamic_metadata.h:76
AVHDRPlusColorTransformParams::window_lower_right_corner_x
AVRational window_lower_right_corner_x
The relative x coordinate of the bottom right pixel of the processing window.
Definition: hdr_dynamic_metadata.h:85
get_bits.h
PutBitContext
Definition: put_bits.h:50
AVHDRPlusPercentile::percentage
uint8_t percentage
The percentage value corresponding to a specific percentile linearized RGB value in the processing wi...
Definition: hdr_dynamic_metadata.h:45
if
if(ret)
Definition: filter_design.txt:179
NULL
#define NULL
Definition: coverity.c:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
get_bits1
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:378
AVHDRPlusColorTransformParams::fraction_bright_pixels
AVRational fraction_bright_pixels
The fraction of selected pixels in the image that contains the brightest pixel in the scene.
Definition: hdr_dynamic_metadata.h:183
AVHDRPlusColorTransformParams::color_saturation_weight
AVRational color_saturation_weight
The color saturation gain in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:229
size
int size
Definition: twinvq_data.h:10344
AVFrameSideData::data
uint8_t * data
Definition: frame.h:238
AVHDRPlusColorTransformParams::window_lower_right_corner_y
AVRational window_lower_right_corner_y
The relative y coordinate of the bottom right pixel of the processing window.
Definition: hdr_dynamic_metadata.h:94
AVHDRPlusColorTransformParams::window_upper_left_corner_x
AVRational window_upper_left_corner_x
The relative x coordinate of the top left pixel of the processing window.
Definition: hdr_dynamic_metadata.h:67
AVHDRPlusColorTransformParams::semimajor_axis_internal_ellipse
uint16_t semimajor_axis_internal_ellipse
The semi-major axis value of the internal ellipse of the elliptical pixel selector in amount of pixel...
Definition: hdr_dynamic_metadata.h:125
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
fraction_pixel_den
static const int32_t fraction_pixel_den
Definition: hdr_dynamic_metadata.c:32
AVHDRPlusColorTransformParams::overlap_process_option
enum AVHDRPlusOverlapProcessOption overlap_process_option
Overlap process option indicates one of the two methods of combining rendered pixels in the processin...
Definition: hdr_dynamic_metadata.h:149
av_mallocz
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:254
AVDynamicHDRPlus
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
Definition: hdr_dynamic_metadata.h:243
av_dynamic_hdr_plus_create_side_data
AVDynamicHDRPlus * av_dynamic_hdr_plus_create_side_data(AVFrame *frame)
Allocate a complete AVDynamicHDRPlus and add it to the frame.
Definition: hdr_dynamic_metadata.c:49
ret
ret
Definition: filter_design.txt:187
frame
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
Definition: filter_design.txt:264
knee_point_den
static const int32_t knee_point_den
Definition: hdr_dynamic_metadata.c:33
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
AV_FRAME_DATA_DYNAMIC_HDR_PLUS
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
Definition: frame.h:159
defs.h
peak_luminance_den
static const int32_t peak_luminance_den
Definition: hdr_dynamic_metadata.c:30
AVHDRPlusColorTransformParams::num_distribution_maxrgb_percentiles
uint8_t num_distribution_maxrgb_percentiles
The number of linearized maxRGB values at given percentiles in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:170
AVHDRPlusColorTransformParams::maxscl
AVRational maxscl[3]
The maximum of the color components of linearized RGB values in the processing window in the scene.
Definition: hdr_dynamic_metadata.h:157
hdr_dynamic_metadata.h
AVHDRPlusColorTransformParams::center_of_ellipse_y
uint16_t center_of_ellipse_y
The y coordinate of the center position of the concentric internal and external ellipses of the ellip...
Definition: hdr_dynamic_metadata.h:110
mem.h
AVFrameSideData
Structure to hold side data for an AVFrame.
Definition: frame.h:236
flush_put_bits
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
Definition: put_bits.h:143
rgb_den
static const int64_t rgb_den
Definition: hdr_dynamic_metadata.c:31
av_dynamic_hdr_plus_alloc
AVDynamicHDRPlus * av_dynamic_hdr_plus_alloc(size_t *size)
Allocate an AVDynamicHDRPlus structure and set its fields to default values.
Definition: hdr_dynamic_metadata.c:37
av_dynamic_hdr_plus_from_t35
int av_dynamic_hdr_plus_from_t35(AVDynamicHDRPlus *s, const uint8_t *data, size_t size)
Parse the user data registered ITU-T T.35 to AVbuffer (AVDynamicHDRPlus).
Definition: hdr_dynamic_metadata.c:62
int32_t
int32_t
Definition: audioconvert.c:56
bezier_anchor_den
static const int32_t bezier_anchor_den
Definition: hdr_dynamic_metadata.c:34
saturation_weight_den
static const int32_t saturation_weight_den
Definition: hdr_dynamic_metadata.c:35
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
put_bits.h
AVHDRPlusColorTransformParams::bezier_curve_anchors
AVRational bezier_curve_anchors[15]
The intermediate anchor parameters of the tone mapping function in the processing window in the scene...
Definition: hdr_dynamic_metadata.h:216