Go to the documentation of this file.
43 *
size =
sizeof(*hdr_plus);
88 if (
s->num_windows < 1 ||
s->num_windows > 3) {
95 for (
int w = 1;
w <
s->num_windows;
w++) {
120 s->targeted_system_display_maximum_luminance =
122 s->targeted_system_display_actual_peak_luminance_flag =
get_bits1(gb);
124 if (
s->targeted_system_display_actual_peak_luminance_flag) {
130 if (((rows < 2) || (rows > 25)) || ((cols < 2) || (cols > 25))) {
133 s->num_rows_targeted_system_display_actual_peak_luminance = rows;
134 s->num_cols_targeted_system_display_actual_peak_luminance = cols;
139 for (
int i = 0;
i < rows;
i++) {
140 for (
int j = 0; j < cols; j++) {
141 s->targeted_system_display_actual_peak_luminance[
i][j] =
146 for (
int w = 0;
w <
s->num_windows;
w++) {
151 for (
int i = 0;
i < 3;
i++) {
176 s->mastering_display_actual_peak_luminance_flag =
get_bits1(gb);
177 if (
s->mastering_display_actual_peak_luminance_flag) {
183 if (((rows < 2) || (rows > 25)) || ((cols < 2) || (cols > 25))) {
186 s->num_rows_mastering_display_actual_peak_luminance = rows;
187 s->num_cols_mastering_display_actual_peak_luminance = cols;
192 for (
int i = 0;
i < rows;
i++) {
193 for (
int j = 0; j < cols; j++) {
194 s->mastering_display_actual_peak_luminance[
i][j] =
200 for (
int w = 0;
w <
s->num_windows;
w++) {
242 size_t size_bits, size_bytes;
268 for (
int w = 1;
w <
s->num_windows;
w++)
274 if (
s->targeted_system_display_actual_peak_luminance_flag)
276 s->num_rows_targeted_system_display_actual_peak_luminance *
277 s->num_cols_targeted_system_display_actual_peak_luminance * 4;
279 for (
int w = 0;
w <
s->num_windows;
w++)
280 size_bits += 72 +
s->params[
w].num_distribution_maxrgb_percentiles * 24 + 10;
283 if (
s->mastering_display_actual_peak_luminance_flag)
285 s->num_rows_mastering_display_actual_peak_luminance *
286 s->num_cols_mastering_display_actual_peak_luminance * 4;
288 for (
int w = 0;
w <
s->num_windows;
w++) {
290 if (
s->params[
w].tone_mapping_flag)
291 size_bits += 28 +
s->params[
w].num_bezier_curve_anchors * 10;
294 if (
s->params[
w].color_saturation_mapping_flag)
298 size_bytes = (size_bits + 7) / 8;
306 if (*
size < size_bytes)
323 for (
int w = 1;
w <
s->num_windows;
w++) {
324 put_bits(pb, 16,
s->params[
w].window_upper_left_corner_x.num /
s->params[
w].window_upper_left_corner_x.den);
325 put_bits(pb, 16,
s->params[
w].window_upper_left_corner_y.num /
s->params[
w].window_upper_left_corner_y.den);
326 put_bits(pb, 16,
s->params[
w].window_lower_right_corner_x.num /
s->params[
w].window_lower_right_corner_x.den);
327 put_bits(pb, 16,
s->params[
w].window_lower_right_corner_y.num /
s->params[
w].window_lower_right_corner_y.den);
328 put_bits(pb, 16,
s->params[
w].center_of_ellipse_x);
329 put_bits(pb, 16,
s->params[
w].center_of_ellipse_y);
331 put_bits(pb, 16,
s->params[
w].semimajor_axis_internal_ellipse);
332 put_bits(pb, 16,
s->params[
w].semimajor_axis_external_ellipse);
333 put_bits(pb, 16,
s->params[
w].semiminor_axis_external_ellipse);
334 put_bits(pb, 1,
s->params[
w].overlap_process_option);
338 s->targeted_system_display_maximum_luminance.den);
339 put_bits(pb, 1,
s->targeted_system_display_actual_peak_luminance_flag);
340 if (
s->targeted_system_display_actual_peak_luminance_flag) {
341 put_bits(pb, 5,
s->num_rows_targeted_system_display_actual_peak_luminance);
342 put_bits(pb, 5,
s->num_cols_targeted_system_display_actual_peak_luminance);
343 for (
int i = 0;
i <
s->num_rows_targeted_system_display_actual_peak_luminance;
i++) {
344 for (
int j = 0; j <
s->num_cols_targeted_system_display_actual_peak_luminance; j++)
346 s->targeted_system_display_actual_peak_luminance[
i][j].den);
350 for (
int w = 0;
w <
s->num_windows;
w++) {
351 for (
int i = 0;
i < 3;
i++)
353 put_bits(pb, 17,
s->params[
w].average_maxrgb.num *
rgb_den /
s->params[
w].average_maxrgb.den);
354 put_bits(pb, 4,
s->params[
w].num_distribution_maxrgb_percentiles);
355 for (
int i = 0;
i <
s->params[
w].num_distribution_maxrgb_percentiles;
i++) {
356 put_bits(pb, 7,
s->params[
w].distribution_maxrgb[
i].percentage);
358 s->params[
w].distribution_maxrgb[
i].percentile.den);
361 s->params[
w].fraction_bright_pixels.den);
364 put_bits(pb, 1,
s->mastering_display_actual_peak_luminance_flag);
365 if (
s->mastering_display_actual_peak_luminance_flag) {
366 put_bits(pb, 5,
s->num_rows_mastering_display_actual_peak_luminance);
367 put_bits(pb, 5,
s->num_cols_mastering_display_actual_peak_luminance);
368 for (
int i = 0;
i <
s->num_rows_mastering_display_actual_peak_luminance;
i++) {
369 for (
int j = 0; j <
s->num_cols_mastering_display_actual_peak_luminance; j++)
371 s->mastering_display_actual_peak_luminance[
i][j].den);
375 for (
int w = 0;
w <
s->num_windows;
w++) {
376 put_bits(pb, 1,
s->params[
w].tone_mapping_flag);
377 if (
s->params[
w].tone_mapping_flag) {
380 put_bits(pb, 4,
s->params[
w].num_bezier_curve_anchors);
381 for (
int i = 0;
i <
s->params[
w].num_bezier_curve_anchors;
i++)
383 s->params[
w].bezier_curve_anchors[
i].den);
384 put_bits(pb, 1,
s->params[
w].color_saturation_mapping_flag);
385 if (
s->params[
w].color_saturation_mapping_flag)
387 s->params[
w].color_saturation_weight.den);
static int get_bits_left(GetBitContext *gb)
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
AVFrameSideData * av_frame_new_side_data(AVFrame *frame, enum AVFrameSideDataType type, size_t size)
Add a new side data to a frame.
AVRational percentile
The linearized maxRGB value at a specific percentile in the processing window in the scene.
static unsigned int get_bits_long(GetBitContext *s, int n)
Read 0-32 bits.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
This structure describes decoded (raw) audio or video data.
static void put_bits(Jpeg2000EncoderContext *s, int val, int n)
put n times val bit
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
#define AVERROR_BUFFER_TOO_SMALL
Buffer too small.
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
uint8_t percentage
The percentage value corresponding to a specific percentile linearized RGB value in the processing wi...
Rational number (pair of numerator and denominator).
static unsigned int get_bits1(GetBitContext *s)
#define i(width, name, range_min, range_max)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
This struct represents dynamic metadata for color volume transform - application 4 of SMPTE 2094-40:2...
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
#define AV_INPUT_BUFFER_PADDING_SIZE
@ AV_FRAME_DATA_DYNAMIC_HDR_PLUS
HDR dynamic metadata associated with a video frame.
Structure to hold side data for an AVFrame.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.