AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
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 #if !defined(NTV2_DEPRECATE_16_0)
19  typedef std::vector <uint8_t> NTV2TestPatternBuffer, NTV2TestPatBuffer;
20 #endif // !defined(NTV2_DEPRECATE_16_0)
22 
27 {
57 };
59 
60 #define NTV2_IS_VALID_PATTERN(__S__) ((__S__) >= NTV2_TestPatt_ColorBars100 && (__S__) < NTV2_TestPatt_All)
61 #define NTV2_IS_12B_PATTERN(__S__) ((__S__) >= NTV2_TestPatt_ZonePlate_12b_RGB && (__S__) < NTV2_TestPatt_All)
62 
63 typedef std::set<NTV2TestPatternSelect> NTV2TestPatternSet;
64 typedef NTV2TestPatternSet::const_iterator NTV2TestPatternSetConstIter;
65 
66 
72 {
73  // CLASS METHODS
74  public:
78 
85  static bool canDrawTestPattern (const NTV2TestPatternSelect inPattern,
86  const NTV2FormatDescriptor & inDesc);
87 
91  static NTV2TestPatternNames getTestPatternNames (void);
92 
97  static std::string findTestPatternName (const NTV2TestPatternSelect inPattern);
98 
102  static NTV2StringList getColorNames (void); // New in SDK 16.0
103 
108  static NTV2TestPatternSelect findTestPatternByName (const std::string & inName); // New in SDK 16.0
109 
122  static ULWord findRGBColorByName (const std::string & inName); // New in SDK 16.0
124 
125  // INSTANCE METHODS
126  public:
132  virtual inline ~NTV2TestPatternGen () {}
134 
138 
151  virtual bool DrawTestPattern (const std::string & inTPName,
152  const NTV2FormatDescriptor & inFormatDesc,
153  NTV2Buffer & inBuffer); // New in SDK 16.0
166  virtual bool DrawTestPattern (const NTV2TestPatternSelect inPattern,
167  const NTV2FormatDescriptor & inFormatDesc,
168  NTV2Buffer & inBuffer); // New in SDK 16.0
169 
170 #if !defined(NTV2_DEPRECATE_16_0)
171 
174  virtual NTV2_DEPRECATED_16_0(bool DrawTestPattern (const NTV2TestPatternID tp, const NTV2FormatDesc & fd, NTV2TestPatBuffer & buf));
178  virtual NTV2_DEPRECATED_16_0(bool DrawTestPattern (const NTV2TestPatternID tp, const uint32_t w, const uint32_t h, const NTV2PixelFormat pf, NTV2TestPatBuffer & buf));
179 #endif // !defined(NTV2_DEPRECATE_16_0)
180 
185  inline bool getUseRGBSmpteRange (void) const {return mSetRGBSmpteRange;}
187  inline NTV2SignalMask getSignalMask (void) const {return mSignalMask;}
188  inline const double & getSliderValue (void) const {return mSliderValue;}
189  inline bool getAlphaFromLuma (void) const {return mSetAlphaFromLuma;}
190  inline bool setVANCToLegalBlack (void) const {return mSetDstVancBlack;}
191 
196  inline NTV2TestPatternGen & setUseRGBSmpteRange (const bool useRGBSmpteRange) {mSetRGBSmpteRange = useRGBSmpteRange; return *this;}
198  inline NTV2TestPatternGen & setSignalMask (const NTV2SignalMask signalMask) {mSignalMask = signalMask; return *this;}
199  inline NTV2TestPatternGen & setSliderValue (const double & sliderValue) {mSliderValue = sliderValue; return *this;}
200  inline NTV2TestPatternGen & setAlphaFromLuma (const bool alphaFromLuma) {mSetAlphaFromLuma = alphaFromLuma; return *this;}
206  inline NTV2TestPatternGen & setVANCToLegalBlack (const bool inClearVANC) {mSetDstVancBlack = inClearVANC; return *this;}
208 
209  // INTERNAL METHODS
210  protected:
211  virtual bool DrawSegmentedTestPattern ();
212  virtual bool DrawYCbCrFrame (uint16_t Y, uint16_t Cb, uint16_t Cr);
213  virtual bool DrawBorderFrame ();
214  virtual bool DrawLinearRampFrame ();
215  virtual bool DrawSlantRampFrame ();
216  virtual bool DrawZonePlateFrame ();
217  virtual bool DrawNoiseUniformFrame();
218  virtual bool DrawNoiseGaussianFrame();
219  virtual bool DrawQuadrantBorderFrame ();
220  virtual bool DrawColorQuadrantFrame ();
221  virtual bool DrawColorQuadrantFrameTsi ();
222  virtual bool DrawColorQuadrantFrameTsi2 ();
223 
224  // 12-bit patterns:
225  virtual bool DrawTestPatternNarrowHLG();
226  virtual bool DrawTestPatternNarrowPQ();
227  virtual bool DrawTestPatternWidePQ();
228  virtual bool Draw12BitRamp();
229  virtual bool Draw12BitZonePlate();
230  virtual void PrepareForOutput();
231 
232  bool IsSDStandard(void) const;
233  bool GetStandard (int & outStandard, bool & outIs4K, bool & outIs8K) const;
234  virtual bool drawIt (void);
235 
236  // INSTANCE DATA
237  protected:
239 // NTV2FormatDesc mDstFormat; ///< @brief Dest format
241  uint32_t mDstFrameWidth;
242  uint32_t mDstFrameHeight;
243  uint32_t mDstLinePitch;
244  uint32_t mSrcLinePitch;
245  uint32_t mDstBufferSize;
246  uint8_t * mpDstBuffer;
247  uint32_t * mpPackedLineBuffer;
252  double mSliderValue;
254 
255  uint32_t mNumPixels;
256  uint32_t mNumLines;
260  uint32_t mDataOffset;
261  uint32_t mDataSize;
262  std::vector<char> mData;
263  std::vector<uint16_t> mUnPackedRAWBuffer;
264  std::vector<uint16_t> mRGBBuffer;
265 
266 }; // NTV2TestPatternGen
267 
268 #endif // NTV2_TESTPATTERN_GEN_
bool setVANCToLegalBlack(void) const
uint8_t * mpDstBuffer
Dest buffer (start of active video)
uint32_t mDstFrameHeight
Dest height (lines)
The NTV2 test pattern generator.
std::set< NTV2TestPatternSelect > NTV2TestPatternSet
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:219
NTV2SignalMask
Definition: ntv2enums.h:1687
uint32_t ULWord
Definition: ajatypes.h:223
const double & getSliderValue(void) const
std::vector< uint16_t > mRGBBuffer
uint32_t mDstLinePitch
Dest bytes per row.
uint32_t mSrcLinePitch
Src bytes per row.
Enumerations for controlling NTV2 devices.
Defines the import/export macros for producing DLLs or LIBs.
std::vector< uint16_t > mUnPackedRAWBuffer
Describes a video frame for a given video standard or format and pixel format, including the total nu...
std::vector< uint8_t > NTV2TestPatternBuffer
uint32_t mDstFrameWidth
Dest width (pixels)
std::vector< std::string > NTV2StringList
Definition: ntv2utils.h:1155
NTV2TestPatternGen & setSignalMask(const NTV2SignalMask signalMask)
NTV2PixelFormat mDstPixelFormat
Dest pixel format.
std::vector< uint8_t > NTV2TestPatBuffer
Describes a user-space buffer on the host computer. I have an address and a length, plus some optional attributes (allocated by SDK?, page-aligned? etc.).
uint32_t mDstBufferSize
Dest visible buffer size (bytes)
#define AJAExport
Definition: export.h:33
NTV2TestPatternGen & setSliderValue(const double &sliderValue)
Declares numerous NTV2 utility functions.
NTV2SignalMask mSignalMask
Component mask for MultiBurst, LineSweep.
NTV2TestPatternGen & setAlphaFromLuma(const bool alphaFromLuma)
bool getAlphaFromLuma(void) const
NTV2TestPatternGen & setVANCToLegalBlack(const bool inClearVANC)
Changes my "clear VANC lines to legal black" setting.
double mSliderValue
Used for Zone Plate.
NTV2SignalMask getSignalMask(void) const
bool mSetDstVancBlack
Set destination VANC lines to legal black?
NTV2StringList NTV2TestPatternNames
An ordered sequence of pattern names.
#define NTV2_DEPRECATED_16_0(__f__)
Definition: ajatypes.h:529
NTV2TestPatternSelect NTV2TestPatternID
std::vector< char > mData
NTV2TestPatternSet::const_iterator NTV2TestPatternSetConstIter
uint16_t * mpUnpackedLineBuffer
NTV2TestPatternID mPatternID
Pattern number.
NTV2TestPatternSelect
Identifies a predefined NTV2 test pattern.