25 .base_hdr_headroom = { 0, 1 },
26 .alternate_hdr_headroom = { 0, 1 },
31 for (
int c = 0;
c < 3;
c++) {
32 p->channels[
c] = (
struct AVGainMapChannel) {
33 .gain_map_min = { 0, 1 },
34 .gain_map_max = { 0, 1 },
36 .base_offset = { 1, 64 },
37 .alternate_offset = { 1, 64 },
42#define CHECK(cond) do { if (!(cond)) return AVERROR_INVALIDDATA; } while (0)
43#define CHECK_SIGNED(q) CHECK((q).den > 0);
44#define CHECK_UNSIGNED(q) CHECK((q).num >= 0 && (q).den > 0);
49 CHECK(p->nb_channels == 1 || p->nb_channels == 3);
53 for (
int c = 0;
c < p->nb_channels;
c++) {
54 const struct AVGainMapChannel *
const ch = &p->channels[
c];
58 CHECK(ch->gamma.num != 0);
77 static_assert(
sizeof(p->channels[0]) ==
sizeof(
int[2]) * 5,
78 "AVGainMapChannel struct is tightly packed");
80 return !memcmp(&p->channels[0], &p->channels[1],
sizeof(p->channels[0])) &&
81 !memcmp(&p->channels[0], &p->channels[2],
sizeof(p->channels[0]));
AVFrameSideData * av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, enum AVFrameSideDataType type, size_t size, unsigned int flags)
Add new side data entry to an array.
#define AV_FRAME_SIDE_DATA_FLAG_REPLACE
Don't add a new entry if another of the same type exists.
@ AV_FRAME_DATA_GAIN_MAP_PARAMS
Parameters describing how to combine this gain map with its base image to form an alternate rendition...
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
#define CHECK_UNSIGNED(q)
int av_gain_map_params_validate(const AVGainMapParams *p)
Returns >= 0 if the given AVGainMapParams struct contains valid data; or a negative AVERROR otherwise...
AVGainMapParams * av_gain_map_params_alloc(size_t *size)
Allocate an AVGainMapParams structure and initialize it to default values.
int av_gain_map_channels_identical(const AVGainMapParams *p)
Returns 1 if all channels of the gain map have identical parameters, 0 otherwise.
static void gain_map_params_default(AVGainMapParams *p)
AVGainMapParams * av_gain_map_params_create_side_data(AVFrameSideData ***fsd, int *nb_sd)
Allocate and add an AVGainMapParams structure to an existing AVFrameSideData array as AV_FRAME_DATA_G...
#define AV_ISO21496_VERSION
Memory handling functions.
Structure to hold side data for an AVFrame.
Parameters describing how to combine a gain map rendition with its base rendition to recover the alte...