FFmpeg
Loading...
Searching...
No Matches
gain_map.c File Reference
#include "gain_map.h"
#include "mem.h"

Go to the source code of this file.

Macros

#define CHECK(cond)
 
#define CHECK_SIGNED(q)
 
#define CHECK_UNSIGNED(q)
 

Functions

static void gain_map_params_default (AVGainMapParams *p)
 
int av_gain_map_params_validate (const AVGainMapParams *p)
 Returns >= 0 if the given AVGainMapParams struct contains valid data; or a negative AVERROR otherwise.
 
int av_gain_map_channels_identical (const AVGainMapParams *p)
 Returns 1 if all channels of the gain map have identical parameters, 0 otherwise.
 
AVGainMapParams * av_gain_map_params_alloc (size_t *size)
 Allocate an AVGainMapParams structure and initialize it to default values.
 
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_GAIN_MAP_PARAMS side data.
 

Macro Definition Documentation

◆ CHECK

#define CHECK ( cond)
Value:
do { if (!(cond)) return AVERROR_INVALIDDATA; } while (0)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition error.h:61
int(* cond)(enum AVPixelFormat pix_fmt)

Definition at line 42 of file gain_map.c.

Referenced by av_gain_map_params_validate().

◆ CHECK_SIGNED

#define CHECK_SIGNED ( q)
Value:
CHECK((q).den > 0);
#define CHECK(call)
Definition cbs_apv.c:59

Definition at line 43 of file gain_map.c.

Referenced by av_gain_map_params_validate().

◆ CHECK_UNSIGNED

#define CHECK_UNSIGNED ( q)
Value:
CHECK((q).num >= 0 && (q).den > 0);
int num
Definition error.c:23

Definition at line 44 of file gain_map.c.

Referenced by av_gain_map_params_validate().

Function Documentation

◆ gain_map_params_default()

static void gain_map_params_default ( AVGainMapParams * p)
static

Definition at line 22 of file gain_map.c.

Referenced by av_gain_map_params_alloc(), and av_gain_map_params_create_side_data().

◆ av_gain_map_params_validate()

int av_gain_map_params_validate ( const AVGainMapParams * p)

Returns >= 0 if the given AVGainMapParams struct contains valid data; or a negative AVERROR otherwise.

Note: The ISO spec declares these as signed, but a negative value makes no numeric sense and would result in infinities in the middle of the valid signal range; so just constrain them to be unsigned as a safeguard. Note that the Adobe hdrgm spec explicitly requires them to be nonnegative as well, so this avoids an inconsistency.

Definition at line 46 of file gain_map.c.

Referenced by ff_gain_map_params_check_xmp(), ff_gain_map_params_from_iso21496(), ff_gain_map_params_to_iso21496(), ff_mjpeg_add_gain_map_size(), and process_frame().

◆ av_gain_map_channels_identical()

int av_gain_map_channels_identical ( const AVGainMapParams * p)

Returns 1 if all channels of the gain map have identical parameters, 0 otherwise.

Definition at line 75 of file gain_map.c.

Referenced by ff_gain_map_params_check_xmp(), and ff_gain_map_params_to_iso21496().

◆ av_gain_map_params_alloc()

AVGainMapParams * av_gain_map_params_alloc ( size_t * size)

Allocate an AVGainMapParams structure and initialize it to default values.

The resulting pointer must be freed using av_free().

Parameters
sizeif non-NULL, set to sizeof(AVGainMapParams)
Returns
the newly allocated struct, or NULL on failure

Definition at line 84 of file gain_map.c.

◆ av_gain_map_params_create_side_data()

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_GAIN_MAP_PARAMS side data.

Returns
the newly allocated struct, or NULL on failure

Definition at line 98 of file gain_map.c.

Referenced by process_frame().