FFmpeg
Loading...
Searching...
No Matches
gain_map.h File Reference

Serialization of AVGainMapParams into the metadata blobs that image formats carry it in, and back. More...

Go to the source code of this file.

Macros

#define FF_GAIN_MAP_VERSION   0
 
#define FF_GAIN_MAP_MAX_PAYLOAD_SIZE   141 /* = 5 + 2*8 + 3*5*8 */
 
#define FF_GAIN_MAP_XMP_IDENT   "http://ns.adobe.com/xap/1.0/"
 
#define FF_GAIN_MAP_XMP_NAMESPACE   "http://ns.adobe.com/hdr-gain-map/1.0/"
 
#define FF_GAIN_MAP_XMP_MAX_LEN   1024
 

Functions

int ff_gain_map_params_from_iso21496 (AVGainMapParams *p, const uint8_t *data, size_t size)
 Parse the payload of an ISO 21496-1 gain map metadata blob.
 
int ff_gain_map_params_to_iso21496 (const AVGainMapParams *p, uint8_t *buf)
 Serialize an AVGainMapParams as an ISO 21496-1 gain map metadata blob.
 
int ff_gain_map_params_check_xmp (const AVGainMapParams *p)
 Returns 1 if the gain map parameters are compatible with the XMP-based encoding, or 0 otherwise.
 
int ff_gain_map_params_to_xmp (const AVGainMapParams *p, char *buf)
 Serialize an AVGainMapParams as an Ultra HDR XMP packet.
 

Detailed Description

Serialization of AVGainMapParams into the metadata blobs that image formats carry it in, and back.

Kept separate from the codecs so that an encoder writing the blob and a bitstream filter splicing it into an existing bitstream can share the same code.

Definition in file gain_map.h.

Macro Definition Documentation

◆ FF_GAIN_MAP_VERSION

#define FF_GAIN_MAP_VERSION   0

◆ FF_GAIN_MAP_MAX_PAYLOAD_SIZE

#define FF_GAIN_MAP_MAX_PAYLOAD_SIZE   141 /* = 5 + 2*8 + 3*5*8 */

Definition at line 34 of file gain_map.h.

Referenced by ff_gain_map_params_to_iso21496(), and ff_mjpeg_add_gain_map_size().

◆ FF_GAIN_MAP_XMP_IDENT

#define FF_GAIN_MAP_XMP_IDENT   "http://ns.adobe.com/xap/1.0/"

◆ FF_GAIN_MAP_XMP_NAMESPACE

#define FF_GAIN_MAP_XMP_NAMESPACE   "http://ns.adobe.com/hdr-gain-map/1.0/"

Definition at line 38 of file gain_map.h.

Referenced by parse_app1().

◆ FF_GAIN_MAP_XMP_MAX_LEN

#define FF_GAIN_MAP_XMP_MAX_LEN   1024

Definition at line 39 of file gain_map.h.

Referenced by ff_gain_map_params_to_xmp(), and ff_mjpeg_add_gain_map_size().

Function Documentation

◆ ff_gain_map_params_from_iso21496()

int ff_gain_map_params_from_iso21496 ( AVGainMapParams * p,
const uint8_t * data,
size_t size )

Parse the payload of an ISO 21496-1 gain map metadata blob.

Parameters
pstruct to fill; overwritten on success, untouched on failure
datapayload, excluding container-specific identifiers
sizesize of data in bytes
Returns
>= 0 on success, or a negative AVERROR on failure

◆ ff_gain_map_params_to_iso21496()

int ff_gain_map_params_to_iso21496 ( const AVGainMapParams * p,
uint8_t * buf )

Serialize an AVGainMapParams as an ISO 21496-1 gain map metadata blob.

The output starts at the minimum_version field; the caller should prepend whatever identifier its container requires.

Parameters
pparameters to serialize
bufByte buffer to fill with the serialized data. Must contain at least FF_GAIN_MAP_MAX_PAYLOAD_SIZE bytes.
Returns
Number of bytes written on success, or a negative AVERROR on failure
Note
Always succeeds if av_gain_map_params_validate() returns >= 0, and p->version <= AV_ISO21496_VERSION.

Definition at line 132 of file gain_map.c.

Referenced by jpeg_put_comments().

◆ ff_gain_map_params_check_xmp()

int ff_gain_map_params_check_xmp ( const AVGainMapParams * p)

Returns 1 if the gain map parameters are compatible with the XMP-based encoding, or 0 otherwise.

Definition at line 173 of file gain_map.c.

Referenced by ff_gain_map_params_to_xmp(), ff_mjpeg_add_gain_map_size(), and want_gain_map_xmp().

◆ ff_gain_map_params_to_xmp()

int ff_gain_map_params_to_xmp ( const AVGainMapParams * p,
char * buf )

Serialize an AVGainMapParams as an Ultra HDR XMP packet.

Parameters
pparameters to serialize
bufByte buffer to fill with the serialized data. Must contain at least FF_GAIN_MAP_MAX_XMP_LEN bytes.
Returns
Number of bytes written on success, or a negative AVERROR on failure
Note
Always succeeds if ff_gain_map_params_check_xmp() returns 1.

Definition at line 209 of file gain_map.c.

Referenced by jpeg_put_comments().