2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * Copyright (C) 2007 David A. Schleef <ds@schleef.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
30 #include "video-color.h"
32 #ifndef GST_DISABLE_GST_DEBUG
33 #define GST_CAT_DEFAULT ensure_debug_category()
34 static GstDebugCategory *
35 ensure_debug_category (void)
37 static gsize cat_gonce = 0;
39 if (g_once_init_enter (&cat_gonce)) {
42 cat_done = (gsize) _gst_debug_category_new ("video-color", 0,
43 "video-color object");
45 g_once_init_leave (&cat_gonce, cat_done);
48 return (GstDebugCategory *) cat_gonce;
51 #define ensure_debug_category() /* NOOP */
52 #endif /* GST_DISABLE_GST_DEBUG */
57 GstVideoColorimetry color;
60 #define MAKE_COLORIMETRY(n,r,m,t,p) { GST_VIDEO_COLORIMETRY_ ##n, \
61 { GST_VIDEO_COLOR_RANGE ##r, GST_VIDEO_COLOR_MATRIX_ ##m, \
62 GST_VIDEO_TRANSFER_ ##t, GST_VIDEO_COLOR_PRIMARIES_ ##p } }
64 #define GST_VIDEO_COLORIMETRY_NONAME NULL
66 static const ColorimetryInfo colorimetry[] = {
67 MAKE_COLORIMETRY (BT601, _16_235, BT601, BT601, SMPTE170M),
68 MAKE_COLORIMETRY (BT709, _16_235, BT709, BT709, BT709),
69 MAKE_COLORIMETRY (SMPTE240M, _16_235, SMPTE240M, SMPTE240M, SMPTE240M),
70 MAKE_COLORIMETRY (SRGB, _0_255, RGB, SRGB, BT709),
71 MAKE_COLORIMETRY (BT2020, _16_235, BT2020, BT2020_12, BT2020),
72 MAKE_COLORIMETRY (BT2020_10, _16_235, BT2020, BT2020_10, BT2020),
73 MAKE_COLORIMETRY (BT2100_PQ, _16_235, BT2020, SMPTE2084, BT2020),
74 MAKE_COLORIMETRY (BT2100_HLG, _16_235, BT2020, ARIB_STD_B67, BT2020),
75 MAKE_COLORIMETRY (NONAME, _0_255, BT601, UNKNOWN, UNKNOWN),
76 MAKE_COLORIMETRY (NONAME, _UNKNOWN, UNKNOWN, UNKNOWN, UNKNOWN), /* Keep last! */
79 #define DEFAULT_UNKNOWN (G_N_ELEMENTS(colorimetry)-1)
81 static const ColorimetryInfo *
82 gst_video_get_colorimetry (const gchar * s)
86 for (i = 0; colorimetry[i].name; i++) {
87 if (g_str_equal (colorimetry[i].name, s))
88 return &colorimetry[i];
93 #define CI_IS_EQUAL(ci,i) (((ci)->range == (i)->range) && \
94 ((ci)->matrix == (i)->matrix) && \
95 ((ci)->transfer == (i)->transfer) && \
96 ((ci)->primaries == (i)->primaries))
98 #define IS_EQUAL(ci,i) CI_IS_EQUAL(&(ci)->color, (i))
100 #define IS_UNKNOWN(ci) (IS_EQUAL (&colorimetry[DEFAULT_UNKNOWN], ci))
103 * gst_video_colorimetry_from_string:
104 * @cinfo: a #GstVideoColorimetry
105 * @color: a colorimetry string
107 * Parse the colorimetry string and update @cinfo with the parsed
110 * Returns: %TRUE if @color points to valid colorimetry info.
113 gst_video_colorimetry_from_string (GstVideoColorimetry * cinfo,
116 const ColorimetryInfo *ci;
117 gboolean res = FALSE;
120 *cinfo = colorimetry[DEFAULT_UNKNOWN].color;
122 } else if ((ci = gst_video_get_colorimetry (color))) {
128 if (sscanf (color, "%d:%d:%d:%d", &r, &m, &t, &p) == 4) {
132 cinfo->primaries = p;
140 * gst_video_colorimetry_to_string:
141 * @cinfo: a #GstVideoColorimetry
143 * Make a string representation of @cinfo.
145 * Returns: (transfer full) (nullable): a string representation of @cinfo
146 * or %NULL if all the entries of @cinfo are unknown values.
149 gst_video_colorimetry_to_string (const GstVideoColorimetry * cinfo)
153 for (i = 0; colorimetry[i].name; i++) {
154 if (IS_EQUAL (&colorimetry[i], cinfo)) {
155 return g_strdup (colorimetry[i].name);
158 if (!IS_UNKNOWN (cinfo)) {
159 return g_strdup_printf ("%d:%d:%d:%d", cinfo->range, cinfo->matrix,
160 cinfo->transfer, cinfo->primaries);
166 * gst_video_colorimetry_matches:
167 * @cinfo: a #GstVideoInfo
168 * @color: a colorimetry string
170 * Check if the colorimetry information in @info matches that of the
173 * Returns: %TRUE if @color conveys the same colorimetry info as the color
174 * information in @info.
177 gst_video_colorimetry_matches (const GstVideoColorimetry * cinfo,
180 const ColorimetryInfo *ci;
182 if ((ci = gst_video_get_colorimetry (color)))
183 return IS_EQUAL (ci, cinfo);
189 * gst_video_color_range_offsets:
190 * @range: a #GstVideoColorRange
191 * @info: a #GstVideoFormatInfo
192 * @offset: (out caller-allocates) (array fixed-size=4): output offsets
193 * @scale: (out caller-allocates) (array fixed-size=4): output scale
195 * Compute the offset and scale values for each component of @info. For each
196 * component, (c[i] - offset[i]) / scale[i] will scale the component c[i] to the
197 * range [0.0 .. 1.0].
199 * The reverse operation (c[i] * scale[i]) + offset[i] can be used to convert
200 * the component values in range [0.0 .. 1.0] back to their representation in
204 gst_video_color_range_offsets (GstVideoColorRange range,
205 const GstVideoFormatInfo * info, gint offset[GST_VIDEO_MAX_COMPONENTS],
206 gint scale[GST_VIDEO_MAX_COMPONENTS])
210 yuv = GST_VIDEO_FORMAT_INFO_IS_YUV (info);
214 case GST_VIDEO_COLOR_RANGE_0_255:
217 offset[1] = 1 << (info->depth[1] - 1);
218 offset[2] = 1 << (info->depth[2] - 1);
223 scale[0] = (1 << info->depth[0]) - 1;
224 scale[1] = (1 << info->depth[1]) - 1;
225 scale[2] = (1 << info->depth[2]) - 1;
227 case GST_VIDEO_COLOR_RANGE_16_235:
228 offset[0] = 1 << (info->depth[0] - 4);
229 scale[0] = 219 << (info->depth[0] - 8);
231 offset[1] = 1 << (info->depth[1] - 1);
232 offset[2] = 1 << (info->depth[2] - 1);
233 scale[1] = 224 << (info->depth[1] - 8);
234 scale[2] = 224 << (info->depth[2] - 8);
236 offset[1] = 1 << (info->depth[1] - 4);
237 offset[2] = 1 << (info->depth[2] - 4);
238 scale[1] = 219 << (info->depth[1] - 8);
239 scale[2] = 219 << (info->depth[2] - 8);
243 /* alpha channel is always full range */
245 scale[3] = (1 << info->depth[3]) - 1;
247 GST_DEBUG ("scale: %d %d %d %d", scale[0], scale[1], scale[2], scale[3]);
248 GST_DEBUG ("offset: %d %d %d %d", offset[0], offset[1], offset[2], offset[3]);
252 * gst_video_colorimetry_is_equal:
253 * @cinfo: a #GstVideoColorimetry
254 * @other: another #GstVideoColorimetry
256 * Compare the 2 colorimetry sets for equality
258 * Returns: %TRUE if @cinfo and @other are equal.
263 gst_video_colorimetry_is_equal (const GstVideoColorimetry * cinfo,
264 const GstVideoColorimetry * other)
266 g_return_val_if_fail (cinfo != NULL, FALSE);
267 g_return_val_if_fail (other != NULL, FALSE);
269 return CI_IS_EQUAL (cinfo, other);
272 #define WP_C 0.31006, 0.31616
273 #define WP_D65 0.31271, 0.32902
274 #define WP_CENTRE (1/3), (1/3)
275 #define WP_WHITE 0.314, 0.351
277 static const GstVideoColorPrimariesInfo color_primaries[] = {
278 {GST_VIDEO_COLOR_PRIMARIES_UNKNOWN, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
279 {GST_VIDEO_COLOR_PRIMARIES_BT709, WP_D65, 0.64, 0.33, 0.30, 0.60, 0.15, 0.06},
280 {GST_VIDEO_COLOR_PRIMARIES_BT470M, WP_C, 0.67, 0.33, 0.21, 0.71, 0.14, 0.08},
281 {GST_VIDEO_COLOR_PRIMARIES_BT470BG, WP_D65, 0.64, 0.33, 0.29, 0.60, 0.15,
283 {GST_VIDEO_COLOR_PRIMARIES_SMPTE170M, WP_D65, 0.63, 0.34, 0.31, 0.595, 0.155,
285 {GST_VIDEO_COLOR_PRIMARIES_SMPTE240M, WP_D65, 0.63, 0.34, 0.31, 0.595, 0.155,
287 {GST_VIDEO_COLOR_PRIMARIES_FILM, WP_C, 0.681, 0.319, 0.243, 0.692, 0.145,
289 {GST_VIDEO_COLOR_PRIMARIES_BT2020, WP_D65, 0.708, 0.292, 0.170, 0.797, 0.131,
291 {GST_VIDEO_COLOR_PRIMARIES_ADOBERGB, WP_D65, 0.64, 0.33, 0.21, 0.71, 0.15,
293 {GST_VIDEO_COLOR_PRIMARIES_SMPTEST428, WP_CENTRE, 1.0, 0.0, 0.0, 1.0, 0.0,
295 {GST_VIDEO_COLOR_PRIMARIES_SMPTERP431, WP_WHITE, 0.68, 0.32, 0.265, 0.69,
297 {GST_VIDEO_COLOR_PRIMARIES_SMPTEEG432, WP_D65, 0.68, 0.32, 0.265, 0.69, 0.15,
299 {GST_VIDEO_COLOR_PRIMARIES_EBU3213, WP_D65, 0.63, 0.34, 0.295, 0.605, 0.155,
304 * gst_video_color_primaries_get_info:
305 * @primaries: a #GstVideoColorPrimaries
307 * Get information about the chromaticity coordinates of @primaries.
309 * Returns: a #GstVideoColorPrimariesInfo for @primaries.
313 const GstVideoColorPrimariesInfo *
314 gst_video_color_primaries_get_info (GstVideoColorPrimaries primaries)
316 g_return_val_if_fail ((gint) primaries <
317 G_N_ELEMENTS (color_primaries), NULL);
319 return &color_primaries[primaries];
323 * gst_video_color_matrix_get_Kr_Kb:
324 * @matrix: a #GstVideoColorMatrix
325 * @Kr: (out): result red channel coefficient
326 * @Kb: (out): result blue channel coefficient
328 * Get the coefficients used to convert between Y'PbPr and R'G'B' using @matrix.
333 * 0.0 <= [Y',R',G',B'] <= 1.0)
334 * (-0.5 <= [Pb,Pr] <= 0.5)
337 * the general conversion is given by:
340 * Y' = Kr*R' + (1-Kr-Kb)*G' + Kb*B'
341 * Pb = (B'-Y')/(2*(1-Kb))
342 * Pr = (R'-Y')/(2*(1-Kr))
345 * and the other way around:
348 * R' = Y' + Cr*2*(1-Kr)
349 * G' = Y' - Cb*2*(1-Kb)*Kb/(1-Kr-Kb) - Cr*2*(1-Kr)*Kr/(1-Kr-Kb)
350 * B' = Y' + Cb*2*(1-Kb)
353 * Returns: TRUE if @matrix was a YUV color format and @Kr and @Kb contain valid
359 gst_video_color_matrix_get_Kr_Kb (GstVideoColorMatrix matrix, gdouble * Kr,
367 case GST_VIDEO_COLOR_MATRIX_RGB:
371 case GST_VIDEO_COLOR_MATRIX_FCC:
375 case GST_VIDEO_COLOR_MATRIX_BT709:
379 case GST_VIDEO_COLOR_MATRIX_BT601:
383 case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
387 case GST_VIDEO_COLOR_MATRIX_BT2020:
392 GST_DEBUG ("matrix: %d, Kr %f, Kb %f", matrix, *Kr, *Kb);
398 * gst_video_color_transfer_encode:
399 * @func: a #GstVideoTransferFunction
402 * Convert @val to its gamma encoded value.
404 * For a linear value L in the range [0..1], conversion to the non-linear
405 * (gamma encoded) L' is in general performed with a power function like:
408 * L' = L ^ (1 / gamma)
411 * Depending on @func, different formulas might be applied. Some formulas
412 * encode a linear segment in the lower range.
414 * Returns: the gamme encoded value of @val
419 gst_video_color_transfer_encode (GstVideoTransferFunction func, gdouble val)
424 case GST_VIDEO_TRANSFER_UNKNOWN:
425 case GST_VIDEO_TRANSFER_GAMMA10:
429 case GST_VIDEO_TRANSFER_GAMMA18:
430 res = pow (val, 1.0 / 1.8);
432 case GST_VIDEO_TRANSFER_GAMMA20:
433 res = pow (val, 1.0 / 2.0);
435 case GST_VIDEO_TRANSFER_GAMMA22:
436 res = pow (val, 1.0 / 2.2);
438 case GST_VIDEO_TRANSFER_BT601:
439 case GST_VIDEO_TRANSFER_BT709:
440 case GST_VIDEO_TRANSFER_BT2020_10:
444 res = 1.099 * pow (val, 0.45) - 0.099;
446 case GST_VIDEO_TRANSFER_SMPTE240M:
450 res = 1.1115 * pow (val, 0.45) - 0.1115;
452 case GST_VIDEO_TRANSFER_SRGB:
453 if (val <= 0.0031308)
456 res = 1.055 * pow (val, 1.0 / 2.4) - 0.055;
458 case GST_VIDEO_TRANSFER_GAMMA28:
459 res = pow (val, 1 / 2.8);
461 case GST_VIDEO_TRANSFER_LOG100:
465 res = 1.0 + log10 (val) / 2.0;
467 case GST_VIDEO_TRANSFER_LOG316:
468 if (val < 0.0031622777)
471 res = 1.0 + log10 (val) / 2.5;
473 case GST_VIDEO_TRANSFER_BT2020_12:
477 res = 1.0993 * pow (val, 0.45) - 0.0993;
479 case GST_VIDEO_TRANSFER_ADOBERGB:
480 res = pow (val, 1.0 / 2.19921875);
482 case GST_VIDEO_TRANSFER_SMPTE2084:
484 gdouble c1 = 3424.0 / 4096.0; /* c3 - c2 + 1 */
485 gdouble c2 = 32 * 2413 / 4096.0;
486 gdouble c3 = 32 * 2392 / 4096.0;
487 gdouble m = 128 * 2523 / 4096.0;
488 gdouble n = 0.25 * 2610 / 4096.0;
489 gdouble Ln = pow (val, n);
491 /* val equal to 1 for peak white is ordinarily intended to
492 * correspond to a reference output luminance level of 10000 cd/m^2 */
493 res = pow ((c1 + c2 * Ln) / (1.0 + c3 * Ln), m);
496 case GST_VIDEO_TRANSFER_ARIB_STD_B67:
498 gdouble a = 0.17883277;
499 gdouble b = 0.28466892;
500 gdouble c = 0.55991073;
502 /* For [0, 1] normalized source as defined by HEVC specification */
503 if (val > (1.0 / 12.0))
504 res = a * log (12.0 * val - b) + c;
506 res = sqrt (3.0 * val);
515 * gst_video_color_transfer_decode:
516 * @func: a #GstVideoTransferFunction
519 * Convert @val to its gamma decoded value. This is the inverse operation of
520 * @gst_video_color_transfer_encode().
522 * For a non-linear value L' in the range [0..1], conversion to the linear
523 * L is in general performed with a power function like:
529 * Depending on @func, different formulas might be applied. Some formulas
530 * encode a linear segment in the lower range.
532 * Returns: the gamme decoded value of @val
537 gst_video_color_transfer_decode (GstVideoTransferFunction func, gdouble val)
542 case GST_VIDEO_TRANSFER_UNKNOWN:
543 case GST_VIDEO_TRANSFER_GAMMA10:
547 case GST_VIDEO_TRANSFER_GAMMA18:
548 res = pow (val, 1.8);
550 case GST_VIDEO_TRANSFER_GAMMA20:
551 res = pow (val, 2.0);
553 case GST_VIDEO_TRANSFER_GAMMA22:
554 res = pow (val, 2.2);
556 case GST_VIDEO_TRANSFER_BT601:
557 case GST_VIDEO_TRANSFER_BT709:
558 case GST_VIDEO_TRANSFER_BT2020_10:
562 res = pow ((val + 0.099) / 1.099, 1.0 / 0.45);
564 case GST_VIDEO_TRANSFER_SMPTE240M:
568 res = pow ((val + 0.1115) / 1.1115, 1.0 / 0.45);
570 case GST_VIDEO_TRANSFER_SRGB:
574 res = pow ((val + 0.055) / 1.055, 2.4);
576 case GST_VIDEO_TRANSFER_GAMMA28:
577 res = pow (val, 2.8);
579 case GST_VIDEO_TRANSFER_LOG100:
583 res = pow (10.0, 2.0 * (val - 1.0));
585 case GST_VIDEO_TRANSFER_LOG316:
589 res = pow (10.0, 2.5 * (val - 1.0));
591 case GST_VIDEO_TRANSFER_BT2020_12:
595 res = pow ((val + 0.0993) / 1.0993, 1.0 / 0.45);
597 case GST_VIDEO_TRANSFER_ADOBERGB:
598 res = pow (val, 2.19921875);
600 case GST_VIDEO_TRANSFER_SMPTE2084:
602 gdouble c1 = 3424.0 / 4096.0; /* c3 - c2 + 1 */
603 gdouble c2 = 32 * 2413 / 4096.0;
604 gdouble c3 = 32 * 2392 / 4096.0;
605 gdouble mi = 1 / (128 * 2523 / 4096.0);
606 gdouble ni = 1 / (0.25 * 2610 / 4096.0);
607 gdouble nm = pow (val, mi);
609 res = pow ((nm - c1) / (c2 - c3 * nm), ni);
612 case GST_VIDEO_TRANSFER_ARIB_STD_B67:
614 gdouble a = 0.17883277;
615 gdouble b = 0.28466892;
616 gdouble c = 0.55991073;
619 res = (exp ((val - c) / a) + b) / 12.0;
621 res = val * val / 3.0;
629 /* conversion between GStreamer color{matrix,transfer,primaries} enum
630 * and indices defined by ITU-T H.273 and ISO/IEC 230001-8 specification */
632 /* FIXME 2.0: Define color{matrix,transfer,primaries} with explicit numbering
633 * to be matched with specification
637 * gst_video_color_matrix_to_iso:
638 * @matrix: a #GstVideoColorMatrix
640 * Converts #GstVideoColorMatrix to the "matrix coefficients"
641 * (MatrixCoefficients) value defined by "ISO/IEC 23001-8 Section 7.3 Table 4"
642 * and "ITU-T H.273 Table 4".
643 * "H.264 Table E-5" and "H.265 Table E.5" share the identical values.
645 * Returns: The value of ISO/IEC 23001-8 matrix coefficients.
650 gst_video_color_matrix_to_iso (GstVideoColorMatrix matrix)
653 case GST_VIDEO_COLOR_MATRIX_RGB:
655 case GST_VIDEO_COLOR_MATRIX_BT709:
657 case GST_VIDEO_COLOR_MATRIX_FCC:
659 case GST_VIDEO_COLOR_MATRIX_BT601:
661 case GST_VIDEO_COLOR_MATRIX_SMPTE240M:
663 case GST_VIDEO_COLOR_MATRIX_BT2020:
665 case GST_VIDEO_COLOR_MATRIX_UNKNOWN:
672 * gst_video_color_transfer_to_iso:
673 * @func: a #GstVideoTransferFunction
675 * Converts #GstVideoTransferFunction to the "transfer characteristics"
676 * (TransferCharacteristics) value defined by "ISO/IEC 23001-8 Section 7.2 Table 3"
677 * and "ITU-T H.273 Table 3".
678 * "H.264 Table E-4" and "H.265 Table E.4" share the identical values.
680 * Returns: The value of ISO/IEC 23001-8 transfer characteristics.
685 gst_video_color_transfer_to_iso (GstVideoTransferFunction func)
688 case GST_VIDEO_TRANSFER_BT709:
690 case GST_VIDEO_TRANSFER_GAMMA22:
692 case GST_VIDEO_TRANSFER_GAMMA28:
694 case GST_VIDEO_TRANSFER_BT601:
696 case GST_VIDEO_TRANSFER_SMPTE240M:
698 case GST_VIDEO_TRANSFER_GAMMA10:
700 case GST_VIDEO_TRANSFER_LOG100:
702 case GST_VIDEO_TRANSFER_LOG316:
704 case GST_VIDEO_TRANSFER_SRGB:
706 case GST_VIDEO_TRANSFER_BT2020_10:
708 case GST_VIDEO_TRANSFER_BT2020_12:
710 case GST_VIDEO_TRANSFER_SMPTE2084:
712 case GST_VIDEO_TRANSFER_ARIB_STD_B67:
714 case GST_VIDEO_TRANSFER_GAMMA18:
715 case GST_VIDEO_TRANSFER_GAMMA20:
716 case GST_VIDEO_TRANSFER_ADOBERGB:
717 case GST_VIDEO_TRANSFER_UNKNOWN:
724 * gst_video_color_primaries_to_iso:
725 * @primaries: a #GstVideoColorPrimaries
727 * Converts #GstVideoColorPrimaries to the "colour primaries" (ColourPrimaries)
728 * value defined by "ISO/IEC 23001-8 Section 7.1 Table 2"
729 * and "ITU-T H.273 Table 2".
730 * "H.264 Table E-3" and "H.265 Table E.3" share the identical values.
732 * Returns: The value of ISO/IEC 23001-8 colour primaries.
737 gst_video_color_primaries_to_iso (GstVideoColorPrimaries primaries)
740 case GST_VIDEO_COLOR_PRIMARIES_BT709:
742 case GST_VIDEO_COLOR_PRIMARIES_BT470M:
744 case GST_VIDEO_COLOR_PRIMARIES_BT470BG:
746 case GST_VIDEO_COLOR_PRIMARIES_SMPTE170M:
748 case GST_VIDEO_COLOR_PRIMARIES_SMPTE240M:
750 case GST_VIDEO_COLOR_PRIMARIES_FILM:
752 case GST_VIDEO_COLOR_PRIMARIES_BT2020:
754 case GST_VIDEO_COLOR_PRIMARIES_SMPTEST428:
756 case GST_VIDEO_COLOR_PRIMARIES_SMPTERP431:
758 case GST_VIDEO_COLOR_PRIMARIES_SMPTEEG432:
760 case GST_VIDEO_COLOR_PRIMARIES_EBU3213:
762 case GST_VIDEO_COLOR_PRIMARIES_ADOBERGB:
763 case GST_VIDEO_COLOR_PRIMARIES_UNKNOWN:
770 * gst_video_color_matrix_from_iso:
771 * @value: a ITU-T H.273 matrix coefficients value
773 * Converts the @value to the #GstVideoColorMatrix
774 * The matrix coefficients (MatrixCoefficients) value is
775 * defined by "ISO/IEC 23001-8 Section 7.3 Table 4"
776 * and "ITU-T H.273 Table 4".
777 * "H.264 Table E-5" and "H.265 Table E.5" share the identical values.
779 * Returns: the matched #GstVideoColorMatrix
784 gst_video_color_matrix_from_iso (guint value)
788 return GST_VIDEO_COLOR_MATRIX_RGB;
790 return GST_VIDEO_COLOR_MATRIX_BT709;
792 return GST_VIDEO_COLOR_MATRIX_FCC;
795 return GST_VIDEO_COLOR_MATRIX_BT601;
797 return GST_VIDEO_COLOR_MATRIX_SMPTE240M;
799 return GST_VIDEO_COLOR_MATRIX_BT2020;
802 return GST_VIDEO_COLOR_MATRIX_UNKNOWN;
807 * gst_video_color_transfer_from_iso:
808 * @value: a ITU-T H.273 transfer characteristics value
810 * Converts the @value to the #GstVideoTransferFunction
811 * The transfer characteristics (TransferCharacteristics) value is
812 * defined by "ISO/IEC 23001-8 Section 7.2 Table 3"
813 * and "ITU-T H.273 Table 3".
814 * "H.264 Table E-4" and "H.265 Table E.4" share the identical values.
816 * Returns: the matched #GstVideoTransferFunction
820 GstVideoTransferFunction
821 gst_video_color_transfer_from_iso (guint value)
825 return GST_VIDEO_TRANSFER_BT709;
827 return GST_VIDEO_TRANSFER_GAMMA22;
829 return GST_VIDEO_TRANSFER_GAMMA28;
831 return GST_VIDEO_TRANSFER_BT601;
833 return GST_VIDEO_TRANSFER_SMPTE240M;
835 return GST_VIDEO_TRANSFER_GAMMA10;
837 return GST_VIDEO_TRANSFER_LOG100;
839 return GST_VIDEO_TRANSFER_LOG316;
841 return GST_VIDEO_TRANSFER_SRGB;
843 return GST_VIDEO_TRANSFER_BT2020_10;
845 return GST_VIDEO_TRANSFER_BT2020_12;
847 return GST_VIDEO_TRANSFER_SMPTE2084;
849 return GST_VIDEO_TRANSFER_ARIB_STD_B67;
852 return GST_VIDEO_TRANSFER_UNKNOWN;
857 * gst_video_color_primaries_from_iso:
858 * @value: a ITU-T H.273 colour primaries value
860 * Converts the @value to the #GstVideoColorPrimaries
861 * The colour primaries (ColourPrimaries) value is
862 * defined by "ISO/IEC 23001-8 Section 7.1 Table 2" and "ITU-T H.273 Table 2".
863 * "H.264 Table E-3" and "H.265 Table E.3" share the identical values.
865 * Returns: the matched #GstVideoColorPrimaries
869 GstVideoColorPrimaries
870 gst_video_color_primaries_from_iso (guint value)
874 return GST_VIDEO_COLOR_PRIMARIES_BT709;
876 return GST_VIDEO_COLOR_PRIMARIES_BT470M;
878 return GST_VIDEO_COLOR_PRIMARIES_BT470BG;
880 return GST_VIDEO_COLOR_PRIMARIES_SMPTE170M;
882 return GST_VIDEO_COLOR_PRIMARIES_SMPTE240M;
884 return GST_VIDEO_COLOR_PRIMARIES_FILM;
886 return GST_VIDEO_COLOR_PRIMARIES_BT2020;
888 return GST_VIDEO_COLOR_PRIMARIES_SMPTEST428;
890 return GST_VIDEO_COLOR_PRIMARIES_SMPTERP431;
892 return GST_VIDEO_COLOR_PRIMARIES_SMPTEEG432;
894 return GST_VIDEO_COLOR_PRIMARIES_EBU3213;
897 return GST_VIDEO_COLOR_PRIMARIES_UNKNOWN;