FFmpeg 5.1.6
csp.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
3 * This file is part of FFmpeg.
4 *
5 * FFmpeg is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * FFmpeg is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with FFmpeg; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifndef AVUTIL_CSP_H
21#define AVUTIL_CSP_H
22
23#include "pixfmt.h"
24#include "rational.h"
25
26/**
27 * @file Colorspace value utility functions for libavutil.
28 * @author Ronald S. Bultje <rsbultje@gmail.com>
29 * @author Leo Izen <leo.izen@gmail.com>
30 * @defgroup lavu_math_csp Colorspace Utility
31 * @ingroup lavu_math
32 * @{
33 */
34
35/**
36 * Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar
37 * calculations.
38 */
39typedef struct AVLumaCoefficients {
42
43/**
44 * Struct containing chromaticity x and y values for the standard CIE 1931
45 * chromaticity definition.
46 */
47typedef struct AVCIExy {
49} AVCIExy;
50
51/**
52 * Struct defining the red, green, and blue primary locations in terms of CIE
53 * 1931 chromaticity x and y.
54 */
55typedef struct AVPrimaryCoefficients {
58
59/**
60 * Struct defining white point location in terms of CIE 1931 chromaticity x
61 * and y.
62 */
64
65/**
66 * Struct that contains both white point location and primaries location, providing
67 * the complete description of a color gamut.
68 */
69typedef struct AVColorPrimariesDesc {
73
74/**
75 * Retrieves the Luma coefficients necessary to construct a conversion matrix
76 * from an enum constant describing the colorspace.
77 * @param csp An enum constant indicating YUV or similar colorspace.
78 * @return The Luma coefficients associated with that colorspace, or NULL
79 * if the constant is unknown to libavutil.
80 */
82
83/**
84 * Retrieves a complete gamut description from an enum constant describing the
85 * color primaries.
86 * @param prm An enum constant indicating primaries
87 * @return A description of the colorspace gamut associated with that enum
88 * constant, or NULL if the constant is unknown to libavutil.
89 */
91
92/**
93 * Detects which enum AVColorPrimaries constant corresponds to the given complete
94 * gamut description.
95 * @see enum AVColorPrimaries
96 * @param prm A description of the colorspace gamut
97 * @return The enum constant associated with this gamut, or
98 * AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified.
99 */
101
102/**
103 * @}
104 */
105
106#endif /* AVUTIL_CSP_H */
const AVLumaCoefficients * av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp)
Retrieves the Luma coefficients necessary to construct a conversion matrix from an enum constant desc...
enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm)
Detects which enum AVColorPrimaries constant corresponds to the given complete gamut description.
AVCIExy AVWhitepointCoefficients
Struct defining white point location in terms of CIE 1931 chromaticity x and y.
Definition: csp.h:63
const AVColorPrimariesDesc * av_csp_primaries_desc_from_id(enum AVColorPrimaries prm)
Retrieves a complete gamut description from an enum constant describing the color primaries.
pixel format definitions
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:471
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:525
Utilties for rational number calculation.
Struct containing chromaticity x and y values for the standard CIE 1931 chromaticity definition.
Definition: csp.h:47
AVRational x
Definition: csp.h:48
AVRational y
Definition: csp.h:48
Struct that contains both white point location and primaries location, providing the complete descrip...
Definition: csp.h:69
AVWhitepointCoefficients wp
Definition: csp.h:70
AVPrimaryCoefficients prim
Definition: csp.h:71
Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
Definition: csp.h:39
AVRational cb
Definition: csp.h:40
AVRational cr
Definition: csp.h:40
AVRational cg
Definition: csp.h:40
Struct defining the red, green, and blue primary locations in terms of CIE 1931 chromaticity x and y.
Definition: csp.h:55
Rational number (pair of numerator and denominator).
Definition: rational.h:58