AJA NTV2 SDK  17.0.1.1246
NTV2 SDK 17.0.1.1246
ntv2testpatterngen.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
8 #ifndef NTV2_TESTPATTERN_GEN_
9 #define NTV2_TESTPATTERN_GEN_
10 
11 #include "ajaexport.h"
12 #include "ntv2enums.h"
13 #include "ntv2utils.h"
14 #include <vector>
15 #include <set>
16 #include <string>
17 
18 typedef std::vector <uint8_t> NTV2TestPatternBuffer, NTV2TestPatBuffer;
20 
25 {
53 };
55 
56 #define NTV2_IS_VALID_PATTERN(__S__) ((__S__) >= NTV2_TestPatt_ColorBars100 && (__S__) < NTV2_TestPatt_All)
57 #define NTV2_IS_12B_PATTERN(__S__) ((__S__) >= NTV2_TestPatt_ZonePlate_12b_RGB && (__S__) < NTV2_TestPatt_All)
58 
59 typedef std::set<NTV2TestPatternSelect> NTV2TestPatternSet;
60 typedef NTV2TestPatternSet::const_iterator NTV2TestPatternSetConstIter;
61 
62 
68 {
69  // CLASS METHODS
70  public:
74 
81  static bool canDrawTestPattern (const NTV2TestPatternSelect inPattern,
82  const NTV2FormatDescriptor & inDesc);
83 
87  static NTV2TestPatternNames getTestPatternNames (void);
88 
92  static NTV2StringList getColorNames (void); // New in SDK 16.0
93 
98  static NTV2TestPatternSelect findTestPatternByName (const std::string & inName); // New in SDK 16.0
99 
112  static ULWord findRGBColorByName (const std::string & inName); // New in SDK 16.0
114 
115  // INSTANCE METHODS
116  public:
122  virtual inline ~NTV2TestPatternGen () {}
124 
128 
141  virtual bool DrawTestPattern (const std::string & inTPName,
142  const NTV2FormatDescriptor & inFormatDesc,
143  NTV2Buffer & inBuffer); // New in SDK 16.0
156  virtual bool DrawTestPattern (const NTV2TestPatternSelect inPattern,
157  const NTV2FormatDescriptor & inFormatDesc,
158  NTV2Buffer & inBuffer); // New in SDK 16.0
159 
160 #if !defined(NTV2_DEPRECATE_16_0)
161 
164  virtual NTV2_DEPRECATED_f(bool DrawTestPattern (const NTV2TestPatternSelect inPattern, const NTV2FormatDescriptor & inDesc, NTV2TestPatBuffer & outBuffer));
168  virtual NTV2_DEPRECATED_f(bool DrawTestPattern (const NTV2TestPatternSelect inPat, const uint32_t inWdth, const uint32_t inHght, const NTV2FrameBufferFormat inPF, NTV2TestPatBuffer & outBuf));
169 #endif // !defined(NTV2_DEPRECATE_16_0)
170 
175  inline bool getUseRGBSmpteRange (void) const {return mSetRGBSmpteRange;}
177  inline NTV2SignalMask getSignalMask (void) const {return mSignalMask;}
178  inline const double & getSliderValue (void) const {return mSliderValue;}
179  inline bool getAlphaFromLuma (void) const {return mSetAlphaFromLuma;}
180  inline bool setVANCToLegalBlack (void) const {return mSetDstVancBlack;}
181 
186  inline NTV2TestPatternGen & setUseRGBSmpteRange (const bool useRGBSmpteRange) {mSetRGBSmpteRange = useRGBSmpteRange; return *this;}
188  inline NTV2TestPatternGen & setSignalMask (const NTV2SignalMask signalMask) {mSignalMask = signalMask; return *this;}
189  inline NTV2TestPatternGen & setSliderValue (const double & sliderValue) {mSliderValue = sliderValue; return *this;}
190  inline NTV2TestPatternGen & setAlphaFromLuma (const bool alphaFromLuma) {mSetAlphaFromLuma = alphaFromLuma; return *this;}
196  inline NTV2TestPatternGen & setVANCToLegalBlack (const bool inClearVANC) {mSetDstVancBlack = inClearVANC; return *this;}
198 
199  // INTERNAL METHODS
200  protected:
201  virtual bool DrawSegmentedTestPattern ();
202  virtual bool DrawYCbCrFrame (uint16_t Y, uint16_t Cb, uint16_t Cr);
203  virtual bool DrawBorderFrame ();
204  virtual bool DrawLinearRampFrame ();
205  virtual bool DrawSlantRampFrame ();
206  virtual bool DrawZonePlateFrame ();
207  virtual bool DrawQuadrantBorderFrame ();
208  virtual bool DrawColorQuadrantFrame ();
209  virtual bool DrawColorQuadrantFrameTsi ();
210  virtual bool DrawColorQuadrantFrameTsi2 ();
211 
212  // 12-bit patterns:
213  virtual bool DrawTestPatternNarrowHLG();
214  virtual bool DrawTestPatternNarrowPQ();
215  virtual bool DrawTestPatternWidePQ();
216  virtual bool Draw12BitRamp();
217  virtual bool Draw12BitZonePlate();
218  virtual void PrepareForOutput();
219 
220  bool IsSDStandard(void) const;
221  bool GetStandard (int & outStandard, bool & outIs4K, bool & outIs8K) const;
222  virtual bool drawIt (void);
223 
224  // INSTANCE DATA
225  protected:
227 // NTV2FormatDesc mDstFormat; ///< @brief Dest format
229  uint32_t mDstFrameWidth;
230  uint32_t mDstFrameHeight;
231  uint32_t mDstLinePitch;
232  uint32_t mSrcLinePitch;
233  uint32_t mDstBufferSize;
234  uint8_t * mpDstBuffer;
235  uint32_t * mpPackedLineBuffer;
240  double mSliderValue;
242 
243  uint32_t mNumPixels;
244  uint32_t mNumLines;
248  uint32_t mDataOffset;
249  uint32_t mDataSize;
250  std::vector<char> mData;
251  std::vector<uint16_t> mUnPackedRAWBuffer;
252  std::vector<uint16_t> mRGBBuffer;
253 
254 }; // NTV2TestPatternGen
255 
256 #endif // NTV2_TESTPATTERN_GEN_
NTV2_TestPatt_LinearRamp_12b_RGB
@ NTV2_TestPatt_LinearRamp_12b_RGB
Definition: ntv2testpatterngen.h:46
NTV2TestPatternGen::getSignalMask
NTV2SignalMask getSignalMask(void) const
Definition: ntv2testpatterngen.h:177
NTV2_TestPatt_TsiAlignment
@ NTV2_TestPatt_TsiAlignment
Definition: ntv2testpatterngen.h:44
NTV2TestPatternGen::mpUnpackedLineBuffer
uint16_t * mpUnpackedLineBuffer
Definition: ntv2testpatterngen.h:236
ajaexport.h
Defines the import/export macros for producing DLLs or LIBs.
NTV2TestPatternID
NTV2TestPatternSelect NTV2TestPatternID
Definition: ntv2testpatterngen.h:54
NTV2_TestPatt_CheckField
@ NTV2_TestPatt_CheckField
Definition: ntv2testpatterngen.h:32
NTV2TestPatternGen::mSliderValue
double mSliderValue
Used for Zone Plate.
Definition: ntv2testpatterngen.h:240
NTV2_TestPatt_MultiBurst
@ NTV2_TestPatt_MultiBurst
Definition: ntv2testpatterngen.h:30
NTV2FormatDescriptor
Describes a video frame for a given video standard or format and pixel format, including the total nu...
Definition: ntv2formatdescriptor.h:41
NTV2TestPatternSelect
NTV2TestPatternSelect
Identifies a predefined NTV2 test pattern.
Definition: ntv2testpatterngen.h:24
NTV2_TestPatt_All
@ NTV2_TestPatt_All
Definition: ntv2testpatterngen.h:50
NTV2Buffer
A generic user-space buffer object that has an address and a length. Used most often to share an arbi...
Definition: ntv2publicinterface.h:5967
NTV2TestPatternGen::getAlphaFromLuma
bool getAlphaFromLuma(void) const
Definition: ntv2testpatterngen.h:179
NTV2_TestPatt_PQ_Wide_12b_RGB
@ NTV2_TestPatt_PQ_Wide_12b_RGB
Definition: ntv2testpatterngen.h:49
NTV2TestPatternGen::mSetDstVancBlack
bool mSetDstVancBlack
Set destination VANC lines to legal black?
Definition: ntv2testpatterngen.h:239
NTV2TestPatternGen::setAlphaFromLuma
NTV2TestPatternGen & setAlphaFromLuma(const bool alphaFromLuma)
Definition: ntv2testpatterngen.h:190
NTV2TestPatternGen::mDstPixelFormat
NTV2PixelFormat mDstPixelFormat
Dest pixel format.
Definition: ntv2testpatterngen.h:228
NTV2_TestPatt_ColorBars100
@ NTV2_TestPatt_ColorBars100
Definition: ntv2testpatterngen.h:26
NTV2TestPatternGen::mBitsPerComponent
uint32_t mBitsPerComponent
Definition: ntv2testpatterngen.h:245
NTV2FrameBufferFormat
NTV2FrameBufferFormat
Identifies a particular video frame buffer format. See Device Frame Buffer Formats for details.
Definition: ntv2enums.h:207
NTV2_TestPatt_INVALID
@ NTV2_TestPatt_INVALID
Definition: ntv2testpatterngen.h:51
NTV2TestPatternGen::mRGBBuffer
std::vector< uint16_t > mRGBBuffer
Definition: ntv2testpatterngen.h:252
NTV2_TestPatt_PQ_Narrow_12b_RGB
@ NTV2_TestPatt_PQ_Narrow_12b_RGB
Definition: ntv2testpatterngen.h:48
NTV2SignalMask
NTV2SignalMask
Definition: ntv2enums.h:1632
NTV2TestPatBuffer
std::vector< uint8_t > NTV2TestPatBuffer
A byte vector that stores a complete video frame.
Definition: ntv2testpatterngen.h:18
NTV2_TestPatt_ZonePlate_12b_RGB
@ NTV2_TestPatt_ZonePlate_12b_RGB
Definition: ntv2testpatterngen.h:45
NTV2TestPatternGen::getSliderValue
const double & getSliderValue(void) const
Definition: ntv2testpatterngen.h:178
NTV2TestPatternSetConstIter
NTV2TestPatternSet::const_iterator NTV2TestPatternSetConstIter
Definition: ntv2testpatterngen.h:60
NTV2_TestPatt_White
@ NTV2_TestPatt_White
Definition: ntv2testpatterngen.h:36
NTV2TestPatternGen::setSliderValue
NTV2TestPatternGen & setSliderValue(const double &sliderValue)
Definition: ntv2testpatterngen.h:189
NTV2TestPatternBuffer
std::vector< uint8_t > NTV2TestPatternBuffer
Definition: ntv2testpatterngen.h:18
NTV2TestPatternGen::mSetAlphaFromLuma
bool mSetAlphaFromLuma
Definition: ntv2testpatterngen.h:238
NTV2_TestPatt_Ramp
@ NTV2_TestPatt_Ramp
Definition: ntv2testpatterngen.h:29
ULWord
uint32_t ULWord
Definition: ajatypes.h:246
NTV2_TestPatt_FlatField
@ NTV2_TestPatt_FlatField
Definition: ntv2testpatterngen.h:33
NTV2_TestPatt_HLG_Narrow_12b_RGB
@ NTV2_TestPatt_HLG_Narrow_12b_RGB
Definition: ntv2testpatterngen.h:47
NTV2_TestPatt_ColorQuadrantTsi
@ NTV2_TestPatt_ColorQuadrantTsi
Definition: ntv2testpatterngen.h:43
NTV2_TestPatt_ColorQuadrant
@ NTV2_TestPatt_ColorQuadrant
Definition: ntv2testpatterngen.h:41
NTV2_TestPatt_ColorQuadrantBorder
@ NTV2_TestPatt_ColorQuadrantBorder
Definition: ntv2testpatterngen.h:42
ntv2enums.h
Enumerations for controlling NTV2 devices.
NTV2TestPatternGen::mpDstBuffer
uint8_t * mpDstBuffer
Dest buffer (start of active video)
Definition: ntv2testpatterngen.h:234
ntv2utils.h
Declares numerous NTV2 utility functions.
NTV2TestPatternGen::mData
std::vector< char > mData
Definition: ntv2testpatterngen.h:250
NTV2_TestPatt_Black
@ NTV2_TestPatt_Black
Definition: ntv2testpatterngen.h:35
NTV2_TestPatt_SlantRamp
@ NTV2_TestPatt_SlantRamp
Definition: ntv2testpatterngen.h:39
NTV2_TestPatt_ColorBars75
@ NTV2_TestPatt_ColorBars75
Definition: ntv2testpatterngen.h:28
NTV2_TestPatt_ZonePlate
@ NTV2_TestPatt_ZonePlate
Definition: ntv2testpatterngen.h:40
NTV2TestPatternGen::mpPackedLineBuffer
uint32_t * mpPackedLineBuffer
Definition: ntv2testpatterngen.h:235
NTV2TestPatternGen::mNumPixels
uint32_t mNumPixels
Definition: ntv2testpatterngen.h:243
NTV2StringList
std::vector< std::string > NTV2StringList
Definition: ntv2utils.h:1134
NTV2TestPatternGen
The NTV2 test pattern generator.
Definition: ntv2testpatterngen.h:67
NTV2_TestPatt_LAST
@ NTV2_TestPatt_LAST
Definition: ntv2testpatterngen.h:52
NTV2_TestPatt_Border
@ NTV2_TestPatt_Border
Definition: ntv2testpatterngen.h:37
NTV2_DEPRECATED_f
#define NTV2_DEPRECATED_f(__f__)
Definition: ajatypes.h:646
NTV2TestPatternGen::mPatternID
NTV2TestPatternID mPatternID
Pattern number.
Definition: ntv2testpatterngen.h:226
NTV2TestPatternGen::mSamplesPerPixel
uint32_t mSamplesPerPixel
Definition: ntv2testpatterngen.h:246
NTV2TestPatternGen::~NTV2TestPatternGen
virtual ~NTV2TestPatternGen()
Definition: ntv2testpatterngen.h:122
NTV2TestPatternGen::mSrcLinePitch
uint32_t mSrcLinePitch
Src bytes per row.
Definition: ntv2testpatterngen.h:232
NTV2TestPatternGen::mDataOffset
uint32_t mDataOffset
Definition: ntv2testpatterngen.h:248
NTV2TestPatternGen::mDstFrameWidth
uint32_t mDstFrameWidth
Dest width (pixels)
Definition: ntv2testpatterngen.h:229
AJAExport
#define AJAExport
Definition: export.h:33
NTV2TestPatternGen::mDstFrameHeight
uint32_t mDstFrameHeight
Dest height (lines)
Definition: ntv2testpatterngen.h:230
NTV2TestPatternGen::mDstBufferSize
uint32_t mDstBufferSize
Dest visible buffer size (bytes)
Definition: ntv2testpatterngen.h:233
NTV2TestPatternGen::mNumLines
uint32_t mNumLines
Definition: ntv2testpatterngen.h:244
NTV2TestPatternGen::setSignalMask
NTV2TestPatternGen & setSignalMask(const NTV2SignalMask signalMask)
Definition: ntv2testpatterngen.h:188
NTV2TestPatternGen::mDstLinePitch
uint32_t mDstLinePitch
Dest bytes per row.
Definition: ntv2testpatterngen.h:231
NTV2_TestPatt_MultiPattern
@ NTV2_TestPatt_MultiPattern
Definition: ntv2testpatterngen.h:34
NTV2_TestPatt_FIRST
@ NTV2_TestPatt_FIRST
Definition: ntv2testpatterngen.h:27
NTV2_TestPatt_LineSweep
@ NTV2_TestPatt_LineSweep
Definition: ntv2testpatterngen.h:31
NTV2TestPatternGen::mDataSize
uint32_t mDataSize
Definition: ntv2testpatterngen.h:249
NTV2TestPatternGen::mCompressionType
uint16_t mCompressionType
Definition: ntv2testpatterngen.h:247
NTV2_TestPatt_LinearRamp
@ NTV2_TestPatt_LinearRamp
Definition: ntv2testpatterngen.h:38
NTV2TestPatternGen::mSignalMask
NTV2SignalMask mSignalMask
Component mask for MultiBurst, LineSweep.
Definition: ntv2testpatterngen.h:241
NTV2TestPatternGen::mUnPackedRAWBuffer
std::vector< uint16_t > mUnPackedRAWBuffer
Definition: ntv2testpatterngen.h:251
NTV2TestPatternGen::setVANCToLegalBlack
NTV2TestPatternGen & setVANCToLegalBlack(const bool inClearVANC)
Changes my "clear VANC lines to legal black" setting.
Definition: ntv2testpatterngen.h:196
NTV2TestPatternGen::mSetRGBSmpteRange
bool mSetRGBSmpteRange
Definition: ntv2testpatterngen.h:237
NTV2TestPatternNames
NTV2StringList NTV2TestPatternNames
A list (std::vector) of pattern names.
Definition: ntv2testpatterngen.h:19
NTV2TestPatternSet
std::set< NTV2TestPatternSelect > NTV2TestPatternSet
Definition: ntv2testpatterngen.h:59