16 #include <libavutil/pixfmt.h> 19 template<u
int8_t Order>
25 explicit CMatrix(
const std::array<std::array<float, Order>, Order>& other) : m_mat(other) {}
26 explicit CMatrix(
const std::array<std::array<float, Order - 1>, Order - 1>& other);
29 virtual CMatrix operator*(
const std::array<std::array<float, Order>, Order>& other);
34 CMatrix& operator=(
const std::array<std::array<float, Order - 1>, Order - 1>& other);
38 for (
int i = 0; i < Order; ++i)
40 for (
int j = 0; j < Order; ++j)
42 if (m_mat[i][j] == other.m_mat[i][j])
46 if (std::abs(m_mat[i][j] - other.m_mat[i][j]) <=
47 (std::max(std::abs(other.m_mat[i][j]), std::abs(m_mat[i][j])) * 1e-2f))
57 std::array<float, Order>& operator[](
int index) {
return m_mat[index]; }
59 const std::array<float, Order>& operator[](
int index)
const {
return m_mat[index]; }
61 std::array<std::array<float, Order>, Order>& Get();
63 const std::array<std::array<float, Order>, Order>& Get()
const;
67 float* ToRaw() {
return &m_mat[0][0]; }
70 std::array<std::array<float, Order>, Order> Invert(
71 std::array<std::array<float, Order>, Order>& other)
const;
73 std::array<std::array<float, Order>, Order> m_mat{{}};
81 explicit CGlMatrix(
const std::array<std::array<float, 3>, 3>& other);
83 CMatrix operator*(
const std::array<std::array<float, 4>, 4>& other)
override;
89 CScale(
float x,
float y,
float z);
90 ~
CScale()
override =
default;
116 PrimaryToXYZ(
const float (&primaries)[3][2],
const float (&whitepoint)[2]);
121 float CalcBy(
const float p[3][2],
const float w[2]);
122 float CalcGy(
const float p[3][2],
const float w[2],
const float By);
123 float CalcRy(
const float By,
const float Gy);
129 PrimaryToRGB(
float (&primaries)[3][2],
float (&whitepoint)[2]);
137 using Matrix3x1 = std::array<float, 3>;
180 CConvertMatrix& SetDestinationColorPrimaries(AVColorPrimaries dst);
220 static Matrix3x1 GetRGBYuvCoefs(AVColorSpace colspace);
226 std::unique_ptr<CGlMatrix> m_mat;
227 std::unique_ptr<CMatrix<3>> m_matPrim;
229 AVColorSpace m_colSpace = AVCOL_SPC_BT709;
230 AVColorPrimaries m_colPrimariesSrc = AVCOL_PRI_BT709;
231 float m_gammaSrc = 2.2f;
232 bool m_limitedSrc =
true;
233 AVColorPrimaries m_colPrimariesDst = AVCOL_PRI_BT709;
234 float m_gammaDst = 2.2f;
235 bool m_limitedDst =
false;
237 int m_srcTextureBits = 8;
238 float m_contrast = 1.0;
Helper class used for YUV to RGB conversions.
Definition: ConversionMatrix.h:144
Definition: ConversionMatrix.h:20
Definition: ConversionMatrix.h:100
Definition: ConversionMatrix.h:113
Definition: ConversionMatrix.h:76
Definition: ConversionMatrix.h:126
Definition: ConversionMatrix.h:86
Definition: ConversionMatrix.h:93