aja-vpid-data.cpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. #include "aja-vpid-data.hpp"
  2. VPIDData::VPIDData()
  3. : mVpidA{0},
  4. mVpidB{0},
  5. mStandardA{VPIDStandard_Unknown},
  6. mStandardB{VPIDStandard_Unknown},
  7. mSamplingA{VPIDSampling_XYZ_444},
  8. mSamplingB{VPIDSampling_XYZ_444},
  9. mBitDepthA{VPIDBitDepth_8},
  10. mBitDepthB{VPIDBitDepth_8}
  11. {
  12. }
  13. VPIDData::VPIDData(ULWord vpidA, ULWord vpidB)
  14. : mVpidA{vpidA},
  15. mVpidB{vpidB},
  16. mStandardA{VPIDStandard_Unknown},
  17. mStandardB{VPIDStandard_Unknown},
  18. mSamplingA{VPIDSampling_XYZ_444},
  19. mSamplingB{VPIDSampling_XYZ_444},
  20. mBitDepthA{VPIDBitDepth_8},
  21. mBitDepthB{VPIDBitDepth_8}
  22. {
  23. Parse();
  24. }
  25. VPIDData::VPIDData(const VPIDData &other)
  26. : mVpidA{other.mVpidA},
  27. mVpidB{other.mVpidB},
  28. mStandardA{VPIDStandard_Unknown},
  29. mStandardB{VPIDStandard_Unknown},
  30. mSamplingA{VPIDSampling_XYZ_444},
  31. mSamplingB{VPIDSampling_XYZ_444},
  32. mBitDepthA{VPIDBitDepth_8},
  33. mBitDepthB{VPIDBitDepth_8}
  34. {
  35. Parse();
  36. }
  37. VPIDData::VPIDData(VPIDData &&other)
  38. : mVpidA{other.mVpidA},
  39. mVpidB{other.mVpidB},
  40. mStandardA{VPIDStandard_Unknown},
  41. mStandardB{VPIDStandard_Unknown},
  42. mSamplingA{VPIDSampling_XYZ_444},
  43. mSamplingB{VPIDSampling_XYZ_444},
  44. mBitDepthA{VPIDBitDepth_8},
  45. mBitDepthB{VPIDBitDepth_8}
  46. {
  47. Parse();
  48. }
  49. VPIDData &VPIDData::operator=(const VPIDData &other)
  50. {
  51. mVpidA = other.mVpidA;
  52. mVpidB = other.mVpidB;
  53. mStandardA = other.mStandardA;
  54. mStandardB = other.mStandardB;
  55. mSamplingA = other.mSamplingA;
  56. mSamplingB = other.mSamplingB;
  57. mBitDepthA = other.mBitDepthA;
  58. mBitDepthB = other.mBitDepthB;
  59. return *this;
  60. }
  61. VPIDData &VPIDData::operator=(VPIDData &&other)
  62. {
  63. mVpidA = other.mVpidA;
  64. mVpidB = other.mVpidB;
  65. mStandardA = other.mStandardA;
  66. mStandardB = other.mStandardB;
  67. mSamplingA = other.mSamplingA;
  68. mSamplingB = other.mSamplingB;
  69. mBitDepthA = other.mBitDepthA;
  70. mBitDepthB = other.mBitDepthB;
  71. return *this;
  72. }
  73. bool VPIDData::operator==(const VPIDData &rhs) const
  74. {
  75. return (mVpidA == rhs.mVpidA && mVpidB == rhs.mVpidB);
  76. }
  77. bool VPIDData::operator!=(const VPIDData &rhs) const
  78. {
  79. return !operator==(rhs);
  80. }
  81. void VPIDData::SetA(ULWord vpidA)
  82. {
  83. mVpidA = vpidA;
  84. }
  85. void VPIDData::SetB(ULWord vpidB)
  86. {
  87. mVpidB = vpidB;
  88. }
  89. void VPIDData::Parse()
  90. {
  91. CNTV2VPID parserA;
  92. parserA.SetVPID(mVpidA);
  93. mStandardA = parserA.GetStandard();
  94. mSamplingA = parserA.GetSampling();
  95. mBitDepthA = parserA.GetBitDepth();
  96. CNTV2VPID parserB;
  97. parserB.SetVPID(mVpidB);
  98. mStandardB = parserB.GetStandard();
  99. mSamplingB = parserB.GetSampling();
  100. mBitDepthB = parserB.GetBitDepth();
  101. }
  102. bool VPIDData::IsRGB() const
  103. {
  104. switch (mSamplingA) {
  105. default:
  106. break;
  107. case VPIDSampling_GBR_444:
  108. case VPIDSampling_GBRA_4444:
  109. case VPIDSampling_GBRD_4444:
  110. return true;
  111. }
  112. return false;
  113. }
  114. VPIDStandard VPIDData::Standard() const
  115. {
  116. return mStandardA;
  117. }
  118. VPIDSampling VPIDData::Sampling() const
  119. {
  120. return mSamplingA;
  121. }
  122. VPIDBitDepth VPIDData::BitDepth() const
  123. {
  124. return mBitDepthA;
  125. }