11 static const double kPi(3.1415926536);
415 switch (inCoeffIndex)
428 NTV2_ASSERT (
false &&
"Unhandled coefficient index");
435 switch (inCoeffIndex)
453 switch (inOffsetIndex)
470 switch (inOffsetIndex)
489 mA0 = (pre.mA0 * current.mA0) + (pre.mB0 * current.mA1) + (pre.mC0 * current.mA2);
490 mA1 = (pre.mA1 * current.mA0) + (pre.mB1 * current.mA1) + (pre.mC1 * current.mA2);
491 mA2 = (pre.mA2 * current.mA0) + (pre.mB2 * current.mA1) + (pre.mC2 * current.mA2);
493 mB0 = (pre.mA0 * current.mB0) + (pre.mB0 * current.mB1) + (pre.mC0 * current.mB2);
494 mB1 = (pre.mA1 * current.mB0) + (pre.mB1 * current.mB1) + (pre.mC1 * current.mB2);
495 mB2 = (pre.mA2 * current.mB0) + (pre.mB2 * current.mB1) + (pre.mC2 * current.mB2);
497 mC0 = (pre.mA0 * current.mC0) + (pre.mB0 * current.mC1) + (pre.mC0 * current.mC2);
498 mC1 = (pre.mA1 * current.mC0) + (pre.mB1 * current.mC1) + (pre.mC1 * current.mC2);
499 mC2 = (pre.mA2 * current.mC0) + (pre.mB2 * current.mC1) + (pre.mC2 * current.mC2);
511 mA0 = (current.mA0 * post.mA0) + (current.mB0 * post.mA1) + (current.mC0 * post.mA2);
512 mA1 = (current.mA1 * post.mA0) + (current.mB1 * post.mA1) + (current.mC1 * post.mA2);
513 mA2 = (current.mA2 * post.mA0) + (current.mB2 * post.mA1) + (current.mC2 * post.mA2);
515 mB0 = (current.mA0 * post.mB0) + (current.mB0 * post.mB1) + (current.mC0 * post.mB2);
516 mB1 = (current.mA1 * post.mB0) + (current.mB1 * post.mB1) + (current.mC1 * post.mB2);
517 mB2 = (current.mA2 * post.mB0) + (current.mB2 * post.mB1) + (current.mC2 * post.mB2);
519 mC0 = (current.mA0 * post.mC0) + (current.mB0 * post.mC1) + (current.mC0 * post.mC2);
520 mC1 = (current.mA1 * post.mC0) + (current.mB1 * post.mC1) + (current.mC1 * post.mC2);
521 mC2 = (current.mA2 * post.mC0) + (current.mB2 * post.mC1) + (current.mC2 * post.mC2);
538 double rad =
kPi * inDegrees / 180.0;
549 mPreOffset0 = inOffset0;
550 mPreOffset1 = inOffset1;
551 mPreOffset2 = inOffset2;
558 mPreOffset0 += inOffset0;
559 mPreOffset1 += inOffset1;
560 mPreOffset2 += inOffset2;
567 mPostOffsetA = inOffsetA;
568 mPostOffsetB = inOffsetB;
569 mPostOffsetC = inOffsetC;
575 mPostOffsetA += inOffsetA;
576 mPostOffsetB += inOffsetB;
577 mPostOffsetC += inOffsetC;
586 if (mA0 != 1.0 || mA1 != 0.0 || mA2 != 0.0)
589 if (mB0 != 0.0 || mB1 != 1.0 || mB2 != 0.0)
592 if (mC0 != 0.0 || mC1 != 0.0 || mC2 != 1.0)
603 if ( (mA0 != rhs.mA0) || (mA1 != rhs.mA1) || (mA2 != rhs.mA2) )
606 if ( (mB0 != rhs.mB0) || (mB1 != rhs.mB1) || (mB2 != rhs.mB2) )
609 if ( (mC0 != rhs.mC0) || (mC1 != rhs.mC1) || (mC2 != rhs.mC2) )
612 if ( (mPreOffset0 != rhs.mPreOffset0) || (mPreOffset1 != rhs.mPreOffset1) || (mPreOffset2 != rhs.mPreOffset2) )
615 if ( (mPostOffsetA != rhs.mPostOffsetA) || (mPostOffsetB != rhs.mPostOffsetB) || (mPostOffsetC != rhs.mPostOffsetC) )
641 return ::fabs(inCoeff1 - inCoeff2) < inMaxDiff;
Declares the utility class for abstract color space matrix operations.
virtual int16_t GetOffset(const NTV2CSCOffsetIndex inOffsetIndex) const
Returns the value of a requested offset.
CNTV2CSCMatrix(const NTV2ColorSpaceMatrixType inPreset=NTV2_Unity_Matrix)
Instantiates and initializes the instance with a known set of coefficients.
virtual void SetOffset(const NTV2CSCOffsetIndex inOffsetIndex, const int16_t inOffset)
Changes the specified offset to the given value.
Proportion of input component 1 applied to C output.
virtual bool operator==(const CNTV2CSCMatrix &rhs) const
Returns true if the matrix coefficients and offsets EXACTLY match those of the specified instance...
Proportion of input component 1 applied to A output.
#define NTV2_ASSERT(_expr_)
Proportion of input component 1 applied to B output.
virtual void SetGain(const double inGain0, const double inGain1, const double inGain2)
Set the matrix diagonals (gains).
virtual void AddPostOffsets(const int16_t inIncrementA, const int16_t inIncrementB, const int16_t inIncrementC)
Add post-offsets.
const int16_t NTV2_CSCMatrix_SMPTECOffset
const int16_t NTV2_CSCMatrix_ZeroOffset
enum NTV2CSCOffset NTV2CSCOffsetIndex
static const double kPi(3.1415926536)
virtual void PostMultiply(const CNTV2CSCMatrix &inPostInstance)
Post-multiply the current 3x3 matrix by the matrix of the given instance.
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...
virtual void InitMatrix(const NTV2ColorSpaceMatrixType inPreset)
Replace the current matrix coefficients with a known set of coefficients.
virtual void SetHueRotate(const double inDegrees)
Set matrix for hue rotation.
const int16_t NTV2_CSCMatrix_SMPTEYOffset
virtual bool CoeffEqual(const double inCoeff1, const double inCoeff2, const double inMaxDiff)
Tests if two coefficients differ by less than the fiven tolerance.
Proportion of input component 0 applied to C output.
virtual void SetPreOffsets(const int16_t inOffset0, const int16_t inOffset1, const int16_t inOffset2)
Set pre-offsets.
Proportion of input component 0 applied to B output.
virtual void SetPostOffsets(const int16_t inOffsetA, const int16_t inOffsetB, const int16_t inOffsetC)
Set post-offsets.
enum NTV2CSCCoeff NTV2CSCCoeffIndex
virtual void AddPreOffsets(const int16_t inIncrement0, const int16_t inIncrement1, const int16_t inIncrement2)
Add pre-offsets.
Proportion of input component 0 applied to A output.
This class supports the color space conversion matrix described below.
Proportion of input component 2 applied to C output.
virtual void SetCoefficient(const NTV2CSCCoeffIndex inCoeffIndex, const double inCoefficient)
Changes the specified matrix coefficient to the given value.
Proportion of input component 2 applied to A output.
virtual void PreMultiply(const CNTV2CSCMatrix &inPreInstance)
Pre-multiply the current 3x3 matrix by the matrix of the given instance.
virtual double GetCoefficient(const NTV2CSCCoeffIndex inCoeffIndex) const
Returns the value of a requested matrix coefficient.
virtual bool IsUnityMatrix(void)
Returns 'true' if this CSC Matrix has unity matrix coefficients.
Proportion of input component 2 applied to B output.