FFmpeg
Data Structures | Macros | Functions
cms.h File Reference
#include <stdbool.h>
#include "libavutil/csp.h"
#include "csputils.h"
#include "swscale.h"
#include "utils.h"

Go to the source code of this file.

Data Structures

struct  SwsColorMap
 

Macros

#define PERCEPTUAL_KNEE_MIN   0.10f
 
#define PERCEPTUAL_KNEE_MAX   0.80f
 
#define PERCEPTUAL_KNEE_DEF   0.40f
 
#define PERCEPTUAL_ADAPTATION   0.40f
 
#define PERCEPTUAL_DEADZONE   0.30f
 
#define PERCEPTUAL_CONTRAST   0.50f
 
#define SLOPE_TUNING   1.50f /* [0,10] */
 
#define SLOPE_OFFSET   0.20f /* [0,1] */
 
#define PERCEPTUAL_STRENGTH   0.80f
 
#define SOFTCLIP_KNEE   0.70f
 
#define COLORIMETRIC_GAMMA   1.80f
 

Functions

bool sws_color_map_noop (const SwsColorMap *map)
 Returns true if the given color map is a semantic no-op - that is, the overall RGB end to end transform would an identity mapping. More...
 
int sws_color_map_generate_static (v3u16_t *lut, int size, const SwsColorMap *map)
 Generates a single end-to-end color mapping 3DLUT embedding a static tone mapping curve. More...
 
int sws_color_map_generate_dynamic (v3u16_t *input, v3u16_t *output, int size_input, int size_I, int size_PT, const SwsColorMap *map)
 Generates a split pair of 3DLUTS, going to IPT and back, allowing an arbitrary dynamic EETF to be nestled in between these two operations. More...
 
void sws_tone_map_generate (v2u16_t *lut, int size, const SwsColorMap *map)
 Generate a 1D LUT of size size adapting intensity (I) levels from the source to the destination color space. More...
 

Macro Definition Documentation

◆ PERCEPTUAL_KNEE_MIN

#define PERCEPTUAL_KNEE_MIN   0.10f

Definition at line 33 of file cms.h.

◆ PERCEPTUAL_KNEE_MAX

#define PERCEPTUAL_KNEE_MAX   0.80f

Definition at line 34 of file cms.h.

◆ PERCEPTUAL_KNEE_DEF

#define PERCEPTUAL_KNEE_DEF   0.40f

Definition at line 35 of file cms.h.

◆ PERCEPTUAL_ADAPTATION

#define PERCEPTUAL_ADAPTATION   0.40f

Definition at line 38 of file cms.h.

◆ PERCEPTUAL_DEADZONE

#define PERCEPTUAL_DEADZONE   0.30f

Definition at line 41 of file cms.h.

◆ PERCEPTUAL_CONTRAST

#define PERCEPTUAL_CONTRAST   0.50f

Definition at line 44 of file cms.h.

◆ SLOPE_TUNING

#define SLOPE_TUNING   1.50f /* [0,10] */

Definition at line 47 of file cms.h.

◆ SLOPE_OFFSET

#define SLOPE_OFFSET   0.20f /* [0,1] */

Definition at line 48 of file cms.h.

◆ PERCEPTUAL_STRENGTH

#define PERCEPTUAL_STRENGTH   0.80f

Definition at line 51 of file cms.h.

◆ SOFTCLIP_KNEE

#define SOFTCLIP_KNEE   0.70f

Definition at line 54 of file cms.h.

◆ COLORIMETRIC_GAMMA

#define COLORIMETRIC_GAMMA   1.80f

Definition at line 57 of file cms.h.

Function Documentation

◆ sws_color_map_noop()

bool sws_color_map_noop ( const SwsColorMap map)

Returns true if the given color map is a semantic no-op - that is, the overall RGB end to end transform would an identity mapping.

Definition at line 34 of file cms.c.

Referenced by adapt_colors().

◆ sws_color_map_generate_static()

int sws_color_map_generate_static ( v3u16_t lut,
int  size,
const SwsColorMap map 
)

Generates a single end-to-end color mapping 3DLUT embedding a static tone mapping curve.

Returns 0 on success, or a negative error code on failure.

Definition at line 679 of file cms.c.

Referenced by sws_lut3d_generate().

◆ sws_color_map_generate_dynamic()

int sws_color_map_generate_dynamic ( v3u16_t input,
v3u16_t output,
int  size_input,
int  size_I,
int  size_PT,
const SwsColorMap map 
)

Generates a split pair of 3DLUTS, going to IPT and back, allowing an arbitrary dynamic EETF to be nestled in between these two operations.

See sws_tone_map_generate().

Returns 0 on success, or a negative error code on failure.

The IPT transform already implies an explicit white point adaptation from src to dst, so to get absolute colorimetric semantics we have to explicitly undo this adaptation with a * corresponding inverse.

Definition at line 684 of file cms.c.

Referenced by sws_color_map_generate_static(), and sws_lut3d_generate().

◆ sws_tone_map_generate()

void sws_tone_map_generate ( v2u16_t lut,
int  size,
const SwsColorMap map 
)

Generate a 1D LUT of size size adapting intensity (I) levels from the source to the destination color space.

The LUT is normalized to the relevant intensity range directly. The second channel of each entry returns the corresponding 15-bit scaling factor for the P/T channels. The scaling factor k may be applied as (1 << 15) - k + (PT * k >> 15).

This is designed to be used with sws_gamut_map_generate_dynamic().

Returns 0 on success, or a negative error code on failure.

Definition at line 743 of file cms.c.

Referenced by sws_lut3d_update().