2 * Copyright (c) 2016 Ronald S. Bultje <rsbultje@gmail.com>
3 * This file is part of FFmpeg.
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.
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.
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
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
36 * Struct containing luma coefficients to be used for RGB to YUV/YCoCg, or similar
39 typedef struct AVLumaCoefficients
{
40 AVRational cr
, cg
, cb
;
44 * Struct containing chromaticity x and y values for the standard CIE 1931
45 * chromaticity definition.
47 typedef struct AVCIExy
{
52 * Struct defining the red, green, and blue primary locations in terms of CIE
53 * 1931 chromaticity x and y.
55 typedef struct AVPrimaryCoefficients
{
57 } AVPrimaryCoefficients
;
60 * Struct defining white point location in terms of CIE 1931 chromaticity x
63 typedef AVCIExy AVWhitepointCoefficients
;
66 * Struct that contains both white point location and primaries location, providing
67 * the complete description of a color gamut.
69 typedef struct AVColorPrimariesDesc
{
70 AVWhitepointCoefficients wp
;
71 AVPrimaryCoefficients prim
;
72 } AVColorPrimariesDesc
;
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.
81 const AVLumaCoefficients
*av_csp_luma_coeffs_from_avcsp(enum AVColorSpace csp
);
84 * Retrieves a complete gamut description from an enum constant describing the
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.
90 const AVColorPrimariesDesc
*av_csp_primaries_desc_from_id(enum AVColorPrimaries prm
);
93 * Detects which enum AVColorPrimaries constant corresponds to the given complete
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.
100 enum AVColorPrimaries
av_csp_primaries_id_from_desc(const AVColorPrimariesDesc
*prm
);
106 #endif /* AVUTIL_CSP_H */