VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
grcolourspacematrix.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Graeme Walker
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 ///
18 /// \file grcolourspacematrix.h
19 ///
20 /// This file has been machine generated -- do not edit
21 ///
22 
23 #ifndef GR_COLOURSPACE_MATRIX__H
24 #define GR_COLOURSPACE_MATRIX__H
25 
26 #include "gdef.h"
27 
28 namespace Gr
29 {
30 namespace ColourSpace
31 {
32 
33 /// \class Gr::ColourSpace::matrix_256_inverse
34 /// Rgb-to-yuv matrix using scaled integers where 256 is 1.
35 ///
37 {
38  static g__constexpr int scale = 256 ;
39 
40  static g__constexpr int ry = 256 ;
41  static g__constexpr int ru = 0 ;
42  static g__constexpr int rv = 359 ; // 2*(kg+kb)
43 
44  static g__constexpr int gy = 256 ;
45  static g__constexpr int gu = -88 ; // -2*(kr+kg)*kb/kg
46  static g__constexpr int gv = -183 ; // -2*(kg+kb)*kr/kg
47 
48  static g__constexpr int by = 256 ;
49  static g__constexpr int bu = 454 ; // 2*(kr+kg)
50  static g__constexpr int bv = 0 ;
51 } ;
52 
53 /// \class Gr::ColourSpace::matrix_256
54 /// Yuv-to-rgb matrix using scaled integers where 256 is 1.
55 ///
56 struct matrix_256
57 {
59  static g__constexpr int scale = 256 ;
60 
61  static g__constexpr int yr = 77 ; // kr
62  static g__constexpr int yg = 150 ; // kg=1-kr-kb
63  static g__constexpr int yb = 29 ; // kb=1-kr-kg
64 
65  static g__constexpr int ur = -43 ; // -kr/2(1-kb)
66  static g__constexpr int ug = -85 ; // -kg/2(1-kb)
67  static g__constexpr int ub = 128 ;
68 
69  static g__constexpr int vr = 128 ;
70  static g__constexpr int vg = -107 ; // -kg/2(1-kr)
71  static g__constexpr int vb = -21 ; // -kb/2(1-kr)
72 } ;
73 
74 /// \class Gr::ColourSpace::matrix_1000_inverse
75 /// Rgb-to-yuv matrix using scaled integers where 1000 is 1.
76 ///
78 {
79  static g__constexpr int scale = 1000 ;
80 
81  static g__constexpr int ry = 1000 ;
82  static g__constexpr int ru = 0 ;
83  static g__constexpr int rv = 1402 ; // 2*(kg+kb)
84 
85  static g__constexpr int gy = 1000 ;
86  static g__constexpr int gu = -344 ; // -2*(kr+kg)*kb/kg
87  static g__constexpr int gv = -714 ; // -2*(kg+kb)*kr/kg
88 
89  static g__constexpr int by = 1000 ;
90  static g__constexpr int bu = 1772 ; // 2*(kr+kg)
91  static g__constexpr int bv = 0 ;
92 } ;
93 
94 /// \class Gr::ColourSpace::matrix_1000
95 /// Yuv-to-rgb matrix using scaled integers where 1000 is 1.
96 ///
98 {
100  static g__constexpr int scale = 1000 ;
101 
102  static g__constexpr int yr = 299 ; // kr
103  static g__constexpr int yg = 587 ; // kg=1-kr-kb
104  static g__constexpr int yb = 114 ; // kb=1-kr-kg
105 
106  static g__constexpr int ur = -169 ; // -kr/2(1-kb)
107  static g__constexpr int ug = -331 ; // -kg/2(1-kb)
108  static g__constexpr int ub = 500 ;
109 
110  static g__constexpr int vr = 500 ;
111  static g__constexpr int vg = -419 ; // -kg/2(1-kr)
112  static g__constexpr int vb = -81 ; // -kb/2(1-kr)
113 } ;
114 
115 }
116 }
117 
118 #endif
Rgb-to-yuv matrix using scaled integers where 256 is 1.
Yuv-to-rgb matrix using scaled integers where 256 is 1.
Yuv-to-rgb matrix using scaled integers where 1000 is 1.
Rgb-to-yuv matrix using scaled integers where 1000 is 1.