FFmpeg
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
28  * Colorspace value utility functions for libavutil.
29  * @ingroup lavu_math_csp
30  * @author Ronald S. Bultje <rsbultje@gmail.com>
31  * @author Leo Izen <leo.izen@gmail.com>
32  */
33 
34 /**
35  * @defgroup lavu_math_csp Colorspace Utility
36  * @ingroup lavu_math
37  * @{
38  */
39 
40 /**
41  * Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar
42  * calculations.
43  */
44 typedef struct AVLumaCoefficients {
47 
48 /**
49  * Struct containing chromaticity x and y values for the standard CIE 1931
50  * chromaticity definition.
51  */
52 typedef struct AVCIExy {
54 } AVCIExy;
55 
56 /**
57  * Struct defining the red, green, and blue primary locations in terms of CIE
58  * 1931 chromaticity x and y.
59  */
60 typedef struct AVPrimaryCoefficients {
61  AVCIExy r, g, b;
63 
64 /**
65  * Struct defining white point location in terms of CIE 1931 chromaticity x
66  * and y.
67  */
69 
70 /**
71  * Struct that contains both white point location and primaries location, providing
72  * the complete description of a color gamut.
73  */
74 typedef struct AVColorPrimariesDesc {
78 
79 /**
80  * Retrieves the Luma coefficients necessary to construct a conversion matrix
81  * from an enum constant describing the colorspace.
82  * @param csp An enum constant indicating YUV or similar colorspace.
83  * @return The Luma coefficients associated with that colorspace, or NULL
84  * if the constant is unknown to libavutil.
85  */
87 
88 /**
89  * Retrieves a complete gamut description from an enum constant describing the
90  * color primaries.
91  * @param prm An enum constant indicating primaries
92  * @return A description of the colorspace gamut associated with that enum
93  * constant, or NULL if the constant is unknown to libavutil.
94  */
96 
97 /**
98  * Detects which enum AVColorPrimaries constant corresponds to the given complete
99  * gamut description.
100  * @see enum AVColorPrimaries
101  * @param prm A description of the colorspace gamut
102  * @return The enum constant associated with this gamut, or
103  * AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified.
104  */
106 
107 /**
108  * @}
109  */
110 
111 #endif /* AVUTIL_CSP_H */
AVLumaCoefficients::cr
AVRational cr
Definition: csp.h:45
AVColorPrimariesDesc::wp
AVWhitepointCoefficients wp
Definition: csp.h:75
AVColorPrimariesDesc
Struct that contains both white point location and primaries location, providing the complete descrip...
Definition: csp.h:74
rational.h
av_csp_luma_coeffs_from_avcsp
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...
Definition: csp.c:53
AVLumaCoefficients
Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar calculations.
Definition: csp.h:44
AVColorPrimaries
AVColorPrimaries
Chromaticity coordinates of the source primaries.
Definition: pixfmt.h:533
AVPrimaryCoefficients
Struct defining the red, green, and blue primary locations in terms of CIE 1931 chromaticity x and y.
Definition: csp.h:60
av_csp_primaries_desc_from_id
const AVColorPrimariesDesc * av_csp_primaries_desc_from_id(enum AVColorPrimaries prm)
Retrieves a complete gamut description from an enum constant describing the color primaries.
Definition: csp.c:85
av_csp_primaries_id_from_desc
enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm)
Detects which enum AVColorPrimaries constant corresponds to the given complete gamut description.
Definition: csp.c:105
AVLumaCoefficients::cg
AVRational cg
Definition: csp.h:45
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVCIExy
Struct containing chromaticity x and y values for the standard CIE 1931 chromaticity definition.
Definition: csp.h:52
AVWhitepointCoefficients
AVCIExy AVWhitepointCoefficients
Struct defining white point location in terms of CIE 1931 chromaticity x and y.
Definition: csp.h:68
AVCIExy::x
AVRational x
Definition: csp.h:53
AVPrimaryCoefficients::b
AVCIExy b
Definition: csp.h:61
AVPrimaryCoefficients::r
AVCIExy r
Definition: csp.h:61
AVPrimaryCoefficients::g
AVCIExy g
Definition: csp.h:61
AVColorSpace
AVColorSpace
YUV colorspace type.
Definition: pixfmt.h:587
pixfmt.h
AVCIExy::y
AVRational y
Definition: csp.h:53
AVColorPrimariesDesc::prim
AVPrimaryCoefficients prim
Definition: csp.h:76
AVLumaCoefficients::cb
AVRational cb
Definition: csp.h:45