FFmpeg
Functions
fflcms2.c File Reference
#include "libavutil/csp.h"
#include "fflcms2.h"

Go to the source code of this file.

Functions

static void log_cb (cmsContext ctx, cmsUInt32Number error, const char *str)
 
int ff_icc_context_init (FFIccContext *s, void *avctx)
 Initializes an FFIccContext. More...
 
void ff_icc_context_uninit (FFIccContext *s)
 
static int get_curve (FFIccContext *s, enum AVColorTransferCharacteristic trc, cmsToneCurve **out_curve)
 
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...
 
static av_always_inline void XYZ_xy (cmsCIEXYZ XYZ, AVCIExy *xy)
 
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...
 

Function Documentation

◆ log_cb()

static void log_cb ( cmsContext  ctx,
cmsUInt32Number  error,
const char *  str 
)
static

Definition at line 24 of file fflcms2.c.

Referenced by ff_icc_context_init(), and libplacebo_init().

◆ 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().

◆ get_curve()

static int get_curve ( FFIccContext s,
enum AVColorTransferCharacteristic  trc,
cmsToneCurve **  out_curve 
)
static

Definition at line 50 of file fflcms2.c.

Referenced by ff_icc_profile_detect_transfer(), and ff_icc_profile_generate().

◆ 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().

◆ XYZ_xy()

static av_always_inline void XYZ_xy ( cmsCIEXYZ  XYZ,
AVCIExy xy 
)
static

Definition at line 197 of file fflcms2.c.

Referenced by ff_icc_profile_read_primaries().

◆ 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().