AJA NTV2 SDK
17.1.3.1410
NTV2 SDK 17.1.3.1410
|
This class supports the color space conversion matrix described below. More...
#include <ntv2cscmatrix.h>
Public Member Functions | |
CNTV2CSCMatrix (const NTV2ColorSpaceMatrixType inPreset=NTV2_Unity_Matrix) | |
Instantiates and initializes the instance with a known set of coefficients. More... | |
virtual | ~CNTV2CSCMatrix () |
My destructor. More... | |
virtual void | InitMatrix (const NTV2ColorSpaceMatrixType inPreset) |
Replace the current matrix coefficients with a known set of coefficients. More... | |
virtual double | GetCoefficient (const NTV2CSCCoeffIndex inCoeffIndex) const |
Returns the value of a requested matrix coefficient. More... | |
virtual void | SetCoefficient (const NTV2CSCCoeffIndex inCoeffIndex, const double inCoefficient) |
Changes the specified matrix coefficient to the given value. More... | |
virtual int16_t | GetOffset (const NTV2CSCOffsetIndex inOffsetIndex) const |
Returns the value of a requested offset. More... | |
virtual void | SetOffset (const NTV2CSCOffsetIndex inOffsetIndex, const int16_t inOffset) |
Changes the specified offset to the given value. More... | |
virtual void | PreMultiply (const CNTV2CSCMatrix &inPreInstance) |
Pre-multiply the current 3x3 matrix by the matrix of the given instance. More... | |
virtual void | PostMultiply (const CNTV2CSCMatrix &inPostInstance) |
Post-multiply the current 3x3 matrix by the matrix of the given instance. More... | |
virtual void | SetGain (const double inGain0, const double inGain1, const double inGain2) |
Set the matrix diagonals (gains). More... | |
virtual void | SetHueRotate (const double inDegrees) |
Set matrix for hue rotation. More... | |
virtual void | SetPreOffsets (const int16_t inOffset0, const int16_t inOffset1, const int16_t inOffset2) |
Set pre-offsets. More... | |
virtual void | AddPreOffsets (const int16_t inIncrement0, const int16_t inIncrement1, const int16_t inIncrement2) |
Add pre-offsets. More... | |
virtual void | SetPostOffsets (const int16_t inOffsetA, const int16_t inOffsetB, const int16_t inOffsetC) |
Set post-offsets. More... | |
virtual void | AddPostOffsets (const int16_t inIncrementA, const int16_t inIncrementB, const int16_t inIncrementC) |
Add post-offsets. More... | |
virtual bool | IsUnityMatrix (void) |
Returns 'true' if this CSC Matrix has unity matrix coefficients. More... | |
virtual bool | operator== (const CNTV2CSCMatrix &rhs) const |
Returns true if the matrix coefficients and offsets EXACTLY match those of the specified instance. More... | |
virtual bool | operator!= (const CNTV2CSCMatrix &rhs) const |
Returns true if the matrix coefficients and offsets differ from those of the specified instance. More... | |
virtual bool | IsEqual (const CNTV2CSCMatrix &inCSCMatrix, const double inMaxDiff=NTV2CSCMatrix_MaxCoeffDiff) |
Tests if the matrix coefficients can all be considered equal to those of the specified instance,. More... | |
virtual bool | CoeffEqual (const double inCoeff1, const double inCoeff2, const double inMaxDiff) |
Tests if two coefficients differ by less than the fiven tolerance. More... | |
This class supports the color space conversion matrix described below.
The CSC matrix consists of a pre-subtractor, a 3x3 matrix multiplier, and a post-adder. It receives up to three components as input (labeled Input0, Input1, and Input2), cross-processes them, and outputs them as OutputA, OutputB, OutputC. The standard component assignment for GBR and YCbCr video is: YCbCr RGB Input0 / OutputA = Y G Input1 / OutputB = Cb B Input2 / OutputC = Cr R
The basic purpose of the pre-subtractor is to remove any DC bias(es) that may be on the input video prior to the matrix multiply. For example, YCbCr video typically has a "black" offset of 0x10 for luminance (Y) and 0x80 for chrominance (Cb/Cr - values given for 8-bit video). In general, these offsets must be subtracted from the video before using the 3x3 matrix.
Similarly, the post-adder is typically used to re-add "black" biases to the output video. Note that both pre- and post-offsets are typically "positive" values, and assume a left-justified representation within a 16-bit integer. In the above example, Y Black offset would be 0x0800 (i.e. 0x10 with an added sign bit and ls-padded to 16 bits). Similarly, C Black Offset is 0x4000 (0x80 with a sign bit and ls-padded to 16 bits).
The 3x3 matrix coefficients are labeled according to the input (0, 1, or 2) and output (A, B, or C) they affect. For example, coefficient "A0" determines the amount of Input0 that is applied to OutputA. The matrix form of the equation can be represented as:
[OutA OutB OutC] = [In0 In1 In2] [ A0 B0 C0 A1 B1 C1 A2 B2 C2 ]
This class has methods for presetting known matrix values (for "typical" RGB <=> YUV conversions), as well as some typical "gain" and "hue rotation" matrices. It also includes methods for combining matrices for more complex effects, including matrix multiplication.
Definition at line 98 of file ntv2cscmatrix.h.
|
explicit |
Instantiates and initializes the instance with a known set of coefficients.
[in] | inPreset | Specifies an initial setting for the matrix coefficients. |
Definition at line 14 of file ntv2cscmatrix.cpp.
|
inlinevirtual |
My destructor.
Definition at line 111 of file ntv2cscmatrix.h.
|
virtual |
Add post-offsets.
[in] | inIncrementA | The amount to be added to the existing postOffsetA |
[in] | inIncrementB | The amount to be added to the existing postOffsetB |
[in] | inIncrementC | The amount to be added to the existing postOffsetC |
Definition at line 573 of file ntv2cscmatrix.cpp.
|
virtual |
Add pre-offsets.
[in] | inIncrement0 | The amount to be added to the existing preOffset0 |
[in] | inIncrement1 | The amount to be added to the existing preOffset1 |
[in] | inIncrement2 | The amount to be added to the existing preOffset2 |
Definition at line 556 of file ntv2cscmatrix.cpp.
|
virtual |
Tests if two coefficients differ by less than the fiven tolerance.
[in] | inCoeff1 | Specifies the first coefficient to be compared |
[in] | inCoeff2 | Specifies the second coefficient to be compared |
[in] | inMaxDiff | Specifies the amount by which two coefficients can differ and still be considered "equal" |
Definition at line 639 of file ntv2cscmatrix.cpp.
|
virtual |
Returns the value of a requested matrix coefficient.
[in] | inCoeffIndex | Specifies which matrix coefficient to return. |
Definition at line 413 of file ntv2cscmatrix.cpp.
|
virtual |
Returns the value of a requested offset.
[in] | inOffsetIndex | Specifies which offset to return. |
Definition at line 451 of file ntv2cscmatrix.cpp.
|
virtual |
Replace the current matrix coefficients with a known set of coefficients.
[in] | inPreset | Specifies a new setting for the matrix coefficients. |
Definition at line 20 of file ntv2cscmatrix.cpp.
|
virtual |
Tests if the matrix coefficients can all be considered equal to those of the specified instance,.
[in] | inCSCMatrix | Specifies a reference to a CNTV2CSCMatrix instance. |
[in] | inMaxDiff | Specifies the amount by which two coefficients can differ and still be considered "equal" |
Definition at line 622 of file ntv2cscmatrix.cpp.
|
virtual |
Returns 'true' if this CSC Matrix has unity matrix coefficients.
Definition at line 582 of file ntv2cscmatrix.cpp.
|
inlinevirtual |
Returns true if the matrix coefficients and offsets differ from those of the specified instance.
Definition at line 239 of file ntv2cscmatrix.h.
|
virtual |
Returns true if the matrix coefficients and offsets EXACTLY match those of the specified instance.
Definition at line 601 of file ntv2cscmatrix.cpp.
|
virtual |
Post-multiply the current 3x3 matrix by the matrix of the given instance.
[in] | inPostInstance | Specifies a reference to a CNTV2CSCMatrix instance. |
Definition at line 505 of file ntv2cscmatrix.cpp.
|
virtual |
Pre-multiply the current 3x3 matrix by the matrix of the given instance.
[in] | inPreInstance | Specifies a reference to a CNTV2CSCMatrix instance. |
Definition at line 483 of file ntv2cscmatrix.cpp.
|
virtual |
Changes the specified matrix coefficient to the given value.
[in] | inCoeffIndex | Specifies which matrix coefficient to change. |
[in] | inCoefficient | Specifies the new matrix coefficient value. |
Definition at line 433 of file ntv2cscmatrix.cpp.
|
virtual |
Set the matrix diagonals (gains).
[in] | inGain0 | Specifies the amount of gain to be applied to the 1st channel (unity = 1.0) |
[in] | inGain1 | Specifies the amount of gain to be applied to the 2nd channel |
[in] | inGain2 | Specifies the amount of gain to be applied to the 3rd channel |
Definition at line 527 of file ntv2cscmatrix.cpp.
|
virtual |
Set matrix for hue rotation.
[in] | inDegrees | Amount of Cb/Cr "rotation" (in degrees) |
Definition at line 536 of file ntv2cscmatrix.cpp.
|
virtual |
Changes the specified offset to the given value.
[in] | inOffsetIndex | Specifies which offset to change. |
[in] | inOffset | Specifies the new offset value. |
Definition at line 468 of file ntv2cscmatrix.cpp.
|
virtual |
Set post-offsets.
[in] | inOffsetA | The zero, or "black" level of the 1st output channel |
[in] | inOffsetB | The zero, or "black" level of the 2nd output channel |
[in] | inOffsetC | The zero, or "black" level of the 3rd output channel |
Definition at line 565 of file ntv2cscmatrix.cpp.
|
virtual |
Set pre-offsets.
[in] | inOffset0 | The zero, or "black" level of the 1st input channel |
[in] | inOffset1 | The zero, or "black" level of the 2nd input channel |
[in] | inOffset2 | The zero, or "black" level of the 3rd input channel |
Definition at line 547 of file ntv2cscmatrix.cpp.