FFmpeg
Data Structures | Functions
fflcms2.h File Reference
#include "libavutil/csp.h"
#include "libavutil/frame.h"
#include "libavutil/pixfmt.h"
#include <lcms2.h>

Go to the source code of this file.

Data Structures

struct  FFIccContext
 

Functions

int ff_icc_context_init (FFIccContext *s, void *avctx)
 Initializes an FFIccContext. More...
 
void ff_icc_context_uninit (FFIccContext *s)
 
int ff_icc_profile_generate (FFIccContext *s, enum AVColorPrimaries color_prim, enum AVColorTransferCharacteristic color_trc, cmsHPROFILE *out_profile)
 Generate an ICC profile for a given combination of color primaries and transfer function. More...
 
int ff_icc_profile_attach (FFIccContext *s, cmsHPROFILE profile, AVFrame *frame)
 Attach an ICC profile to a frame. More...
 
int ff_icc_profile_read_primaries (FFIccContext *s, cmsHPROFILE profile, AVColorPrimariesDesc *out_primaries)
 Read the color primaries and white point coefficients encoded by an ICC profile, and return the raw values in out_primaries. More...
 
int ff_icc_profile_detect_transfer (FFIccContext *s, cmsHPROFILE profile, enum AVColorTransferCharacteristic *out_trc)
 Attempt detecting the transfer characteristic that best approximates the transfer function encoded by an ICC profile. More...
 

Detailed Description

Various functions for dealing with ICC profiles

Definition in file fflcms2.h.

Function Documentation

◆ ff_icc_context_init()

int ff_icc_context_init ( FFIccContext s,
void *  avctx 
)

Initializes an FFIccContext.

This must be done prior to using it.

Returns 0 on success, or a negative error code.

Definition at line 30 of file fflcms2.c.

Referenced by iccdetect_init(), and iccgen_init().

◆ ff_icc_context_uninit()

void ff_icc_context_uninit ( FFIccContext s)

Definition at line 42 of file fflcms2.c.

Referenced by avcodec_close(), iccdetect_uninit(), and iccgen_uninit().

◆ ff_icc_profile_generate()

int ff_icc_profile_generate ( FFIccContext s,
enum AVColorPrimaries  color_prim,
enum AVColorTransferCharacteristic  color_trc,
cmsHPROFILE *  out_profile 
)

Generate an ICC profile for a given combination of color primaries and transfer function.

Both values must be set to valid entries (not "undefined") for this function to work.

Returns 0 on success, or a negative error code.

Definition at line 145 of file fflcms2.c.

Referenced by iccgen_filter_frame().

◆ ff_icc_profile_attach()

int ff_icc_profile_attach ( FFIccContext s,
cmsHPROFILE  profile,
AVFrame frame 
)

Attach an ICC profile to a frame.

Helper wrapper around cmsSaveProfileToMem and av_frame_new_side_data_from_buf.

Returns 0 on success, or a negative error code.

Definition at line 172 of file fflcms2.c.

Referenced by iccgen_filter_frame().

◆ ff_icc_profile_read_primaries()

int ff_icc_profile_read_primaries ( FFIccContext s,
cmsHPROFILE  profile,
AVColorPrimariesDesc out_primaries 
)

Read the color primaries and white point coefficients encoded by an ICC profile, and return the raw values in out_primaries.

Returns 0 on success, or a negative error code.

Definition at line 204 of file fflcms2.c.

Referenced by iccdetect_filter_frame().

◆ ff_icc_profile_detect_transfer()

int ff_icc_profile_detect_transfer ( FFIccContext s,
cmsHPROFILE  profile,
enum AVColorTransferCharacteristic out_trc 
)

Attempt detecting the transfer characteristic that best approximates the transfer function encoded by an ICC profile.

Sets out_trc to AVCOL_TRC_UNSPECIFIED if no clear match can be identified.

Returns 0 on success (including no match), or a negative error code.

Definition at line 251 of file fflcms2.c.

Referenced by iccdetect_filter_frame().