FFmpeg
Loading...
Searching...
No Matches
gain_map.h
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#ifndef AVUTIL_GAIN_MAP_H
20#define AVUTIL_GAIN_MAP_H
21
22#include <stddef.h>
23
24#include "rational.h"
25#include "frame.h"
26
27#define AV_ISO21496_VERSION 0
28#define AV_ISO21496_IDENTIFIER "urn:iso:std:iso:ts:21496:-1"
29
30/**
31 * Parameters describing how to combine a gain map rendition with its base
32 * rendition to recover the alternate rendition, as defined by
33 * ISO 21496-1:2025 "Digital photography - Gain map metadata for image
34 * conversion".
35 *
36 * Note: sizeof(AVGainMapParams) is not part of the ABI. New fields may be
37 * added at the end of the struct.
38 */
39typedef struct AVGainMapParams {
40 /**
41 * The version of this gain map struct. Reserved to allow future
42 * extensions of the struct. Must be <= AV_ISO21496_VERSION.
43 */
45
46 /**
47 * If non-zero, the gain map is applied in the colour space of the base
48 * rendition; otherwise in that of the alternate rendition.
49 */
51
52 /**
53 * log2 of the display headroom at which the base rendition is shown
54 * unmodified, and at which the map is applied in full.
55 */
58
60 /**
61 * log2-domain minimum and maximum gain applied by the map, i.e. the
62 * values the map's 0.0 and 1.0 endpoints decode to.
63 */
66
67 /**
68 * Encoding gamma of the stored map values. Must be > 0.
69 */
71
72 /**
73 * Small constants added before the log-domain math to avoid a
74 * singularity at zero.
75 */
78 } channels[3]; /* R, G, B */
79
80 /**
81 * Must be 1 or 3. If 1, all channels share the same set of parameters.
82 */
85
86/**
87 * Returns >= 0 if the given AVGainMapParams struct contains valid data;
88 * or a negative AVERROR otherwise.
89 */
91
92/**
93 * Returns 1 if all channels of the gain map have identical parameters,
94 * 0 otherwise.
95 */
97
98/**
99 * Allocate an AVGainMapParams structure and initialize it to default values.
100 * The resulting pointer must be freed using av_free().
101 *
102 * @param size if non-NULL, set to sizeof(AVGainMapParams)
103 * @return the newly allocated struct, or NULL on failure
104 */
106
107/**
108 * Allocate and add an AVGainMapParams structure to an existing AVFrameSideData
109 * array as AV_FRAME_DATA_GAIN_MAP_PARAMS side data.
110 *
111 * @return the newly allocated struct, or NULL on failure
112 */
114
115#endif /* AVUTIL_GAIN_MAP_H */
channels
Definition aptx.h:31
reference-counted frame API
int av_gain_map_params_validate(const AVGainMapParams *p)
Returns >= 0 if the given AVGainMapParams struct contains valid data; or a negative AVERROR otherwise...
Definition gain_map.c:46
AVGainMapParams * av_gain_map_params_alloc(size_t *size)
Allocate an AVGainMapParams structure and initialize it to default values.
Definition gain_map.c:84
AVGainMapParams * av_gain_map_params_create_side_data(AVFrameSideData ***sd, int *nb_sd)
Allocate and add an AVGainMapParams structure to an existing AVFrameSideData array as AV_FRAME_DATA_G...
Definition gain_map.c:98
int av_gain_map_channels_identical(const AVGainMapParams *p)
Returns 1 if all channels of the gain map have identical parameters, 0 otherwise.
Definition gain_map.c:75
Utilities for rational number calculation.
Structure to hold side data for an AVFrame.
Definition frame.h:334
AVRational gain_map_min
log2-domain minimum and maximum gain applied by the map, i.e.
Definition gain_map.h:64
AVRational base_offset
Small constants added before the log-domain math to avoid a singularity at zero.
Definition gain_map.h:76
AVRational gamma
Encoding gamma of the stored map values.
Definition gain_map.h:70
Parameters describing how to combine a gain map rendition with its base rendition to recover the alte...
Definition gain_map.h:39
AVRational alternate_hdr_headroom
Definition gain_map.h:57
int version
The version of this gain map struct.
Definition gain_map.h:44
int nb_channels
Must be 1 or 3.
Definition gain_map.h:83
int use_base_color_space
If non-zero, the gain map is applied in the colour space of the base rendition; otherwise in that of ...
Definition gain_map.h:50
AVRational base_hdr_headroom
log2 of the display headroom at which the base rendition is shown unmodified, and at which the map is...
Definition gain_map.h:56
Rational number (pair of numerator and denominator).
Definition rational.h:58
int size