AJA NTV2 SDK  18.1.0.2439
NTV2 SDK 18.1.0.2439
ntv2utils.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: MIT */
7 #include "ajatypes.h"
8 #include "ntv2utils.h"
9 #include "ntv2formatdescriptor.h"
10 #include "ntv2registerexpert.h"
11 #include "ntv2videodefines.h"
12 #include "ntv2audiodefines.h"
13 #include "ntv2endian.h"
14 #include "ntv2debug.h"
15 #include "ntv2transcode.h"
16 #include "ntv2version.h"
17 #include "ntv2devicefeatures.h" // Required for NTV2DeviceCanDoVideoFormat
18 #include "ajabase/system/lock.h"
19 #include "ajabase/system/info.h"
20 #include "ajabase/common/common.h"
21 #if defined(AJALinux)
22  #include <string.h> // For memset
23  #include <stdint.h>
24 
25 #endif
26 #include <algorithm>
27 #include <sstream>
28 #include <iomanip>
29 #include <iterator>
30 #include <map>
31 
32 
33 using namespace std;
34 
35 
36 // Macros to simplify returning of strings for given enum
37 #define NTV2UTILS_ENUM_CASE_RETURN_STR(enum_name) case(enum_name): return #enum_name
38 
39 #define NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(condition, retail_name, enum_name)\
40  case(enum_name): return condition ? retail_name : #enum_name
41 
43 // BEGIN SECTION MOVED FROM 'videoutilities.cpp'
45 
46 uint32_t CalcRowBytesForFormat (const NTV2FrameBufferFormat inPixelFormat, const uint32_t inPixelWidth)
47 {
48  uint32_t rowBytes = 0;
49 
50  switch (inPixelFormat)
51  {
54  rowBytes = inPixelWidth * 2;
55  break;
56 
59  rowBytes = (( inPixelWidth % 48 == 0 ) ? inPixelWidth : (((inPixelWidth / 48 ) + 1) * 48)) * 8 / 3;
60  break;
61 
62  case NTV2_FBF_10BIT_RGB:
63  case NTV2_FBF_10BIT_DPX:
66  case NTV2_FBF_ARGB:
67  case NTV2_FBF_RGBA:
68  case NTV2_FBF_ABGR:
69  rowBytes = inPixelWidth * 4;
70  break;
71 
72  case NTV2_FBF_24BIT_RGB:
73  case NTV2_FBF_24BIT_BGR:
74  rowBytes = inPixelWidth * 3;
75  break;
76 
78  rowBytes = inPixelWidth * 2/4;
79  break;
80 
81  case NTV2_FBF_48BIT_RGB:
82  rowBytes = inPixelWidth * 6;
83  break;
84 
86  rowBytes = inPixelWidth * 36 / 8;
87  break;
88 
91  rowBytes = inPixelWidth * 20 / 16;
92  break;
93 
96  rowBytes = inPixelWidth;
97  break;
98 
100  rowBytes = inPixelWidth * 5;
101  break;
102 
104  case NTV2_FBF_8BIT_HDV:
107  case NTV2_FBF_PRORES_HDV:
108  case NTV2_FBF_16BIT_ARGB:
115  // TO DO.....add more
116  break;
117  }
118 
119  return rowBytes;
120 }
121 
122 
123 bool UnpackLine_10BitYUVtoUWordSequence (const void * pIn10BitYUVLine, UWordSequence & out16BitYUVLine, ULWord inNumPixels)
124 {
125  out16BitYUVLine.clear();
126  const ULWord * pInputLine (reinterpret_cast <const ULWord *> (pIn10BitYUVLine));
127 
128  if (!pInputLine)
129  return false; // bad pointer
130  if (inNumPixels < 6)
131  return false; // bad width
132  if (inNumPixels % 6)
133  inNumPixels -= inNumPixels % 6;
134 
135  const ULWord totalULWords (inNumPixels * 4 / 6); // 4 ULWords per 6 pixels
136  out16BitYUVLine.reserve(totalULWords * 3);
137  for (ULWord inputCount (0); inputCount < totalULWords; inputCount++)
138  {
139  out16BitYUVLine.push_back ((pInputLine [inputCount] ) & 0x3FF);
140  out16BitYUVLine.push_back ((pInputLine [inputCount] >> 10) & 0x3FF);
141  out16BitYUVLine.push_back ((pInputLine [inputCount] >> 20) & 0x3FF);
142  }
143  return true;
144 }
145 
146 
147 bool UnpackLine_10BitYUVtoUWordSequence (const void * pIn10BitYUVLine, const NTV2FormatDescriptor & inFormatDesc, UWordSequence & out16BitYUVLine)
148 {
149  out16BitYUVLine.clear();
150  const ULWord * pInputLine (reinterpret_cast <const ULWord *> (pIn10BitYUVLine));
151 
152  if (!pInputLine)
153  return false; // bad pointer
154  if (!inFormatDesc.IsValid())
155  return false; // bad formatDesc
156  if (inFormatDesc.GetRasterWidth() < 6)
157  return false; // bad width
158  if (inFormatDesc.GetPixelFormat() != NTV2_FBF_10BIT_YCBCR)
159  return false; // wrong FBF
160 
161  out16BitYUVLine.reserve(inFormatDesc.linePitch * 3);
162  for (ULWord inputCount (0); inputCount < inFormatDesc.linePitch; inputCount++)
163  {
164  out16BitYUVLine.push_back ((pInputLine [inputCount] ) & 0x3FF);
165  out16BitYUVLine.push_back ((pInputLine [inputCount] >> 10) & 0x3FF);
166  out16BitYUVLine.push_back ((pInputLine [inputCount] >> 20) & 0x3FF);
167  }
168  return true;
169 }
170 
171 
172 bool UnpackLine_10BitARGBtoUWordSequence (const void * pIn10BitARGBLine, const NTV2FormatDescriptor & inFormatDesc, UWordSequence & out16BitARGBLine)
173 {
174  out16BitARGBLine.clear();
175  const UByte * pInputLine (reinterpret_cast <const UByte *> (pIn10BitARGBLine));
176 
177  if (!pInputLine)
178  return false; // bad pointer
179  if (!inFormatDesc.IsValid())
180  return false; // bad formatDesc
181  if (inFormatDesc.GetRasterWidth() < 1)
182  return false; // bad width
183  if (inFormatDesc.GetPixelFormat() != NTV2_FBF_10BIT_ARGB)
184  return false; // wrong FBF
185 
186  out16BitARGBLine.reserve(inFormatDesc.linePitch * 4);
187  for (ULWord inputCount (0); inputCount < inFormatDesc.linePitch; inputCount++)
188  {
189  out16BitARGBLine.push_back ((UWord(pInputLine[1] & 0x03) << 8) | (UWord(pInputLine[0] & 0xFF) >> 0)); // B
190  out16BitARGBLine.push_back ((UWord(pInputLine[2] & 0x0F) << 6) | (UWord(pInputLine[1] & 0xFC) >> 2)); // G
191  out16BitARGBLine.push_back ((UWord(pInputLine[3] & 0x3F) << 4) | (UWord(pInputLine[2] & 0xF0) >> 4)); // R
192  out16BitARGBLine.push_back ((UWord(pInputLine[4] & 0xFF) << 2) | (UWord(pInputLine[3] & 0xC0) >> 6)); // A
193  pInputLine += 5;
194  }
195  return true;
196 }
197 
198 
199 // UnPack10BitYCbCrBuffer
200 // UnPack 10 Bit YCbCr Data to 16 bit Word per component
201 void UnPack10BitYCbCrBuffer (uint32_t* packedBuffer, uint16_t* ycbcrBuffer, uint32_t numPixels)
202 {
203  for ( uint32_t sampleCount = 0, dataCount = 0;
204  sampleCount < (numPixels*2) ;
205  sampleCount+=3,dataCount++ )
206  {
207  ycbcrBuffer[sampleCount] = packedBuffer[dataCount]&0x3FF;
208  ycbcrBuffer[sampleCount+1] = (packedBuffer[dataCount]>>10)&0x3FF;
209  ycbcrBuffer[sampleCount+2] = (packedBuffer[dataCount]>>20)&0x3FF;
210 
211  }
212 }
213 
214 // PackTo10BitYCbCrBuffer
215 // Pack 16 bit Word per component to 10 Bit YCbCr Data
216 void PackTo10BitYCbCrBuffer (const uint16_t * ycbcrBuffer, uint32_t * packedBuffer, const uint32_t numPixels)
217 {
218  for ( uint32_t inputCount=0, outputCount=0;
219  inputCount < (numPixels*2);
220  outputCount += 4, inputCount += 12 )
221  {
222  packedBuffer[outputCount] = uint32_t (ycbcrBuffer[inputCount+0]) + uint32_t (ycbcrBuffer[inputCount+1]<<10) + uint32_t (ycbcrBuffer[inputCount+2]<<20);
223  packedBuffer[outputCount+1] = uint32_t (ycbcrBuffer[inputCount+3]) + uint32_t (ycbcrBuffer[inputCount+4]<<10) + uint32_t (ycbcrBuffer[inputCount+5]<<20);
224  packedBuffer[outputCount+2] = uint32_t (ycbcrBuffer[inputCount+6]) + uint32_t (ycbcrBuffer[inputCount+7]<<10) + uint32_t (ycbcrBuffer[inputCount+8]<<20);
225  packedBuffer[outputCount+3] = uint32_t (ycbcrBuffer[inputCount+9]) + uint32_t (ycbcrBuffer[inputCount+10]<<10) + uint32_t (ycbcrBuffer[inputCount+11]<<20);
226  }
227 }
228 
229 void MakeUnPacked10BitYCbCrBuffer( uint16_t* buffer, uint16_t Y , uint16_t Cb , uint16_t Cr,uint32_t numPixels )
230 {
231  // assumes lineData is large enough for numPixels
232  for ( uint32_t count = 0; count < numPixels*2; count+=4 )
233  {
234  buffer[count] = Cb;
235  buffer[count+1] = Y;
236  buffer[count+2] = Cr;
237  buffer[count+3] = Y;
238  }
239 }
240 
241 
242 // ConvertLineTo8BitYCbCr
243 // 10 Bit YCbCr to 8 Bit YCbCr
244 void ConvertLineTo8BitYCbCr (const uint16_t * ycbcr10BitBuffer, uint8_t * ycbcr8BitBuffer, const uint32_t numPixels)
245 {
246  for (uint32_t pixel(0); pixel < numPixels * 2; pixel++)
247  ycbcr8BitBuffer[pixel] = uint8_t(ycbcr10BitBuffer[pixel] >> 2);
248 }
249 
250 //***********************************************************************************************************
251 
252 // ConvertUnpacked10BitYCbCrToPixelFormat()
253 // Converts a line of "unpacked" 10-bit Y/Cb/Cr pixels into a "packed" line in the pixel format
254 // for the current frame buffer format.
255 void ConvertUnpacked10BitYCbCrToPixelFormat(uint16_t *unPackedBuffer, uint32_t *packedBuffer, uint32_t numPixels, NTV2FrameBufferFormat pixelFormat,
256  bool bUseSmpteRange, bool bAlphaFromLuma)
257 {
258  bool bIsSD = false;
259  if(numPixels < 1280)
260  bIsSD = true;
261 
262  switch(pixelFormat)
263  {
265  PackTo10BitYCbCrBuffer(unPackedBuffer, packedBuffer, numPixels);
266  break;
267 
268  case NTV2_FBF_8BIT_YCBCR:
269  ConvertLineTo8BitYCbCr(unPackedBuffer, reinterpret_cast<uint8_t*>(packedBuffer), numPixels);
270  break;
271 
272  case NTV2_FBF_ARGB:
273  ConvertLinetoRGB(unPackedBuffer, reinterpret_cast<RGBAlphaPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange, bAlphaFromLuma);
274  break;
275 
276  case NTV2_FBF_RGBA:
277  ConvertLinetoRGB(unPackedBuffer, reinterpret_cast<RGBAlphaPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange, bAlphaFromLuma);
278  ConvertARGBYCbCrToRGBA(reinterpret_cast<UByte*>(packedBuffer), numPixels);
279  break;
280 
281  case NTV2_FBF_10BIT_RGB:
282  ConvertLineto10BitRGB(unPackedBuffer, reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
283  PackRGB10BitFor10BitRGB(reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels);
284  break;
285 
287  ConvertLineTo8BitYCbCr(unPackedBuffer, reinterpret_cast<uint8_t*>(packedBuffer), numPixels);
288  Convert8BitYCbCrToYUY2(reinterpret_cast<uint8_t*>(packedBuffer), numPixels);
289  break;
290 
291  case NTV2_FBF_ABGR:
292  ConvertLinetoRGB(unPackedBuffer, reinterpret_cast<RGBAlphaPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange, bAlphaFromLuma);
293  ConvertARGBYCbCrToABGR(reinterpret_cast<uint8_t*>(packedBuffer), numPixels);
294  break;
295 
296  case NTV2_FBF_10BIT_DPX:
297  ConvertLineto10BitRGB(unPackedBuffer, reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
298  PackRGB10BitFor10BitDPX(reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels);
299  break;
300 
303  break;
304 
305  case NTV2_FBF_24BIT_RGB:
306  ConvertLinetoRGB(unPackedBuffer,reinterpret_cast<RGBAlphaPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
307  ConvertARGBToRGB(reinterpret_cast<UByte*>(packedBuffer), reinterpret_cast<UByte*>(packedBuffer), numPixels);
308  break;
309 
310  case NTV2_FBF_24BIT_BGR:
311  ConvertLinetoRGB(unPackedBuffer,reinterpret_cast<RGBAlphaPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
312  ConvertARGBToBGR(reinterpret_cast<UByte*>(packedBuffer), reinterpret_cast<UByte*>(packedBuffer), numPixels);
313  break;
314 
316  ConvertLineto10BitRGB(unPackedBuffer, reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
317  PackRGB10BitFor10BitDPX(reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels, false);
318  break;
319 
320  case NTV2_FBF_48BIT_RGB:
321  ConvertLineto16BitRGB(unPackedBuffer, reinterpret_cast<RGBAlpha16BitPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
322  Convert16BitARGBTo16BitRGB(reinterpret_cast<RGBAlpha16BitPixel*>(packedBuffer), reinterpret_cast<UWord*>(packedBuffer), numPixels);
323  break;
324 
326  ConvertLineto10BitRGB(unPackedBuffer, reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
327  PackRGB10BitFor10BitRGBPacked(reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels);
328  break;
329 
330  case NTV2_FBF_10BIT_ARGB:
331  ConvertLineto10BitRGB(unPackedBuffer, reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange, bAlphaFromLuma);
332  PackRGB10BitFor10BitARGBPacked(reinterpret_cast<RGBAlpha10BitPixel*>(packedBuffer), numPixels);
333  break;
334 
336  ConvertLineto16BitRGB(unPackedBuffer, reinterpret_cast<RGBAlpha16BitPixel*>(packedBuffer), numPixels, bIsSD, bUseSmpteRange);
337  Convert16BitARGBTo12BitRGBPacked(reinterpret_cast<RGBAlpha16BitPixel*>(packedBuffer), reinterpret_cast<UByte*>(packedBuffer), numPixels);
338  break;
339 
340  #if defined(_DEBUG)
343  case NTV2_FBF_8BIT_HDV:
346  case NTV2_FBF_PRORES_HDV:
347  case NTV2_FBF_16BIT_ARGB:
357  case NTV2_FBF_LAST:
358  break;
359  #else
360  default: break;
361  #endif
362  }
363 }
364 
365 // MaskUnPacked10BitYCbCrBuffer
366 // Mask Data In place based on signalMask
367 void MaskUnPacked10BitYCbCrBuffer( uint16_t* ycbcrUnPackedBuffer, uint16_t signalMask , uint32_t numPixels )
368 {
369  uint32_t pixelCount;
370 
371  // Not elegant but fairly fast.
372  switch ( signalMask )
373  {
374  case NTV2_SIGNALMASK_NONE: // Output Black
375  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
376  {
377  ycbcrUnPackedBuffer[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
378  ycbcrUnPackedBuffer[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
379  ycbcrUnPackedBuffer[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
380  ycbcrUnPackedBuffer[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
381  }
382  break;
383  case NTV2_SIGNALMASK_Y:
384  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
385  {
386  ycbcrUnPackedBuffer[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
387  ycbcrUnPackedBuffer[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
388  }
389 
390  break;
391  case NTV2_SIGNALMASK_Cb:
392  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
393  {
394  ycbcrUnPackedBuffer[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
395  ycbcrUnPackedBuffer[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
396  ycbcrUnPackedBuffer[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
397  }
398 
399  break;
401  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
402  {
403  ycbcrUnPackedBuffer[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
404  }
405 
406  break;
407 
408  case NTV2_SIGNALMASK_Cr:
409  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
410  {
411  ycbcrUnPackedBuffer[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
412  ycbcrUnPackedBuffer[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
413  ycbcrUnPackedBuffer[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
414  }
415 
416 
417  break;
419  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
420  {
421  ycbcrUnPackedBuffer[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
422  }
423 
424 
425  break;
427  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
428  {
429  ycbcrUnPackedBuffer[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
430  ycbcrUnPackedBuffer[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
431  }
432 
433 
434  break;
436  // Do nothing
437  break;
438  }
439 
440 }
441 
442 
443 
444 //--------------------------------------------------------------------------------------------------------------------
445 // StackQuadrants()
446 //
447 // Take a 4K source, cut it into 4 quandrants and stack it into the destination. Also handle cases where
448 // where source/destination rowBytes/widths are mismatched (eg 4096 -> 3840)
449 //--------------------------------------------------------------------------------------------------------------------
450 void StackQuadrants(uint8_t* pSrc, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcRowBytes,
451  uint8_t* pDst)
452 {
453  (void) srcWidth;
454  uint32_t dstSample;
455  uint32_t srcSample;
456  uint32_t copyRowBytes = srcRowBytes/2;
457  uint32_t copyHeight = srcHeight/2;
458  uint32_t dstRowBytes = copyRowBytes;
459  uint32_t dstHeight = srcHeight/2;
460  //uint32_t dstWidth = srcWidth/2;
461 
462  // rowbytes for left hand side quadrant
463  uint32_t srcLHSQuadrantRowBytes = srcRowBytes/2;
464 
465  for (uint32_t quadrant=0; quadrant<4; quadrant++)
466  {
467  // starting point for source quadrant
468  switch (quadrant)
469  {
470  default:
471  case 0: srcSample = 0; break; // quadrant 0, upper left
472  case 1: srcSample = srcLHSQuadrantRowBytes; break; // quadrant 1, upper right
473  case 2: srcSample = (srcRowBytes*copyHeight); break; // quadrant 2, lower left
474  case 3: srcSample = (srcRowBytes*copyHeight) + srcLHSQuadrantRowBytes; break; // quadrant 3, lower right
475  }
476 
477  // starting point for destination stack
478  dstSample = quadrant * dstRowBytes * dstHeight;
479 
480  for (uint32_t row=0; row<copyHeight; row++)
481  {
482  memcpy(&pDst[dstSample], &pSrc[srcSample], copyRowBytes);
483  dstSample += dstRowBytes;
484  srcSample += srcRowBytes;
485  }
486  }
487 }
488 
489 // Copy a quater-sized quadrant from a source buffer to a destination buffer
490 // quad13Offset is almost always zero, but can be used for Quadrants 1, 3 for special offset frame buffers. (e.g. 4096x1080 10Bit YCbCr frame buffers)
491 void CopyFromQuadrant(uint8_t* srcBuffer, uint32_t srcHeight, uint32_t srcRowBytes, uint32_t srcQuadrant, uint8_t* dstBuffer, uint32_t quad13Offset)
492 {
493  ULWord dstSample = 0;
494  ULWord srcSample = 0;
495  ULWord dstHeight = srcHeight / 2;
496  ULWord dstRowBytes = srcRowBytes / 2;
497 
498  // calculate starting point for source of copy, based on source quadrant
499  switch (srcQuadrant)
500  {
501  default:
502  case 0: srcSample = 0; break; // quadrant 0, upper left
503  case 1: srcSample = dstRowBytes - quad13Offset; break; // quadrant 1, upper right
504  case 2: srcSample = srcRowBytes*dstHeight; break; // quadrant 2, lower left
505  case 3: srcSample = srcRowBytes*dstHeight + dstRowBytes - quad13Offset; break; // quadrant 3, lower right
506  }
507 
508  // for each row
509  for (ULWord i=0; i<dstHeight; i++)
510  {
511  memcpy(&dstBuffer[dstSample], &srcBuffer[srcSample], dstRowBytes);
512  dstSample += dstRowBytes;
513  srcSample += srcRowBytes;
514  }
515 }
516 
517 // Copy a source buffer to a quadrant of a 4x-sized destination buffer
518 // quad13Offset is almost always zero, but can be used for Quadrants 1, 3 for special offset frame buffers. (e.g. 4096x1080 10Bit YCbCr frame buffers)
519 void CopyToQuadrant(uint8_t* srcBuffer, uint32_t srcHeight, uint32_t srcRowBytes, uint32_t dstQuadrant, uint8_t* dstBuffer, uint32_t quad13Offset)
520 {
521  ULWord dstSample = 0;
522  ULWord srcSample = 0;
523  ULWord dstRowBytes = srcRowBytes * 2;
524 
525  // calculate starting point for destination of copy, based on destination quadrant
526  switch (dstQuadrant)
527  {
528  default:
529  case 0: dstSample = 0; break; // quadrant 0, upper left
530  case 1: dstSample = srcRowBytes - quad13Offset; break; // quadrant 1, upper right
531  case 2: dstSample = dstRowBytes*srcHeight; break; // quadrant 2, lower left
532  case 3: dstSample = dstRowBytes*srcHeight + srcRowBytes - quad13Offset; break; // quadrant 3, lower right
533  }
534 
535  // for each row
536  for (ULWord i=0; i<srcHeight; i++)
537  {
538  memcpy(&dstBuffer[dstSample], &srcBuffer[srcSample], srcRowBytes);
539  dstSample += dstRowBytes;
540  srcSample += srcRowBytes;
541  }
542 }
544 // END SECTION MOVED FROM 'videoutilities.cpp'
546 
547 
548 void UnpackLine_10BitYUVto16BitYUV (const ULWord * pIn10BitYUVLine, UWord * pOut16BitYUVLine, const ULWord inNumPixels)
549 {
550  NTV2_ASSERT (pIn10BitYUVLine && pOut16BitYUVLine && "UnpackLine_10BitYUVto16BitYUV -- NULL buffer pointer(s)");
551  NTV2_ASSERT (inNumPixels && "UnpackLine_10BitYUVto16BitYUV -- Zero pixel count");
552 
553  for (ULWord outputCount = 0, inputCount = 0;
554  outputCount < (inNumPixels * 2);
555  outputCount += 3, inputCount++)
556  {
557  pOut16BitYUVLine [outputCount ] = pIn10BitYUVLine [inputCount] & 0x3FF;
558  pOut16BitYUVLine [outputCount + 1] = (pIn10BitYUVLine [inputCount] >> 10) & 0x3FF;
559  pOut16BitYUVLine [outputCount + 2] = (pIn10BitYUVLine [inputCount] >> 20) & 0x3FF;
560  }
561 }
562 
563 
564 void PackLine_16BitYUVto10BitYUV (const UWord * pIn16BitYUVLine, ULWord * pOut10BitYUVLine, const ULWord inNumPixels)
565 {
566  NTV2_ASSERT (pIn16BitYUVLine && pOut10BitYUVLine && "PackLine_16BitYUVto10BitYUV -- NULL buffer pointer(s)");
567  NTV2_ASSERT (inNumPixels && "PackLine_16BitYUVto10BitYUV -- Zero pixel count");
568 
569  for (ULWord inputCount = 0, outputCount = 0;
570  inputCount < (inNumPixels * 2);
571  outputCount += 4, inputCount += 12)
572  {
573  pOut10BitYUVLine [outputCount ] = ULWord (pIn16BitYUVLine [inputCount + 0]) + (ULWord (pIn16BitYUVLine [inputCount + 1]) << 10) + (ULWord (pIn16BitYUVLine [inputCount + 2]) << 20);
574  pOut10BitYUVLine [outputCount + 1] = ULWord (pIn16BitYUVLine [inputCount + 3]) + (ULWord (pIn16BitYUVLine [inputCount + 4]) << 10) + (ULWord (pIn16BitYUVLine [inputCount + 5]) << 20);
575  pOut10BitYUVLine [outputCount + 2] = ULWord (pIn16BitYUVLine [inputCount + 6]) + (ULWord (pIn16BitYUVLine [inputCount + 7]) << 10) + (ULWord (pIn16BitYUVLine [inputCount + 8]) << 20);
576  pOut10BitYUVLine [outputCount + 3] = ULWord (pIn16BitYUVLine [inputCount + 9]) + (ULWord (pIn16BitYUVLine [inputCount +10]) << 10) + (ULWord (pIn16BitYUVLine [inputCount +11]) << 20);
577  } // for each component in the line
578 }
579 
580 
581 bool PackLine_UWordSequenceTo10BitYUV (const UWordSequence & in16BitYUVLine, ULWord * pOut10BitYUVLine, const ULWord inNumPixels)
582 {
583  if (!pOut10BitYUVLine)
584  return false; // NULL buffer pointer
585  if (!inNumPixels)
586  return false; // Zero pixel count
587  if (ULWord(in16BitYUVLine.size()) < inNumPixels*2)
588  return false; // UWordSequence too small
589 
590  for (ULWord inputCount = 0, outputCount = 0;
591  inputCount < (inNumPixels * 2);
592  outputCount += 4, inputCount += 12)
593  {
594  pOut10BitYUVLine[outputCount ] = ULWord(in16BitYUVLine[inputCount + 0]) + (ULWord(in16BitYUVLine[inputCount + 1]) << 10) + (ULWord(in16BitYUVLine[inputCount + 2]) << 20);
595  pOut10BitYUVLine[outputCount + 1] = ULWord(in16BitYUVLine[inputCount + 3]) + (ULWord(in16BitYUVLine[inputCount + 4]) << 10) + (ULWord(in16BitYUVLine[inputCount + 5]) << 20);
596  pOut10BitYUVLine[outputCount + 2] = ULWord(in16BitYUVLine[inputCount + 6]) + (ULWord(in16BitYUVLine[inputCount + 7]) << 10) + (ULWord(in16BitYUVLine[inputCount + 8]) << 20);
597  pOut10BitYUVLine[outputCount + 3] = ULWord(in16BitYUVLine[inputCount + 9]) + (ULWord(in16BitYUVLine[inputCount +10]) << 10) + (ULWord(in16BitYUVLine[inputCount +11]) << 20);
598  } // for each component in the line
599  return true;
600 }
601 
602 
603 bool YUVComponentsTo10BitYUVPackedBuffer (const vector<uint16_t> & inYCbCrLine, NTV2Buffer & inFrameBuffer,
604  const NTV2FormatDescriptor & inDescriptor, const UWord inLineOffset)
605 {
606  if (inYCbCrLine.size() < 12)
607  return false; // Input vector needs at least 12 components
608  if (inFrameBuffer.IsNULL())
609  return false; // NULL frame buffer
610  if (!inDescriptor.IsValid())
611  return false; // Bad format descriptor
612  if (ULWord(inLineOffset) >= inDescriptor.GetFullRasterHeight())
613  return false; // Illegal line offset
614  if (inDescriptor.GetPixelFormat() != NTV2_FBF_10BIT_YCBCR)
615  return false; // Not 'v210' pixel format
616 
617  const uint32_t pixPerLineX2 (inDescriptor.GetRasterWidth() * 2);
618  uint32_t * pOutPackedLine (AJA_NULL);
619  if (inFrameBuffer.GetByteCount() < inDescriptor.GetBytesPerRow() * ULWord(inLineOffset+1))
620  return false; // Buffer too small
621 
622  pOutPackedLine = reinterpret_cast<uint32_t*>(inDescriptor.GetWriteableRowAddress(inFrameBuffer.GetHostAddress(0), inLineOffset));
623  if (!pOutPackedLine)
624  return false; // Buffer too small
625 
626  for (uint32_t inputCount = 0, outputCount = 0; inputCount < pixPerLineX2; outputCount += 4, inputCount += 12)
627  {
628  if ((inputCount+11) >= uint32_t(inYCbCrLine.size()))
629  break; // Early exit (not fatal)
630  #if defined(_DEBUG) // 'at' throws upon bad index values
631  pOutPackedLine[outputCount] = uint32_t(inYCbCrLine.at(inputCount+0)) | uint32_t(inYCbCrLine.at(inputCount+ 1)<<10) | uint32_t(inYCbCrLine.at(inputCount+ 2)<<20);
632  pOutPackedLine[outputCount+1] = uint32_t(inYCbCrLine.at(inputCount+3)) | uint32_t(inYCbCrLine.at(inputCount+ 4)<<10) | uint32_t(inYCbCrLine.at(inputCount+ 5)<<20);
633  pOutPackedLine[outputCount+2] = uint32_t(inYCbCrLine.at(inputCount+6)) | uint32_t(inYCbCrLine.at(inputCount+ 7)<<10) | uint32_t(inYCbCrLine.at(inputCount+ 8)<<20);
634  pOutPackedLine[outputCount+3] = uint32_t(inYCbCrLine.at(inputCount+9)) | uint32_t(inYCbCrLine.at(inputCount+10)<<10) | uint32_t(inYCbCrLine.at(inputCount+11)<<20);
635  #else // 'operator[]' doesn't throw
636  pOutPackedLine[outputCount] = uint32_t(inYCbCrLine[inputCount+0]) | uint32_t(inYCbCrLine[inputCount+ 1]<<10) | uint32_t(inYCbCrLine[inputCount+ 2]<<20);
637  pOutPackedLine[outputCount+1] = uint32_t(inYCbCrLine[inputCount+3]) | uint32_t(inYCbCrLine[inputCount+ 4]<<10) | uint32_t(inYCbCrLine[inputCount+ 5]<<20);
638  pOutPackedLine[outputCount+2] = uint32_t(inYCbCrLine[inputCount+6]) | uint32_t(inYCbCrLine[inputCount+ 7]<<10) | uint32_t(inYCbCrLine[inputCount+ 8]<<20);
639  pOutPackedLine[outputCount+3] = uint32_t(inYCbCrLine[inputCount+9]) | uint32_t(inYCbCrLine[inputCount+10]<<10) | uint32_t(inYCbCrLine[inputCount+11]<<20);
640  #endif
641  }
642  return true;
643 }
644 
645 
646 bool UnpackLine_10BitYUVtoU16s (vector<uint16_t> & outYCbCrLine, const NTV2Buffer & inFrameBuffer,
647  const NTV2FormatDescriptor & inDescriptor, const UWord inLineOffset)
648 {
649  outYCbCrLine.clear();
650  if (inFrameBuffer.IsNULL())
651  return false; // NULL frame buffer
652  if (!inDescriptor.IsValid())
653  return false; // Bad format descriptor
654  if (ULWord(inLineOffset) >= inDescriptor.GetFullRasterHeight())
655  return false; // Illegal line offset
656  if (inDescriptor.GetPixelFormat() != NTV2_FBF_10BIT_YCBCR)
657  return false; // Not 'v210' pixel format
658  if (inDescriptor.GetRasterWidth () < 6)
659  return false; // bad width
660 
661  const ULWord * pInputLine (reinterpret_cast<const ULWord*>(inDescriptor.GetRowAddress(inFrameBuffer.GetHostPointer(), inLineOffset)));
662  outYCbCrLine.reserve (inDescriptor.linePitch * 3);
663  for (ULWord inputCount(0); inputCount < inDescriptor.linePitch; inputCount++)
664  {
665  outYCbCrLine.push_back((pInputLine[inputCount] ) & 0x3FF);
666  outYCbCrLine.push_back((pInputLine[inputCount] >> 10) & 0x3FF);
667  outYCbCrLine.push_back((pInputLine[inputCount] >> 20) & 0x3FF);
668  }
669  return true;
670 }
671 
672 
673 // RePackLineDataForYCbCrDPX
674 void RePackLineDataForYCbCrDPX(ULWord *packedycbcrLine, ULWord numULWords )
675 {
676  for ( UWord count = 0; count < numULWords; count++)
677  {
678  ULWord value = (packedycbcrLine[count])<<2;
679  value = (value<<24) + ((value>>24)&0x000000FF) + ((value<<8)&0x00FF0000) + ((value>>8)&0x0000FF00);
680 
681  packedycbcrLine[count] = value;
682  }
683 }
684 // UnPack 10 Bit DPX Format linebuffer to RGBAlpha10BitPixel linebuffer.
685 void UnPack10BitDPXtoRGBAlpha10BitPixel(RGBAlpha10BitPixel* rgba10BitBuffer, const ULWord* DPXLinebuffer ,ULWord numPixels, bool bigEndian)
686 {
687  for ( ULWord pixel=0;pixel<numPixels;pixel++)
688  {
689  ULWord value = DPXLinebuffer[pixel];
690  if ( bigEndian)
691  {
692  rgba10BitBuffer[pixel].Red = UWord((value&0xC0)>>14) + UWord((value&0xFF)<<2);
693  rgba10BitBuffer[pixel].Green = UWord((value&0x3F00)>>4) + UWord((value&0xF00000)>>20);
694  rgba10BitBuffer[pixel].Blue = UWord((value&0xFC000000)>>26) + UWord((value&0xF0000)>>12);
695  }
696  else
697  {
698  rgba10BitBuffer[pixel].Red = (value>>22)&0x3FF;
699  rgba10BitBuffer[pixel].Green = (value>>12)&0x3FF;
700  rgba10BitBuffer[pixel].Blue = (value>>2)&0x3FF;
701 
702  }
703  }
704 }
705 
706 void UnPack10BitDPXtoForRP215withEndianSwap(UWord* rawrp215Buffer,ULWord* DPXLinebuffer ,ULWord numPixels)
707 {
708  // gets the green component.
709  for ( ULWord pixel=0;pixel<numPixels;pixel++)
710  {
711  ULWord value = DPXLinebuffer[pixel];
712  rawrp215Buffer[pixel] = ((value&0x3F00)>>4) + ((value&0xF00000)>>20);
713  }
714 }
715 
716 void UnPack10BitDPXtoForRP215(UWord* rawrp215Buffer,ULWord* DPXLinebuffer ,ULWord numPixels)
717 {
718  // gets the green component.
719  for ( ULWord pixel=0;pixel<numPixels;pixel++)
720  {
721  ULWord value = DPXLinebuffer[pixel];
722  rawrp215Buffer[pixel] = ((value&0x3F)>>4) + ((value&0xF00000)>>20);
723  }
724 }
725 
726 // MaskYCbCrLine
727 // Mask Data In place based on signalMask
728 void MaskYCbCrLine(UWord* ycbcrLine, UWord signalMask , ULWord numPixels)
729 {
730  ULWord pixelCount;
731 
732  // Not elegant but fairly fast.
733  switch ( signalMask )
734  {
735  case NTV2_SIGNALMASK_NONE: // Output Black
736  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
737  {
738  ycbcrLine[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
739  ycbcrLine[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
740  ycbcrLine[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
741  ycbcrLine[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
742  }
743  break;
744  case NTV2_SIGNALMASK_Y:
745  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
746  {
747  ycbcrLine[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
748  ycbcrLine[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
749  }
750 
751  break;
752  case NTV2_SIGNALMASK_Cb:
753  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
754  {
755  ycbcrLine[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
756  ycbcrLine[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
757  ycbcrLine[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
758  }
759 
760  break;
762  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
763  {
764  ycbcrLine[pixelCount+2] = CCIR601_10BIT_CHROMAOFFSET; // Cr
765  }
766 
767  break;
768 
769  case NTV2_SIGNALMASK_Cr:
770  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
771  {
772  ycbcrLine[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
773  ycbcrLine[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
774  ycbcrLine[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
775  }
776 
777 
778  break;
780  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
781  {
782  ycbcrLine[pixelCount] = CCIR601_10BIT_CHROMAOFFSET; // Cb
783  }
784 
785 
786  break;
788  for ( pixelCount = 0; pixelCount < (numPixels*2); pixelCount += 4 )
789  {
790  ycbcrLine[pixelCount+1] = CCIR601_10BIT_BLACK; // Y
791  ycbcrLine[pixelCount+3] = CCIR601_10BIT_BLACK; // Y
792  }
793 
794 
795  break;
797  // Do nothing
798  break;
799  }
800 
801 }
802 
803 void Make10BitBlackLine (UWord * pOutLineData, const ULWord inNumPixels)
804 {
805  // Write *UNPACKED* 10-bit YCbCr values into pOutLineData, assuming it can hold at least inNumPixels * 4 bytes
806  // NOTE: When I return, 'pOutLineData' will NOT contain NTV2_FBF_10BIT_YCBCR!
807  // (Use ::PackLine_16BitYUVto10BitYUV to convert to NTV2_FBF_10BIT_YCBCR.)
808  if (pOutLineData && inNumPixels)
809  for (ULWord count(0); count < inNumPixels; count++)
810  {
811  *pOutLineData++ = UWord(CCIR601_10BIT_CHROMAOFFSET); // 512 0x200
812  *pOutLineData++ = UWord(CCIR601_10BIT_BLACK); // 64 0x40
813  }
814 }
815 
816 void Make10BitWhiteLine (UWord* pOutLineData, const ULWord inNumPixels)
817 {
818  // Write *UNPACKED* 10-bit YCbCr values into pOutLineData, assuming it can hold at least inNumPixels * 4 bytes
819  // NOTE: When I return, 'pOutLineData' will NOT contain NTV2_FBF_10BIT_YCBCR!
820  // (Use ::PackLine_16BitYUVto10BitYUV to convert to NTV2_FBF_10BIT_YCBCR.)
821  if (pOutLineData && inNumPixels)
822  for (ULWord count(0); count < inNumPixels; count++)
823  {
824  *pOutLineData++ = UWord(CCIR601_10BIT_CHROMAOFFSET); // 512 0x200
825  *pOutLineData++ = UWord(CCIR601_10BIT_WHITE); // 940 0x3AC
826  }
827 }
828 
829 void Make10BitLine (UWord* pOutLineData, const UWord Y, const UWord Cb, const UWord Cr, const ULWord inNumPixels)
830 {
831  // assumes lineData is large enough for numPixels
832  if (pOutLineData && inNumPixels)
833  for (ULWord count(0); count < inNumPixels*2; count+=4)
834  {
835  pOutLineData[count] = Cb;
836  pOutLineData[count+1] = Y;
837  pOutLineData[count+2] = Cr;
838  pOutLineData[count+3] = Y;
839  }
840 }
841 
842 bool Fill10BitYCbCrVideoFrame (void * pBaseVideoAddress,
843  const NTV2Standard inStandard,
844  const NTV2FrameBufferFormat inFBF,
845  const YCbCr10BitPixel inPixelColor,
846  const NTV2VANCMode inVancMode)
847 {
848  if (!pBaseVideoAddress)
849  return false;
850 
851  const NTV2FormatDescriptor fd (inStandard, inFBF, inVancMode);
852  UWord lineBuffer[2048*2];
853  ULWord * pBaseAddress (reinterpret_cast<ULWord*>(pBaseVideoAddress));
854  Make10BitLine (lineBuffer, inPixelColor.y, inPixelColor.cb, inPixelColor.cr, UWord(fd.GetRasterWidth()));
855 
856  for (UWord lineNdx(0); lineNdx < fd.numLines; lineNdx++)
857  {
858  ::PackLine_16BitYUVto10BitYUV (lineBuffer, pBaseAddress, fd.GetRasterWidth());
859  pBaseAddress += fd.linePitch;
860  }
861  return true;
862 }
863 
864 
865 void Make8BitBlackLine (UByte * lineData, ULWord numPixels, NTV2FrameBufferFormat fbFormat)
866 {
867  // assumes lineData is large enough for numPixels
868  if ( fbFormat == NTV2_FBF_8BIT_YCBCR )
869  {
870  for ( uint32_t count = 0; count < numPixels*2; count+=2 )
871  {
872  lineData[count] = UWord(CCIR601_8BIT_CHROMAOFFSET);
873  lineData[count+1] = UWord(CCIR601_8BIT_BLACK);
874  }
875  }
876  else
877  {
878  // NTV2_FBF_8BIT_YCBCR_YUY2
879  for ( uint32_t count = 0; count < numPixels*2; count+=2 )
880  {
881  lineData[count] = UWord(CCIR601_8BIT_BLACK);
882  lineData[count+1] = UWord(CCIR601_8BIT_CHROMAOFFSET);
883  }
884  }
885 }
886 
887 void Make8BitWhiteLine (UByte * lineData, ULWord numPixels, NTV2FrameBufferFormat fbFormat)
888 {
889  // assumes lineData is large enough for numPixels
890  // assumes lineData is large enough for numPixels
891  if ( fbFormat == NTV2_FBF_8BIT_YCBCR )
892  {
893  for ( uint32_t count = 0; count < numPixels*2; count+=2 )
894  {
895  lineData[count] = UWord(CCIR601_8BIT_CHROMAOFFSET);
896  lineData[count+1] = UWord(CCIR601_8BIT_WHITE);
897  }
898  }
899  else
900  {
901  // NTV2_FBF_8BIT_YCBCR_YUY2
902  for ( uint32_t count = 0; count < numPixels*2; count+=2 )
903  {
904  lineData[count] = UWord(CCIR601_8BIT_WHITE);
905  lineData[count+1] = UWord(CCIR601_8BIT_CHROMAOFFSET);
906  }
907  }
908 
909 }
910 
911 void Make8BitLine (UByte * lineData, UByte Y, UByte Cb, UByte Cr, ULWord numPixels, NTV2FrameBufferFormat fbFormat)
912 {
913  // assumes lineData is large enough for numPixels
914  if (fbFormat == NTV2_FBF_8BIT_YCBCR)
915  {
916  for (ULWord count = 0; count < numPixels*2; count += 4)
917  {
918  lineData[count] = Cb;
919  lineData[count+1] = Y;
920  lineData[count+2] = Cr;
921  lineData[count+3] = Y;
922  }
923  }
924  else
925  {
926  for (ULWord count = 0; count < numPixels*2; count += 4)
927  {
928  lineData[count] = Y;
929  lineData[count+1] = Cb;
930  lineData[count+2] = Y;
931  lineData[count+3] = Cr;
932  }
933 
934  }
935 }
936 
937 bool Fill8BitYCbCrVideoFrame (void * pBaseVideoAddress, const NTV2Standard inStandard, const NTV2FrameBufferFormat inFBF,
938  const YCbCrPixel inPixelColor, const NTV2VANCMode inVancMode)
939 {
940  if (!pBaseVideoAddress)
941  return false;
942 
943  const NTV2FormatDescriptor fd (inStandard, inFBF, inVancMode);
944  UByte * pBaseAddress (reinterpret_cast<UByte*>(pBaseVideoAddress));
945 
946  for (UWord lineNdx(0); lineNdx < fd.numLines; lineNdx++)
947  {
948  Make8BitLine (pBaseAddress, inPixelColor.y, inPixelColor.cb, inPixelColor.cr, fd.numPixels, inFBF);
949  pBaseAddress += fd.GetBytesPerRow();
950  }
951  return true;
952 }
953 
954 void Fill4k8BitYCbCrVideoFrame(PULWord _baseVideoAddress,
955  NTV2FrameBufferFormat frameBufferFormat,
956  YCbCrPixel color,
957  bool vancEnabled,
958  bool b4k,
959  bool wideVANC)
960 {
961  (void) vancEnabled;
962  (void) wideVANC;
964  if(b4k)
965  {
966  fd.numLines = 2160;
967  fd.numPixels = 4096;
968  fd.firstActiveLine = 0;
969  fd.linePitch = 4096*2/4;
970  }
971  else
972  {
973  fd.numLines = 2160;
974  fd.numPixels = 3840;
975  fd.firstActiveLine = 0;
976  fd.linePitch = 3840*2/4;
977  }
978 
979  Make8BitLine(reinterpret_cast<UByte*>(_baseVideoAddress), color.y, color.cb, color.cr, fd.numPixels*fd.numLines, frameBufferFormat);
980 }
981 
982 
983 // Copy arbrary-sized source image buffer to arbitrary-sized destination frame buffer.
984 // It will automatically clip and/or pad the source image to center it in the destination frame.
985 // This will work with any RGBA/RGB frame buffer formats with 4 Bytes/pixel size
986 void CopyRGBAImageToFrame(ULWord* pSrcBuffer, ULWord srcWidth, ULWord srcHeight,
987  ULWord* pDstBuffer, ULWord dstWidth, ULWord dstHeight)
988 {
989  // all variables are in pixels
990  ULWord topPad = 0, bottomPad = 0, leftPad = 0, rightPad = 0;
991  ULWord contentHeight = 0;
992  ULWord contentWidth = 0;
993  ULWord* pSrc = pSrcBuffer;
994  ULWord* pDst = pDstBuffer;
995 
996  if (dstHeight > srcHeight)
997  {
998  topPad = (dstHeight - srcHeight) / 2;
999  bottomPad = dstHeight - topPad - srcHeight;
1000  }
1001  else
1002  pSrc += ((srcHeight - dstHeight) / 2) * srcWidth;
1003 
1004  if (dstWidth > srcWidth)
1005  {
1006  leftPad = (dstWidth - srcWidth) / 2;
1007  rightPad = dstWidth - srcWidth - leftPad;
1008  }
1009  else
1010  pSrc += (srcWidth - dstWidth) / 2;
1011 
1012  // content
1013  contentHeight = dstHeight - topPad - bottomPad;
1014  contentWidth = dstWidth - leftPad - rightPad;
1015 
1016  // top pad
1017  memset(pDst, 0, topPad * dstWidth * 4);
1018  pDst += topPad * dstWidth;
1019 
1020  // content
1021  while (contentHeight--)
1022  {
1023  // left
1024  memset(pDst, 0, leftPad * 4);
1025  pDst += leftPad;
1026 
1027  // content
1028  memcpy(pDst, pSrc, contentWidth * 4);
1029  pDst += contentWidth;
1030  pSrc += srcWidth;
1031 
1032  // right
1033  memset(pDst, 0, rightPad * 4);
1034  pDst += rightPad;
1035  }
1036 
1037  // bottom pad
1038  memset(pDst, 0, bottomPad * dstWidth * 4);
1039 }
1040 
1041 
1042 static bool SetRasterLinesBlack8BitYCbCr (UByte * pDstBuffer,
1043  const ULWord inDstBytesPerLine,
1044  const UWord inDstTotalLines)
1045 {
1046  const ULWord dstMaxPixelWidth (inDstBytesPerLine / 2); // 2 bytes per pixel for '2vuy'
1047  UByte * pLine (pDstBuffer);
1048  NTV2_ASSERT(dstMaxPixelWidth < 64UL*1024UL); // Because Make8BitBlackLine takes uint16_t pixelWidth
1049  for (UWord lineNum(0); lineNum < inDstTotalLines; lineNum++)
1050  {
1051  ::Make8BitBlackLine (pLine, UWord(dstMaxPixelWidth));
1052  pLine += inDstBytesPerLine;
1053  }
1054  return true;
1055 }
1056 
1057 
1058 static bool SetRasterLinesBlack10BitYCbCr (UByte * pDstBuffer,
1059  const ULWord inDstBytesPerLine,
1060  const UWord inDstTotalLines)
1061 {
1062  // In SDKs before 17.0, this function wrote past the end of the last line in
1063  // the destination raster buffer, because Make10BitBlackLine (which used to
1064  // be called once per line) always wrote 1.5 times inDstBytesPerLine.
1065  NTV2Buffer tmp(inDstBytesPerLine * 2); // Temporarily holds unpacked Y/C values
1066  NTV2Buffer dstBuffer (pDstBuffer, ULWord(inDstTotalLines) * inDstBytesPerLine);
1067  const ULWord dstMaxPixelWidth (inDstBytesPerLine / 16 * 6);
1068  ::Make10BitBlackLine (tmp, dstMaxPixelWidth); // Write unpacked SMPTE black Y/C values
1069  ::PackLine_16BitYUVto10BitYUV (tmp, dstBuffer, dstMaxPixelWidth); // Pack to '2vuy' into dstBuffer line 0
1070  for (UWord lineNum(1); lineNum < inDstTotalLines; lineNum++) // Make copies of line 0...
1071  if (!dstBuffer.CopyFrom (dstBuffer, // srcBuffer is line 0 of dstBuffer
1072  0, // srcByteOffset
1073  ULWord(lineNum) * inDstBytesPerLine, // dstByteOffset
1074  inDstBytesPerLine)) // numBytesToCopy
1075  return false; // failed!
1076  return true;
1077 }
1078 
1079 
1080 static bool SetRasterLinesWhite8BitYCbCr (UByte * pDstBuffer,
1081  const ULWord inDstBytesPerLine,
1082  const UWord inDstTotalLines)
1083 {
1084  const ULWord dstMaxPixelWidth (inDstBytesPerLine / 2); // 2 bytes per pixel for '2vuy'
1085  UByte * pLine (pDstBuffer);
1086  NTV2_ASSERT(dstMaxPixelWidth < 64UL*1024UL); // Because Make8BitWhiteLine takes uint16_t pixelWidth
1087  for (UWord lineNum(0); lineNum < inDstTotalLines; lineNum++)
1088  {
1089  ::Make8BitWhiteLine (pLine, UWord(dstMaxPixelWidth));
1090  pLine += inDstBytesPerLine;
1091  }
1092  return true;
1093 }
1094 
1095 
1096 static bool SetRasterLinesWhite10BitYCbCr (UByte * pDstBuffer,
1097  const ULWord inDstBytesPerLine,
1098  const UWord inDstTotalLines)
1099 {
1100  // In SDKs before 17.0, this function wrote past the end of the last line in
1101  // the destination raster buffer, because Make10BitWhiteLine (which used to
1102  // be called once per line) always wrote 1.5 times inDstBytesPerLine.
1103  NTV2Buffer tmp(inDstBytesPerLine * 2); // Temporarily holds unpacked Y/C values
1104  NTV2Buffer dstBuffer (pDstBuffer, ULWord(inDstTotalLines) * inDstBytesPerLine);
1105  const ULWord dstMaxPixelWidth (inDstBytesPerLine / 16 * 6);
1106  ::Make10BitWhiteLine (tmp, dstMaxPixelWidth); // Write unpacked SMPTE white Y/C values
1107  ::PackLine_16BitYUVto10BitYUV (tmp, dstBuffer, dstMaxPixelWidth); // Pack to '2vuy' into dstBuffer line 0
1108  for (UWord lineNum(1); lineNum < inDstTotalLines; lineNum++) // Make copies of line 0...
1109  if (!dstBuffer.CopyFrom (dstBuffer, // srcBuffer is line 0 of dstBuffer
1110  0, // srcByteOffset
1111  ULWord(lineNum) * inDstBytesPerLine, // dstByteOffset
1112  inDstBytesPerLine)) // numBytesToCopy
1113  return false; // failed!
1114  return true;
1115 }
1116 
1117 
1118 bool SetRasterLinesBlack (const NTV2PixelFormat inPixelFormat,
1119  UByte * pDstBuffer,
1120  const ULWord inDstBytesPerLine,
1121  const UWord inDstTotalLines)
1122 {
1123  if (!pDstBuffer) // NULL buffer
1124  return false;
1125  if (inDstBytesPerLine == 0) // zero rowbytes
1126  return false;
1127  if (inDstTotalLines == 0) // zero height
1128  return false;
1129 
1130  switch (inPixelFormat)
1131  {
1132  case NTV2_FBF_10BIT_YCBCR: return SetRasterLinesBlack10BitYCbCr (pDstBuffer, inDstBytesPerLine, inDstTotalLines);
1133 
1134  case NTV2_FBF_8BIT_YCBCR: return SetRasterLinesBlack8BitYCbCr (pDstBuffer, inDstBytesPerLine, inDstTotalLines);
1135 
1136  case NTV2_FBF_ARGB:
1137  case NTV2_FBF_RGBA:
1138  case NTV2_FBF_ABGR:
1139  case NTV2_FBF_24BIT_RGB:
1140  case NTV2_FBF_24BIT_BGR:
1141  case NTV2_FBF_48BIT_RGB:
1142  case NTV2_FBF_10BIT_RGB:
1143  case NTV2_FBF_10BIT_ARGB:
1144  case NTV2_FBF_16BIT_ARGB:
1145  { NTV2Buffer dst(pDstBuffer, inDstBytesPerLine * ULWord(inDstTotalLines));
1146  return dst.Fill(ULWord(0)); // Zero all R/G/B/A components
1147  }
1148 
1150  case NTV2_FBF_10BIT_DPX:
1152  case NTV2_FBF_8BIT_DVCPRO:
1154  case NTV2_FBF_8BIT_HDV:
1155  case NTV2_FBF_10BIT_YCBCRA:
1156  case NTV2_FBF_10BIT_DPX_LE:
1159  case NTV2_FBF_PRORES_HDV:
1171  return false;
1172  }
1173  return false;
1174 
1175 } // SetRasterLinesBlack
1176 
1177 
1178 bool SetRasterLinesWhite (const NTV2PixelFormat inPixelFormat,
1179  UByte * pDstBuffer,
1180  const ULWord inDstBytesPerLine,
1181  const UWord inDstTotalLines)
1182 {
1183  if (!pDstBuffer) // NULL buffer
1184  return false;
1185  if (inDstBytesPerLine == 0) // zero rowbytes
1186  return false;
1187  if (inDstTotalLines == 0) // zero height
1188  return false;
1189 
1190  switch (inPixelFormat)
1191  {
1192  case NTV2_FBF_10BIT_YCBCR: return SetRasterLinesWhite10BitYCbCr (pDstBuffer, inDstBytesPerLine, inDstTotalLines);
1193 
1194  case NTV2_FBF_8BIT_YCBCR: return SetRasterLinesWhite8BitYCbCr (pDstBuffer, inDstBytesPerLine, inDstTotalLines);
1195 
1196  case NTV2_FBF_ARGB:
1197  case NTV2_FBF_RGBA:
1198  case NTV2_FBF_ABGR:
1199  case NTV2_FBF_24BIT_RGB:
1200  case NTV2_FBF_24BIT_BGR:
1201  case NTV2_FBF_48BIT_RGB:
1202  case NTV2_FBF_10BIT_RGB:
1203  case NTV2_FBF_10BIT_ARGB:
1204  case NTV2_FBF_16BIT_ARGB:
1205  { NTV2Buffer dst(pDstBuffer, inDstBytesPerLine * ULWord(inDstTotalLines));
1206  return dst.Fill(ULWord(0xFFFFFFFF)); // Set all R/G/B/A components to 0xFFs
1207  }
1208 
1210  case NTV2_FBF_10BIT_DPX:
1212  case NTV2_FBF_8BIT_DVCPRO:
1214  case NTV2_FBF_8BIT_HDV:
1215  case NTV2_FBF_10BIT_YCBCRA:
1216  case NTV2_FBF_10BIT_DPX_LE:
1219  case NTV2_FBF_PRORES_HDV:
1231  return false;
1232  }
1233  return false;
1234 
1235 } // SetRasterLinesWhite
1236 
1237 
1238 static const UByte * GetReadAddress_2vuy (const UByte * pInFrameBuffer, const ULWord inBytesPerVertLine, const UWord inVertLineOffset, const UWord inHorzPixelOffset, const UWord inBytesPerHorzPixel)
1239 {
1240  const UByte * pResult (pInFrameBuffer);
1241  NTV2_ASSERT (inBytesPerVertLine);
1242  NTV2_ASSERT ((inHorzPixelOffset & 1) == 0); // For '2vuy', horizontal pixel offset must be even!!
1243  pResult += inBytesPerVertLine * ULWord(inVertLineOffset);
1244  pResult += ULWord(inBytesPerHorzPixel) * ULWord(inHorzPixelOffset);
1245  return pResult;
1246 }
1247 
1248 
1249 static UByte * GetWriteAddress_2vuy (UByte * pInFrameBuffer, const ULWord inBytesPerVertLine, const UWord inVertLineOffset, const UWord inHorzPixelOffset, const UWord inBytesPerHorzPixel)
1250 {
1251  UByte * pResult (pInFrameBuffer);
1252  NTV2_ASSERT (inBytesPerVertLine);
1253  NTV2_ASSERT ((inHorzPixelOffset & 1) == 0); // For '2vuy', horizontal pixel offset must be even!!
1254  pResult += inBytesPerVertLine * ULWord(inVertLineOffset);
1255  pResult += ULWord(inBytesPerHorzPixel) * ULWord(inHorzPixelOffset);
1256  return pResult;
1257 }
1258 
1259 
1260 // This function should work on all 4-byte-per-2-pixel formats
1261 static bool CopyRaster4BytesPer2Pixels (UByte * pDstBuffer, // Dest buffer to be modified
1262  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width)
1263  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1264  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1265  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear
1266  const UByte * pSrcBuffer, // Src buffer
1267  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width)
1268  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1269  const UWord inSrcVertLineOffset, // Src image top edge
1270  const UWord inSrcVertLinesToCopy, // Src image height
1271  const UWord inSrcHorzPixelOffset, // Src image left edge
1272  const UWord inSrcHorzPixelsToCopy) // Src image width
1273 {
1274  if (inDstHorzPixelOffset & 1) // dst odd pixel offset
1275  return false;
1276  if (inSrcHorzPixelOffset & 1) // src odd pixel offset
1277  return false;
1278 
1279  const ULWord TWO_BYTES_PER_PIXEL (2); // 2 bytes per pixel for '2vuy'
1280  const ULWord dstMaxPixelWidth (inDstBytesPerLine / TWO_BYTES_PER_PIXEL);
1281  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / TWO_BYTES_PER_PIXEL);
1282  UWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1283  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1284 
1285  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1286  return false;
1287  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1288  return false;
1289  if (ULWord(inSrcHorzPixelOffset + inSrcHorzPixelsToCopy) > srcMaxPixelWidth)
1290  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1291  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1292  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1293  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1294  {
1295  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1296  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1297  else
1298  return true;
1299  }
1300 
1301  const UByte * pSrc (::GetReadAddress_2vuy (pSrcBuffer, inSrcBytesPerLine, inSrcVertLineOffset, inSrcHorzPixelOffset, TWO_BYTES_PER_PIXEL));
1302  UByte * pDst (::GetWriteAddress_2vuy (pDstBuffer, inDstBytesPerLine, inDstVertLineOffset, inDstHorzPixelOffset, TWO_BYTES_PER_PIXEL));
1303 
1304  for (UWord srcLinesToCopy (numVertLinesToCopy); srcLinesToCopy > 0; srcLinesToCopy--) // for each src raster line
1305  {
1306  UWord dstPixelsCopied (0);
1307  const UByte * pSavedSrc (pSrc);
1308  UByte * pSavedDst (pDst);
1309  for (UWord hPixelsToCopy (numHorzPixelsToCopy); hPixelsToCopy > 0; hPixelsToCopy--) // for each pixel/column
1310  {
1311  pDst[0] = pSrc[0];
1312  pDst[1] = pSrc[1];
1313  dstPixelsCopied++;
1314  if (dstPixelsCopied + inDstHorzPixelOffset >= UWord(dstMaxPixelWidth))
1315  break; // Clip to dst raster's right edge
1316  pDst += TWO_BYTES_PER_PIXEL;
1317  pSrc += TWO_BYTES_PER_PIXEL;
1318  }
1319  pSrc = pSavedSrc;
1320  pDst = pSavedDst;
1321  pSrc += inSrcBytesPerLine;
1322  pDst += inDstBytesPerLine;
1323  } // for each src line to copy
1324  return true;
1325 
1326 } // CopyRaster4BytesPer2Pixels
1327 
1328 
1329 // This function should work on all 16-byte-per-6-pixel formats
1330 static bool CopyRaster16BytesPer6Pixels ( UByte * pDstBuffer, // Dest buffer to be modified
1331  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width) -- must be evenly divisible by 16
1332  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1333  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1334  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear -- must be evenly divisible by 6
1335  const UByte * pSrcBuffer, // Src buffer
1336  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width) -- must be evenly divisible by 16
1337  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1338  const UWord inSrcVertLineOffset, // Src image top edge
1339  const UWord inSrcVertLinesToCopy, // Src image height
1340  const UWord inSrcHorzPixelOffset, // Src image left edge -- must be evenly divisible by 6
1341  const UWord inSrcHorzPixelsToCopy) // Src image width -- must be evenly divisible by 6
1342 {
1343  if (inDstHorzPixelOffset % 6) // dst pixel offset must be on 6-pixel boundary
1344  return false;
1345  if (inSrcHorzPixelOffset % 6) // src pixel offset must be on 6-pixel boundary
1346  return false;
1347  if (inDstBytesPerLine % 16) // dst raster width must be evenly divisible by 16 (width must be multiple of 6)
1348  return false;
1349  if (inSrcBytesPerLine % 16) // src raster width must be evenly divisible by 16 (width must be multiple of 6)
1350  return false;
1351  if (inSrcHorzPixelsToCopy % 6) // pixel width of src image portion to copy must be on 6-pixel boundary
1352  return false;
1353 
1354  const ULWord dstMaxPixelWidth (inDstBytesPerLine / 16 * 6);
1355  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / 16 * 6);
1356  ULWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1357  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1358 
1359  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1360  return false;
1361  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1362  return false;
1363  if (inSrcHorzPixelOffset + inSrcHorzPixelsToCopy > UWord(srcMaxPixelWidth))
1364  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1365  if (inDstHorzPixelOffset + numHorzPixelsToCopy > dstMaxPixelWidth)
1366  numHorzPixelsToCopy = inDstHorzPixelOffset + numHorzPixelsToCopy - dstMaxPixelWidth;
1367  NTV2_ASSERT (numHorzPixelsToCopy % 6 == 0);
1368  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1369  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1370  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1371  {
1372  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1373  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1374  else
1375  return true;
1376  }
1377 
1378  for (UWord lineNdx (0); lineNdx < numVertLinesToCopy; lineNdx++) // for each raster line to copy
1379  {
1380  const UByte * pSrcLine (pSrcBuffer + inSrcBytesPerLine * (inSrcVertLineOffset + lineNdx) + inSrcHorzPixelOffset * 16 / 6);
1381  UByte * pDstLine (pDstBuffer + inDstBytesPerLine * (inDstVertLineOffset + lineNdx) + inDstHorzPixelOffset * 16 / 6);
1382  ::memcpy (pDstLine, pSrcLine, numHorzPixelsToCopy * 16 / 6); // copy the line
1383  }
1384 
1385  return true;
1386 
1387 } // CopyRaster16BytesPer6Pixels
1388 
1389 
1390 // This function should work on all 20-byte-per-16-pixel formats
1391 static bool CopyRaster20BytesPer16Pixels ( UByte * pDstBuffer, // Dest buffer to be modified
1392  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width) -- must be evenly divisible by 20
1393  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1394  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1395  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear
1396  const UByte * pSrcBuffer, // Src buffer
1397  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width) -- must be evenly divisible by 20
1398  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1399  const UWord inSrcVertLineOffset, // Src image top edge
1400  const UWord inSrcVertLinesToCopy, // Src image height
1401  const UWord inSrcHorzPixelOffset, // Src image left edge
1402  const UWord inSrcHorzPixelsToCopy) // Src image width
1403 {
1404  if (inDstHorzPixelOffset % 16) // dst pixel offset must be on 16-pixel boundary
1405  return false;
1406  if (inSrcHorzPixelOffset % 16) // src pixel offset must be on 16-pixel boundary
1407  return false;
1408  if (inDstBytesPerLine % 20) // dst raster width must be evenly divisible by 20
1409  return false;
1410  if (inSrcBytesPerLine % 20) // src raster width must be evenly divisible by 20
1411  return false;
1412  if (inSrcHorzPixelsToCopy % 16) // pixel width of src image portion to copy must be on 16-pixel boundary
1413  return false;
1414 
1415  const ULWord dstMaxPixelWidth (inDstBytesPerLine / 20 * 16);
1416  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / 20 * 16);
1417  ULWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1418  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1419 
1420  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1421  return false;
1422  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1423  return false;
1424  if (inSrcHorzPixelOffset + inSrcHorzPixelsToCopy > UWord(srcMaxPixelWidth))
1425  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1426  if (inDstHorzPixelOffset + numHorzPixelsToCopy > dstMaxPixelWidth)
1427  numHorzPixelsToCopy = inDstHorzPixelOffset + numHorzPixelsToCopy - dstMaxPixelWidth;
1428  NTV2_ASSERT (numHorzPixelsToCopy % 16 == 0);
1429  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1430  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1431  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1432  {
1433  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1434  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1435  else
1436  return true;
1437  }
1438 
1439  for (UWord lineNdx (0); lineNdx < numVertLinesToCopy; lineNdx++) // for each raster line to copy
1440  {
1441  const UByte * pSrcLine (pSrcBuffer + inSrcBytesPerLine * (inSrcVertLineOffset + lineNdx) + inSrcHorzPixelOffset * 20 / 16);
1442  UByte * pDstLine (pDstBuffer + inDstBytesPerLine * (inDstVertLineOffset + lineNdx) + inDstHorzPixelOffset * 20 / 16);
1443  ::memcpy (pDstLine, pSrcLine, numHorzPixelsToCopy * 20 / 16); // copy the line
1444  }
1445 
1446  return true;
1447 
1448 } // CopyRaster20BytesPer16Pixels
1449 
1450 // This function should work on all 36-byte-per-8-pixel formats
1451 static bool CopyRaster36BytesPer8Pixels ( UByte * pDstBuffer, // Dest buffer to be modified
1452  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width) -- must be evenly divisible by 20
1453  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1454  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1455  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear
1456  const UByte * pSrcBuffer, // Src buffer
1457  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width) -- must be evenly divisible by 20
1458  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1459  const UWord inSrcVertLineOffset, // Src image top edge
1460  const UWord inSrcVertLinesToCopy, // Src image height
1461  const UWord inSrcHorzPixelOffset, // Src image left edge
1462  const UWord inSrcHorzPixelsToCopy) // Src image width
1463 {
1464  if (inDstHorzPixelOffset % 8) // dst pixel offset must be on 16-pixel boundary
1465  return false;
1466  if (inSrcHorzPixelOffset % 8) // src pixel offset must be on 16-pixel boundary
1467  return false;
1468  if (inDstBytesPerLine % 36) // dst raster width must be evenly divisible by 20
1469  return false;
1470  if (inSrcBytesPerLine % 36) // src raster width must be evenly divisible by 20
1471  return false;
1472  if (inSrcHorzPixelsToCopy % 8) // pixel width of src image portion to copy must be on 16-pixel boundary
1473  return false;
1474 
1475  const ULWord dstMaxPixelWidth (inDstBytesPerLine / 36 * 8);
1476  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / 36 * 8);
1477  ULWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1478  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1479 
1480  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1481  return false;
1482  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1483  return false;
1484  if (inSrcHorzPixelOffset + inSrcHorzPixelsToCopy > UWord(srcMaxPixelWidth))
1485  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1486  if (inDstHorzPixelOffset + numHorzPixelsToCopy > dstMaxPixelWidth)
1487  numHorzPixelsToCopy = inDstHorzPixelOffset + numHorzPixelsToCopy - dstMaxPixelWidth;
1488  NTV2_ASSERT (numHorzPixelsToCopy % 8 == 0);
1489  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1490  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1491  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1492  {
1493  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1494  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1495  else
1496  return true;
1497  }
1498 
1499  for (UWord lineNdx (0); lineNdx < numVertLinesToCopy; lineNdx++) // for each raster line to copy
1500  {
1501  const UByte * pSrcLine (pSrcBuffer + inSrcBytesPerLine * (inSrcVertLineOffset + lineNdx) + inSrcHorzPixelOffset * 36 / 8);
1502  UByte * pDstLine (pDstBuffer + inDstBytesPerLine * (inDstVertLineOffset + lineNdx) + inDstHorzPixelOffset * 36 / 8);
1503  ::memcpy (pDstLine, pSrcLine, numHorzPixelsToCopy * 36 / 8); // copy the line
1504  }
1505 
1506  return true;
1507 
1508 } // CopyRaster20BytesPer16Pixels
1509 
1510 
1511 // This function should work on all 5-byte-per-pixel formats
1512 static bool CopyRaster5BytesPerPixel ( UByte * pDstBuffer, // Dest buffer to be modified
1513  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width)
1514  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1515  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1516  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear -- must be evenly divisible by 6
1517  const UByte * pSrcBuffer, // Src buffer
1518  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width)
1519  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1520  const UWord inSrcVertLineOffset, // Src image top edge
1521  const UWord inSrcVertLinesToCopy, // Src image height
1522  const UWord inSrcHorzPixelOffset, // Src image left edge
1523  const UWord inSrcHorzPixelsToCopy) // Src image width
1524 {
1525  const UWord FIVE_BYTES_PER_PIXEL (5);
1526 
1527  if (inDstBytesPerLine % FIVE_BYTES_PER_PIXEL) // dst raster width (in bytes) must be evenly divisible by 5
1528  return false;
1529  if (inSrcBytesPerLine % FIVE_BYTES_PER_PIXEL) // src raster width (in bytes) must be evenly divisible by 5
1530  return false;
1531 
1532  const ULWord dstMaxPixelWidth (inDstBytesPerLine / FIVE_BYTES_PER_PIXEL);
1533  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / FIVE_BYTES_PER_PIXEL);
1534  ULWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1535  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1536 
1537  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1538  return false;
1539  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1540  return false;
1541  if (inSrcHorzPixelOffset + inSrcHorzPixelsToCopy > UWord(srcMaxPixelWidth))
1542  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1543  if (inDstHorzPixelOffset + numHorzPixelsToCopy > dstMaxPixelWidth)
1544  numHorzPixelsToCopy = inDstHorzPixelOffset + numHorzPixelsToCopy - dstMaxPixelWidth;
1545  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1546  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1547  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1548  {
1549  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1550  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1551  else
1552  return true;
1553  }
1554 
1555  for (UWord lineNdx (0); lineNdx < numVertLinesToCopy; lineNdx++) // for each raster line to copy
1556  {
1557  const UByte * pSrcLine (pSrcBuffer + inSrcBytesPerLine * (inSrcVertLineOffset + lineNdx) + inSrcHorzPixelOffset * FIVE_BYTES_PER_PIXEL);
1558  UByte * pDstLine (pDstBuffer + inDstBytesPerLine * (inDstVertLineOffset + lineNdx) + inDstHorzPixelOffset * FIVE_BYTES_PER_PIXEL);
1559  ::memcpy (pDstLine, pSrcLine, numHorzPixelsToCopy * FIVE_BYTES_PER_PIXEL); // copy the line
1560  }
1561 
1562  return true;
1563 
1564 } // CopyRaster5BytesPerPixel
1565 
1566 
1567 // This function should work on all 4-byte-per-pixel formats
1568 static bool CopyRaster4BytesPerPixel ( UByte * pDstBuffer, // Dest buffer to be modified
1569  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width)
1570  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1571  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1572  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear -- must be evenly divisible by 6
1573  const UByte * pSrcBuffer, // Src buffer
1574  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width)
1575  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1576  const UWord inSrcVertLineOffset, // Src image top edge
1577  const UWord inSrcVertLinesToCopy, // Src image height
1578  const UWord inSrcHorzPixelOffset, // Src image left edge
1579  const UWord inSrcHorzPixelsToCopy) // Src image width
1580 {
1581  const UWord FOUR_BYTES_PER_PIXEL (4);
1582 
1583  if (inDstBytesPerLine % FOUR_BYTES_PER_PIXEL) // dst raster width (in bytes) must be evenly divisible by 4
1584  return false;
1585  if (inSrcBytesPerLine % FOUR_BYTES_PER_PIXEL) // src raster width (in bytes) must be evenly divisible by 4
1586  return false;
1587 
1588  const ULWord dstMaxPixelWidth (inDstBytesPerLine / FOUR_BYTES_PER_PIXEL);
1589  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / FOUR_BYTES_PER_PIXEL);
1590  ULWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1591  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1592 
1593  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1594  return false;
1595  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1596  return false;
1597  if (inSrcHorzPixelOffset + inSrcHorzPixelsToCopy > UWord(srcMaxPixelWidth))
1598  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1599  if (inDstHorzPixelOffset + numHorzPixelsToCopy > dstMaxPixelWidth)
1600  numHorzPixelsToCopy = inDstHorzPixelOffset + numHorzPixelsToCopy - dstMaxPixelWidth;
1601  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1602  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1603  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1604  {
1605  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1606  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1607  else
1608  return true;
1609  }
1610 
1611  for (UWord lineNdx (0); lineNdx < numVertLinesToCopy; lineNdx++) // for each raster line to copy
1612  {
1613  const UByte * pSrcLine (pSrcBuffer + inSrcBytesPerLine * (inSrcVertLineOffset + lineNdx) + inSrcHorzPixelOffset * FOUR_BYTES_PER_PIXEL);
1614  UByte * pDstLine (pDstBuffer + inDstBytesPerLine * (inDstVertLineOffset + lineNdx) + inDstHorzPixelOffset * FOUR_BYTES_PER_PIXEL);
1615  ::memcpy (pDstLine, pSrcLine, numHorzPixelsToCopy * FOUR_BYTES_PER_PIXEL); // copy the line
1616  }
1617 
1618  return true;
1619 
1620 } // CopyRaster4BytesPerPixel
1621 
1622 
1623 // This function should work on all 3-byte-per-pixel formats
1624 static bool CopyRaster3BytesPerPixel ( UByte * pDstBuffer, // Dest buffer to be modified
1625  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width)
1626  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1627  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1628  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear -- must be evenly divisible by 6
1629  const UByte * pSrcBuffer, // Src buffer
1630  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width)
1631  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1632  const UWord inSrcVertLineOffset, // Src image top edge
1633  const UWord inSrcVertLinesToCopy, // Src image height
1634  const UWord inSrcHorzPixelOffset, // Src image left edge
1635  const UWord inSrcHorzPixelsToCopy) // Src image width
1636 {
1637  const UWord THREE_BYTES_PER_PIXEL (3);
1638 
1639  if (inDstBytesPerLine % THREE_BYTES_PER_PIXEL) // dst raster width (in bytes) must be evenly divisible by 3
1640  return false;
1641  if (inSrcBytesPerLine % THREE_BYTES_PER_PIXEL) // src raster width (in bytes) must be evenly divisible by 3
1642  return false;
1643 
1644  const ULWord dstMaxPixelWidth (inDstBytesPerLine / THREE_BYTES_PER_PIXEL);
1645  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / THREE_BYTES_PER_PIXEL);
1646  ULWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1647  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1648 
1649  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1650  return false;
1651  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1652  return false;
1653  if (inSrcHorzPixelOffset + inSrcHorzPixelsToCopy > UWord(srcMaxPixelWidth))
1654  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1655  if (inDstHorzPixelOffset + numHorzPixelsToCopy > dstMaxPixelWidth)
1656  numHorzPixelsToCopy = inDstHorzPixelOffset + numHorzPixelsToCopy - dstMaxPixelWidth;
1657  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1658  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1659  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1660  {
1661  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1662  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1663  else
1664  return true;
1665  }
1666 
1667  for (UWord lineNdx (0); lineNdx < numVertLinesToCopy; lineNdx++) // for each raster line to copy
1668  {
1669  const UByte * pSrcLine (pSrcBuffer + inSrcBytesPerLine * (inSrcVertLineOffset + lineNdx) + inSrcHorzPixelOffset * THREE_BYTES_PER_PIXEL);
1670  UByte * pDstLine (pDstBuffer + inDstBytesPerLine * (inDstVertLineOffset + lineNdx) + inDstHorzPixelOffset * THREE_BYTES_PER_PIXEL);
1671  ::memcpy (pDstLine, pSrcLine, numHorzPixelsToCopy * THREE_BYTES_PER_PIXEL); // copy the line
1672  }
1673 
1674  return true;
1675 
1676 } // CopyRaster3BytesPerPixel
1677 
1678 
1679 // This function should work on all 6-byte-per-pixel formats
1680 static bool CopyRaster6BytesPerPixel ( UByte * pDstBuffer, // Dest buffer to be modified
1681  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width)
1682  const UWord inDstTotalLines, // Dest buffer total raster lines (max height)
1683  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1684  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear -- must be evenly divisible by 6
1685  const UByte * pSrcBuffer, // Src buffer
1686  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width)
1687  const UWord inSrcTotalLines, // Src buffer total raster lines (max height)
1688  const UWord inSrcVertLineOffset, // Src image top edge
1689  const UWord inSrcVertLinesToCopy, // Src image height
1690  const UWord inSrcHorzPixelOffset, // Src image left edge
1691  const UWord inSrcHorzPixelsToCopy) // Src image width
1692 {
1693  const UWord SIX_BYTES_PER_PIXEL (6);
1694 
1695  if (inDstBytesPerLine % SIX_BYTES_PER_PIXEL) // dst raster width (in bytes) must be evenly divisible by 6
1696  return false;
1697  if (inSrcBytesPerLine % SIX_BYTES_PER_PIXEL) // src raster width (in bytes) must be evenly divisible by 6
1698  return false;
1699 
1700  const ULWord dstMaxPixelWidth (inDstBytesPerLine / SIX_BYTES_PER_PIXEL);
1701  const ULWord srcMaxPixelWidth (inSrcBytesPerLine / SIX_BYTES_PER_PIXEL);
1702  ULWord numHorzPixelsToCopy (inSrcHorzPixelsToCopy);
1703  UWord numVertLinesToCopy (inSrcVertLinesToCopy);
1704 
1705  if (inDstHorzPixelOffset >= dstMaxPixelWidth) // dst past right edge
1706  return false;
1707  if (inSrcHorzPixelOffset >= srcMaxPixelWidth) // src past right edge
1708  return false;
1709  if (inSrcHorzPixelOffset + inSrcHorzPixelsToCopy > UWord(srcMaxPixelWidth))
1710  numHorzPixelsToCopy -= inSrcHorzPixelOffset + inSrcHorzPixelsToCopy - srcMaxPixelWidth; // Clip to src raster's right edge
1711  if (inDstHorzPixelOffset + numHorzPixelsToCopy > dstMaxPixelWidth)
1712  numHorzPixelsToCopy = inDstHorzPixelOffset + numHorzPixelsToCopy - dstMaxPixelWidth;
1713  if (inSrcVertLineOffset + inSrcVertLinesToCopy > inSrcTotalLines)
1714  numVertLinesToCopy -= inSrcVertLineOffset + inSrcVertLinesToCopy - inSrcTotalLines; // Clip to src raster's bottom edge
1715  if (numVertLinesToCopy + inDstVertLineOffset >= inDstTotalLines)
1716  {
1717  if (numVertLinesToCopy + inDstVertLineOffset > inDstTotalLines)
1718  numVertLinesToCopy -= numVertLinesToCopy + inDstVertLineOffset - inDstTotalLines;
1719  else
1720  return true;
1721  }
1722 
1723  for (UWord lineNdx (0); lineNdx < numVertLinesToCopy; lineNdx++) // for each raster line to copy
1724  {
1725  const UByte * pSrcLine (pSrcBuffer + inSrcBytesPerLine * (inSrcVertLineOffset + lineNdx) + inSrcHorzPixelOffset * SIX_BYTES_PER_PIXEL);
1726  UByte * pDstLine (pDstBuffer + inDstBytesPerLine * (inDstVertLineOffset + lineNdx) + inDstHorzPixelOffset * SIX_BYTES_PER_PIXEL);
1727  ::memcpy (pDstLine, pSrcLine, numHorzPixelsToCopy * SIX_BYTES_PER_PIXEL); // copy the line
1728  }
1729 
1730  return true;
1731 
1732 } // CopyRaster6BytesPerPixel
1733 
1734 
1735 bool CopyRaster (const NTV2PixelFormat inPixelFormat, // Pixel format of both src and dst buffers
1736  UByte * pDstBuffer, // Dest buffer to be modified
1737  const ULWord inDstBytesPerLine, // Dest buffer bytes per raster line (determines max width)
1738  const UWord inDstTotalLines, // Dest buffer total lines in raster (max height)
1739  const UWord inDstVertLineOffset, // Vertical line offset into the dest raster where the top edge of the src image will appear
1740  const UWord inDstHorzPixelOffset, // Horizontal pixel offset into the dest raster where the left edge of the src image will appear
1741  const UByte * pSrcBuffer, // Src buffer
1742  const ULWord inSrcBytesPerLine, // Src buffer bytes per raster line (determines max width)
1743  const UWord inSrcTotalLines, // Src buffer total lines in raster (max height)
1744  const UWord inSrcVertLineOffset, // Src image top edge
1745  const UWord inSrcVertLinesToCopy, // Src image height
1746  const UWord inSrcHorzPixelOffset, // Src image left edge
1747  const UWord inSrcHorzPixelsToCopy) // Src image width
1748 {
1749  if (!pDstBuffer) // NULL buffer
1750  return false;
1751  if (!pSrcBuffer) // NULL buffer
1752  return false;
1753  if (pDstBuffer == pSrcBuffer) // src & dst buffers must be different
1754  return false;
1755  if (inDstBytesPerLine == 0) // zero rowbytes
1756  return false;
1757  if (inSrcBytesPerLine == 0) // zero rowbytes
1758  return false;
1759  if (inDstTotalLines == 0) // zero height
1760  return false;
1761  if (inSrcTotalLines == 0) // zero height
1762  return false;
1763  if (inDstVertLineOffset >= inDstTotalLines) // dst past bottom edge
1764  return false;
1765  if (inSrcVertLineOffset >= inSrcTotalLines) // src past bottom edge
1766  return false;
1767  switch (inPixelFormat)
1768  {
1769  case NTV2_FBF_10BIT_YCBCR:
1770  case NTV2_FBF_10BIT_YCBCR_DPX: return CopyRaster16BytesPer6Pixels (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1771  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1772  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1773 
1774  case NTV2_FBF_8BIT_YCBCR:
1775  case NTV2_FBF_8BIT_YCBCR_YUY2: return CopyRaster4BytesPer2Pixels (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1776  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1777  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1778 
1779  case NTV2_FBF_ARGB:
1780  case NTV2_FBF_RGBA:
1781  case NTV2_FBF_ABGR:
1782  case NTV2_FBF_10BIT_DPX:
1783  case NTV2_FBF_10BIT_DPX_LE:
1784  case NTV2_FBF_10BIT_RGB: return CopyRaster4BytesPerPixel (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1785  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1786  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1787 
1788  case NTV2_FBF_24BIT_RGB:
1789  case NTV2_FBF_24BIT_BGR: return CopyRaster3BytesPerPixel (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1790  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1791  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1792 
1793  case NTV2_FBF_48BIT_RGB: return CopyRaster6BytesPerPixel (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1794  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1795  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1796 
1797  case NTV2_FBF_12BIT_RGB_PACKED: return CopyRaster36BytesPer8Pixels (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1798  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1799  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1800  case NTV2_FBF_10BIT_RAW_YCBCR: return CopyRaster20BytesPer16Pixels (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1801  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1802  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1803 
1804  case NTV2_FBF_10BIT_ARGB: return CopyRaster5BytesPerPixel (pDstBuffer, inDstBytesPerLine, inDstTotalLines, inDstVertLineOffset, inDstHorzPixelOffset,
1805  pSrcBuffer, inSrcBytesPerLine, inSrcTotalLines, inSrcVertLineOffset, inSrcVertLinesToCopy,
1806  inSrcHorzPixelOffset, inSrcHorzPixelsToCopy);
1807 
1808  case NTV2_FBF_8BIT_DVCPRO: // Lossy
1809  case NTV2_FBF_8BIT_HDV: // Lossy
1811  case NTV2_FBF_10BIT_YCBCRA:
1813  case NTV2_FBF_PRORES_HDV:
1815  case NTV2_FBF_16BIT_ARGB:
1825  return false; // Unsupported
1826  }
1827  return false;
1828 
1829 } // CopyRaster
1830 
1831 
1832 // frames per second
1833 double GetFramesPerSecond (const NTV2FrameRate inFrameRate)
1834 {
1835  switch (inFrameRate)
1836  {
1837  case NTV2_FRAMERATE_12000: return 120.0;
1838  case NTV2_FRAMERATE_11988: return 120000.0 / 1001.0;
1839  case NTV2_FRAMERATE_6000: return 60.0;
1840  case NTV2_FRAMERATE_5994: return 60000.0 / 1001.0;
1841  case NTV2_FRAMERATE_5000: return 50.0;
1842  case NTV2_FRAMERATE_4800: return 48.0;
1843  case NTV2_FRAMERATE_4795: return 48000.0 / 1001.0;
1844  case NTV2_FRAMERATE_3000: return 30.0;
1845  case NTV2_FRAMERATE_2997: return 30000.0 / 1001.0;
1846  case NTV2_FRAMERATE_2500: return 25.0;
1847  case NTV2_FRAMERATE_2400: return 24.0;
1848  case NTV2_FRAMERATE_2398: return 24000.0 / 1001.0;
1849  case NTV2_FRAMERATE_1500: return 15.0;
1850  case NTV2_FRAMERATE_1498: return 15000.0 / 1001.0;
1851 #if !defined(NTV2_DEPRECATE_16_0)
1852  case NTV2_FRAMERATE_1900: return 19.0;
1853  case NTV2_FRAMERATE_1898: return 19000.0 / 1001.0;
1854  case NTV2_FRAMERATE_1800: return 18.0;
1855  case NTV2_FRAMERATE_1798: return 18000.0 / 1001.0;
1856 #endif
1857 #if defined(_DEBUG)
1858  case NTV2_NUM_FRAMERATES:
1859  case NTV2_FRAMERATE_UNKNOWN: break;
1860 #else
1861  default: break;
1862 #endif
1863  }
1864  return 30.0 / 1.001;
1865 }
1866 
1867 
1868 bool GetFramesPerSecond (const NTV2FrameRate inFrameRate, ULWord & outFractionNumerator, ULWord & outFractionDenominator)
1869 {
1870  switch (inFrameRate)
1871  {
1872  case NTV2_FRAMERATE_12000: outFractionNumerator = 120; outFractionDenominator = 1; break;
1873  case NTV2_FRAMERATE_11988: outFractionNumerator = 120000; outFractionDenominator = 1001; break;
1874  case NTV2_FRAMERATE_6000: outFractionNumerator = 60; outFractionDenominator = 1; break;
1875  case NTV2_FRAMERATE_5994: outFractionNumerator = 60000; outFractionDenominator = 1001; break;
1876  case NTV2_FRAMERATE_5000: outFractionNumerator = 50; outFractionDenominator = 1; break;
1877  case NTV2_FRAMERATE_4800: outFractionNumerator = 48; outFractionDenominator = 1; break;
1878  case NTV2_FRAMERATE_4795: outFractionNumerator = 48000; outFractionDenominator = 1001; break;
1879  case NTV2_FRAMERATE_3000: outFractionNumerator = 30; outFractionDenominator = 1; break;
1880  case NTV2_FRAMERATE_2997: outFractionNumerator = 30000; outFractionDenominator = 1001; break;
1881  case NTV2_FRAMERATE_2500: outFractionNumerator = 25; outFractionDenominator = 1; break;
1882  case NTV2_FRAMERATE_2400: outFractionNumerator = 24; outFractionDenominator = 1; break;
1883  case NTV2_FRAMERATE_2398: outFractionNumerator = 24000; outFractionDenominator = 1001; break;
1884  case NTV2_FRAMERATE_1500: outFractionNumerator = 15; outFractionDenominator = 1; break;
1885  case NTV2_FRAMERATE_1498: outFractionNumerator = 15000; outFractionDenominator = 1001; break;
1886 #if !defined(NTV2_DEPRECATE_16_0)
1887  case NTV2_FRAMERATE_1900: outFractionNumerator = 19; outFractionDenominator = 1; break;
1888  case NTV2_FRAMERATE_1898: outFractionNumerator = 19000; outFractionDenominator = 1001; break;
1889  case NTV2_FRAMERATE_1800: outFractionNumerator = 18; outFractionDenominator = 1; break;
1890  case NTV2_FRAMERATE_1798: outFractionNumerator = 18000; outFractionDenominator = 1001; break;
1891 #endif // !defined(NTV2_DEPRECATE_16_0)
1892 #if defined(_DEBUG)
1893  case NTV2_NUM_FRAMERATES:
1894  case NTV2_FRAMERATE_UNKNOWN: outFractionNumerator = 0; outFractionDenominator = 0; return false;
1895 #else
1896  default: outFractionNumerator = 0; outFractionDenominator = 0; return false;
1897 #endif
1898  }
1899  return true;
1900 }
1901 
1902 
1903 NTV2Standard GetNTV2StandardFromScanGeometry (const UByte inScanGeometry, const bool inIsProgressiveTransport)
1904 {
1905  switch (inScanGeometry)
1906  {
1907  case NTV2_SG_525: return NTV2_STANDARD_525;
1908  case NTV2_SG_625: return NTV2_STANDARD_625;
1909  case NTV2_SG_750: return NTV2_STANDARD_720;
1910  case NTV2_SG_2Kx1556: return NTV2_STANDARD_2K;
1911 
1912  case NTV2_SG_1125:
1913  case NTV2_SG_2Kx1080: return inIsProgressiveTransport ? NTV2_STANDARD_1080p : NTV2_STANDARD_1080;
1914 
1915  default: break;
1916  }
1917  return NTV2_STANDARD_INVALID;
1918 }
1919 
1920 
1922  const UWord inHeightLines,
1923  const UWord inWidthPixels,
1924  const bool inIsInterlaced,
1925  const bool inIsLevelB,
1926  const bool inIsPSF)
1927 {
1929  if (inFrameRate == ::GetNTV2FrameRateFromVideoFormat(fmt))
1930  if (inHeightLines == ::GetDisplayHeight(fmt))
1931  if (inWidthPixels == ::GetDisplayWidth(fmt))
1932  if (inIsInterlaced == !::IsProgressiveTransport(fmt))
1933  if (inIsPSF == ::IsPSF(fmt))
1934  if (NTV2_VIDEO_FORMAT_IS_B(fmt) == inIsLevelB)
1935  return fmt;
1936  return NTV2_FORMAT_UNKNOWN;
1937 }
1938 
1939 
1941 {
1942  NTV2VideoFormat quarterSizedFormat(inVideoFormat);
1943 
1944  switch (inVideoFormat)
1945  {
1947  case NTV2_FORMAT_4x1920x1080psf_2398: quarterSizedFormat = NTV2_FORMAT_1080psf_2398; break;
1949  case NTV2_FORMAT_4x1920x1080psf_2400: quarterSizedFormat = NTV2_FORMAT_1080psf_2400; break;
1951  case NTV2_FORMAT_4x1920x1080psf_2500: quarterSizedFormat = NTV2_FORMAT_1080psf_2500_2; break;
1953  case NTV2_FORMAT_4x1920x1080psf_2997: quarterSizedFormat = NTV2_FORMAT_1080i_5994; break; // NTV2_FORMAT_1080psf_2997
1955  case NTV2_FORMAT_4x1920x1080psf_3000: quarterSizedFormat = NTV2_FORMAT_1080i_6000; break; // NTV2_FORMAT_1080psf_3000
1956 
1958  case NTV2_FORMAT_4x2048x1080psf_2398: quarterSizedFormat = NTV2_FORMAT_1080psf_2K_2398; break;
1960  case NTV2_FORMAT_4x2048x1080psf_2400: quarterSizedFormat = NTV2_FORMAT_1080psf_2K_2400; break;
1962  case NTV2_FORMAT_4x2048x1080psf_2500: quarterSizedFormat = NTV2_FORMAT_1080psf_2K_2500; break;
1963  //case NTV2_FORMAT_4x2048x1080psf_2997: quarterSizedFormat = NTV2_FORMAT_1080psf_2K_2997; break;
1964  //case NTV2_FORMAT_4x2048x1080psf_3000: quarterSizedFormat = NTV2_FORMAT_1080psf_2K_3000; break;
1965 
1967  case NTV2_FORMAT_4x1920x1080p_2398: quarterSizedFormat = NTV2_FORMAT_1080p_2398; break;
1969  case NTV2_FORMAT_4x1920x1080p_2400: quarterSizedFormat = NTV2_FORMAT_1080p_2400; break;
1971  case NTV2_FORMAT_4x1920x1080p_2500: quarterSizedFormat = NTV2_FORMAT_1080p_2500; break;
1973  case NTV2_FORMAT_4x1920x1080p_2997: quarterSizedFormat = NTV2_FORMAT_1080p_2997; break;
1975  case NTV2_FORMAT_4x1920x1080p_3000: quarterSizedFormat = NTV2_FORMAT_1080p_3000; break;
1977  case NTV2_FORMAT_4x1920x1080p_5000: quarterSizedFormat = NTV2_FORMAT_1080p_5000_A; break;
1979  case NTV2_FORMAT_4x1920x1080p_5994: quarterSizedFormat = NTV2_FORMAT_1080p_5994_A; break;
1981  case NTV2_FORMAT_4x1920x1080p_6000: quarterSizedFormat = NTV2_FORMAT_1080p_6000_A; break;
1983  case NTV2_FORMAT_4x1920x1080p_5000_B: quarterSizedFormat = NTV2_FORMAT_1080p_5000_B; break;
1985  case NTV2_FORMAT_4x1920x1080p_5994_B: quarterSizedFormat = NTV2_FORMAT_1080p_5994_B; break;
1987  case NTV2_FORMAT_4x1920x1080p_6000_B: quarterSizedFormat = NTV2_FORMAT_1080p_6000_B; break;
1988 
1990  case NTV2_FORMAT_4x2048x1080p_2398: quarterSizedFormat = NTV2_FORMAT_1080p_2K_2398; break;
1992  case NTV2_FORMAT_4x2048x1080p_2400: quarterSizedFormat = NTV2_FORMAT_1080p_2K_2400; break;
1994  case NTV2_FORMAT_4x2048x1080p_2500: quarterSizedFormat = NTV2_FORMAT_1080p_2K_2500; break;
1996  case NTV2_FORMAT_4x2048x1080p_2997: quarterSizedFormat = NTV2_FORMAT_1080p_2K_2997; break;
1998  case NTV2_FORMAT_4x2048x1080p_3000: quarterSizedFormat = NTV2_FORMAT_1080p_2K_3000; break;
2000  case NTV2_FORMAT_4x2048x1080p_4795: quarterSizedFormat = NTV2_FORMAT_1080p_2K_4795_A; break;
2002  case NTV2_FORMAT_4x2048x1080p_4800: quarterSizedFormat = NTV2_FORMAT_1080p_2K_4800_A; break;
2004  case NTV2_FORMAT_4x2048x1080p_5000: quarterSizedFormat = NTV2_FORMAT_1080p_2K_5000_A; break;
2006  case NTV2_FORMAT_4x2048x1080p_5994: quarterSizedFormat = NTV2_FORMAT_1080p_2K_5994_A; break;
2008  case NTV2_FORMAT_4x2048x1080p_6000: quarterSizedFormat = NTV2_FORMAT_1080p_2K_6000_A; break;
2010  case NTV2_FORMAT_4x2048x1080p_4795_B: quarterSizedFormat = NTV2_FORMAT_1080p_2K_4795_B; break;
2012  case NTV2_FORMAT_4x2048x1080p_4800_B: quarterSizedFormat = NTV2_FORMAT_1080p_2K_4800_B; break;
2014  case NTV2_FORMAT_4x2048x1080p_5000_B: quarterSizedFormat = NTV2_FORMAT_1080p_2K_5000_B; break;
2016  case NTV2_FORMAT_4x2048x1080p_5994_B: quarterSizedFormat = NTV2_FORMAT_1080p_2K_5994_B; break;
2018  case NTV2_FORMAT_4x2048x1080p_6000_B: quarterSizedFormat = NTV2_FORMAT_1080p_2K_6000_B; break;
2019  // No quarter sized formats for 119.88 or 120 Hz
2020 
2021  case NTV2_FORMAT_4x3840x2160p_2398: quarterSizedFormat = NTV2_FORMAT_3840x2160p_2398; break;
2022  case NTV2_FORMAT_4x3840x2160p_2400: quarterSizedFormat = NTV2_FORMAT_3840x2160p_2400; break;
2023  case NTV2_FORMAT_4x3840x2160p_2500: quarterSizedFormat = NTV2_FORMAT_3840x2160p_2500; break;
2024  case NTV2_FORMAT_4x3840x2160p_2997: quarterSizedFormat = NTV2_FORMAT_3840x2160p_2997; break;
2025  case NTV2_FORMAT_4x3840x2160p_3000: quarterSizedFormat = NTV2_FORMAT_3840x2160p_3000; break;
2026  case NTV2_FORMAT_4x3840x2160p_5000: quarterSizedFormat = NTV2_FORMAT_3840x2160p_5000; break;
2027  case NTV2_FORMAT_4x3840x2160p_5994: quarterSizedFormat = NTV2_FORMAT_3840x2160p_5994; break;
2028  case NTV2_FORMAT_4x3840x2160p_6000: quarterSizedFormat = NTV2_FORMAT_3840x2160p_6000; break;
2029  case NTV2_FORMAT_4x3840x2160p_5000_B: quarterSizedFormat = NTV2_FORMAT_3840x2160p_5000_B; break;
2030  case NTV2_FORMAT_4x3840x2160p_5994_B: quarterSizedFormat = NTV2_FORMAT_3840x2160p_5994_B; break;
2031  case NTV2_FORMAT_4x3840x2160p_6000_B: quarterSizedFormat = NTV2_FORMAT_3840x2160p_6000_B; break;
2032 
2033  case NTV2_FORMAT_4x4096x2160p_2398: quarterSizedFormat = NTV2_FORMAT_4096x2160p_2398; break;
2034  case NTV2_FORMAT_4x4096x2160p_2400: quarterSizedFormat = NTV2_FORMAT_4096x2160p_2400; break;
2035  case NTV2_FORMAT_4x4096x2160p_2500: quarterSizedFormat = NTV2_FORMAT_4096x2160p_2500; break;
2036  case NTV2_FORMAT_4x4096x2160p_2997: quarterSizedFormat = NTV2_FORMAT_4096x2160p_2997; break;
2037  case NTV2_FORMAT_4x4096x2160p_3000: quarterSizedFormat = NTV2_FORMAT_4096x2160p_3000; break;
2038  case NTV2_FORMAT_4x4096x2160p_4795: quarterSizedFormat = NTV2_FORMAT_4096x2160p_4795; break;
2039  case NTV2_FORMAT_4x4096x2160p_4800: quarterSizedFormat = NTV2_FORMAT_4096x2160p_4800; break;
2040  case NTV2_FORMAT_4x4096x2160p_5000: quarterSizedFormat = NTV2_FORMAT_4096x2160p_5000; break;
2041  case NTV2_FORMAT_4x4096x2160p_5994: quarterSizedFormat = NTV2_FORMAT_4096x2160p_5994; break;
2042  case NTV2_FORMAT_4x4096x2160p_6000: quarterSizedFormat = NTV2_FORMAT_4096x2160p_6000; break;
2043  case NTV2_FORMAT_4x4096x2160p_4795_B: quarterSizedFormat = NTV2_FORMAT_4096x2160p_4795_B; break;
2044  case NTV2_FORMAT_4x4096x2160p_4800_B: quarterSizedFormat = NTV2_FORMAT_4096x2160p_4800_B; break;
2045  case NTV2_FORMAT_4x4096x2160p_5000_B: quarterSizedFormat = NTV2_FORMAT_4096x2160p_5000_B; break;
2046  case NTV2_FORMAT_4x4096x2160p_5994_B: quarterSizedFormat = NTV2_FORMAT_4096x2160p_5994_B; break;
2047  case NTV2_FORMAT_4x4096x2160p_6000_B: quarterSizedFormat = NTV2_FORMAT_4096x2160p_6000_B; break;
2048 #if defined(_DEBUG)
2049  case NTV2_FORMAT_UNKNOWN:
2053  case NTV2_FORMAT_720p_5994:
2054  case NTV2_FORMAT_720p_6000:
2066  case NTV2_FORMAT_720p_5000:
2070  case NTV2_FORMAT_720p_2398:
2071  case NTV2_FORMAT_720p_2500:
2081  case NTV2_FORMAT_525_5994:
2082  case NTV2_FORMAT_625_5000:
2083  case NTV2_FORMAT_525_2398:
2084  case NTV2_FORMAT_525_2400:
2088  case NTV2_FORMAT_2K_1498:
2089  case NTV2_FORMAT_2K_1500:
2090  case NTV2_FORMAT_2K_2398:
2091  case NTV2_FORMAT_2K_2400:
2092  case NTV2_FORMAT_2K_2500:
2120 #else
2121  default:
2122 #endif
2123  break;
2124  }
2125  return quarterSizedFormat;
2126 }
2127 
2128 
2129 NTV2VideoFormat GetQuadSizedVideoFormat (const NTV2VideoFormat inVideoFormat, const bool isSquareDivision)
2130 {
2131  switch (inVideoFormat)
2132  {
2138 
2142  //case NTV2_FORMAT_1080psf_2K_2997: return NTV2_FORMAT_4x2048x1080psf_29;
2143  //case NT2_FORMAT_1080psf_2K_3000: return NTV2V2_FORMAT_4x2048x1080psf_3000;
2144 
2156 
2172 
2184 
2200 
2201 #if defined(_DEBUG)
2202  case NTV2_FORMAT_UNKNOWN:
2204  case NTV2_FORMAT_720p_5994:
2205  case NTV2_FORMAT_720p_6000:
2206  case NTV2_FORMAT_720p_5000:
2207  case NTV2_FORMAT_720p_2398:
2208  case NTV2_FORMAT_720p_2500:
2212  case NTV2_FORMAT_525_5994:
2213  case NTV2_FORMAT_625_5000:
2214  case NTV2_FORMAT_525_2398:
2215  case NTV2_FORMAT_525_2400:
2219  case NTV2_FORMAT_2K_1498:
2220  case NTV2_FORMAT_2K_1500:
2221  case NTV2_FORMAT_2K_2398:
2222  case NTV2_FORMAT_2K_2400:
2223  case NTV2_FORMAT_2K_2500:
2307 #else
2308  default:
2309 #endif
2310  break;
2311  }
2312  return inVideoFormat;
2313 }
2314 
2316 {
2317  switch (inGeometry)
2318  {
2323  default: return inGeometry;
2324  }
2325 }
2326 
2327 
2329 {
2330  switch (inGeometry)
2331  {
2336  default: return inGeometry;
2337  }
2338 }
2339 
2341 {
2342  switch (inStandard)
2343  {
2352  default: return inStandard;
2353  }
2354 }
2355 
2356 
2357 NTV2Standard Get4xSizedStandard (const NTV2Standard inStandard, const bool bIs4k)
2358 {
2359  switch (inStandard)
2360  {
2363 
2364  case NTV2_STANDARD_3840HFR:
2366 
2367  case NTV2_STANDARD_4096HFR:
2369 
2370  default: return inStandard;
2371  }
2372 }
2373 
2374 
2376 {
2378 
2379  switch (inVideoFormat)
2380  {
2397  standard = NTV2_STANDARD_1080;
2398  break;
2407  standard = NTV2_STANDARD_1080p;
2408  break;
2419  standard = NTV2_STANDARD_2Kx1080p;
2420  break;
2424  standard = NTV2_STANDARD_2Kx1080i;
2425  break;
2426  case NTV2_FORMAT_720p_2398:
2427  case NTV2_FORMAT_720p_5000:
2428  case NTV2_FORMAT_720p_5994:
2429  case NTV2_FORMAT_720p_6000:
2430  case NTV2_FORMAT_720p_2500:
2431  standard = NTV2_STANDARD_720;
2432  break;
2433  case NTV2_FORMAT_525_5994:
2434  case NTV2_FORMAT_525_2398:
2435  case NTV2_FORMAT_525_2400:
2437  standard = NTV2_STANDARD_525;
2438  break;
2439  case NTV2_FORMAT_625_5000:
2441  standard = NTV2_STANDARD_625 ;
2442  break;
2443  case NTV2_FORMAT_2K_1498:
2444  case NTV2_FORMAT_2K_1500:
2445  case NTV2_FORMAT_2K_2398:
2446  case NTV2_FORMAT_2K_2400:
2447  case NTV2_FORMAT_2K_2500:
2448  standard = NTV2_STANDARD_2K ;
2449  break;
2460  standard = NTV2_STANDARD_3840x2160p;
2461  break;
2472  standard = NTV2_STANDARD_3840x2160p;
2473  break;
2480  standard = NTV2_STANDARD_3840HFR;
2481  break;
2496  standard = NTV2_STANDARD_4096x2160p;
2497  break;
2508  standard = NTV2_STANDARD_4096x2160p;
2509  break;
2520  standard = NTV2_STANDARD_4096HFR;
2521  break;
2522 
2531  standard = NTV2_STANDARD_7680;
2532  break;
2533 
2544  standard = NTV2_STANDARD_8192;
2545  break;
2546 
2547 
2548 #if defined (_DEBUG)
2549 // Debug builds warn about missing values
2550  case NTV2_FORMAT_UNKNOWN:
2584  break; // Unsupported
2585 #else
2586  default:
2587  break;
2588 #endif
2589  }
2590 
2591  return standard;
2592 }
2593 
2594 
2595 //-------------------------------------------------------------------------------------------------------
2596 // GetSupportedNTV2VideoFormatFromInputVideoFormat
2597 //-------------------------------------------------------------------------------------------------------
2599 {
2600  NTV2VideoFormat result;
2601 
2602  switch (inVideoFormat)
2603  {
2607 
2613 
2617 
2623 
2627 
2633 
2634  default: result = inVideoFormat; break;
2635  }
2636 
2637  return result;
2638 }
2639 
2640 
2641 //-------------------------------------------------------------------------------------------------------
2642 // GetNTV2FrameGeometryFromVideoFormat
2643 //-------------------------------------------------------------------------------------------------------
2645 {
2647 
2648  switch (inVideoFormat)
2649  {
2661  result = NTV2_FG_4x3840x2160;
2662  break;
2663 
2679  result = NTV2_FG_4x4096x2160;
2680  break;
2681 
2714  result = NTV2_FG_4x1920x1080;
2715  break;
2716 
2761  result = NTV2_FG_4x2048x1080;
2762  break;
2763 
2764  case NTV2_FORMAT_2K_1498:
2765  case NTV2_FORMAT_2K_1500:
2766  case NTV2_FORMAT_2K_2398:
2767  case NTV2_FORMAT_2K_2400:
2768  case NTV2_FORMAT_2K_2500:
2769  result = NTV2_FG_2048x1556;
2770  break;
2771 
2791  result = NTV2_FG_1920x1080;
2792  break;
2793 
2812  result = NTV2_FG_2048x1080;
2813  break;
2814 
2815  case NTV2_FORMAT_720p_2398:
2816  case NTV2_FORMAT_720p_2500:
2817  case NTV2_FORMAT_720p_5994:
2818  case NTV2_FORMAT_720p_6000:
2819  case NTV2_FORMAT_720p_5000:
2820  result = NTV2_FG_1280x720;
2821  break;
2822 
2823  case NTV2_FORMAT_525_2398:
2824  case NTV2_FORMAT_525_2400:
2825  case NTV2_FORMAT_525_5994:
2827  result = NTV2_FG_720x486;
2828  break;
2829 
2830  case NTV2_FORMAT_625_5000:
2832  result = NTV2_FG_720x576;
2833  break;
2834 
2835 #if defined (_DEBUG)
2836 // Debug builds warn about missing values
2837  case NTV2_FORMAT_UNKNOWN:
2847  break; // Unsupported
2848 #else
2849  default:
2850  break;
2851 #endif
2852  }
2853 
2854  return result;
2855 }
2856 
2857 
2858 ULWord GetVideoActiveSize (const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, const NTV2VANCMode inVancMode)
2859 {
2860  const NTV2FormatDescriptor fd (inVideoFormat, inFBFormat, inVancMode);
2861  return fd.GetTotalBytes();
2862 } // GetVideoActiveSize
2863 
2864 
2865 // GetVideoWriteSize
2866 // At least in Windows, to get bursting to work between our board and the disk
2867 // system without going through the file manager cache, you need to open the file
2868 // with FILE_FLAG_NO_BUFFERING flag. With this you must do reads and writes
2869 // on 4096 byte boundaries with most modern disk systems. You could actually
2870 // do 512 on some systems though.
2871 // So this function takes in the videoformat and the framebufferformat
2872 // and gets the framesize you need to write to meet this requirement.
2873 //
2874 
2875 ULWord GetVideoWriteSize (const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, const NTV2VANCMode inVancMode)
2876 {
2877  ULWord ulSize (::GetVideoActiveSize (inVideoFormat, inFBFormat, inVancMode));
2878  if (ulSize % 4096)
2879  ulSize = ((ulSize / 4096) + 1) * 4096;
2880  return ulSize;
2881 }
2882 
2883 
2884 // For a given framerate and audiorate, returns how many audio samples there
2885 // will be in a frame's time. cadenceFrame is only used for 5994 or 2997 @ 48k.
2886 // smpte372Enabled indicates that you are doing 1080p60,1080p5994 or 1080p50
2887 // in this mode the boards framerate might be NTV2_FRAMERATE_3000, but since
2888 // 2 links are coming out, the video rate is actually NTV2_FRAMERATE_6000
2889 ULWord GetAudioSamplesPerFrame (const NTV2FrameRate inFrameRate, const NTV2AudioRate inAudioRate, ULWord inCadenceFrame, const bool inIsSMPTE372Enabled)
2890 {
2891  NTV2FrameRate frameRate(inFrameRate);
2892  ULWord audioSamplesPerFrame(0);
2893  inCadenceFrame %= 5;
2894 
2895  if (inIsSMPTE372Enabled)
2896  {
2897  // the video is actually coming out twice as fast as the board rate
2898  // since there are 2 links.
2899  switch (inFrameRate)
2900  {
2901  case NTV2_FRAMERATE_3000: frameRate = NTV2_FRAMERATE_6000; break;
2902  case NTV2_FRAMERATE_2997: frameRate = NTV2_FRAMERATE_5994; break;
2903  case NTV2_FRAMERATE_2500: frameRate = NTV2_FRAMERATE_5000; break;
2904  case NTV2_FRAMERATE_2400: frameRate = NTV2_FRAMERATE_4800; break;
2905  case NTV2_FRAMERATE_2398: frameRate = NTV2_FRAMERATE_4795; break;
2906  default:
2907  break;
2908  }
2909  }
2910 
2911  if (inAudioRate == NTV2_AUDIO_48K)
2912  {
2913  switch (frameRate)
2914  {
2915  case NTV2_FRAMERATE_12000:
2916  audioSamplesPerFrame = 400;
2917  break;
2918  case NTV2_FRAMERATE_11988:
2919  switch (inCadenceFrame)
2920  {
2921  case 0:
2922  case 2:
2923  case 4: audioSamplesPerFrame = 400; break;
2924 
2925  case 1:
2926  case 3: audioSamplesPerFrame = 401; break;
2927  }
2928  break;
2929  case NTV2_FRAMERATE_6000:
2930  audioSamplesPerFrame = 800;
2931  break;
2932  case NTV2_FRAMERATE_5994:
2933  switch (inCadenceFrame)
2934  {
2935  case 0: audioSamplesPerFrame = 800; break;
2936 
2937  case 1:
2938  case 2:
2939  case 3:
2940  case 4: audioSamplesPerFrame = 801; break;
2941  }
2942  break;
2943  case NTV2_FRAMERATE_5000: audioSamplesPerFrame = 1920/2; break;
2944  case NTV2_FRAMERATE_4800: audioSamplesPerFrame = 1000; break;
2945  case NTV2_FRAMERATE_4795: audioSamplesPerFrame = 1001; break;
2946  case NTV2_FRAMERATE_3000: audioSamplesPerFrame = 1600; break;
2947  case NTV2_FRAMERATE_2997:
2948  // depends on cadenceFrame;
2949  switch (inCadenceFrame)
2950  {
2951  case 0:
2952  case 2:
2953  case 4: audioSamplesPerFrame = 1602; break;
2954 
2955  case 1:
2956  case 3: audioSamplesPerFrame = 1601; break;
2957  }
2958  break;
2959  case NTV2_FRAMERATE_2500: audioSamplesPerFrame = 1920; break;
2960  case NTV2_FRAMERATE_2400: audioSamplesPerFrame = 2000; break;
2961  case NTV2_FRAMERATE_2398: audioSamplesPerFrame = 2002; break;
2962  case NTV2_FRAMERATE_1500: audioSamplesPerFrame = 3200; break;
2963  case NTV2_FRAMERATE_1498:
2964  // depends on cadenceFrame;
2965  switch (inCadenceFrame)
2966  {
2967  case 0: audioSamplesPerFrame = 3204; break;
2968 
2969  case 1:
2970  case 2:
2971  case 3:
2972  case 4: audioSamplesPerFrame = 3203; break;
2973  }
2974  break;
2975  #if !defined(NTV2_DEPRECATE_16_0)
2976  case NTV2_FRAMERATE_1900: // Not supported yet
2977  case NTV2_FRAMERATE_1898: // Not supported yet
2978  case NTV2_FRAMERATE_1800: // Not supported yet
2979  case NTV2_FRAMERATE_1798: // Not supported yet
2980  #endif
2981  case NTV2_FRAMERATE_UNKNOWN:
2982  case NTV2_NUM_FRAMERATES:
2983  audioSamplesPerFrame = 0;
2984  break;
2985  }
2986  }
2987  else if (inAudioRate == NTV2_AUDIO_96K)
2988  {
2989  switch (frameRate)
2990  {
2991  case NTV2_FRAMERATE_12000:
2992  audioSamplesPerFrame = 800;
2993  break;
2994  case NTV2_FRAMERATE_11988:
2995  switch (inCadenceFrame)
2996  {
2997  case 0:
2998  case 1:
2999  case 2:
3000  case 3: audioSamplesPerFrame = 801; break; // Fixed in SDK 16.2, was incorrect (901) before 16.2
3001 
3002  case 4: audioSamplesPerFrame = 800; break;
3003  }
3004  break;
3005  case NTV2_FRAMERATE_6000: audioSamplesPerFrame = 800*2; break;
3006  case NTV2_FRAMERATE_5994:
3007  switch (inCadenceFrame)
3008  {
3009  case 0:
3010  case 2:
3011  case 4: audioSamplesPerFrame = 1602; break;
3012 
3013  case 1:
3014  case 3: audioSamplesPerFrame = 1601; break;
3015  }
3016  break;
3017  case NTV2_FRAMERATE_5000: audioSamplesPerFrame = 1920; break;
3018  case NTV2_FRAMERATE_4800: audioSamplesPerFrame = 2000; break;
3019  case NTV2_FRAMERATE_4795: audioSamplesPerFrame = 2002; break;
3020  case NTV2_FRAMERATE_3000: audioSamplesPerFrame = 1600*2; break;
3021  case NTV2_FRAMERATE_2997:
3022  // depends on cadenceFrame;
3023  switch (inCadenceFrame)
3024  {
3025  case 0: audioSamplesPerFrame = 3204; break;
3026 
3027  case 1:
3028  case 2:
3029  case 3:
3030  case 4: audioSamplesPerFrame = 3203; break;
3031  }
3032  break;
3033  case NTV2_FRAMERATE_2500: audioSamplesPerFrame = 1920*2; break;
3034  case NTV2_FRAMERATE_2400: audioSamplesPerFrame = 2000*2; break;
3035  case NTV2_FRAMERATE_2398: audioSamplesPerFrame = 2002*2; break;
3036  case NTV2_FRAMERATE_1500: audioSamplesPerFrame = 3200*2; break;
3037  case NTV2_FRAMERATE_1498:
3038  // depends on cadenceFrame;
3039  switch (inCadenceFrame)
3040  {
3041  case 0: audioSamplesPerFrame = 3204*2; break;
3042 
3043  case 1:
3044  case 2:
3045  case 3:
3046  case 4: audioSamplesPerFrame = 3203*2; break;
3047  }
3048  break;
3049  #if !defined(NTV2_DEPRECATE_16_0)
3050  case NTV2_FRAMERATE_1900: // Not supported yet
3051  case NTV2_FRAMERATE_1898: // Not supported yet
3052  case NTV2_FRAMERATE_1800: // Not supported yet
3053  case NTV2_FRAMERATE_1798: // Not supported yet
3054  #endif
3055  case NTV2_FRAMERATE_UNKNOWN:
3056  case NTV2_NUM_FRAMERATES:
3057  audioSamplesPerFrame = 0*2; //haha
3058  break;
3059  }
3060  }
3061  else if (inAudioRate == NTV2_AUDIO_192K)
3062  {
3063  switch (frameRate)
3064  {
3065  case NTV2_FRAMERATE_12000:
3066  audioSamplesPerFrame = 1600;
3067  break;
3068  case NTV2_FRAMERATE_11988:
3069  switch (inCadenceFrame)
3070  {
3071  case 0:
3072  case 2:
3073  case 4: audioSamplesPerFrame = 1602; break;
3074 
3075  case 1:
3076  case 3: audioSamplesPerFrame = 1601; break;
3077  }
3078  break;
3079  case NTV2_FRAMERATE_6000:
3080  audioSamplesPerFrame = 3200;
3081  break;
3082  case NTV2_FRAMERATE_5994:
3083  switch (inCadenceFrame)
3084  {
3085  case 0: audioSamplesPerFrame = 3204; break;
3086 
3087  case 1:
3088  case 2:
3089  case 3:
3090  case 4: audioSamplesPerFrame = 3203; break;
3091  }
3092  break;
3093  case NTV2_FRAMERATE_5000: audioSamplesPerFrame = 3840; break;
3094  case NTV2_FRAMERATE_4800: audioSamplesPerFrame = 4000; break;
3095  case NTV2_FRAMERATE_4795: audioSamplesPerFrame = 4004; break;
3096  case NTV2_FRAMERATE_3000: audioSamplesPerFrame = 6400; break;
3097  case NTV2_FRAMERATE_2997:
3098  // depends on cadenceFrame;
3099  switch (inCadenceFrame)
3100  {
3101  case 0:
3102  case 1: audioSamplesPerFrame = 6407; break;
3103 
3104  case 2:
3105  case 3:
3106  case 4: audioSamplesPerFrame = 6406; break;
3107  }
3108  break;
3109  case NTV2_FRAMERATE_2500: audioSamplesPerFrame = 7680; break;
3110  case NTV2_FRAMERATE_2400: audioSamplesPerFrame = 8000; break;
3111  case NTV2_FRAMERATE_2398: audioSamplesPerFrame = 8008; break;
3112  case NTV2_FRAMERATE_1500: audioSamplesPerFrame = 12800; break;
3113  case NTV2_FRAMERATE_1498:
3114  // depends on cadenceFrame;
3115  switch (inCadenceFrame)
3116  {
3117  case 0:
3118  case 1:
3119  case 2:
3120  case 3: audioSamplesPerFrame = 12813; break;
3121 
3122  case 4: audioSamplesPerFrame = 12812; break;
3123  }
3124  break;
3125 #if !defined(NTV2_DEPRECATE_16_0)
3126  case NTV2_FRAMERATE_1900: // Not supported yet
3127  case NTV2_FRAMERATE_1898: // Not supported yet
3128  case NTV2_FRAMERATE_1800: // Not supported yet
3129  case NTV2_FRAMERATE_1798: // Not supported yet
3130 #endif
3131  case NTV2_FRAMERATE_UNKNOWN:
3132  case NTV2_NUM_FRAMERATES:
3133  audioSamplesPerFrame = 0*2; //haha
3134  break;
3135  }
3136  }
3137 
3138  return audioSamplesPerFrame;
3139 }
3140 
3141 
3142 // For a given framerate and audiorate and ending frame number (non-inclusive), returns the total number of audio samples over
3143 // the range of video frames starting at frame number zero up to and not including the passed in frame number, inFrameNumNonInclusive.
3144 // Utilizes cadence patterns in function immediately above, GetAudioSamplesPerFrame().
3145 // No smpte372Enabled support
3146 LWord64 GetTotalAudioSamplesFromFrameNbrZeroUpToFrameNbr (const NTV2FrameRate inFrameRate, const NTV2AudioRate inAudioRate, const ULWord inFrameNumNonInclusive)
3147 {
3148  LWord64 numTotalAudioSamples;
3149  LWord64 numAudioSamplesFromWholeGroups;
3150 
3151  ULWord numWholeGroupsOfFive;
3152  ULWord numAudioSamplesFromRemainder;
3153  ULWord remainder;
3154 
3155  numWholeGroupsOfFive = inFrameNumNonInclusive / 5;
3156  remainder = inFrameNumNonInclusive % 5;
3157 
3158  numTotalAudioSamples = 0;
3159  numAudioSamplesFromWholeGroups = 0;
3160  numAudioSamplesFromRemainder = 0;
3161 
3162  if (inAudioRate == NTV2_AUDIO_48K)
3163  {
3164  switch (inFrameRate)
3165  {
3166  case NTV2_FRAMERATE_12000:
3167  numTotalAudioSamples = 400 * inFrameNumNonInclusive;
3168  break;
3169  case NTV2_FRAMERATE_11988:
3170  numAudioSamplesFromWholeGroups = ((2*401) + (3*400)) * numWholeGroupsOfFive;
3171  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : ((400 * remainder) + remainder/2);
3172  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3173  break;
3174  case NTV2_FRAMERATE_6000:
3175  numTotalAudioSamples = 800 * inFrameNumNonInclusive;
3176  break;
3177  case NTV2_FRAMERATE_5994:
3178  // depends on cadenceFrame;
3179  numAudioSamplesFromWholeGroups = ((1*800) + (4*801)) * numWholeGroupsOfFive;
3180  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : ((801 * remainder) - 1);
3181  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3182  break;
3183  case NTV2_FRAMERATE_5000:
3184  numTotalAudioSamples = 1920/2 * inFrameNumNonInclusive;
3185  break;
3186  case NTV2_FRAMERATE_4800:
3187  numTotalAudioSamples = 1000 * inFrameNumNonInclusive;
3188  break;
3189  case NTV2_FRAMERATE_4795:
3190  numTotalAudioSamples = 1001 * inFrameNumNonInclusive;
3191  break;
3192  case NTV2_FRAMERATE_3000:
3193  numTotalAudioSamples = 1600 * inFrameNumNonInclusive;
3194  break;
3195  case NTV2_FRAMERATE_2997:
3196  // depends on cadenceFrame;
3197  numAudioSamplesFromWholeGroups = ((3*1602) + (2*1601)) * numWholeGroupsOfFive;
3198  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : ((1602 * remainder) - remainder/2);
3199  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3200  break;
3201  case NTV2_FRAMERATE_2500:
3202  numTotalAudioSamples = 1920 * inFrameNumNonInclusive;
3203  break;
3204  case NTV2_FRAMERATE_2400:
3205  numTotalAudioSamples = 2000 * inFrameNumNonInclusive;
3206  break;
3207  case NTV2_FRAMERATE_2398:
3208  numTotalAudioSamples = 2002 * inFrameNumNonInclusive;
3209  break;
3210  case NTV2_FRAMERATE_1500:
3211  numTotalAudioSamples = 3200 * inFrameNumNonInclusive;
3212  break;
3213  case NTV2_FRAMERATE_1498:
3214  // depends on cadenceFrame;
3215  numAudioSamplesFromWholeGroups = ((1*3204) + (4*3203)) * numWholeGroupsOfFive;
3216  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : ((3203 * remainder) + 1);
3217  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3218  break;
3219 #if !defined(NTV2_DEPRECATE_16_0)
3220  case NTV2_FRAMERATE_1900: // Not supported yet
3221  case NTV2_FRAMERATE_1898: // Not supported yet
3222  case NTV2_FRAMERATE_1800: // Not supported yet
3223  case NTV2_FRAMERATE_1798: // Not supported yet
3224 #endif
3225  case NTV2_FRAMERATE_UNKNOWN:
3226  case NTV2_NUM_FRAMERATES:
3227  numTotalAudioSamples = 0;
3228  break;
3229  }
3230  }
3231  else if (inAudioRate == NTV2_AUDIO_96K)
3232  {
3233  switch (inFrameRate)
3234  {
3235  case NTV2_FRAMERATE_12000:
3236  numTotalAudioSamples = 800 * inFrameNumNonInclusive;
3237  break;
3238  case NTV2_FRAMERATE_11988:
3239  numAudioSamplesFromWholeGroups = ((4*801) + (1*800)) * numWholeGroupsOfFive;
3240  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : (801 * remainder);
3241  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3242  break;
3243  case NTV2_FRAMERATE_6000:
3244  numTotalAudioSamples = (800*2) * inFrameNumNonInclusive;
3245  break;
3246  case NTV2_FRAMERATE_5994:
3247  numAudioSamplesFromWholeGroups = ((3*1602) + (2*1601)) * numWholeGroupsOfFive;
3248  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : ((1602 * remainder) - remainder/2);
3249  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3250  break;
3251  case NTV2_FRAMERATE_5000:
3252  numTotalAudioSamples = 1920 * inFrameNumNonInclusive;
3253  break;
3254  case NTV2_FRAMERATE_4800:
3255  numTotalAudioSamples = 2000 * inFrameNumNonInclusive;
3256  break;
3257  case NTV2_FRAMERATE_4795:
3258  numTotalAudioSamples = 2002 * inFrameNumNonInclusive;
3259  break;
3260  case NTV2_FRAMERATE_3000:
3261  numTotalAudioSamples = (1600*2) * inFrameNumNonInclusive;
3262  break;
3263  case NTV2_FRAMERATE_2997:
3264  // depends on cadenceFrame;
3265  numAudioSamplesFromWholeGroups = ((1*3204) + (4*3203)) * numWholeGroupsOfFive;
3266  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : ((3203 * remainder) + 1);
3267  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3268  break;
3269  case NTV2_FRAMERATE_2500:
3270  numTotalAudioSamples = (1920*2) * inFrameNumNonInclusive;
3271  break;
3272  case NTV2_FRAMERATE_2400:
3273  numTotalAudioSamples = (2000*2) * inFrameNumNonInclusive;
3274  break;
3275  case NTV2_FRAMERATE_2398:
3276  numTotalAudioSamples = (2002*2) * inFrameNumNonInclusive;
3277  break;
3278  case NTV2_FRAMERATE_1500:
3279  numTotalAudioSamples = (3200*2) * inFrameNumNonInclusive;
3280  break;
3281  case NTV2_FRAMERATE_1498:
3282  // depends on cadenceFrame;
3283  numAudioSamplesFromWholeGroups = ((1*3204*2) + (4*3203*2)) * numWholeGroupsOfFive;
3284  numAudioSamplesFromRemainder = (remainder == 0) ? 0 : (((3203*2) * remainder) + 2);
3285  numTotalAudioSamples = numAudioSamplesFromWholeGroups + numAudioSamplesFromRemainder;
3286  break;
3287 #if !defined(NTV2_DEPRECATE_16_0)
3288  case NTV2_FRAMERATE_1900: // Not supported yet
3289  case NTV2_FRAMERATE_1898: // Not supported yet
3290  case NTV2_FRAMERATE_1800: // Not supported yet
3291  case NTV2_FRAMERATE_1798: // Not supported yet
3292 #endif
3293  case NTV2_FRAMERATE_UNKNOWN:
3294  case NTV2_NUM_FRAMERATES:
3295  numTotalAudioSamples = 0*2; //haha
3296  break;
3297  }
3298  }
3299 
3300  return numTotalAudioSamples;
3301 }
3302 
3303 double GetAudioSamplesPerSecond (const NTV2AudioRate inAudioRate)
3304 {
3305  static const ULWord sSamplesPerSecond [] = {48000, 96000, 192000, 0};
3306  if (!NTV2_IS_VALID_AUDIO_RATE(inAudioRate))
3307  return 0.00;
3308  return double(sSamplesPerSecond[inAudioRate]);
3309 }
3310 
3311 
3312 // For a given sequenceRate and playRate, given the cadenceFrame it returns how many times we
3313 // repeate the frame to output varicam. If the result is zero then this is an unsupported varicam
3314 // rate.
3315 ULWord GetVaricamRepeatCount (const NTV2FrameRate inSequenceRate, const NTV2FrameRate inPlayRate, const ULWord inCadenceFrame)
3316 {
3317  ULWord result = 0;
3318 
3319  switch (inPlayRate)
3320  {
3321  case NTV2_FRAMERATE_6000:
3322  switch (inSequenceRate)
3323  {
3324  case NTV2_FRAMERATE_1500:
3325  result = 4;
3326  break;
3327  case NTV2_FRAMERATE_2400: // 24 -> 60 2:3|2:3|2:3 ...
3328  //inCadenceFrame %= 2;
3329  switch (inCadenceFrame % 2)
3330  {
3331  case 0:
3332  result = 2;
3333  break;
3334  case 1:
3335  result = 3;
3336  break;
3337  }
3338  break;
3339  case NTV2_FRAMERATE_2500: // 25 -> 60 2:3:2:3:2|2:3:2:3:2 ...
3340  //inCadenceFrame %= 5;
3341  switch (inCadenceFrame % 5)
3342  {
3343  case 0:
3344  case 2:
3345  case 4:
3346  result = 2;
3347  break;
3348  case 1:
3349  case 3:
3350  result = 3;
3351  break;
3352  }
3353  break;
3354  case NTV2_FRAMERATE_3000: // 30 -> 60 2|2|2|2|2|2 ...
3355  result = 2;
3356  break;
3357  case NTV2_FRAMERATE_4800: // 48 -> 60 2:1:1:1|2:1:1:1 ...
3358  //inCadenceFrame %= 4;
3359  switch (inCadenceFrame % 4)
3360  {
3361  case 0:
3362  result = 2;
3363  break;
3364  case 1:
3365  case 2:
3366  case 3:
3367  result = 1;
3368  break;
3369  }
3370  break;
3371  case NTV2_FRAMERATE_5000: // 50 -> 60 2:1:1:1:1|2:1:1:1:1: ...
3372  //inCadenceFrame %= 5;
3373  switch (inCadenceFrame % 5)
3374  {
3375  case 0:
3376  result = 2;
3377  break;
3378  case 1:
3379  case 2:
3380  case 3:
3381  case 4:
3382  result = 1;
3383  break;
3384  }
3385  break;
3386  case NTV2_FRAMERATE_6000: // 60 -> 60 1|1|1|1|1|1 ...
3387  result = 1;
3388  break;
3389  default:
3390  break;
3391  }
3392  break;
3393 
3394  case NTV2_FRAMERATE_5994:
3395  switch (inSequenceRate)
3396  {
3397  case NTV2_FRAMERATE_1498:
3398  result = 4;
3399  break;
3400  case NTV2_FRAMERATE_2398: // 23.98 -> 59.94 2:3|2:3|2:3 ...
3401  //inCadenceFrame %= 2;
3402  switch (inCadenceFrame % 2)
3403  {
3404  case 0:
3405  result = 2;
3406  break;
3407  case 1:
3408  result = 3;
3409  break;
3410  }
3411  break;
3412  case NTV2_FRAMERATE_2997: // 29.97 -> 59.94 2|2|2|2|2|2 ...
3413  result = 2;
3414  break;
3415  case NTV2_FRAMERATE_4795: // 47.95 -> 59.94 2:1:1:1|2:1:1:1 ...
3416  //inCadenceFrame %= 4;
3417  switch (inCadenceFrame % 4)
3418  {
3419  case 0:
3420  result = 2;
3421  break;
3422  case 1:
3423  case 2:
3424  case 3:
3425  result = 1;
3426  break;
3427  }
3428  break;
3429  case NTV2_FRAMERATE_5994: // 59.94 -> 59.94 1|1|1|1|1|1 ...
3430  result = 1;
3431  break;
3432  default:
3433  break;
3434  }
3435  break;
3436 
3437  case NTV2_FRAMERATE_5000:
3438  switch (inSequenceRate)
3439  {
3440  case NTV2_FRAMERATE_2500: // 25 -> 50 2|2|2|2|2| ...
3441  result = 2;
3442  break;
3443  default:
3444  break;
3445  }
3446  break;
3447 
3448  default:
3449  break;
3450  }
3451  return result;
3452 }
3453 
3455 {
3456  switch (inFrameRate)
3457  {
3458  case NTV2_FRAMERATE_12000: return 12000;
3459  case NTV2_FRAMERATE_11988: return 11988;
3460  case NTV2_FRAMERATE_6000: return 6000;
3461  case NTV2_FRAMERATE_5994: return 5994;
3462  case NTV2_FRAMERATE_5000: return 5000;
3463  case NTV2_FRAMERATE_4800: return 4800;
3464  case NTV2_FRAMERATE_4795: return 4795;
3465  case NTV2_FRAMERATE_3000: return 3000;
3466  case NTV2_FRAMERATE_2997: return 2997;
3467  case NTV2_FRAMERATE_2500: return 2500;
3468  case NTV2_FRAMERATE_2400: return 2400;
3469  case NTV2_FRAMERATE_2398: return 2398;
3470  case NTV2_FRAMERATE_1500: return 1500;
3471  case NTV2_FRAMERATE_1498: return 1498;
3472 #if !defined(NTV2_DEPRECATE_16_0)
3473  case NTV2_FRAMERATE_1900: return 1900;
3474  case NTV2_FRAMERATE_1898: return 1898;
3475  case NTV2_FRAMERATE_1800: return 1800;
3476  case NTV2_FRAMERATE_1798: return 1798;
3477 #endif
3478  case NTV2_FRAMERATE_UNKNOWN: break;
3479 #if defined(_DEBUG)
3480  case NTV2_NUM_FRAMERATES: break;
3481 #else
3482  default: break;
3483 #endif
3484  }
3485  return 0;
3486 }
3487 
3488 // GetFrameRateFromScale(long scale, long duration, NTV2FrameRate playFrameRate)
3489 // For a given scale value it returns the associated frame rate. This routine is
3490 // used to calculate and decipher the sequence frame rate.
3491 NTV2FrameRate GetFrameRateFromScale (long scale, long duration, NTV2FrameRate playFrameRate)
3492 {
3494 
3495  // Generally the duration is 100 and in that event the scale will tell us for sure what the
3496  // sequence rate is.
3497  if (duration == 100)
3498  {
3499  switch (scale)
3500  {
3501  case 12000: result = NTV2_FRAMERATE_12000; break;
3502  case 11988: result = NTV2_FRAMERATE_11988; break;
3503  case 6000: result = NTV2_FRAMERATE_6000; break;
3504  case 5994: result = NTV2_FRAMERATE_5994; break;
3505  case 5000: result = NTV2_FRAMERATE_5000; break;
3506  case 4800: result = NTV2_FRAMERATE_4800; break;
3507  case 4795: result = NTV2_FRAMERATE_4795; break;
3508  case 3000: result = NTV2_FRAMERATE_3000; break;
3509  case 2997: result = NTV2_FRAMERATE_2997; break;
3510  case 2500: result = NTV2_FRAMERATE_2500; break;
3511  case 2400: result = NTV2_FRAMERATE_2400; break;
3512  case 2398: result = NTV2_FRAMERATE_2398; break;
3513  case 1500: result = NTV2_FRAMERATE_1500; break;
3514  case 1498: result = NTV2_FRAMERATE_1498; break;
3515  }
3516  }
3517  else if (duration == 0)
3518  {
3519  result = playFrameRate;
3520  }
3521  else
3522  {
3523  float scaleFloat = scale / duration * float(100.0);
3524  long scaleInt = long(scaleFloat);
3525 
3526  // In this case we need to derive the sequence rate based on scale, duration and what
3527  // our playback rate is. So first we break down what we might expect based on our
3528  // playback rate. This gives us some room to look at values that are returned and
3529  // which are not exact based on rounding errors. We can break this check up into two
3530  // camps because the assumption is we don't have to worry about playing back 23.98 fps
3531  // sequence on a 60 fps output and conversly playing back 30 fps sequences on a 59.94
3532  // fps output.
3533  switch (playFrameRate)
3534  {
3535  case NTV2_FRAMERATE_12000:
3536  case NTV2_FRAMERATE_6000:
3537  case NTV2_FRAMERATE_5000:
3538  case NTV2_FRAMERATE_4800:
3539  case NTV2_FRAMERATE_3000:
3540  case NTV2_FRAMERATE_2500:
3541  case NTV2_FRAMERATE_2400:
3542  case NTV2_FRAMERATE_1500:
3543  if (scaleInt <= 1500 + 100)
3544  result = NTV2_FRAMERATE_1500;
3545  else if (scaleInt <= 2400 + 50)
3546  result = NTV2_FRAMERATE_2400;
3547  else if (scaleInt <= 2500 + 100)
3548  result = NTV2_FRAMERATE_2500;
3549  else if (scaleInt <= 3000 + 100)
3550  result = NTV2_FRAMERATE_3000;
3551  else if (scaleInt <= 4800 + 100)
3552  result = NTV2_FRAMERATE_4800;
3553  else if (scaleInt <= 5000 + 100)
3554  result = NTV2_FRAMERATE_5000;
3555  else if (scaleInt <= 6000 + 100)
3556  result = NTV2_FRAMERATE_6000;
3557  else
3558  result = NTV2_FRAMERATE_12000;
3559  break;
3560 
3561  case NTV2_FRAMERATE_11988:
3562  case NTV2_FRAMERATE_5994:
3563  case NTV2_FRAMERATE_4795:
3564  case NTV2_FRAMERATE_2997:
3565  case NTV2_FRAMERATE_2398:
3566  case NTV2_FRAMERATE_1498:
3567  if (scaleInt <= 1498 + 100) // add some fudge factor for rounding errors
3568  result = NTV2_FRAMERATE_1498;
3569  else if (scaleInt <= 2398 + 100)
3570  result = NTV2_FRAMERATE_2398;
3571  else if (scaleInt <= 2997 + 100)
3572  result = NTV2_FRAMERATE_2997;
3573  else if (scaleInt <= 4795 + 100)
3574  result = NTV2_FRAMERATE_4795;
3575  else if (scaleInt <= 5994 + 100)
3576  result = NTV2_FRAMERATE_5994;
3577  else
3578  result = NTV2_FRAMERATE_11988;
3579  break;
3580  default:
3581  break;
3582  }
3583  }
3584  return result;
3585 }
3586 
3587 
3589 {
3590  if (inDenominator == 100)
3591  switch (inNumerator)
3592  {
3593  case 12000: return NTV2_FRAMERATE_12000;
3594  case 11988: return NTV2_FRAMERATE_11988;
3595  case 6000: return NTV2_FRAMERATE_6000;
3596  case 5994: return NTV2_FRAMERATE_5994;
3597  case 5000: return NTV2_FRAMERATE_5000;
3598  case 4800: return NTV2_FRAMERATE_4800;
3599  case 4795: return NTV2_FRAMERATE_4795;
3600  case 3000: return NTV2_FRAMERATE_3000;
3601  case 2997: return NTV2_FRAMERATE_2997;
3602  case 2500: return NTV2_FRAMERATE_2500;
3603  case 2400: return NTV2_FRAMERATE_2400;
3604  case 2398: return NTV2_FRAMERATE_2398;
3605  case 1500: return NTV2_FRAMERATE_1500;
3606  case 1498: return NTV2_FRAMERATE_1498;
3607  default: break;
3608  }
3609  else
3610  {
3611  const ULWord denominator(inDenominator == 1 ? inDenominator * 1000ULL : inDenominator);
3612  const ULWord numerator(inDenominator == 1 ? inNumerator * 1000ULL : inNumerator);
3613  switch (numerator)
3614  {
3615  case 120000: return (denominator == 1000) ? NTV2_FRAMERATE_12000 : NTV2_FRAMERATE_11988;
3616  case 60000: return (denominator == 1000) ? NTV2_FRAMERATE_6000 : NTV2_FRAMERATE_5994;
3617  case 50000: return (denominator == 1000) ? NTV2_FRAMERATE_5000 : NTV2_FRAMERATE_UNKNOWN;
3618  case 48000: return (denominator == 1000) ? NTV2_FRAMERATE_4800 : NTV2_FRAMERATE_4795;
3619  case 30000: return (denominator == 1000) ? NTV2_FRAMERATE_3000 : NTV2_FRAMERATE_2997;
3620  case 25000: return (denominator == 1000) ? NTV2_FRAMERATE_2500 : NTV2_FRAMERATE_UNKNOWN;
3621  case 24000: return (denominator == 1000) ? NTV2_FRAMERATE_2400 : NTV2_FRAMERATE_2398;
3622  case 15000: return (denominator == 1000) ? NTV2_FRAMERATE_1500 : NTV2_FRAMERATE_1498;
3623  default: break;
3624  }
3625  }
3626  return NTV2_FRAMERATE_UNKNOWN;
3627 }
3628 
3629 
3631 {
3633  switch (videoFormat)
3634  {
3635 
3636  case NTV2_FORMAT_2K_1498:
3637  frameRate = NTV2_FRAMERATE_1498;
3638  break;
3639 
3640  case NTV2_FORMAT_2K_1500:
3641  frameRate = NTV2_FRAMERATE_1500;
3642  break;
3643 
3644  case NTV2_FORMAT_525_2398:
3645  case NTV2_FORMAT_720p_2398:
3651  case NTV2_FORMAT_2K_2398:
3665  frameRate = NTV2_FRAMERATE_2398;
3666  break;
3667 
3668  case NTV2_FORMAT_525_2400:
3674  case NTV2_FORMAT_2K_2400:
3688  frameRate = NTV2_FRAMERATE_2400;
3689  break;
3690 
3691  case NTV2_FORMAT_625_5000:
3693  case NTV2_FORMAT_720p_2500:
3701  case NTV2_FORMAT_2K_2500:
3718  frameRate = NTV2_FRAMERATE_2500;
3719  break;
3720 
3721  case NTV2_FORMAT_525_5994:
3745  frameRate = NTV2_FRAMERATE_2997;
3746  break;
3747 
3770  frameRate = NTV2_FRAMERATE_3000;
3771  break;
3772 
3777  frameRate = NTV2_FRAMERATE_4795;
3778  break;
3779 
3784  frameRate = NTV2_FRAMERATE_4800;
3785  break;
3786 
3787  case NTV2_FORMAT_720p_5000:
3796  frameRate = NTV2_FRAMERATE_5000;
3797  break;
3798 
3799  case NTV2_FORMAT_720p_5994:
3808  frameRate = NTV2_FRAMERATE_5994;
3809  break;
3810 
3811  case NTV2_FORMAT_720p_6000:
3820  frameRate = NTV2_FRAMERATE_6000;
3821  break;
3822 
3825  frameRate = NTV2_FRAMERATE_11988;
3826  break;
3829  frameRate = NTV2_FRAMERATE_12000;
3830  break;
3831 
3832 #if defined (_DEBUG)
3833  // Debug builds warn about missing values
3834  case NTV2_FORMAT_UNKNOWN:
3844  break;
3845 #else
3846  default:
3847  break; // Unsupported -- fail
3848 #endif
3849  }
3850 
3851  return frameRate;
3852 
3853 } // GetNTV2FrameRateFromVideoFormat
3854 
3855 
3857 {
3858  switch (inFrameGeometry)
3859  {
3860  case NTV2_FG_1920x1080: // 1080i, 1080p
3861  case NTV2_FG_1280x720: // 720p
3862  case NTV2_FG_720x486: // ntsc 525i, 525p60
3863  case NTV2_FG_720x576: // pal 625i
3864  case NTV2_FG_2048x1080: // 2k1080p
3865  case NTV2_FG_2048x1556: // 2k1556psf
3866  case NTV2_FG_4x1920x1080: // UHD
3867  case NTV2_FG_4x2048x1080: // 4K
3868  case NTV2_FG_4x3840x2160:
3869  case NTV2_FG_4x4096x2160:
3870  return inFrameGeometry; // No change, already normalized
3871 
3872  // 525i
3873  case NTV2_FG_720x508: return NTV2_FG_720x486; // 720x486 + tall vanc
3874  case NTV2_FG_720x514: return NTV2_FG_720x486; // 720x486 + taller vanc (extra-wide ntsc)
3875 
3876  // 625i
3877  case NTV2_FG_720x598: return NTV2_FG_720x576; // pal 625i + tall vanc
3878  case NTV2_FG_720x612: return NTV2_FG_720x576; // 720x576 + taller vanc (extra-wide pal)
3879 
3880  // 720p
3881  case NTV2_FG_1280x740: return NTV2_FG_1280x720; // 1280x720 + tall vanc
3882 
3883  // 1080
3884  case NTV2_FG_1920x1112: return NTV2_FG_1920x1080; // 1920x1080 + tall vanc
3885  case NTV2_FG_1920x1114: return NTV2_FG_1920x1080; // 1920x1080 + taller vanc
3886 
3887  // 2kx1080
3888  case NTV2_FG_2048x1112: return NTV2_FG_2048x1080; // 2048x1080 + tall vanc
3889  case NTV2_FG_2048x1114: return NTV2_FG_2048x1080; // 2048x1080 + taller vanc
3890 
3891  // 2kx1556 film
3892  case NTV2_FG_2048x1588: return NTV2_FG_2048x1556; // 2048x1556 + tall vanc
3893 
3894 #if defined (_DEBUG)
3895  case NTV2_FG_INVALID: break;
3896 #else
3897  default: break;
3898 #endif
3899  }
3900  return NTV2_FG_INVALID; // fail
3901 }
3902 
3903 
3905 {
3906  if (!NTV2_IS_VALID_VANCMODE(inVancMode))
3907  return NTV2_FG_INVALID; // Invalid vanc mode
3908  if (!NTV2_IS_VALID_NTV2FrameGeometry(inFrameGeometry))
3909  return NTV2_FG_INVALID; // Invalid FG
3910  if (!NTV2_IS_VANCMODE_ON(inVancMode))
3911  return ::GetNormalizedFrameGeometry(inFrameGeometry); // Return normalized
3912 
3913  switch (inFrameGeometry)
3914  {
3915  case NTV2_FG_1920x1080: // 1920x1080 ::NTV2_VANCMODE_OFF
3916  case NTV2_FG_1920x1112: // 1920x1080 ::NTV2_VANCMODE_TALL
3917  case NTV2_FG_1920x1114: // 1920x1080 ::NTV2_VANCMODE_TALLER
3919 
3920  case NTV2_FG_1280x720: // 1280x720, ::NTV2_VANCMODE_OFF
3921  case NTV2_FG_1280x740: // 1280x720 ::NTV2_VANCMODE_TALL
3922  return NTV2_FG_1280x740;
3923 
3924  case NTV2_FG_720x486: // 720x486 ::NTV2_VANCMODE_OFF
3925  case NTV2_FG_720x508: // 720x486 ::NTV2_VANCMODE_TALL
3926  case NTV2_FG_720x514: // 720x486 ::NTV2_VANCMODE_TALLER
3927  return NTV2_IS_VANCMODE_TALL(inVancMode) ? NTV2_FG_720x508 : NTV2_FG_720x514;
3928 
3929  case NTV2_FG_720x576: // 720x576 ::NTV2_VANCMODE_OFF
3930  case NTV2_FG_720x598: // 720x576 ::NTV2_VANCMODE_TALL
3931  case NTV2_FG_720x612: // 720x576 ::NTV2_VANCMODE_TALLER
3932  return NTV2_IS_VANCMODE_TALL(inVancMode) ? NTV2_FG_720x598 : NTV2_FG_720x612;
3933 
3934  case NTV2_FG_2048x1080: // 2048x1080 ::NTV2_VANCMODE_OFF
3935  case NTV2_FG_2048x1112: // 2048x1080 ::NTV2_VANCMODE_TALL
3936  case NTV2_FG_2048x1114: // 2048x1080 ::NTV2_VANCMODE_TALLER
3938 
3939  case NTV2_FG_2048x1556: // 2048x1556 film ::NTV2_VANCMODE_OFF
3940  case NTV2_FG_2048x1588: // 2048x1556 film ::NTV2_VANCMODE_TALL
3941  return NTV2_FG_2048x1588;
3942 
3943  case NTV2_FG_4x1920x1080: // 3840x2160 ::NTV2_VANCMODE_OFF
3944  case NTV2_FG_4x2048x1080: // 4096x2160 ::NTV2_VANCMODE_OFF
3945  case NTV2_FG_4x3840x2160:
3946  case NTV2_FG_4x4096x2160:
3947  return inFrameGeometry; // no tall or taller geometries!
3948 #if defined (_DEBUG)
3949  case NTV2_FG_INVALID: break;
3950 #else
3951  default: break;
3952 #endif
3953  }
3954  return NTV2_FG_INVALID; // fail
3955 }
3956 
3958 {
3960  if (::GetNTV2FrameGeometryWidth(fg) == inFD.width())
3961  if (::GetNTV2FrameGeometryHeight(fg) == inFD.height())
3962  return fg;
3963  return NTV2_FG_INVALID;
3964 }
3965 
3967 {
3968  switch (inFG)
3969  {
3970  case NTV2_FG_1920x1080: // 1920x1080 ::NTV2_VANCMODE_OFF
3971  case NTV2_FG_1920x1112: // 1920x1080 ::NTV2_VANCMODE_TALL
3972  case NTV2_FG_1920x1114: // 1920x1080 ::NTV2_VANCMODE_TALLER
3973  case NTV2_FG_1280x720: // 1280x720, ::NTV2_VANCMODE_OFF
3974  case NTV2_FG_1280x740: // 1280x720 ::NTV2_VANCMODE_TALL
3975  case NTV2_FG_720x486: // 720x486 ::NTV2_VANCMODE_OFF
3976  case NTV2_FG_720x508: // 720x486 ::NTV2_VANCMODE_TALL
3977  case NTV2_FG_720x514: // 720x486 ::NTV2_VANCMODE_TALLER
3978  case NTV2_FG_720x576: // 720x576 ::NTV2_VANCMODE_OFF
3979  case NTV2_FG_720x598: // 720x576 ::NTV2_VANCMODE_TALL
3980  case NTV2_FG_720x612: // 720x576 ::NTV2_VANCMODE_TALLER
3981  case NTV2_FG_2048x1080: // 2048x1080 ::NTV2_VANCMODE_OFF
3982  case NTV2_FG_2048x1112: // 2048x1080 ::NTV2_VANCMODE_TALL
3983  case NTV2_FG_2048x1114: // 2048x1080 ::NTV2_VANCMODE_TALLER
3984  case NTV2_FG_2048x1556: // 2048x1556 film ::NTV2_VANCMODE_OFF
3985  case NTV2_FG_2048x1588: // 2048x1556 film ::NTV2_VANCMODE_TALL
3986  return true;
3987 
3988  case NTV2_FG_4x1920x1080: // 3840x2160
3989  case NTV2_FG_4x2048x1080: // 4096x2160
3990  case NTV2_FG_4x3840x2160:
3991  case NTV2_FG_4x4096x2160:
3992  break; // no tall or taller geometries!
3993 #if defined (_DEBUG)
3994  case NTV2_FG_INVALID: break;
3995 #else
3996  default: break;
3997 #endif
3998  }
3999  return false;
4000 }
4001 
4003 {
4004  NTV2GeometrySet result;
4005  switch (inFG)
4006  {
4007  case NTV2_FG_1920x1080: // 1920x1080 ::NTV2_VANCMODE_OFF
4008  case NTV2_FG_1920x1112: // 1920x1080 ::NTV2_VANCMODE_TALL
4009  case NTV2_FG_1920x1114: // 1920x1080 ::NTV2_VANCMODE_TALLER
4010  result.insert(NTV2_FG_1920x1080); result.insert(NTV2_FG_1920x1112); result.insert(NTV2_FG_1920x1114);
4011  break;
4012 
4013  case NTV2_FG_1280x720: // 1280x720, ::NTV2_VANCMODE_OFF
4014  case NTV2_FG_1280x740: // 1280x720 ::NTV2_VANCMODE_TALL
4015  result.insert(NTV2_FG_1280x720); result.insert(NTV2_FG_1280x740);
4016  break;
4017 
4018  case NTV2_FG_720x486: // 720x486 ::NTV2_VANCMODE_OFF
4019  case NTV2_FG_720x508: // 720x486 ::NTV2_VANCMODE_TALL
4020  case NTV2_FG_720x514: // 720x486 ::NTV2_VANCMODE_TALLER
4021  result.insert(NTV2_FG_720x486); result.insert(NTV2_FG_720x508); result.insert(NTV2_FG_720x514);
4022  break;
4023 
4024  case NTV2_FG_720x576: // 720x576 ::NTV2_VANCMODE_OFF
4025  case NTV2_FG_720x598: // 720x576 ::NTV2_VANCMODE_TALL
4026  case NTV2_FG_720x612: // 720x576 ::NTV2_VANCMODE_TALLER
4027  result.insert(NTV2_FG_720x576); result.insert(NTV2_FG_720x598); result.insert(NTV2_FG_720x612);
4028  break;
4029 
4030  case NTV2_FG_2048x1080: // 2048x1080 ::NTV2_VANCMODE_OFF
4031  case NTV2_FG_2048x1112: // 2048x1080 ::NTV2_VANCMODE_TALL
4032  case NTV2_FG_2048x1114: // 2048x1080 ::NTV2_VANCMODE_TALLER
4033  result.insert(NTV2_FG_2048x1080); result.insert(NTV2_FG_2048x1112); result.insert(NTV2_FG_2048x1114);
4034  break;
4035 
4036  case NTV2_FG_2048x1556: // 2048x1556 film ::NTV2_VANCMODE_OFF
4037  case NTV2_FG_2048x1588: // 2048x1556 film ::NTV2_VANCMODE_TALL
4038  result.insert(NTV2_FG_2048x1556); result.insert(NTV2_FG_2048x1588);
4039  break;
4040 
4041  case NTV2_FG_4x1920x1080: // 3840x2160
4042  case NTV2_FG_4x2048x1080: // 4096x2160
4043  case NTV2_FG_4x3840x2160:
4044  case NTV2_FG_4x4096x2160:
4045  result.insert(inFG);
4046  break; // no tall or taller geometries!
4047 #if defined (_DEBUG)
4048  case NTV2_FG_INVALID: break;
4049 #else
4050  default: break;
4051 #endif
4052  }
4053  return result;
4054 }
4055 
4057 {
4058  if (NTV2_IS_TALL_VANC_GEOMETRY(inFG))
4059  return NTV2_VANCMODE_TALL;
4060  else if (NTV2_IS_TALLER_VANC_GEOMETRY(inFG))
4061  return NTV2_VANCMODE_TALLER;
4062  else if (NTV2_IS_VALID_NTV2FrameGeometry(inFG))
4063  return NTV2_VANCMODE_OFF;
4064  return NTV2_VANCMODE_INVALID;
4065 }
4066 
4067 
4069 {
4070  switch (inStandard)
4071  {
4072  case NTV2_STANDARD_720: return NTV2_FG_1280x720; // 720p
4073  case NTV2_STANDARD_525: return NTV2_FG_720x486; // 525i
4074  case NTV2_STANDARD_625: return NTV2_FG_720x576; // 625i
4075 
4076  case NTV2_STANDARD_1080:
4077  case NTV2_STANDARD_1080p: return NTV2_FG_1920x1080; // 1080i, 1080psf, 1080p
4078 
4079  case NTV2_STANDARD_2K: return NTV2_FG_2048x1556; // 2048x1556 film
4080 
4082  case NTV2_STANDARD_2Kx1080i: return NTV2_FG_2048x1080; // 2K1080p/i/psf
4083 
4084  case NTV2_STANDARD_3840x2160p: // UHD
4085  case NTV2_STANDARD_3840HFR: // HFR UHD
4086  case NTV2_STANDARD_3840i: return NTV2_FG_4x1920x1080; // HFR psf
4087 
4088  case NTV2_STANDARD_4096x2160p: // 4K
4089  case NTV2_STANDARD_4096HFR: // HFR 4K
4090  case NTV2_STANDARD_4096i: return NTV2_FG_4x2048x1080; // HFR 4K psf
4091 
4093 
4095 #if defined (_DEBUG)
4096  case NTV2_STANDARD_INVALID: break;
4097 #else
4098  default: break;
4099 #endif
4100  }
4101  return NTV2_FG_INVALID;
4102 }
4103 
4104 NTV2Standard GetStandardFromGeometry (const NTV2FrameGeometry inGeometry, const bool inIsProgressive)
4105 {
4106  switch (inGeometry)
4107  {
4108  case NTV2_FG_1920x1080: // 1920x1080 ::NTV2_VANCMODE_OFF
4109  case NTV2_FG_1920x1112: // 1920x1080 ::NTV2_VANCMODE_TALL
4110  case NTV2_FG_1920x1114: // 1920x1080 ::NTV2_VANCMODE_TALLER
4111  return inIsProgressive ? NTV2_STANDARD_1080p : NTV2_STANDARD_1080;
4112 
4113  case NTV2_FG_1280x720: // 1280x720, ::NTV2_VANCMODE_OFF
4114  case NTV2_FG_1280x740: // 1280x720 ::NTV2_VANCMODE_TALL
4115  return NTV2_STANDARD_720;
4116 
4117  case NTV2_FG_720x486: // 720x486 ::NTV2_VANCMODE_OFF
4118  case NTV2_FG_720x508: // 720x486 ::NTV2_VANCMODE_TALL
4119  case NTV2_FG_720x514: // 720x486 ::NTV2_VANCMODE_TALLER
4120  return NTV2_STANDARD_525;
4121 
4122  case NTV2_FG_720x576: // 720x576 ::NTV2_VANCMODE_OFF
4123  case NTV2_FG_720x598: // 720x576 ::NTV2_VANCMODE_TALL
4124  case NTV2_FG_720x612: // 720x576 ::NTV2_VANCMODE_TALLER
4125  return NTV2_STANDARD_625;
4126 
4127  case NTV2_FG_2048x1080: // 2048x1080 ::NTV2_VANCMODE_OFF
4128  case NTV2_FG_2048x1112: // 2048x1080 ::NTV2_VANCMODE_TALL
4129  case NTV2_FG_2048x1114: // 2048x1080 ::NTV2_VANCMODE_TALLER
4130  return inIsProgressive ? NTV2_STANDARD_2Kx1080p : NTV2_STANDARD_2Kx1080i;
4131 
4132  case NTV2_FG_2048x1556: // 2048x1556 film ::NTV2_VANCMODE_OFF
4133  case NTV2_FG_2048x1588: // 2048x1556 film ::NTV2_VANCMODE_TALL
4134  return NTV2_STANDARD_2K;
4135 
4136  case NTV2_FG_4x1920x1080: // 3840x2160
4137  return inIsProgressive ? NTV2_STANDARD_3840x2160p : NTV2_STANDARD_3840i; // NTV2_STANDARD_3840HFR
4138 
4139  case NTV2_FG_4x2048x1080: // 4096x2160
4140  return inIsProgressive ? NTV2_STANDARD_4096x2160p : NTV2_STANDARD_4096i; // NTV2_STANDARD_4096HFR
4141 
4142  case NTV2_FG_4x3840x2160: // 4320x7680 uhd 8K
4143  return NTV2_STANDARD_7680;
4144 
4145  case NTV2_FG_4x4096x2160: // 4320x8192 8K
4146  return NTV2_STANDARD_8192;
4147 
4148 #if defined (_DEBUG)
4149  case NTV2_FG_INVALID: break;
4150 #else
4151  default: break;
4152 #endif
4153  }
4154  return NTV2_STANDARD_INVALID;
4155 }
4156 
4157 
4158 bool NTV2DeviceCanDoFormat (const NTV2DeviceID inDeviceID,
4159  const NTV2FrameRate inFrameRate,
4160  const NTV2FrameGeometry inFrameGeometry,
4161  const NTV2Standard inStandard)
4162 { // DEPRECATED FUNCTION
4163  // This implementation is very inefficient, but...
4164  // a) this function is deprecated;
4165  // b) nobody should be calling it (they should be calling NTV2DeviceCanDoVideoFormat instead)
4166  // c) they shouldn't be calling it every frame.
4167  // We could make it efficient by creating a static global rate/geometry/standard-to-videoFormat
4168  // map, but that has race/deadlock issues.
4169 
4170  const NTV2FrameGeometry fg (::GetNormalizedFrameGeometry(inFrameGeometry));
4171  // Look for a video format that matches the given frame rate, geometry and standard...
4173  {
4174  if (!NTV2_IS_VALID_VIDEO_FORMAT(vFmt))
4175  continue;
4179  if (fr == inFrameRate && std == inStandard && fg == geo)
4180  return ::NTV2DeviceCanDoVideoFormat(inDeviceID, vFmt);
4181  }
4182  return false;
4183 }
4184 
4186 {
4188  return fd.GetRasterHeight(/*visOnly?*/false); // Include VANC
4189 }
4190 
4192 {
4194  return fd.GetRasterWidth();
4195 }
4196 
4197 
4198 // Displayable width of format, not counting HANC/VANC
4200 {
4201  const NTV2FormatDescriptor fd (inVideoFormat, NTV2_FBF_8BIT_YCBCR);
4202  return fd.GetRasterWidth();
4203 } // GetDisplayWidth
4204 
4205 
4206 // Displayable height of format, not counting HANC/VANC
4208 {
4209  const NTV2FormatDescriptor fd (inVideoFormat, NTV2_FBF_8BIT_YCBCR);
4210  return fd.GetVisibleRasterHeight();
4211 } // GetDisplayHeight
4212 
4213 
4214 
4215 // NTV2SmpteLineNumber::NTV2SmpteLineNumber (const NTV2Standard inStandard)
4216 // IMPLEMENTATION MOVED INTO 'ntv2formatdescriptor.cpp'
4217 // SO AS TO USE SAME LineNumbersF1/LineNumbersF2 TABLES
4218 
4220 {
4221  if (!NTV2_IS_VALID_FIELD (inFieldID))
4222  return 0;
4223 
4224  if (inFieldID == NTV2_FIELD0)
4225  return firstFieldTop ? smpteFirstActiveLine : smpteSecondActiveLine;
4226  else
4227  return firstFieldTop ? smpteSecondActiveLine : smpteFirstActiveLine;
4228 }
4229 
4230 
4231 ostream & NTV2SmpteLineNumber::Print (ostream & inOutStream) const
4232 {
4233  if (!IsValid ())
4234  inOutStream << "INVALID ";
4235  inOutStream << "SMPTELineNumber(";
4236  if (IsValid ())
4237  inOutStream << "1st=" << smpteFirstActiveLine << (firstFieldTop ? "(top)" : "")
4238  << ", 2nd=" << smpteSecondActiveLine << (firstFieldTop ? "" : "(top)")
4239  << ", std=" << ::NTV2StandardToString (mStandard) << ")";
4240  else
4241  inOutStream << "INVALID)";
4242  return inOutStream;
4243 }
4244 
4245 
4246 string NTV2SmpteLineNumber::PrintLineNumber (const ULWord inLineOffset, const NTV2FieldID inRasterFieldID) const
4247 {
4248  ostringstream oss;
4249  if (NTV2_IS_VALID_FIELD (inRasterFieldID) && !NTV2_IS_PROGRESSIVE_STANDARD (mStandard))
4250  oss << "F" << (inRasterFieldID == 0 ? "1" : "2") << " ";
4251  oss << "L" << dec << inLineOffset+GetFirstActiveLine(inRasterFieldID);
4252  return oss.str();
4253 }
4254 
4255 
4256 string NTV2ACFrameRange::setFromString (const string & inStr)
4257 {
4258  makeInvalid();
4259  if (inStr.empty())
4260  return "Frame count/range not specified";
4261  const bool hasCount(inStr.find('@') != string::npos);
4262  const bool hasRange(inStr.find('-') != string::npos);
4263  NTV2StringList strs;
4264  if (hasCount && hasRange)
4265  return "'@' and '-' cannot both be specified";
4266  else if (hasCount)
4267  aja::split(inStr, '@', strs);
4268  else if (hasRange)
4269  aja::split(inStr, '-', strs);
4270  else
4271  strs.push_back(inStr);
4272  if (strs.empty())
4273  return "No frame count/range values parsed";
4274  if (strs.size() > 2)
4275  return "More than 2 frame count/range values parsed";
4276  if (hasCount || hasRange)
4277  if (strs.size() != 2)
4278  return "Expected exactly 2 frame count/range values";
4279 
4280  // Check that all characters are decimal digits...
4281  for (size_t strNdx(0); strNdx < strs.size(); strNdx++)
4282  { string str(strs.at(strNdx));
4283  if (aja::strip(str).empty())
4284  return "Expected unsigned decimal integer value";
4285  for (size_t chNdx(0); chNdx < str.length(); chNdx++)
4286  if (!isdigit(str.at(chNdx)))
4287  return "Non-digit character encountered in '" + str + "'";
4288  }
4289 
4290  UWordSequence numbers;
4291  for (NTV2StringListConstIter it(strs.begin()); it != strs.end(); ++it)
4292  {
4293  string str(*it);
4294  numbers.push_back(UWord(aja::stoul(aja::strip(str))));
4295  }
4296  bool isValid(false);
4297  if (hasCount)
4298  isValid = setRangeWithCount(numbers[0], numbers[1]);
4299  else if (hasRange)
4300  isValid = setExactRange(numbers[0], numbers[1]);
4301  else
4302  isValid = setCountOnly(numbers[0]);
4303  return isValid ? "" : "First frame past last frame";
4304 }
4305 
4306 string NTV2ACFrameRange::toString (const bool inNormalized) const
4307 {
4308  ostringstream oss;
4309  if (inNormalized)
4310  {
4311  if (!valid())
4312  ;
4313  else if (isFrameRange())
4314  {
4315  if (false)
4316  oss << DEC(count()) << "@" << DEC(firstFrame());
4317  else
4318  oss << DEC(firstFrame()) << "-" << DEC(lastFrame());
4319  }
4320  else
4321  oss << DEC(count());
4322  }
4323  else
4324  {
4325  if (!valid())
4326  oss << "<invalid>";
4327  else if (isFrameRange())
4328  oss << "Frames " << DEC(firstFrame()) << "-" << DEC(lastFrame()) << " (" << DEC(lastFrame()-firstFrame()+1) << "@" << DEC(firstFrame()) << ")";
4329  else
4330  oss << DEC(count()) << " frames (auto-allocated)";
4331  }
4332  return oss.str();
4333 }
4334 
4335 
4336 // Extracts a channel pair or all channels from the
4337 // NTV2 channel buffer that is retrieved from the hardware.
4338 int RecordCopyAudio(PULWord pAja, PULWord pSR, int iStartSample, int iNumBytes, int iChan0,
4339  int iNumChans, bool bKeepAudio24Bits)
4340 {
4341  const int SAMPLE_SIZE = NTV2_NUMAUDIO_CHANNELS * NTV2_AUDIOSAMPLESIZE;
4342 
4343  // Insurance to prevent bogus array sizes causing havoc
4344 // if (iNumBytes > 48048) // 23.98 == 2002 * 24
4345 // iNumBytes = 48048;
4346 
4347  // Adjust the offset of the first valid channel
4348  if (iStartSample)
4349  {
4350  iChan0 += (NTV2_NUMAUDIO_CHANNELS - iStartSample);
4351  }
4352 
4353  // Driver records audio to offset 24 bytes
4354  PULWord pIn = &pAja[NTV2_NUMAUDIO_CHANNELS];
4355  UWord * puwOut = reinterpret_cast<UWord*>(pSR);
4356 
4357  // If our transfer size has a remainder and our chans are in it,
4358  // adjust number samples
4359  int iNumSamples = iNumBytes / SAMPLE_SIZE;
4360  int iMod = (iNumBytes % SAMPLE_SIZE) / 4;
4361  if (iMod > iChan0)
4362  iNumSamples++;
4363  // else if we have remainder with chans && chans total > number of chans
4364  // reduce start offset by the number of chans
4365  else if (iMod && iChan0 >= NTV2_NUMAUDIO_CHANNELS)
4366  {
4367  iNumSamples++;
4368  iChan0 -= NTV2_NUMAUDIO_CHANNELS;
4369  }
4370  // else if no remainder but start sample adjustment gives more chans
4371  // than number of chans, drop the start offset back by num chans
4372  else if (iChan0 >= NTV2_NUMAUDIO_CHANNELS)
4373  {
4374  iChan0 -= NTV2_NUMAUDIO_CHANNELS;
4375  }
4376 
4377  // Copy incoming audio to the outgoing array
4378  if (bKeepAudio24Bits)
4379  {
4380  for (int s = 0; s < iNumSamples; s++)
4381  {
4382  for (int c = iChan0; c < iChan0 + iNumChans; c++)
4383  {
4384  *pSR++ = pIn[c];
4385  }
4386 
4387  pIn += NTV2_NUMAUDIO_CHANNELS;
4388  }
4389  }
4390  else // convert audio to 16 bits
4391  {
4392  for (int s = 0; s < iNumSamples; s++)
4393  {
4394  for (int c = iChan0; c < iChan0 + iNumChans; c++)
4395  {
4396  *puwOut++ = UWord(pIn[c] >> 16);
4397  }
4398 
4399  pIn += NTV2_NUMAUDIO_CHANNELS;
4400  }
4401  }
4402 
4403  return iNumSamples;
4404 }
4405 
4406 #include "math.h"
4407 // M_PI is defined on RedHat Linux 9 in math.h
4408 #ifndef M_PI
4409 #define M_PI (3.14159265358979323846)
4410 #endif
4411 
4412 
4413 bool AddAudioTone ( ULWord & outNumBytesWritten,
4414  NTV2Buffer & inAudioBuffer,
4415  ULWord & inOutCurrentSample,
4416  const ULWord inNumSamples,
4417  const double inSampleRate,
4418  const double inAmplitude,
4419  const double inFrequency,
4420  const ULWord inNumBitsPerSample,
4421  const bool inByteSwap,
4422  const ULWord inNumChannels)
4423 {
4424  outNumBytesWritten = 0;
4425  if (inAudioBuffer.IsNULL())
4426  return false; // NULL buffer
4427 
4428  const ULWord numBytes (4 * inNumSamples * inNumChannels);
4429  if (inAudioBuffer.GetByteCount() < numBytes)
4430  return false; // buffer too small
4431 
4432  double j (inOutCurrentSample);
4433  const double cycleLength (inSampleRate / inFrequency);
4434  const double scale (double(ULWord(1 << (inNumBitsPerSample - 1))) - 1.0);
4435  ULWord * pAudioBuffer(inAudioBuffer);
4436  NTV2_ASSERT(pAudioBuffer);
4437 
4438  for (ULWord i(0); i < inNumSamples; i++)
4439  {
4440  const double nextFloat = double(::sin (j / cycleLength * (M_PI * 2.0)) * inAmplitude);
4441  LWord value = LWord((nextFloat * scale) + double(0.5));
4442 
4443  if (inByteSwap)
4444  value = LWord(NTV2EndianSwap32(value));
4445 
4446  for (ULWord channel(0); channel < inNumChannels; channel++)
4447  *pAudioBuffer++ = ULWord(value);
4448 
4449  j += 1.0;
4450  if (j > cycleLength)
4451  j -= cycleLength;
4452  inOutCurrentSample++;
4453  } // for each sample
4454 
4455  outNumBytesWritten = numBytes;
4456  return true;
4457 
4458 } // AddAudioTone (NTV2Buffer)
4459 
4460 
4461 ULWord AddAudioTone ( ULWord * pAudioBuffer,
4462  ULWord & inOutCurrentSample,
4463  const ULWord inNumSamples,
4464  const double inSampleRate,
4465  const double inAmplitude,
4466  const double inFrequency,
4467  const ULWord inNumBits,
4468  const bool inByteSwap,
4469  const ULWord inNumChannels)
4470 {
4471  double j (inOutCurrentSample);
4472  const double cycleLength (inSampleRate / inFrequency);
4473  const double scale (double (ULWord (1 << (inNumBits - 1))) - 1.0);
4474 
4475  if (pAudioBuffer)
4476  {
4477  for (ULWord i = 0; i < inNumSamples; i++)
4478  {
4479  const double nextFloat = double(::sin (j / cycleLength * (M_PI * 2.0)) * inAmplitude);
4480  LWord value = LWord((nextFloat * scale) + double(0.5));
4481 
4482  if (inByteSwap)
4483  value = LWord(NTV2EndianSwap32(value)); //odprintf("%f",(float)(LWord)value/(float)0x7FFFFFFF);
4484 
4485  for (ULWord channel = 0; channel < inNumChannels; channel++)
4486  *pAudioBuffer++ = ULWord(value);
4487 
4488  j += 1.0;
4489  if (j > cycleLength)
4490  j -= cycleLength;
4491  inOutCurrentSample++;
4492  } // for each sample
4493  } // if pAudioBuffer
4494 
4495  return inNumSamples * 4 * inNumChannels;
4496 
4497 } // AddAudioTone (ULWord)
4498 
4499 
4500 ULWord AddAudioTone ( UWord * pAudioBuffer,
4501  ULWord & inOutCurrentSample,
4502  const ULWord inNumSamples,
4503  const double inSampleRate,
4504  const double inAmplitude,
4505  const double inFrequency,
4506  const ULWord inNumBits,
4507  const bool inByteSwap,
4508  const ULWord inNumChannels)
4509 {
4510  double j (inOutCurrentSample);
4511  const double cycleLength (inSampleRate / inFrequency);
4512  const double scale (double (ULWord (1 << (inNumBits - 1))) - 1.0);
4513 
4514  if (pAudioBuffer)
4515  {
4516  for (ULWord i(0); i < inNumSamples; i++)
4517  {
4518  const double nextFloat = double(::sin (j / cycleLength * (M_PI * 2.0)) * inAmplitude);
4519  Word value = Word((nextFloat * scale) + double(0.5));
4520 
4521  if (inByteSwap)
4522  value = Word(NTV2EndianSwap16(value));
4523 
4524  for (ULWord channel(0); channel < inNumChannels; channel++)
4525  *pAudioBuffer++ = UWord(value);
4526 
4527  j += 1.0;
4528  if (j > cycleLength)
4529  j -= cycleLength;
4530  inOutCurrentSample++;
4531  } // for each sample
4532  } // if pAudioBuffer
4533 
4534  return inNumSamples * 4 * inNumChannels;
4535 
4536 } // AddAudioTone (UWord)
4537 
4538 
4539 ULWord AddAudioTone ( ULWord * pAudioBuffer,
4540  ULWord & inOutCurrentSample,
4541  const ULWord inNumSamples,
4542  const double inSampleRate,
4543  const double * pInAmplitudes,
4544  const double * pInFrequencies,
4545  const ULWord inNumBits,
4546  const bool inByteSwap,
4547  const ULWord inNumChannels)
4548 {
4549  double j [kNumAudioChannelsMax];
4550  double cycleLength [kNumAudioChannelsMax];
4551  const double scale (double(ULWord (1 << (inNumBits - 1))) - 1.0);
4552 
4553  for (ULWord channel(0); channel < inNumChannels; channel++)
4554  {
4555  cycleLength[channel] = inSampleRate / pInFrequencies[channel];
4556  j [channel] = inOutCurrentSample;
4557  }
4558 
4559  if (pAudioBuffer && pInAmplitudes && pInFrequencies)
4560  {
4561  for (ULWord i(0); i < inNumSamples; i++)
4562  {
4563  for (ULWord channel(0); channel < inNumChannels; channel++)
4564  {
4565  const double nextFloat = double(::sin(j[channel] / cycleLength[channel] * (M_PI * 2.0)) * pInAmplitudes[channel]);
4566  LWord value = LWord((nextFloat * scale) + double(0.5));
4567 
4568  if (inByteSwap)
4569  value = NTV2EndianSwap32(value);
4570 
4571  *pAudioBuffer++ = ULWord(value);
4572 
4573  j[channel] += 1.0;
4574  if (j[channel] > cycleLength[channel])
4575  j[channel] -= cycleLength[channel];
4576 
4577  }
4578  inOutCurrentSample++;
4579  } // for each sample
4580  } // if pAudioBuffer && pInFrequencies
4581 
4582  return inNumSamples * 4 * inNumChannels;
4583 
4584 } // AddAudioTone (per-chl freq & ampl)
4585 
4586 
4588  ULWord & inOutCurrentSample,
4589  const ULWord inNumSamples,
4590  const ULWord inModulus,
4591  const bool inEndianConvert,
4592  const ULWord inNumChannels)
4593 {
4594 
4595  for (ULWord i(0); i < inNumSamples; i++)
4596  {
4597  ULWord value ((inOutCurrentSample % inModulus) << 16);
4598  if (inEndianConvert)
4599  value = NTV2EndianSwap32(value);
4600  for (ULWord channel(0); channel < inNumChannels; channel++)
4601  *pAudioBuffer++ = value;
4602  inOutCurrentSample++;
4603  }
4604  return inNumSamples * 4 * inNumChannels;
4605 }
4606 
4607 
4608 std::string NTV2DeviceIDToString (const NTV2DeviceID inValue, const bool inForRetailDisplay)
4609 {
4610  switch (inValue)
4611  {
4612  case DEVICE_ID_CORVID1: return inForRetailDisplay ? "Corvid 1" : "Corvid";
4613  case DEVICE_ID_CORVID22: return inForRetailDisplay ? "Corvid 22" : "Corvid22";
4614  case DEVICE_ID_CORVID24: return inForRetailDisplay ? "Corvid 24" : "Corvid24";
4615  case DEVICE_ID_CORVID3G: return inForRetailDisplay ? "Corvid 3G" : "Corvid3G";
4616  case DEVICE_ID_CORVID44: return inForRetailDisplay ? "Corvid 44" : "Corvid44";
4617  case DEVICE_ID_CORVID44_GEN3: return inForRetailDisplay ? "Corvid 44 Gen3" : "Corvid-44-Gen3";
4618  case DEVICE_ID_CORVID44_2X4K: return inForRetailDisplay ? "Corvid 44 12G 2x4K" : "Corvid44-12G-2x4K";
4619  case DEVICE_ID_CORVID44_8K: return inForRetailDisplay ? "Corvid 44 12G 8K" : "Corvid44-12G-8K";
4620  case DEVICE_ID_CORVID44_8KMK: return inForRetailDisplay ? "Corvid 44 12G 8KMK" : "Corvid44-12G-8KMK";
4621  case DEVICE_ID_CORVID44_PLNR: return inForRetailDisplay ? "Corvid 44 12G PLNR" : "Corvid44-12G-PLNR";
4622  case DEVICE_ID_CORVID88: return inForRetailDisplay ? "Corvid 88" : "Corvid88";
4623  case DEVICE_ID_CORVID88_GEN3: return inForRetailDisplay ? "Corvid 88 Gen3" : "Corvid-88-Gen3";
4624  case DEVICE_ID_CORVIDHBR: return inForRetailDisplay ? "Corvid HB-R" : "CorvidHBR";
4625  case DEVICE_ID_CORVIDHEVC: return inForRetailDisplay ? "Corvid HEVC" : "CorvidHEVC";
4626  case DEVICE_ID_FS8: return "FS8";
4627  case DEVICE_ID_IO4K: return "Io4K";
4628  case DEVICE_ID_IO4KPLUS: return inForRetailDisplay ? "Avid DNxIV" : "Io4KPlus";
4629  case DEVICE_ID_IO4KUFC: return inForRetailDisplay ? "Io4K UFC" : "Io4KUfc";
4630  case DEVICE_ID_IOEXPRESS: return inForRetailDisplay ? "IoExpress" : "IoExpress";
4631  case DEVICE_ID_IOX3: return "IoX3";
4632  case DEVICE_ID_IOXT: return "IoXT";
4633  case DEVICE_ID_IP25_R: return "IP25-R";
4634  case DEVICE_ID_IP25_T: return "IP25-T";
4635  case DEVICE_ID_KONA1: return inForRetailDisplay ? "Kona 1" : "Kona1";
4636  case DEVICE_ID_KONA3G: return inForRetailDisplay ? "KONA 3G" : "Kona3G";
4637  case DEVICE_ID_KONA3GQUAD: return inForRetailDisplay ? "KONA 3G QUAD" : "Kona3GQuad"; // Used to be "KONA 3G" for retail display
4638  case DEVICE_ID_KONA4: return inForRetailDisplay ? "KONA 4" : "Kona4";
4639  case DEVICE_ID_KONA4UFC: return inForRetailDisplay ? "KONA 4 UFC" : "Kona4Ufc";
4640  case DEVICE_ID_KONA5: return inForRetailDisplay ? "KONA 5" : "Kona5";
4641  case DEVICE_ID_KONA5_2X4K: return inForRetailDisplay ? "KONA 5 (12-Bit)" : "Kona5-12Bit";
4642  case DEVICE_ID_KONA5_3DLUT: return inForRetailDisplay ? "KONA 5 3DLUT" : "Kona5-3DLUT";
4643  case DEVICE_ID_KONA5_8K: return inForRetailDisplay ? "KONA 5 8K" : "Kona5-8K";
4644  case DEVICE_ID_KONA5_8KMK: return inForRetailDisplay ? "KONA 5 8KMK" : "Kona5-8KMK";
4645  case DEVICE_ID_KONA5_8K_MV_TX: return inForRetailDisplay ? "KONA 5 8K MV TX" : "Kona5-8K-MV-TX";
4646  case DEVICE_ID_KONA5_OE1: return "Kona5-OE1";
4647  case DEVICE_ID_KONA5_OE10: return "Kona5-OE10";
4648  case DEVICE_ID_KONA5_OE11: return "Kona5-OE11";
4649  case DEVICE_ID_KONA5_OE12: return "Kona5-OE12";
4650  case DEVICE_ID_KONA5_OE2: return "Kona5-OE2";
4651  case DEVICE_ID_KONA5_OE3: return "Kona5-OE3";
4652  case DEVICE_ID_KONA5_OE4: return "Kona5-OE4";
4653  case DEVICE_ID_KONA5_OE5: return "Kona5-OE5";
4654  case DEVICE_ID_KONA5_OE6: return "Kona5-OE6";
4655  case DEVICE_ID_KONA5_OE7: return "Kona5-OE7";
4656  case DEVICE_ID_KONA5_OE8: return "Kona5-OE8";
4657  case DEVICE_ID_KONA5_OE9: return "Kona5-OE9";
4658  case DEVICE_ID_KONAHDMI: return inForRetailDisplay ? "Kona HDMI" : "KonaHDMI";
4659  case DEVICE_ID_KONALHEPLUS: return inForRetailDisplay ? "KONA LHe+" : "KonaLHe+";
4660  case DEVICE_ID_KONALHI: return inForRetailDisplay ? "KONA LHi" : "KonaLHi";
4661  case DEVICE_ID_KONALHIDVI: return inForRetailDisplay ? "KONA LHi DVI" : "KonaLHiDVI";
4662  case DEVICE_ID_KONAX: return inForRetailDisplay ? "KONA X" : "KonaX";
4663  case DEVICE_ID_KONAXM: return inForRetailDisplay ? "KONA XM" : "KonaXM";
4664  case DEVICE_ID_KONAX_4CH: return inForRetailDisplay ? "KONA X 4CH" : "KonaX_4CH";
4665  case DEVICE_ID_KONAIP_25G: return "KonaIP 25G";
4666  case DEVICE_ID_KONAIP_25G_8CH: return "KonaIP 25G 8Ch";
4667  case DEVICE_ID_SOJI_3DLUT: return "SOJI-3DLUT";
4668  case DEVICE_ID_SOJI_DIAGS: return "SOJI-DIAGS";
4669  case DEVICE_ID_SOJI_OE1: return "SOJI-OE1";
4670  case DEVICE_ID_SOJI_OE2: return "SOJI-OE2";
4671  case DEVICE_ID_SOJI_OE3: return "SOJI-OE3";
4672  case DEVICE_ID_SOJI_OE4: return "SOJI-OE4";
4673  case DEVICE_ID_SOJI_OE5: return "SOJI-OE5";
4674  case DEVICE_ID_SOJI_OE6: return "SOJI-OE6";
4675  case DEVICE_ID_SOJI_OE7: return "SOJI-OE7";
4676  case DEVICE_ID_TTAP: return inForRetailDisplay ? "T-TAP" : "TTap";
4677  case DEVICE_ID_TTAP_PRO: return inForRetailDisplay ? "T-TAP Pro" : "TTapPro";
4678  case DEVICE_ID_VKONA: return inForRetailDisplay ? "VKONA" : "VKona";
4679  case DEVICE_ID_SOFTWARE: return inForRetailDisplay ? "Software" : "Software";
4680  case DEVICE_ID_NOTFOUND: return inForRetailDisplay ? "AJA Device" : "(Not Found)";
4681 #if defined(_DEBUG)
4682  // IoIP/KonaIP10g purge:
4683  case DEVICE_ID_IOIP_2022:
4684  case DEVICE_ID_IOIP_2110:
4688  case DEVICE_ID_KONAIP_2022:
4689  case DEVICE_ID_KONAIP_2110:
4692  case DEVICE_ID_KONAIP_4CH_2SFP: break;
4693 #else
4694  default: break;
4695 #endif
4696  }
4697  return inForRetailDisplay ? "Unknown" : "???";
4698 } // NTV2DeviceIDToString
4699 
4700 
4702 {
4703  return inIndex < NTV2_MAX_NUM_CHANNELS ? NTV2Channel(inIndex) : NTV2_CHANNEL1;
4704 }
4705 
4707 {
4708  return NTV2_IS_VALID_CHANNEL(inChannel) ? ULWord(inChannel) : 0;
4709 }
4710 
4711 
4713 {
4714  switch (inCrosspointChannel)
4715  {
4718  case NTV2CROSSPOINT_INPUT1: return NTV2_CHANNEL1;
4719  case NTV2CROSSPOINT_INPUT2: return NTV2_CHANNEL2;
4724  case NTV2CROSSPOINT_INPUT3: return NTV2_CHANNEL3;
4725  case NTV2CROSSPOINT_INPUT4: return NTV2_CHANNEL4;
4730  case NTV2CROSSPOINT_INPUT5: return NTV2_CHANNEL5;
4731  case NTV2CROSSPOINT_INPUT6: return NTV2_CHANNEL6;
4732  case NTV2CROSSPOINT_INPUT7: return NTV2_CHANNEL7;
4733  case NTV2CROSSPOINT_INPUT8: return NTV2_CHANNEL8;
4735  }
4736  return NTV2_CHANNEL_INVALID;
4737 }
4738 
4739 
4741 {
4742  switch(index)
4743  {
4744  default:
4745  case 0: return NTV2CROSSPOINT_CHANNEL1;
4746  case 1: return NTV2CROSSPOINT_CHANNEL2;
4747  case 2: return NTV2CROSSPOINT_CHANNEL3;
4748  case 3: return NTV2CROSSPOINT_CHANNEL4;
4749  case 4: return NTV2CROSSPOINT_CHANNEL5;
4750  case 5: return NTV2CROSSPOINT_CHANNEL6;
4751  case 6: return NTV2CROSSPOINT_CHANNEL7;
4752  case 7: return NTV2CROSSPOINT_CHANNEL8;
4753  }
4754 }
4755 
4757 {
4758  switch(channel)
4759  {
4760  default:
4761  case NTV2CROSSPOINT_CHANNEL1: return 0;
4762  case NTV2CROSSPOINT_CHANNEL2: return 1;
4763  case NTV2CROSSPOINT_CHANNEL3: return 2;
4764  case NTV2CROSSPOINT_CHANNEL4: return 3;
4765  case NTV2CROSSPOINT_CHANNEL5: return 4;
4766  case NTV2CROSSPOINT_CHANNEL6: return 5;
4767  case NTV2CROSSPOINT_CHANNEL7: return 6;
4768  case NTV2CROSSPOINT_CHANNEL8: return 7;
4769  }
4770 }
4771 
4773 {
4774  switch(index)
4775  {
4776  default:
4777  case 0: return NTV2CROSSPOINT_INPUT1;
4778  case 1: return NTV2CROSSPOINT_INPUT2;
4779  case 2: return NTV2CROSSPOINT_INPUT3;
4780  case 3: return NTV2CROSSPOINT_INPUT4;
4781  case 4: return NTV2CROSSPOINT_INPUT5;
4782  case 5: return NTV2CROSSPOINT_INPUT6;
4783  case 6: return NTV2CROSSPOINT_INPUT7;
4784  case 7: return NTV2CROSSPOINT_INPUT8;
4785  }
4786 }
4787 
4789 {
4790  switch(channel)
4791  {
4792  default:
4793  case NTV2CROSSPOINT_INPUT1: return 0;
4794  case NTV2CROSSPOINT_INPUT2: return 1;
4795  case NTV2CROSSPOINT_INPUT3: return 2;
4796  case NTV2CROSSPOINT_INPUT4: return 3;
4797  case NTV2CROSSPOINT_INPUT5: return 4;
4798  case NTV2CROSSPOINT_INPUT6: return 5;
4799  case NTV2CROSSPOINT_INPUT7: return 6;
4800  case NTV2CROSSPOINT_INPUT8: return 7;
4801  }
4802 }
4803 
4805 {
4806  switch(index)
4807  {
4808  default:
4809  case 0: return NTV2CROSSPOINT_CHANNEL1;
4810  case 1: return NTV2CROSSPOINT_CHANNEL2;
4811  case 2: return NTV2CROSSPOINT_CHANNEL3;
4812  case 3: return NTV2CROSSPOINT_CHANNEL4;
4813  case 4: return NTV2CROSSPOINT_INPUT1;
4814  case 5: return NTV2CROSSPOINT_INPUT2;
4815  case 6: return NTV2CROSSPOINT_INPUT3;
4816  case 7: return NTV2CROSSPOINT_INPUT4;
4817  case 8: return NTV2CROSSPOINT_CHANNEL5;
4818  case 9: return NTV2CROSSPOINT_CHANNEL6;
4819  case 10:return NTV2CROSSPOINT_CHANNEL7;
4820  case 11:return NTV2CROSSPOINT_CHANNEL8;
4821  case 12:return NTV2CROSSPOINT_INPUT5;
4822  case 13:return NTV2CROSSPOINT_INPUT6;
4823  case 14:return NTV2CROSSPOINT_INPUT7;
4824  case 15:return NTV2CROSSPOINT_INPUT8;
4825  }
4826 }
4827 
4829 {
4830  switch(channel)
4831  {
4832  default:
4833  case NTV2CROSSPOINT_CHANNEL1: return 0;
4834  case NTV2CROSSPOINT_CHANNEL2: return 1;
4835  case NTV2CROSSPOINT_CHANNEL3: return 2;
4836  case NTV2CROSSPOINT_CHANNEL4: return 3;
4837  case NTV2CROSSPOINT_INPUT1: return 4;
4838  case NTV2CROSSPOINT_INPUT2: return 5;
4839  case NTV2CROSSPOINT_INPUT3: return 6;
4840  case NTV2CROSSPOINT_INPUT4: return 7;
4841  case NTV2CROSSPOINT_CHANNEL5: return 8;
4842  case NTV2CROSSPOINT_CHANNEL6: return 9;
4843  case NTV2CROSSPOINT_CHANNEL7: return 10;
4844  case NTV2CROSSPOINT_CHANNEL8: return 11;
4845  case NTV2CROSSPOINT_INPUT5: return 12;
4846  case NTV2CROSSPOINT_INPUT6: return 13;
4847  case NTV2CROSSPOINT_INPUT7: return 14;
4848  case NTV2CROSSPOINT_INPUT8: return 15;
4849  }
4850 }
4851 
4852 
4854 {
4855  return NTV2_IS_INPUT_CROSSPOINT(inChannel);
4856 }
4857 
4858 
4860 {
4861  return NTV2_IS_OUTPUT_CROSSPOINT(inChannel);
4862 }
4863 
4864 
4866 {
4869  return static_cast<NTV2EmbeddedAudioInput>(inChannel);
4870 }
4871 
4872 
4874 {
4877  return static_cast<NTV2AudioSystem>(inChannel);
4878 }
4879 
4880 
4882 {
4883  static const NTV2EmbeddedAudioInput gInputSourceToEmbeddedAudioInputs [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_MAX_NUM_EmbeddedAudioInputs,
4884  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_1,
4885  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_2,
4886  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_3,
4887  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_4,
4888  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_1,
4889  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_2,
4890  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_3,
4891  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_4,
4892  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_5,
4893  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_6,
4894  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_7,
4895  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_8,
4896  /* NTV2_INPUTSOURCE_INVALID */ NTV2_MAX_NUM_EmbeddedAudioInputs};
4897  if (inInputSource < NTV2_NUM_INPUTSOURCES && inInputSource < NTV2InputSource(sizeof(gInputSourceToEmbeddedAudioInputs) / sizeof(NTV2EmbeddedAudioInput)))
4898  return gInputSourceToEmbeddedAudioInputs [inInputSource];
4899  else
4901 
4902 } // InputSourceToEmbeddedAudioInput
4903 
4904 
4906 {
4907  if (!NTV2_IS_VALID_INPUT_SOURCE (inInputSource))
4909  if (NTV2_INPUT_SOURCE_IS_SDI (inInputSource))
4910  return NTV2_AUDIO_EMBEDDED;
4911  else if (NTV2_INPUT_SOURCE_IS_HDMI (inInputSource))
4912  return NTV2_AUDIO_HDMI;
4913  else if (NTV2_INPUT_SOURCE_IS_ANALOG (inInputSource))
4914  return NTV2_AUDIO_ANALOG;
4916 }
4917 
4918 
4920 {
4923  if (NTV2_IS_VALID_CHANNEL (inChannel))
4924  return gChannelToInputChannelSpec [inChannel];
4925  else
4926  return NTV2CROSSPOINT_INVALID;
4927 }
4928 
4929 
4931 {
4934  if (inChannel >= NTV2_CHANNEL1 && inChannel < NTV2_MAX_NUM_CHANNELS)
4935  return gChannelToOutputChannelSpec [inChannel];
4936  else
4937  return NTV2CROSSPOINT_INVALID;
4938 }
4939 
4940 
4942 {
4944  if (NTV2_IS_VALID_CHANNEL (inChannel))
4945  return gChannelToInputInterrupt [inChannel];
4946  else
4947  return eNumInterruptTypes;
4948 }
4949 
4950 
4952 {
4954  if (NTV2_IS_VALID_CHANNEL (inChannel))
4955  return gChannelToOutputInterrupt [inChannel];
4956  else
4957  return eNumInterruptTypes;
4958 }
4959 
4960 
4964 
4965 
4966 NTV2TCIndex NTV2ChannelToTimecodeIndex (const NTV2Channel inChannel, const bool inEmbeddedLTC, const bool inIsF2)
4967 {
4968  if (NTV2_IS_VALID_CHANNEL(inChannel))
4969  return inEmbeddedLTC ? gChanATCLTC[inChannel] : (inIsF2 ? gChanVITC2[inChannel] : gChanVITC1[inChannel]);
4970  return NTV2_TCINDEX_INVALID;
4971 }
4972 
4973 
4975 {
4976  NTV2TCIndexes result;
4977  if (NTV2_IS_VALID_CHANNEL(inSDI))
4978  {result.insert(gChanVITC1[inSDI]); result.insert(gChanVITC2[inSDI]); result.insert(gChanATCLTC[inSDI]);}
4979  return result;
4980 }
4981 
4982 
4984 {
4988  return NTV2_IS_VALID_TIMECODE_INDEX (inTCIndex) ? gTCIndexToChannel [inTCIndex] : NTV2_CHANNEL_INVALID;
4989 }
4990 
4991 
4993 {
4999  return NTV2_IS_VALID_TIMECODE_INDEX (inTCIndex) ? gTCIndexToInputSource [inTCIndex] : NTV2_INPUTSOURCE_INVALID;
5000 }
5001 
5002 
5004 {
5005  static const NTV2Crosspoint gInputSourceToChannelSpec [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2CROSSPOINT_INPUT1,
5006  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2CROSSPOINT_INPUT1,
5007  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2CROSSPOINT_INPUT2,
5008  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2CROSSPOINT_INPUT3,
5009  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2CROSSPOINT_INPUT4,
5010  /* NTV2_INPUTSOURCE_SDI1 */ NTV2CROSSPOINT_INPUT1,
5011  /* NTV2_INPUTSOURCE_SDI2 */ NTV2CROSSPOINT_INPUT2,
5012  /* NTV2_INPUTSOURCE_SDI3 */ NTV2CROSSPOINT_INPUT3,
5013  /* NTV2_INPUTSOURCE_SDI4 */ NTV2CROSSPOINT_INPUT4,
5014  /* NTV2_INPUTSOURCE_SDI5 */ NTV2CROSSPOINT_INPUT5,
5015  /* NTV2_INPUTSOURCE_SDI6 */ NTV2CROSSPOINT_INPUT6,
5016  /* NTV2_INPUTSOURCE_SDI7 */ NTV2CROSSPOINT_INPUT7,
5017  /* NTV2_INPUTSOURCE_SDI8 */ NTV2CROSSPOINT_INPUT8,
5018  /* NTV2_NUM_INPUTSOURCES */ NTV2_NUM_CROSSPOINTS};
5019  if (inInputSource < NTV2_NUM_INPUTSOURCES && size_t (inInputSource) < sizeof (gInputSourceToChannelSpec) / sizeof (NTV2Channel))
5020  return gInputSourceToChannelSpec [inInputSource];
5021  else
5022  return NTV2_NUM_CROSSPOINTS;
5023 
5024 } // NTV2InputSourceToChannelSpec
5025 
5026 
5028 {
5029  static const NTV2ReferenceSource gInputSourceToReferenceSource [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_REFERENCE_ANALOG_INPUT1,
5030  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_REFERENCE_HDMI_INPUT1,
5031  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_REFERENCE_HDMI_INPUT2,
5032  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_REFERENCE_HDMI_INPUT3,
5033  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_REFERENCE_HDMI_INPUT4,
5034  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_REFERENCE_INPUT1,
5035  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_REFERENCE_INPUT2,
5036  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_REFERENCE_INPUT3,
5037  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_REFERENCE_INPUT4,
5038  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_REFERENCE_INPUT5,
5039  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_REFERENCE_INPUT6,
5040  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_REFERENCE_INPUT7,
5041  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_REFERENCE_INPUT8,
5042  /* NTV2_NUM_INPUTSOURCES */ NTV2_NUM_REFERENCE_INPUTS};
5043  if (NTV2_IS_VALID_INPUT_SOURCE (inInputSource) && size_t (inInputSource) < sizeof (gInputSourceToReferenceSource) / sizeof (NTV2ReferenceSource))
5044  return gInputSourceToReferenceSource [inInputSource];
5045  else
5046  return NTV2_REFERENCE_INVALID;
5047 
5048 } // NTV2InputSourceToReferenceSource
5049 
5050 
5052 {
5053  static const NTV2Channel gInputSourceToChannel [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_CHANNEL1,
5054  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_CHANNEL1,
5055  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_CHANNEL2,
5056  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_CHANNEL3,
5057  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_CHANNEL4,
5058  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_CHANNEL1,
5059  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_CHANNEL2,
5060  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_CHANNEL3,
5061  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_CHANNEL4,
5062  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_CHANNEL5,
5063  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_CHANNEL6,
5064  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_CHANNEL7,
5065  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_CHANNEL8,
5066  /* NTV2_NUM_INPUTSOURCES */ NTV2_CHANNEL_INVALID};
5067  if (inInputSource < NTV2_NUM_INPUTSOURCES && size_t (inInputSource) < sizeof (gInputSourceToChannel) / sizeof (NTV2Channel))
5068  return gInputSourceToChannel [inInputSource];
5069  else
5070  return NTV2_MAX_NUM_CHANNELS;
5071 
5072 } // NTV2InputSourceToChannel
5073 
5074 
5076 {
5077  static const NTV2AudioSystem gInputSourceToAudioSystem [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_AUDIOSYSTEM_1,
5078  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_AUDIOSYSTEM_1,
5079  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_AUDIOSYSTEM_2,
5080  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_AUDIOSYSTEM_3,
5081  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_AUDIOSYSTEM_4,
5082  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_AUDIOSYSTEM_1,
5083  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_AUDIOSYSTEM_2,
5084  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_AUDIOSYSTEM_3,
5085  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_AUDIOSYSTEM_4,
5086  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_AUDIOSYSTEM_5,
5087  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_AUDIOSYSTEM_6,
5088  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_AUDIOSYSTEM_7,
5089  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_AUDIOSYSTEM_8,
5090  /* NTV2_NUM_INPUTSOURCES */ NTV2_NUM_AUDIOSYSTEMS};
5091  if (inInputSource < NTV2_NUM_INPUTSOURCES && inInputSource < NTV2InputSource(sizeof(gInputSourceToAudioSystem) / sizeof(NTV2AudioSystem)))
5092  return gInputSourceToAudioSystem [inInputSource];
5093  else
5094  return NTV2_AUDIOSYSTEM_INVALID;
5095 
5096 } // NTV2InputSourceToAudioSystem
5097 
5098 
5099 NTV2TimecodeIndex NTV2InputSourceToTimecodeIndex (const NTV2InputSource inInputSource, const bool inEmbeddedLTC)
5100 {
5101  static const NTV2TimecodeIndex gInputSourceToTCIndex []= { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_TCINDEX_LTC1,
5102  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_TCINDEX_INVALID,
5103  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_TCINDEX_INVALID,
5104  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_TCINDEX_INVALID,
5105  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_TCINDEX_INVALID,
5106  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_TCINDEX_SDI1,
5107  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_TCINDEX_SDI2,
5108  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_TCINDEX_SDI3,
5109  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_TCINDEX_SDI4,
5110  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_TCINDEX_SDI5,
5111  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_TCINDEX_SDI6,
5112  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_TCINDEX_SDI7,
5113  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_TCINDEX_SDI8,
5114  /* NTV2_NUM_INPUTSOURCES */ NTV2_TCINDEX_INVALID};
5115  static const NTV2TimecodeIndex gInputSourceToLTCIndex []= { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_TCINDEX_LTC1,
5116  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_TCINDEX_INVALID,
5117  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_TCINDEX_INVALID,
5118  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_TCINDEX_INVALID,
5119  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_TCINDEX_INVALID,
5120  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_TCINDEX_SDI1_LTC,
5121  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_TCINDEX_SDI2_LTC,
5122  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_TCINDEX_SDI3_LTC,
5123  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_TCINDEX_SDI4_LTC,
5124  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_TCINDEX_SDI5_LTC,
5125  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_TCINDEX_SDI6_LTC,
5126  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_TCINDEX_SDI7_LTC,
5127  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_TCINDEX_SDI8_LTC,
5128  /* NTV2_NUM_INPUTSOURCES */ NTV2_TCINDEX_INVALID};
5129  if (inInputSource < NTV2_NUM_INPUTSOURCES && size_t (inInputSource) < sizeof (gInputSourceToTCIndex) / sizeof (NTV2TimecodeIndex))
5130  return inEmbeddedLTC ? gInputSourceToLTCIndex [inInputSource] : gInputSourceToTCIndex [inInputSource];
5131  else
5132  return NTV2_TCINDEX_INVALID;
5133 }
5134 
5135 
5137 {
5147  if (NTV2_IS_VALID_CHANNEL(inChannel))
5148  switch (inSourceType)
5149  {
5150  case NTV2_IOKINDS_SDI: return gChannelToSDIInputSource[inChannel];
5151  case NTV2_IOKINDS_HDMI: return gChannelToHDMIInputSource[inChannel];
5152  case NTV2_IOKINDS_ANALOG: return gChannelToAnlgInputSource[inChannel];
5153  default: break;
5154  }
5155  return NTV2_INPUTSOURCE_INVALID;
5156 }
5157 
5158 
5160 {
5161  if (!NTV2_IS_VALID_OUTPUT_DEST (inOutputDest))
5162  return NTV2_CHANNEL_INVALID;
5163 
5164  static const NTV2Channel gOutputDestToChannel [] = { NTV2_CHANNEL1, NTV2_CHANNEL1,
5167  return gOutputDestToChannel [inOutputDest];
5168 }
5169 
5170 
5172 {
5173  if (!NTV2_IS_VALID_CHANNEL(inChannel))
5175  if (!NTV2_IS_VALID_IOKINDS(inKinds))
5178  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5180  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5182  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5183  if ((inKinds & NTV2_IOKINDS_ALL) == NTV2_IOKINDS_ALL)
5184  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5185  if ((inKinds & NTV2_IOKINDS_HDMI) == NTV2_IOKINDS_HDMI)
5187  if ((inKinds & NTV2_IOKINDS_ANALOG) == NTV2_IOKINDS_ANALOG)
5189 
5193  return gChannelToOutputDest [inChannel];
5194 }
5195 
5196 
5197 // if formats are transport equivalent (e.g. 1080i30 / 1080psf30) return the target version of the format
5199 {
5200  // compatible return target version
5201  if (::IsTransportCompatibleFormat (inFormat, inTargetFormat))
5202  return inTargetFormat;
5203 
5204  // not compatible, return original format
5205  return inFormat;
5206 }
5207 
5208 
5209 // determine if 2 formats are transport compatible (e.g. 1080i30 / 1080psf30)
5210 bool IsTransportCompatibleFormat (const NTV2VideoFormat inFormat1, const NTV2VideoFormat inFormat2)
5211 {
5212  if (inFormat1 == inFormat2)
5213  return true;
5214 
5215  switch (inFormat1)
5216  {
5217  case NTV2_FORMAT_1080i_5000: return inFormat2 == NTV2_FORMAT_1080psf_2500_2;
5218  case NTV2_FORMAT_1080i_5994: return inFormat2 == NTV2_FORMAT_1080psf_2997_2;
5219  case NTV2_FORMAT_1080i_6000: return inFormat2 == NTV2_FORMAT_1080psf_3000_2;
5220  case NTV2_FORMAT_1080psf_2500_2: return inFormat2 == NTV2_FORMAT_1080i_5000;
5221  case NTV2_FORMAT_1080psf_2997_2: return inFormat2 == NTV2_FORMAT_1080i_5994;
5222  case NTV2_FORMAT_1080psf_3000_2: return inFormat2 == NTV2_FORMAT_1080i_6000;
5223  default: return false;
5224  }
5225 }
5226 
5227 
5229 {
5233  static const NTV2InputSource sANLGInputSources[] = { NTV2_INPUTSOURCE_ANALOG1 };
5234  switch (inKinds)
5235  {
5236  case NTV2_IOKINDS_SDI:
5237  if (inIndex0 < sizeof(sSDIInputSources) / sizeof(NTV2InputSource))
5238  return sSDIInputSources[inIndex0];
5239  break;
5240  case NTV2_IOKINDS_HDMI:
5241  if (inIndex0 < sizeof(sHDMIInputSources) / sizeof(NTV2InputSource))
5242  return sHDMIInputSources[inIndex0];
5243  break;
5244  case NTV2_IOKINDS_ANALOG:
5245  if (inIndex0 < sizeof(sANLGInputSources) / sizeof(NTV2InputSource))
5246  return sANLGInputSources[inIndex0];
5247  break;
5248  #if defined(_DEBUG)
5249  case NTV2_IOKINDS_NONE:
5250  case NTV2_IOKINDS_ALL:
5251  break;
5252  #else
5253  default: break;
5254  #endif
5255  }
5256  return NTV2_INPUTSOURCE_INVALID;
5257 }
5258 
5259 
5261 {
5262  if (NTV2_INPUT_SOURCE_IS_SDI(inSrc))
5263  return NTV2_IOKINDS_SDI;
5264  if (NTV2_INPUT_SOURCE_IS_HDMI(inSrc))
5265  return NTV2_IOKINDS_HDMI;
5266  if (NTV2_INPUT_SOURCE_IS_ANALOG(inSrc))
5267  return NTV2_IOKINDS_ANALOG;
5268  return NTV2_IOKINDS_NONE;
5269 }
5270 
5271 
5272 NTV2InputSource GetNTV2HDMIInputSourceForIndex (const ULWord inIndex0) // NTV2_SHOULD_BE_DEPRECATED
5273 {
5275 }
5276 
5277 
5279 {
5280  static const ULWord sInputSourcesIndexes [] = { 0, // NTV2_INPUTSOURCE_ANALOG1,
5281  0, 1, 2, 3, // NTV2_INPUTSOURCE_HDMI1 ... NTV2_INPUTSOURCE_HDMI4,
5282  0, 1, 2, 3, 4, 5, 6, 7 }; // NTV2_INPUTSOURCE_SDI1 ... NTV2_INPUTSOURCE_SDI8
5283  if (size_t(inValue) < sizeof(sInputSourcesIndexes) / sizeof(ULWord))
5284  return sInputSourcesIndexes [inValue];
5285  else
5286  return 0xFFFFFFFF;
5287 
5288 } // GetIndexForNTV2InputSource
5289 
5290 
5292 {
5293  static const ULWord gFrameSizeToByteCount[] = { 2 /* NTV2_FRAMESIZE_2MB */, 4 /* NTV2_FRAMESIZE_4MB */, 8 /* NTV2_FRAMESIZE_8MB */, 16 /* NTV2_FRAMESIZE_16MB */,
5294  6 /* NTV2_FRAMESIZE_6MB */, 10 /* NTV2_FRAMESIZE_10MB */, 12 /* NTV2_FRAMESIZE_12MB */, 14 /* NTV2_FRAMESIZE_14MB */,
5295  18 /* NTV2_FRAMESIZE_18MB */, 20 /* NTV2_FRAMESIZE_20MB */, 22 /* NTV2_FRAMESIZE_22MB */, 24 /* NTV2_FRAMESIZE_24MB */,
5296  26 /* NTV2_FRAMESIZE_26MB */, 28 /* NTV2_FRAMESIZE_28MB */, 30 /* NTV2_FRAMESIZE_30MB */, 32 /* NTV2_FRAMESIZE_32MB */,
5297  0 };
5298  if (inFrameSize < NTV2_MAX_NUM_Framesizes && inFrameSize < NTV2Framesize(sizeof(gFrameSizeToByteCount) / sizeof(ULWord)))
5299  return gFrameSizeToByteCount [inFrameSize] * 1024 * 1024;
5300  else
5301  return 0;
5302 
5303 } // NTV2FramesizeToByteCount
5304 
5305 
5307 { // STANDARD BIG MEDIUM BIGGER INVALID
5308  static const ULWord gBufferSizeToByteCount[] = { 1 * 1024*1024, 4 * 1024*1024, 2 * 1024*1024, 3 * 1024*1024, 0 };
5309  if (NTV2_IS_VALID_AUDIO_BUFFER_SIZE(inBufferSize))
5310  return gBufferSizeToByteCount[inBufferSize];
5311  return 0;
5312 }
5313 
5314 typedef std::set<NTV2FrameRate> NTV2FrameRates;
5315 typedef NTV2FrameRates::const_iterator NTV2FrameRatesConstIter;
5316 typedef std::vector<NTV2FrameRates> NTV2FrameRateFamilies;
5317 typedef NTV2FrameRateFamilies::const_iterator NTV2FrameRateFamiliesConstIter;
5318 
5321 
5322 
5324 {
5325  if (!sFRFamMutex.IsValid())
5326  return false;
5327 
5328  AJAAutoLock autoLock (&sFRFamMutex);
5329  if (sFRFamilies.empty())
5330  {
5331  NTV2FrameRates FR1498, FR1500, FR2398, FR2400, FR2500;
5332  FR1498.insert(NTV2_FRAMERATE_1498); FR1498.insert(NTV2_FRAMERATE_2997); FR1498.insert(NTV2_FRAMERATE_5994); FR1498.insert(NTV2_FRAMERATE_11988);
5333  sFRFamilies.push_back(FR1498);
5334  FR1500.insert(NTV2_FRAMERATE_1500); FR1500.insert(NTV2_FRAMERATE_3000); FR1500.insert(NTV2_FRAMERATE_6000); FR1500.insert(NTV2_FRAMERATE_12000);
5335  sFRFamilies.push_back(FR1500);
5336  FR2398.insert(NTV2_FRAMERATE_2398); FR2398.insert(NTV2_FRAMERATE_4795);
5337  sFRFamilies.push_back(FR2398);
5338  FR2400.insert(NTV2_FRAMERATE_2400); FR2400.insert(NTV2_FRAMERATE_4800);
5339  sFRFamilies.push_back(FR2400);
5340  FR2500.insert(NTV2_FRAMERATE_2500); FR2500.insert(NTV2_FRAMERATE_5000);
5341  sFRFamilies.push_back(FR2500);
5342  }
5343  return !sFRFamilies.empty();
5344 }
5345 
5346 
5348 {
5350  for (NTV2FrameRateFamiliesConstIter it(sFRFamilies.begin()); it != sFRFamilies.end(); ++it)
5351  {
5352  const NTV2FrameRates & family (*it);
5353  NTV2FrameRatesConstIter iter(family.find(inFrameRate));
5354  if (iter != family.end())
5355  return *(family.begin());
5356  }
5357  return NTV2_FRAMERATE_INVALID;
5358 }
5359 
5360 
5361 bool IsMultiFormatCompatible (const NTV2FrameRate inFrameRate1, const NTV2FrameRate inFrameRate2)
5362 {
5363  if (inFrameRate1 == inFrameRate2)
5364  return true;
5365 
5366  if (!NTV2_IS_SUPPORTED_NTV2FrameRate(inFrameRate1) || !NTV2_IS_SUPPORTED_NTV2FrameRate(inFrameRate2))
5367  return false;
5368 
5369  const NTV2FrameRate frFamily1 (GetFrameRateFamily(inFrameRate1));
5370  const NTV2FrameRate frFamily2 (GetFrameRateFamily(inFrameRate2));
5371 
5373  return false; // Probably uninitialized
5374 
5375  return frFamily1 == frFamily2;
5376 
5377 } // IsMultiFormatCompatible (NTV2FrameRate)
5378 
5379 
5380 AJAExport bool IsMultiFormatCompatible (const NTV2VideoFormat inFormat1, const NTV2VideoFormat inFormat2)
5381 {
5382  if (inFormat1 == NTV2_FORMAT_UNKNOWN || inFormat2 == NTV2_FORMAT_UNKNOWN)
5383  return false;
5385 
5386 } // IsMultiFormatCompatible (NTV2VideoFormat)
5387 
5388 
5389 AJAExport bool IsPSF (const NTV2VideoFormat format)
5390 {
5391  return NTV2_IS_PSF_VIDEO_FORMAT(format);
5392 }
5393 
5394 
5396 {
5398 }
5399 
5400 
5402 {
5403  NTV2Standard standard (::GetNTV2StandardFromVideoFormat(format));
5404  return IsProgressiveTransport(standard);
5405 }
5406 
5407 
5409 {
5410  return NTV2_IS_PROGRESSIVE_STANDARD(standard);
5411 }
5412 
5413 
5415 {
5416  return NTV2_IS_FBF_RGB(format);
5417 }
5418 
5419 
5421 {
5422  return !NTV2_IS_FBF_RGB(format); // works for now
5423 }
5424 
5425 
5427 {
5428  return NTV2_FBF_HAS_ALPHA(format);
5429 }
5430 
5431 
5433 {
5434  return NTV2_IS_2K_1080_VIDEO_FORMAT(format) || NTV2_IS_2K_VIDEO_FORMAT(format);
5435 }
5436 
5437 
5439 {
5441 }
5442 
5443 
5445 {
5446  return NTV2_IS_QUAD_QUAD_FORMAT(format);
5447 }
5448 
5449 
5450 AJAExport bool IsRaw (const NTV2FrameBufferFormat frameBufferFormat)
5451 {
5452  return NTV2_FBF_IS_RAW(frameBufferFormat);
5453 }
5454 
5455 
5457 {
5458  return NTV2_IS_FBF_8BIT(format);
5459 }
5460 
5461 
5463 {
5464  return NTV2_VIDEO_FORMAT_IS_A(format);
5465 }
5466 
5467 
5469 {
5470  return NTV2_IS_3Gb_FORMAT(format);
5471 }
5472 
5474 {
5475  return NTV2_VIDEO_FORMAT_IS_J2K_SUPPORTED(format);
5476 }
5477 
5478 
5480 {
5482 
5483  switch( inFormat )
5484  {
5485  case NTV2_FORMAT_720p_5994:
5486  if ( outFormat == NTV2_FORMAT_525_5994 )
5487  cMode = NTV2_720p_5994to525_5994;
5488  else if ( outFormat == NTV2_FORMAT_1080i_5994)
5490  else if ( outFormat == NTV2_FORMAT_1080psf_2997_2)
5492  break;
5493 
5494  case NTV2_FORMAT_720p_5000:
5495  if ( outFormat == NTV2_FORMAT_625_5000 )
5496  cMode = NTV2_720p_5000to625_2500;
5497  else if ( outFormat == NTV2_FORMAT_1080i_5000) // NTV2_FORMAT_1080psf_2500
5499  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2)
5501  break;
5502 
5503  case NTV2_FORMAT_525_2398:
5504  if ( outFormat == NTV2_FORMAT_1080psf_2398 )
5505  cMode = NTV2_525_2398to1080i_2398;
5506  break;
5507 
5508  case NTV2_FORMAT_525_5994:
5509  if ( outFormat == NTV2_FORMAT_1080i_5994 )
5510  cMode = NTV2_525_5994to1080i_5994;
5511  else if (outFormat == NTV2_FORMAT_1080psf_2997_2)
5512  cMode = NTV2_525_5994to1080i_5994;
5513  else if ( outFormat == NTV2_FORMAT_720p_5994 )
5514  cMode = NTV2_525_5994to720p_5994;
5515  else if ( outFormat == NTV2_FORMAT_525_5994 )
5516  cMode = NTV2_525_5994to525_5994;
5517  else if ( outFormat == NTV2_FORMAT_525psf_2997 )
5519  break;
5520 
5521  case NTV2_FORMAT_625_5000:
5522  if ( outFormat == NTV2_FORMAT_1080i_5000) // NTV2_FORMAT_1080psf_2500
5523  cMode = NTV2_625_2500to1080i_2500;
5524  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2)
5525  cMode = NTV2_625_2500to1080i_2500;
5526  else if ( outFormat == NTV2_FORMAT_720p_5000 )
5527  cMode = NTV2_625_2500to720p_5000;
5528  else if ( outFormat == NTV2_FORMAT_625_5000 )
5529  cMode = NTV2_625_2500to625_2500;
5530  else if ( outFormat == NTV2_FORMAT_625psf_2500 )
5532  break;
5533 
5534  case NTV2_FORMAT_720p_6000:
5535  if ( outFormat == NTV2_FORMAT_1080i_6000) // NTV2_FORMAT_1080psf_3000
5537  else if (outFormat == NTV2_FORMAT_1080psf_3000_2 )
5539  break;
5540 
5542  if ( outFormat == NTV2_FORMAT_525_2398 )
5543  cMode = NTV2_1080i2398to525_2398;
5544  else if ( outFormat == NTV2_FORMAT_525_5994 )
5545  cMode = NTV2_1080i2398to525_2997;
5546  else if ( outFormat == NTV2_FORMAT_720p_2398 )
5548  else if ( outFormat == NTV2_FORMAT_1080i_5994 )
5550  break;
5551 
5553  if ( outFormat == NTV2_FORMAT_1080i_6000 )
5555  break;
5556 
5558  if ( outFormat == NTV2_FORMAT_625_5000 )
5559  cMode = NTV2_1080i_2500to625_2500;
5560  else if ( outFormat == NTV2_FORMAT_720p_5000 )
5562  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2 )
5564  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2 )
5566  break;
5567 
5569  if ( outFormat == NTV2_FORMAT_1080i_5994 )
5571  break;
5572 
5574  if ( outFormat == NTV2_FORMAT_1080i_6000 )
5576  break;
5577 
5579  if ( outFormat == NTV2_FORMAT_1080i_5000 )
5581  break;
5582 
5584  if ( outFormat == NTV2_FORMAT_625_5000 )
5585  cMode = NTV2_1080i_2500to625_2500;
5586  else if ( outFormat == NTV2_FORMAT_720p_5000 )
5588  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2 )
5590  break;
5591 
5594  if ( outFormat == NTV2_FORMAT_525_5994 )
5595  cMode = NTV2_1080i_5994to525_5994;
5596  else if ( outFormat == NTV2_FORMAT_720p_5994 )
5598  else if ( outFormat == NTV2_FORMAT_1080psf_2997_2 )
5600  break;
5601 
5604  if ( outFormat == NTV2_FORMAT_720p_6000 )
5606  else if ( outFormat == NTV2_FORMAT_1080psf_3000_2 )
5608  break;
5609 
5610  case NTV2_FORMAT_720p_2398:
5611  if ( outFormat == NTV2_FORMAT_1080psf_2398 )
5613  break;
5614 
5616  if ( outFormat == NTV2_FORMAT_720p_6000 )
5618  break;
5619 
5620  default:
5621  break;
5622  }
5623 
5624  return cMode;
5625 }
5626 
5628 {
5629  NTV2VideoFormat inputFormat = NTV2_FORMAT_UNKNOWN;
5630 
5631  switch( conversionMode )
5632  {
5633  case NTV2_525_5994to525_5994: inputFormat = NTV2_FORMAT_525_5994; break;
5634  case NTV2_525_5994to720p_5994: inputFormat = NTV2_FORMAT_525_5994; break;
5635  case NTV2_525_5994to1080i_5994: inputFormat = NTV2_FORMAT_525_5994; break;
5636  case NTV2_525_2398to1080i_2398: inputFormat = NTV2_FORMAT_525_2398; break;
5637  case NTV2_525_5994to525psf_2997: inputFormat = NTV2_FORMAT_525_5994; break;
5638 
5639  case NTV2_625_2500to625_2500: inputFormat = NTV2_FORMAT_625_5000; break;
5640  case NTV2_625_2500to720p_5000: inputFormat = NTV2_FORMAT_625_5000; break;
5641  case NTV2_625_2500to1080i_2500: inputFormat = NTV2_FORMAT_625_5000; break;
5642  case NTV2_625_5000to625psf_2500: inputFormat = NTV2_FORMAT_625_5000; break;
5643 
5644  case NTV2_720p_5000to625_2500: inputFormat = NTV2_FORMAT_720p_5000; break;
5645  case NTV2_720p_5000to1080i_2500: inputFormat = NTV2_FORMAT_720p_5000; break;
5646  case NTV2_720p_5994to525_5994: inputFormat = NTV2_FORMAT_720p_5994; break;
5647  case NTV2_720p_5994to1080i_5994: inputFormat = NTV2_FORMAT_720p_5994; break;
5648  case NTV2_720p_6000to1080i_3000: inputFormat = NTV2_FORMAT_720p_6000; break;
5649  case NTV2_720p_2398to1080i_2398: inputFormat = NTV2_FORMAT_720p_2398; break;
5650 
5651  case NTV2_1080i2398to525_2398: inputFormat = NTV2_FORMAT_1080psf_2398; break;
5652  case NTV2_1080i2398to525_2997: inputFormat = NTV2_FORMAT_1080psf_2398; break;
5653  case NTV2_1080i_2398to720p_2398: inputFormat = NTV2_FORMAT_1080psf_2398; break;
5654 
5655  case NTV2_1080i_2500to625_2500: inputFormat = NTV2_FORMAT_1080i_5000; break;
5656  case NTV2_1080i_2500to720p_5000: inputFormat = NTV2_FORMAT_1080i_5000; break;
5657  case NTV2_1080i_5994to525_5994: inputFormat = NTV2_FORMAT_1080i_5994; break;
5658  case NTV2_1080i_5994to720p_5994: inputFormat = NTV2_FORMAT_1080i_5994; break;
5659  case NTV2_1080i_3000to720p_6000: inputFormat = NTV2_FORMAT_1080i_6000; break;
5660  case NTV2_1080i_5000to1080psf_2500: inputFormat = NTV2_FORMAT_1080i_5000; break;
5661  case NTV2_1080i_5994to1080psf_2997: inputFormat = NTV2_FORMAT_1080i_5994; break;
5662  case NTV2_1080i_6000to1080psf_3000: inputFormat = NTV2_FORMAT_1080i_6000; break;
5663  case NTV2_1080p_3000to720p_6000: inputFormat = NTV2_FORMAT_1080p_3000; break;
5664 
5665  default: inputFormat = NTV2_FORMAT_UNKNOWN; break;
5666  }
5667  return inputFormat;
5668 }
5669 
5670 
5672 {
5673  NTV2VideoFormat outputFormat = NTV2_FORMAT_UNKNOWN;
5674 
5675  switch( conversionMode )
5676  {
5677  case NTV2_525_5994to525_5994: outputFormat = NTV2_FORMAT_525_5994; break;
5678  case NTV2_525_5994to720p_5994: outputFormat = NTV2_FORMAT_720p_5994; break;
5679  case NTV2_525_5994to1080i_5994: outputFormat = NTV2_FORMAT_1080i_5994; break;
5680  case NTV2_525_2398to1080i_2398: outputFormat = NTV2_FORMAT_1080psf_2398; break;
5681  case NTV2_525_5994to525psf_2997: outputFormat = NTV2_FORMAT_525psf_2997; break;
5682 
5683  case NTV2_625_2500to625_2500: outputFormat = NTV2_FORMAT_625_5000; break;
5684  case NTV2_625_2500to720p_5000: outputFormat = NTV2_FORMAT_720p_5000; break;
5685  case NTV2_625_2500to1080i_2500: outputFormat = NTV2_FORMAT_1080i_5000; break;
5686  case NTV2_625_5000to625psf_2500: outputFormat = NTV2_FORMAT_625psf_2500; break;
5687 
5688  case NTV2_720p_5000to625_2500: outputFormat = NTV2_FORMAT_625_5000; break;
5689  case NTV2_720p_5000to1080i_2500: outputFormat = NTV2_FORMAT_1080i_5000; break;
5690  case NTV2_720p_5994to525_5994: outputFormat = NTV2_FORMAT_525_5994; break;
5691  case NTV2_720p_5994to1080i_5994: outputFormat = NTV2_FORMAT_1080i_5994; break;
5692  case NTV2_720p_6000to1080i_3000: outputFormat = NTV2_FORMAT_1080i_6000; break;
5693  case NTV2_720p_2398to1080i_2398: outputFormat = NTV2_FORMAT_1080psf_2398; break;
5694 
5695  case NTV2_1080i2398to525_2398: outputFormat = NTV2_FORMAT_525_2398; break;
5696  case NTV2_1080i2398to525_2997: outputFormat = NTV2_FORMAT_525_5994; break;
5697  case NTV2_1080i_2398to720p_2398: outputFormat = NTV2_FORMAT_720p_2398; break;
5698  //case NTV2_1080i2400to525_2400: outputFormat = NTV2_FORMAT_525_2400; break;
5699 
5700  //case NTV2_1080p2398to525_2398: outputFormat = NTV2_FORMAT_525_2398; break;
5701  //case NTV2_1080p2398to525_2997: outputFormat = NTV2_FORMAT_525_5994; break;
5702  //case NTV2_1080p2400to525_2400: outputFormat = NTV2_FORMAT_525_2400; break;
5703 
5704  case NTV2_1080i_2500to625_2500: outputFormat = NTV2_FORMAT_625_5000; break;
5705  case NTV2_1080i_2500to720p_5000: outputFormat = NTV2_FORMAT_720p_5000; break;
5706  case NTV2_1080i_5994to525_5994: outputFormat = NTV2_FORMAT_525_5994; break;
5707  case NTV2_1080i_5994to720p_5994: outputFormat = NTV2_FORMAT_720p_5994; break;
5708  case NTV2_1080i_3000to720p_6000: outputFormat = NTV2_FORMAT_720p_6000; break;
5709  case NTV2_1080i_5000to1080psf_2500: outputFormat = NTV2_FORMAT_1080psf_2500_2; break;
5710  case NTV2_1080i_5994to1080psf_2997: outputFormat = NTV2_FORMAT_1080psf_2997_2; break;
5711  case NTV2_1080i_6000to1080psf_3000: outputFormat = NTV2_FORMAT_1080psf_3000_2; break;
5712  case NTV2_1080p_3000to720p_6000: outputFormat = NTV2_FORMAT_720p_6000; break;
5713  default: outputFormat = NTV2_FORMAT_UNKNOWN; break;
5714  }
5715  return outputFormat;
5716 }
5717 
5718 
5719 ostream & operator << (ostream & inOutStream, const NTV2FrameSize & inFrameDimensions)
5720 {
5721  return inOutStream << inFrameDimensions.width() << "Wx" << inFrameDimensions.height() << "H";
5722 }
5723 
5724 
5725 ostream & operator << (ostream & inOutStream, const NTV2SmpteLineNumber & inSmpteLineNumber)
5726 {
5727  return inSmpteLineNumber.Print (inOutStream);
5728 }
5729 
5730 
5731 string NTV2ChannelToString (const NTV2Channel inValue, const bool inForRetailDisplay)
5732 {
5733  switch (inValue)
5734  {
5735  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch1", NTV2_CHANNEL1);
5736  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch2", NTV2_CHANNEL2);
5737  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch3", NTV2_CHANNEL3);
5738  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch4", NTV2_CHANNEL4);
5739  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch5", NTV2_CHANNEL5);
5740  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch6", NTV2_CHANNEL6);
5741  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch7", NTV2_CHANNEL7);
5742  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch8", NTV2_CHANNEL8);
5744  }
5745  return "";
5746 }
5747 
5748 
5749 string NTV2AudioSystemToString (const NTV2AudioSystem inValue, const bool inCompactDisplay)
5750 {
5751  ostringstream oss;
5752  if (NTV2_IS_VALID_AUDIO_SYSTEM(inValue))
5753  oss << (inCompactDisplay ? "AudSys" : "NTV2_AUDIOSYSTEM_") << (inValue + 1);
5754  else
5755  oss << (inCompactDisplay ? "NoAudio" : "NTV2_AUDIOSYSTEM_INVALID");
5756  return oss.str();
5757 }
5758 
5759 
5760 string NTV2AudioRateToString (const NTV2AudioRate inValue, const bool inForRetailDisplay)
5761 {
5762  switch (inValue)
5763  {
5764  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "48 kHz", NTV2_AUDIO_48K);
5765  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "96 kHz", NTV2_AUDIO_96K);
5766  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "192 kHz", NTV2_AUDIO_192K);
5768  }
5769  return "";
5770 }
5771 
5772 
5773 string NTV2AudioBufferSizeToString (const NTV2AudioBufferSize inValue, const bool inForRetailDisplay)
5774 {
5775  switch (inValue)
5776  {
5780  }
5781  return "";
5782 }
5783 
5784 
5785 string NTV2AudioLoopBackToString (const NTV2AudioLoopBack inValue, const bool inForRetailDisplay)
5786 {
5787  switch (inValue)
5788  {
5791  case NTV2_AUDIO_LOOPBACK_INVALID: break; //special case
5792  }
5793  return "???";
5794 }
5795 
5796 
5797 string NTV2EmbeddedAudioClockToString (const NTV2EmbeddedAudioClock inValue, const bool inForRetailDisplay)
5798 {
5799  switch (inValue)
5800  {
5801  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "from device reference", NTV2_EMBEDDED_AUDIO_CLOCK_REFERENCE);
5804  }
5805  return "???";
5806 }
5807 
5808 
5809 string NTV2CrosspointToString (const NTV2Crosspoint inChannel)
5810 {
5811  std::ostringstream oss;
5812  oss << (::IsNTV2CrosspointInput(inChannel) ? "Capture " : "Playout ")
5813  << (::IsNTV2CrosspointInput(inChannel) ? ::GetIndexForNTV2CrosspointInput(inChannel) : ::GetIndexForNTV2CrosspointChannel(inChannel)) + 1;
5814  return oss.str ();
5815 }
5816 
5817 
5818 string NTV2InputCrosspointIDToString (const NTV2InputCrosspointID inValue, const bool inForRetailDisplay)
5819 {
5820  switch (inValue)
5821  {
5838  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Vid", NTV2_XptCSC1VidInput);
5839  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Key", NTV2_XptCSC1KeyInput);
5840  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Vid", NTV2_XptCSC2VidInput);
5841  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Key", NTV2_XptCSC2KeyInput);
5842  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Vid", NTV2_XptCSC3VidInput);
5843  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Key", NTV2_XptCSC3KeyInput);
5844  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Vid", NTV2_XptCSC4VidInput);
5845  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Key", NTV2_XptCSC4KeyInput);
5846  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Vid", NTV2_XptCSC5VidInput);
5847  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Key", NTV2_XptCSC5KeyInput);
5848  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Vid", NTV2_XptCSC6VidInput);
5849  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Key", NTV2_XptCSC6KeyInput);
5850  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Vid", NTV2_XptCSC7VidInput);
5851  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Key", NTV2_XptCSC7KeyInput);
5852  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Vid", NTV2_XptCSC8VidInput);
5853  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Key", NTV2_XptCSC8KeyInput);
5854  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 1", NTV2_XptLUT1Input);
5855  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 2", NTV2_XptLUT2Input);
5856  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 3", NTV2_XptLUT3Input);
5857  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 4", NTV2_XptLUT4Input);
5858  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 5", NTV2_XptLUT5Input);
5859  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 6", NTV2_XptLUT6Input);
5860  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 7", NTV2_XptLUT7Input);
5861  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 8", NTV2_XptLUT8Input);
5866  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 1", NTV2_XptSDIOut1Input);
5867  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 1 DS2", NTV2_XptSDIOut1InputDS2);
5868  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 2", NTV2_XptSDIOut2Input);
5869  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 2 DS2", NTV2_XptSDIOut2InputDS2);
5870  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 3", NTV2_XptSDIOut3Input);
5871  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 3 DS2", NTV2_XptSDIOut3InputDS2);
5872  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 4", NTV2_XptSDIOut4Input);
5873  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 4 DS2", NTV2_XptSDIOut4InputDS2);
5874  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 5", NTV2_XptSDIOut5Input);
5875  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 5 DS2", NTV2_XptSDIOut5InputDS2);
5876  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 6", NTV2_XptSDIOut6Input);
5877  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 6 DS2", NTV2_XptSDIOut6InputDS2);
5878  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 7", NTV2_XptSDIOut7Input);
5879  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 7 DS2", NTV2_XptSDIOut7InputDS2);
5880  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 8", NTV2_XptSDIOut8Input);
5881  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 8 DS2", NTV2_XptSDIOut8InputDS2);
5906  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 BG Key", NTV2_XptMixer1BGKeyInput);
5907  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 BG Vid", NTV2_XptMixer1BGVidInput);
5908  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 FG Key", NTV2_XptMixer1FGKeyInput);
5909  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 FG Vid", NTV2_XptMixer1FGVidInput);
5910  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 BG Key", NTV2_XptMixer2BGKeyInput);
5911  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 BG Vid", NTV2_XptMixer2BGVidInput);
5912  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 FG Key", NTV2_XptMixer2FGKeyInput);
5913  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 FG Vid", NTV2_XptMixer2FGVidInput);
5914  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 BG Key", NTV2_XptMixer3BGKeyInput);
5915  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 BG Vid", NTV2_XptMixer3BGVidInput);
5916  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 FG Key", NTV2_XptMixer3FGKeyInput);
5917  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 FG Vid", NTV2_XptMixer3FGVidInput);
5918  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 BG Key", NTV2_XptMixer4BGKeyInput);
5919  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 BG Vid", NTV2_XptMixer4BGVidInput);
5920  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 FG Key", NTV2_XptMixer4FGKeyInput);
5921  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 FG Vid", NTV2_XptMixer4FGVidInput);
5922  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out", NTV2_XptHDMIOutInput);
5923  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out Q2", NTV2_XptHDMIOutQ2Input);
5924  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out Q3", NTV2_XptHDMIOutQ3Input);
5925  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out Q4", NTV2_XptHDMIOutQ4Input);
5926  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q1", NTV2_Xpt4KDCQ1Input);
5927  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q2", NTV2_Xpt4KDCQ2Input);
5928  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q3", NTV2_Xpt4KDCQ3Input);
5929  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q4", NTV2_Xpt4KDCQ4Input);
5930  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1A", NTV2_Xpt425Mux1AInput);
5931  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1B", NTV2_Xpt425Mux1BInput);
5932  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2A", NTV2_Xpt425Mux2AInput);
5933  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2B", NTV2_Xpt425Mux2BInput);
5934  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3A", NTV2_Xpt425Mux3AInput);
5935  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3B", NTV2_Xpt425Mux3BInput);
5936  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4A", NTV2_Xpt425Mux4AInput);
5937  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4B", NTV2_Xpt425Mux4BInput);
5938  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Analog Out", NTV2_XptAnalogOutInput);
5939  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Analog Composite Out", NTV2_XptAnalogOutCompositeOut);
5940  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Stereo Left", NTV2_XptStereoLeftInput);
5941  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Stereo Right", NTV2_XptStereoRightInput);
5942  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Pro Amp", NTV2_XptProAmpInput);
5943  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "IICT1", NTV2_XptIICT1Input);
5944  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Water Marker 1", NTV2_XptWaterMarker1Input);
5945  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Water Marker 2", NTV2_XptWaterMarker2Input);
5946  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Update Register", NTV2_XptUpdateRegister);
5947  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Compression Module", NTV2_XptCompressionModInput);
5948  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Conversion Module", NTV2_XptConversionModInput);
5949  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Key From In 2", NTV2_XptCSC1KeyFromInput2);
5950  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync2", NTV2_XptFrameSync2Input);
5951  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync1", NTV2_XptFrameSync1Input);
5952  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3D LUT 1", NTV2_Xpt3DLUT1Input);
5955  }
5956  return "";
5957 
5958 } // NTV2InputCrosspointIDToString
5959 
5960 
5961 string NTV2OutputCrosspointIDToString (const NTV2OutputCrosspointID inValue, const bool inForRetailDisplay)
5962 {
5963  switch (inValue)
5964  {
5965  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Black", NTV2_XptBlack);
5966  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 1", NTV2_XptSDIIn1);
5967  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 1 DS2", NTV2_XptSDIIn1DS2);
5968  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 2", NTV2_XptSDIIn2);
5969  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 2 DS2", NTV2_XptSDIIn2DS2);
5970  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 1 YUV", NTV2_XptLUT1YUV);
5971  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Vid YUV", NTV2_XptCSC1VidYUV);
5972  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Conversion Module", NTV2_XptConversionModule);
5973  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Compression Module", NTV2_XptCompressionModule);
5975  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 1 YUV", NTV2_XptFrameSync1YUV);
5976  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 2 YUV", NTV2_XptFrameSync2YUV);
5977  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 1", NTV2_XptDuallinkOut1);
5978  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 1 DS2", NTV2_XptDuallinkOut1DS2);
5979  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 2", NTV2_XptDuallinkOut2);
5980  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 2 DS2", NTV2_XptDuallinkOut2DS2);
5981  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 3", NTV2_XptDuallinkOut3);
5982  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 3 DS2", NTV2_XptDuallinkOut3DS2);
5983  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 4", NTV2_XptDuallinkOut4);
5984  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 4 DS2", NTV2_XptDuallinkOut4DS2);
5985  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Alpha Out", NTV2_XptAlphaOut);
5986  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Analog In", NTV2_XptAnalogIn);
5987  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1", NTV2_XptHDMIIn1);
5988  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q2", NTV2_XptHDMIIn1Q2);
5989  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q3", NTV2_XptHDMIIn1Q3);
5990  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q4", NTV2_XptHDMIIn1Q4);
5991  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 RGB", NTV2_XptHDMIIn1RGB);
5992  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q2 RGB", NTV2_XptHDMIIn1Q2RGB);
5993  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q3 RGB", NTV2_XptHDMIIn1Q3RGB);
5994  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q4 RGB", NTV2_XptHDMIIn1Q4RGB);
5995  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2", NTV2_XptHDMIIn2);
5996  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q2", NTV2_XptHDMIIn2Q2);
5997  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q3", NTV2_XptHDMIIn2Q3);
5998  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q4", NTV2_XptHDMIIn2Q4);
5999  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 RGB", NTV2_XptHDMIIn2RGB);
6000  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q2 RGB", NTV2_XptHDMIIn2Q2RGB);
6001  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q3 RGB", NTV2_XptHDMIIn2Q3RGB);
6002  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q4 RGB", NTV2_XptHDMIIn2Q4RGB);
6003  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 3", NTV2_XptHDMIIn3);
6004  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 3 RGB", NTV2_XptHDMIIn3RGB);
6005  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 4", NTV2_XptHDMIIn4);
6006  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 4 RGB", NTV2_XptHDMIIn4RGB);
6007  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 1", NTV2_XptDuallinkIn1);
6008  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 2", NTV2_XptDuallinkIn2);
6009  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 3", NTV2_XptDuallinkIn3);
6010  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 4", NTV2_XptDuallinkIn4);
6011  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 1", NTV2_XptLUT1Out);
6012  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Vid RGB", NTV2_XptCSC1VidRGB);
6014  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 1 RGB", NTV2_XptFrameSync1RGB);
6015  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 2 RGB", NTV2_XptFrameSync2RGB);
6016  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 2", NTV2_XptLUT2Out);
6017  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Key YUV", NTV2_XptCSC1KeyYUV);
6020  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Vid YUV", NTV2_XptCSC2VidYUV);
6021  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Vid RGB", NTV2_XptCSC2VidRGB);
6022  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Key YUV", NTV2_XptCSC2KeyYUV);
6023  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 Vid YUV", NTV2_XptMixer1VidYUV);
6024  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 Key YUV", NTV2_XptMixer1KeyYUV);
6025  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 Vid RGB", NTV2_XptMixer1VidRGB);
6026  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "IICT RGB", NTV2_XptIICTRGB);
6027  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "IICT 2 RGB", NTV2_XptIICT2RGB);
6028  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Test Pattern YUV", NTV2_XptTestPatternYUV);
6029  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 Vid YUV", NTV2_XptMixer2VidYUV);
6030  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 Key YUV", NTV2_XptMixer2KeyYUV);
6031  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 Vid RGB", NTV2_XptMixer2VidRGB);
6032  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Stereo Compressor Out", NTV2_XptStereoCompressorOut);
6033  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 3", NTV2_XptLUT3Out);
6034  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 4", NTV2_XptLUT4Out);
6039  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 3", NTV2_XptSDIIn3);
6040  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 3 DS2", NTV2_XptSDIIn3DS2);
6041  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 4", NTV2_XptSDIIn4);
6042  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 4 DS2", NTV2_XptSDIIn4DS2);
6043  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Vid YUV", NTV2_XptCSC3VidYUV);
6044  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Vid RGB", NTV2_XptCSC3VidRGB);
6045  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Key YUV", NTV2_XptCSC3KeyYUV);
6046  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Vid YUV", NTV2_XptCSC4VidYUV);
6047  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Vid RGB", NTV2_XptCSC4VidRGB);
6048  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Key YUV", NTV2_XptCSC4KeyYUV);
6049  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Vid YUV", NTV2_XptCSC5VidYUV);
6050  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Vid RGB", NTV2_XptCSC5VidRGB);
6051  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Key YUV", NTV2_XptCSC5KeyYUV);
6052  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 5", NTV2_XptLUT5Out);
6053  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 5", NTV2_XptDuallinkOut5);
6054  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 5 DS2", NTV2_XptDuallinkOut5DS2);
6055  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Out", NTV2_Xpt4KDownConverterOut);
6056  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Out RGB", NTV2_Xpt4KDownConverterOutRGB);
6065  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 5", NTV2_XptSDIIn5);
6066  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 5 DS2", NTV2_XptSDIIn5DS2);
6067  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 6", NTV2_XptSDIIn6);
6068  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 6 DS2", NTV2_XptSDIIn6DS2);
6069  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 7", NTV2_XptSDIIn7);
6070  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 7 DS2", NTV2_XptSDIIn7DS2);
6071  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 8", NTV2_XptSDIIn8);
6072  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 8 DS2", NTV2_XptSDIIn8DS2);
6073  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Vid YUV", NTV2_XptCSC6VidYUV);
6074  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Vid RGB", NTV2_XptCSC6VidRGB);
6075  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Key YUV", NTV2_XptCSC6KeyYUV);
6076  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Vid YUV", NTV2_XptCSC7VidYUV);
6077  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Vid RGB", NTV2_XptCSC7VidRGB);
6078  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Key YUV", NTV2_XptCSC7KeyYUV);
6079  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Vid YUV", NTV2_XptCSC8VidYUV);
6080  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Vid RGB", NTV2_XptCSC8VidRGB);
6081  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Key YUV", NTV2_XptCSC8KeyYUV);
6082  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 6", NTV2_XptLUT6Out);
6083  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 7", NTV2_XptLUT7Out);
6084  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 8", NTV2_XptLUT8Out);
6085  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 6", NTV2_XptDuallinkOut6);
6086  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 6 DS2", NTV2_XptDuallinkOut6DS2);
6087  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 7", NTV2_XptDuallinkOut7);
6088  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 7 DS2", NTV2_XptDuallinkOut7DS2);
6089  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 8", NTV2_XptDuallinkOut8);
6090  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 8 DS2", NTV2_XptDuallinkOut8DS2);
6091  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 Vid YUV", NTV2_XptMixer3VidYUV);
6092  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 Key YUV", NTV2_XptMixer3KeyYUV);
6093  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 Vid RGB", NTV2_XptMixer3VidRGB);
6094  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 Vid YUV", NTV2_XptMixer4VidYUV);
6095  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 Key YUV", NTV2_XptMixer4KeyYUV);
6096  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 Vid RGB", NTV2_XptMixer4VidRGB);
6097  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 5", NTV2_XptDuallinkIn5);
6098  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 6", NTV2_XptDuallinkIn6);
6099  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 7", NTV2_XptDuallinkIn7);
6100  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 8", NTV2_XptDuallinkIn8);
6101  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 1 DS2", NTV2_XptDuallinkIn1DS2);
6102  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 2 DS2", NTV2_XptDuallinkIn2DS2);
6103  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 3 DS2", NTV2_XptDuallinkIn3DS2);
6104  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 4 DS2", NTV2_XptDuallinkIn4DS2);
6105  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 5 DS2", NTV2_XptDuallinkIn5DS2);
6106  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 6 DS2", NTV2_XptDuallinkIn6DS2);
6107  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 7 DS2", NTV2_XptDuallinkIn7DS2);
6108  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 8 DS2", NTV2_XptDuallinkIn8DS2);
6109  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1a YUV", NTV2_Xpt425Mux1AYUV);
6110  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1a RGB", NTV2_Xpt425Mux1ARGB);
6111  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1b YUV", NTV2_Xpt425Mux1BYUV);
6112  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1b RGB", NTV2_Xpt425Mux1BRGB);
6113  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2a YUV", NTV2_Xpt425Mux2AYUV);
6114  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2a RGB", NTV2_Xpt425Mux2ARGB);
6115  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2b YUV", NTV2_Xpt425Mux2BYUV);
6116  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2b RGB", NTV2_Xpt425Mux2BRGB);
6117  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3a YUV", NTV2_Xpt425Mux3AYUV);
6118  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3a RGB", NTV2_Xpt425Mux3ARGB);
6119  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3b YUV", NTV2_Xpt425Mux3BYUV);
6120  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3b RGB", NTV2_Xpt425Mux3BRGB);
6121  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4a YUV", NTV2_Xpt425Mux4AYUV);
6122  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4a RGB", NTV2_Xpt425Mux4ARGB);
6123  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4b YUV", NTV2_Xpt425Mux4BYUV);
6124  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4b RGB", NTV2_Xpt425Mux4BRGB);
6125  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 1 DS2 YUV", NTV2_XptFrameBuffer1_DS2YUV);
6126  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 1 DS2 RGB", NTV2_XptFrameBuffer1_DS2RGB);
6127  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 2 DS2 YUV", NTV2_XptFrameBuffer2_DS2YUV);
6128  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 2 DS2 RGB", NTV2_XptFrameBuffer2_DS2RGB);
6129  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 3 DS2 YUV", NTV2_XptFrameBuffer3_DS2YUV);
6130  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 3 DS2 RGB", NTV2_XptFrameBuffer3_DS2RGB);
6131  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 4 DS2 YUV", NTV2_XptFrameBuffer4_DS2YUV);
6132  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 4 DS2 RGB", NTV2_XptFrameBuffer4_DS2RGB);
6133  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 5 DS2 YUV", NTV2_XptFrameBuffer5_DS2YUV);
6134  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 5 DS2 RGB", NTV2_XptFrameBuffer5_DS2RGB);
6135  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 6 DS2 YUV", NTV2_XptFrameBuffer6_DS2YUV);
6136  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 6 DS2 RGB", NTV2_XptFrameBuffer6_DS2RGB);
6137  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 7 DS2 YUV", NTV2_XptFrameBuffer7_DS2YUV);
6138  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 7 DS2 RGB", NTV2_XptFrameBuffer7_DS2RGB);
6139  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 8 DS2 YUV", NTV2_XptFrameBuffer8_DS2YUV);
6140  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 8 DS2 RGB", NTV2_XptFrameBuffer8_DS2RGB);
6141  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Runtime Calc", NTV2_XptRuntimeCalc);
6142  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS1", NTV2_XptMultiLinkOut1DS1);
6143  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS2", NTV2_XptMultiLinkOut1DS2);
6144  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS3", NTV2_XptMultiLinkOut1DS3);
6145  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS4", NTV2_XptMultiLinkOut1DS4);
6146  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS1", NTV2_XptMultiLinkOut2DS1);
6147  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS2", NTV2_XptMultiLinkOut2DS2);
6148  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS3", NTV2_XptMultiLinkOut2DS3);
6149  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS4", NTV2_XptMultiLinkOut2DS4);
6150  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3D LUT 1 YUV", NTV2_Xpt3DLUT1YUV);
6151  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3D LUT 1 RGB", NTV2_Xpt3DLUT1RGB);
6152  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "OE Out YUV", NTV2_XptOEOutYUV);
6153  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "OE Out RGB", NTV2_XptOEOutRGB);
6154  #if !defined(NTV2_DEPRECATE_16_0)
6155  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "WaterMarker 1 RGB", NTV2_XptWaterMarkerRGB);
6156  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "WaterMarker 2 RGB", NTV2_XptWaterMarker2RGB);
6157  #endif
6158  #if !defined(_DEBUG)
6159  default: break;
6160  #endif
6161  } // switch on inValue
6162  return "";
6163 } // NTV2OutputCrosspointIDToString
6164 
6165 
6166 string NTV2WidgetIDToString (const NTV2WidgetID inValue, const bool inCompactDisplay)
6167 {
6168  switch (inValue)
6169  {
6174  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC1", NTV2_WgtCSC1);
6175  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC2", NTV2_WgtCSC2);
6176  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT1", NTV2_WgtLUT1);
6177  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT2", NTV2_WgtLUT2);
6180  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIIn1", NTV2_WgtSDIIn1);
6181  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIIn2", NTV2_WgtSDIIn2);
6182  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn1", NTV2_Wgt3GSDIIn1);
6183  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn2", NTV2_Wgt3GSDIIn2);
6184  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn3", NTV2_Wgt3GSDIIn3);
6185  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn4", NTV2_Wgt3GSDIIn4);
6186  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut1", NTV2_WgtSDIOut1);
6187  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut2", NTV2_WgtSDIOut2);
6188  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut3", NTV2_WgtSDIOut3);
6189  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut4", NTV2_WgtSDIOut4);
6190  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut1", NTV2_Wgt3GSDIOut1);
6191  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut2", NTV2_Wgt3GSDIOut2);
6192  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut3", NTV2_Wgt3GSDIOut3);
6193  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut4", NTV2_Wgt3GSDIOut4);
6201  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "AnlgIn1", NTV2_WgtAnalogIn1);
6202  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "AnlgOut1", NTV2_WgtAnalogOut1);
6204  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIIn1", NTV2_WgtHDMIIn1);
6205  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIOut1", NTV2_WgtHDMIOut1);
6208  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer1", NTV2_WgtMixer1);
6209  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Compress1", NTV2_WgtCompression1);
6210  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "ProcAmp1", NTV2_WgtProcAmp1);
6211  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "WaterMrkr1", NTV2_WgtWaterMarker1);
6212  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "WaterMrkr2", NTV2_WgtWaterMarker2);
6213  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IICT1", NTV2_WgtIICT1);
6214  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IICT2", NTV2_WgtIICT2);
6216  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "GenLock", NTV2_WgtGenLock);
6217  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DCIMixer1", NTV2_WgtDCIMixer1);
6218  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer2", NTV2_WgtMixer2);
6220  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT3", NTV2_WgtLUT3);
6221  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT4", NTV2_WgtLUT4);
6226  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC3", NTV2_WgtCSC3);
6227  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC4", NTV2_WgtCSC4);
6228  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv2In1", NTV2_WgtHDMIIn1v2);
6229  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv2Out1", NTV2_WgtHDMIOut1v2);
6230  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIMonOut1", NTV2_WgtSDIMonOut1);
6231  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC5", NTV2_WgtCSC5);
6232  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT5", NTV2_WgtLUT5);
6235  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn5", NTV2_Wgt3GSDIIn5);
6236  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn6", NTV2_Wgt3GSDIIn6);
6237  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn7", NTV2_Wgt3GSDIIn7);
6238  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn8", NTV2_Wgt3GSDIIn8);
6239  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut5", NTV2_Wgt3GSDIOut5);
6240  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut6", NTV2_Wgt3GSDIOut6);
6241  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut7", NTV2_Wgt3GSDIOut7);
6242  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut8", NTV2_Wgt3GSDIOut8);
6250  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC6", NTV2_WgtCSC6);
6251  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC7", NTV2_WgtCSC7);
6252  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC8", NTV2_WgtCSC8);
6253  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT6", NTV2_WgtLUT6);
6254  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT7", NTV2_WgtLUT7);
6255  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT8", NTV2_WgtLUT8);
6256  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer3", NTV2_WgtMixer3);
6257  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer4", NTV2_WgtMixer4);
6262  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv3In1", NTV2_WgtHDMIIn1v3);
6263  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv3Out1", NTV2_WgtHDMIOut1v3);
6264  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux1", NTV2_Wgt425Mux1);
6265  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux2", NTV2_Wgt425Mux2);
6266  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux3", NTV2_Wgt425Mux3);
6267  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux4", NTV2_Wgt425Mux4);
6268  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn1", NTV2_Wgt12GSDIIn1);
6269  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn2", NTV2_Wgt12GSDIIn2);
6270  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn3", NTV2_Wgt12GSDIIn3);
6271  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn4", NTV2_Wgt12GSDIIn4);
6272  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn5", NTV2_Wgt12GSDIIn5);
6273  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn6", NTV2_Wgt12GSDIIn6);
6274  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn7", NTV2_Wgt12GSDIIn7);
6275  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn8", NTV2_Wgt12GSDIIn8);
6276  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut1", NTV2_Wgt12GSDIOut1);
6277  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut2", NTV2_Wgt12GSDIOut2);
6278  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut3", NTV2_Wgt12GSDIOut3);
6279  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut4", NTV2_Wgt12GSDIOut4);
6280  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut5", NTV2_Wgt12GSDIOut5);
6281  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut6", NTV2_Wgt12GSDIOut6);
6282  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut7", NTV2_Wgt12GSDIOut7);
6283  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut8", NTV2_Wgt12GSDIOut8);
6284  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In1", NTV2_WgtHDMIIn1v4);
6285  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In2", NTV2_WgtHDMIIn2v4);
6286  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In3", NTV2_WgtHDMIIn3v4);
6287  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In4", NTV2_WgtHDMIIn4v4);
6288  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv5In1", NTV2_WgtHDMIIn1v5);
6289  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4Out1", NTV2_WgtHDMIOut1v4);
6290  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv5Out1", NTV2_WgtHDMIOut1v5);
6291  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out1", NTV2_WgtHDMIOut1v6);
6292  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out2", NTV2_WgtHDMIOut2v6);
6293  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out3", NTV2_WgtHDMIOut3v6);
6294  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out4", NTV2_WgtHDMIOut4v6);
6295  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "MultiLinkOut1", NTV2_WgtMultiLinkOut1);
6296  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "MultiLinkOut2", NTV2_WgtMultiLinkOut2);
6297  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3DLUT1", NTV2_Wgt3DLUT1);
6298  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "OE1", NTV2_WgtOE1);
6299  case NTV2_WgtModuleTypeCount: return "???"; //special case
6300  }
6301  return "";
6302 
6303 } // NTV2WidgetIDToString
6304 
6305 string NTV2WidgetTypeToString (const NTV2WidgetType inValue, const bool inCompactDisplay)
6306 {
6307  switch (inValue) {
6312  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Input", NTV2WidgetType_SDIIn);
6313  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Input 3G", NTV2WidgetType_SDIIn3G);
6314  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Output", NTV2WidgetType_SDIOut);
6315  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Output 3G", NTV2WidgetType_SDIOut3G);
6316  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Monitor Output", NTV2WidgetType_SDIMonOut);
6317  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Input V1", NTV2WidgetType_DualLinkV1In);
6318  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Input V2", NTV2WidgetType_DualLinkV2In);
6319  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Output V1", NTV2WidgetType_DualLinkV1Out);
6320  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Output V2", NTV2WidgetType_DualLinkV2Out);
6321  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Analog Input", NTV2WidgetType_AnalogIn);
6322  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Analog Output", NTV2WidgetType_AnalogOut);
6323  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Analog Composite Output", NTV2WidgetType_AnalogCompositeOut);
6324  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V1", NTV2WidgetType_HDMIInV1);
6325  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V2", NTV2WidgetType_HDMIInV2);
6326  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V3", NTV2WidgetType_HDMIInV3);
6327  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V4", NTV2WidgetType_HDMIInV4);
6328  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V5", NTV2WidgetType_HDMIInV5);
6329  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Up-Down Converter", NTV2WidgetType_UpDownConverter);
6333  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Stereo Compressor", NTV2WidgetType_StereoCompressor);
6336  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "4K Down Converter", NTV2WidgetType_4KDownConverter);
6337  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V1", NTV2WidgetType_HDMIOutV1);
6338  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V2", NTV2WidgetType_HDMIOutV2);
6339  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V3", NTV2WidgetType_HDMIOutV3);
6340  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V4", NTV2WidgetType_HDMIOutV4);
6341  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V5", NTV2WidgetType_HDMIOutV5);
6342  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V6", NTV2WidgetType_HDMIOutV6);
6343  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SMPTE 425 Mux", NTV2WidgetType_SMPTE425Mux);
6344  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Input 12G", NTV2WidgetType_SDIIn12G);
6345  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Output 12G", NTV2WidgetType_SDIOut12G);
6346  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Multi-Link Output", NTV2WidgetType_MultiLinkOut);
6352  case NTV2WidgetType_Max: return "???";
6353  }
6354  return "";
6355 }
6356 
6357 string NTV2TaskModeToString (const NTV2TaskMode inValue, const bool inCompactDisplay)
6358 {
6359  switch (inValue)
6360  {
6361  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Disabled", NTV2_DISABLE_TASKS);
6362  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Standard", NTV2_STANDARD_TASKS);
6365  }
6366  return "";
6367 }
6368 
6369 
6371 {
6372  ostringstream oss;
6373  oss << inObj;
6374  return oss.str ();
6375 }
6376 
6377 
6378 ostream & operator << (ostream & inOutStr, const NTV2RegisterNumberSet & inObj)
6379 {
6380  inOutStr << "[" << inObj.size () << " regs: ";
6381  for (NTV2RegNumSetConstIter iter (inObj.begin ()); iter != inObj.end (); )
6382  {
6383  inOutStr << ::NTV2RegisterNumberToString (NTV2RegisterNumber (*iter));
6384  if (++iter != inObj.end ())
6385  inOutStr << ", ";
6386  }
6387  return inOutStr << "]";
6388 }
6389 
6390 
6392 {
6393  inOutSet.insert (inRegisterNumber);
6394  return inOutSet;
6395 }
6396 
6397 
6398 string NTV2TCIndexToString (const NTV2TCIndex inValue, const bool inCompactDisplay)
6399 {
6400  switch (inValue)
6401  {
6403  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI1-VITC", NTV2_TCINDEX_SDI1);
6404  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI2-VITC", NTV2_TCINDEX_SDI2);
6405  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI3-VITC", NTV2_TCINDEX_SDI3);
6406  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI4-VITC", NTV2_TCINDEX_SDI4);
6411  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI5-VITC", NTV2_TCINDEX_SDI5);
6412  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI6-VITC", NTV2_TCINDEX_SDI6);
6413  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI7-VITC", NTV2_TCINDEX_SDI7);
6414  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI8-VITC", NTV2_TCINDEX_SDI8);
6421  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI1-VITC2", NTV2_TCINDEX_SDI1_2);
6422  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI2-VITC2", NTV2_TCINDEX_SDI2_2);
6423  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI3-VITC2", NTV2_TCINDEX_SDI3_2);
6424  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI4-VITC2", NTV2_TCINDEX_SDI4_2);
6425  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI5-VITC2", NTV2_TCINDEX_SDI5_2);
6426  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI6-VITC2", NTV2_TCINDEX_SDI6_2);
6427  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI7-VITC2", NTV2_TCINDEX_SDI7_2);
6428  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI8-VITC2", NTV2_TCINDEX_SDI8_2);
6430  }
6431  return "";
6432 }
6433 
6434 
6435 string NTV2AudioChannelPairToString (const NTV2AudioChannelPair inValue, const bool inCompactDisplay)
6436 {
6437  ostringstream oss;
6438  if (NTV2_IS_VALID_AUDIO_CHANNEL_PAIR(inValue))
6439  oss << (inCompactDisplay ? "" : "NTV2_AudioChannel")
6440  << DEC(inValue * 2 + 1) << (inCompactDisplay ? "-" : "_") << DEC(inValue * 2 + 2);
6441  else if (!inCompactDisplay)
6442  oss << "NTV2_AUDIO_CHANNEL_PAIR_INVALID";
6443  return oss.str();
6444 }
6445 
6446 
6447 string NTV2AudioChannelQuadToString (const NTV2Audio4ChannelSelect inValue, const bool inCompactDisplay)
6448 {
6449  ostringstream oss;
6450  if (NTV2_IS_VALID_AUDIO_CHANNEL_QUAD(inValue))
6451  oss << (inCompactDisplay ? "" : "NTV2_AudioChannel")
6452  << (inValue * 4 + 1) << (inCompactDisplay ? "-" : "_") << (inValue * 4 + 4);
6453  else if (!inCompactDisplay)
6454  oss << "NTV2_AUDIO_CHANNEL_QUAD_INVALID";
6455  return oss.str ();
6456 }
6457 
6458 
6459 string NTV2AudioChannelOctetToString (const NTV2Audio8ChannelSelect inValue, const bool inCompactDisplay)
6460 {
6461  ostringstream oss;
6462  if (NTV2_IS_VALID_AUDIO_CHANNEL_OCTET(inValue))
6463  oss << (inCompactDisplay ? "" : "NTV2_AudioChannel")
6464  << (inValue * 8 + 1) << (inCompactDisplay ? "-" : "_") << (inValue * 8 + 8);
6465  else if (!inCompactDisplay)
6466  oss << "NTV2_AUDIO_CHANNEL_OCTET_INVALID";
6467  return oss.str ();
6468 }
6469 
6470 
6471 string NTV2FramesizeToString (const NTV2Framesize inValue, const bool inCompactDisplay)
6472 {
6473  switch (inValue)
6474  {
6492  }
6493  return "";
6494 }
6495 
6496 
6497 string NTV2ModeToString (const NTV2Mode inValue, const bool inCompactDisplay)
6498 {
6499  switch (inValue)
6500  {
6504  }
6505  return "";
6506 }
6507 
6508 
6509 string NTV2VANCModeToString (const NTV2VANCMode inValue, const bool inCompactDisplay)
6510 {
6511  switch (inValue)
6512  {
6517  }
6518  return "";
6519 }
6520 
6521 
6522 string NTV2MixerKeyerModeToString (const NTV2MixerKeyerMode inValue, const bool inCompactDisplay)
6523 {
6524  switch(inValue)
6525  {
6531  }
6532  return "";
6533 }
6534 
6535 
6536 string NTV2MixerInputControlToString (const NTV2MixerKeyerInputControl inValue, const bool inCompactDisplay)
6537 {
6538  switch(inValue)
6539  {
6544  }
6545  return "";
6546 }
6547 
6548 
6549 string NTV2VideoLimitingToString (const NTV2VideoLimiting inValue, const bool inCompactDisplay)
6550 {
6551  switch(inValue)
6552  {
6557  }
6558  return "";
6559 }
6560 
6561 
6562 string NTV2BreakoutTypeToString (const NTV2BreakoutType inValue, const bool inCompactDisplay)
6563 {
6564  switch(inValue)
6565  {
6569  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KBox", NTV2_KBox);
6570  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KLBox", NTV2_KLBox);
6571  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "K3Box", NTV2_K3Box);
6572  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KLHiBox", NTV2_KLHiBox);
6573  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KLHePlusBox", NTV2_KLHePlusBox);
6574  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "K3GBox", NTV2_K3GBox);
6576  case NTV2_MAX_NUM_BreakoutTypes: break; //special case
6577  }
6578  return "";
6579 }
6580 
6581 string NTV2AncDataRgnToStr (const NTV2AncDataRgn inValue, const bool inCompactDisplay)
6582 {
6583  switch(inValue)
6584  {
6589  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "AncAll", NTV2_AncRgn_All);
6590  case NTV2_MAX_NUM_AncRgns: break; //special case
6591  }
6592  return "";
6593 }
6594 
6595 string NTV2UpConvertModeToString (const NTV2UpConvertMode inValue, const bool inCompact)
6596 {
6597  switch(inValue)
6598  {
6600  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "4" "\xC3\x97" "3 Pillar Box", NTV2_UpConvertPillarbox4x3);
6601  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Zoomed 14" "\xC3\x97" "9", NTV2_UpConvertZoom14x9);
6604  case NTV2_MAX_NUM_UpConvertModes: break; //special case
6605  }
6606  return "";
6607 }
6608 
6609 string NTV2DownConvertModeToString (const NTV2DownConvertMode inValue, const bool inCompact)
6610 {
6611  switch(inValue)
6612  {
6616  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Zoomed 14" "\xC3\x97" "9", NTV2_DownConvert14x9);
6617  case NTV2_MAX_NUM_DownConvertModes: break; //special case
6618  }
6619  return "";
6620 }
6621 
6622 string NTV2ScanMethodToString (const NTV2ScanMethod inValue, const bool inCompact)
6623 {
6624  switch(inValue)
6625  {
6629  case NTV2_NUM_SCANMETHODS: break;
6630  }
6631  return "";
6632 }
6633 
6634 string NTV2IsoConvertModeToString (const NTV2IsoConvertMode inValue, const bool inCompact)
6635 {
6636  switch(inValue)
6637  {
6639  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Horiz Cropped", NTV2_IsoHCrop);
6640  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Vert Cropped", NTV2_IsoVCrop);
6642  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "14" "\xC3\x97" "9", NTV2_Iso14x9);
6644  case NTV2_MAX_NUM_IsoConvertModes: break; //special case
6645  }
6646  return "";
6647 }
6648 
6649 string NTV2HDMIBitDepthToString (const NTV2HDMIBitDepth inValue, const bool inCompact)
6650 {
6651  switch(inValue)
6652  {
6656  case NTV2_INVALID_HDMIBitDepth: break;
6657  }
6658  return "";
6659 }
6660 
6661 string NTV2HDMIAudioChannelsToString (const NTV2HDMIAudioChannels inValue, const bool inCompact)
6662 {
6663  switch(inValue)
6664  {
6668  }
6669  return "";
6670 }
6671 
6672 string NTV2HDMIProtocolToString (const NTV2HDMIProtocol inValue, const bool inCompact)
6673 {
6674  switch(inValue)
6675  {
6678  case NTV2_INVALID_HDMI_PROTOCOL: break;
6679  }
6680  return "";
6681 }
6682 
6683 string NTV2HDMIRangeToString (const NTV2HDMIRange inValue, const bool inCompact)
6684 {
6685  switch(inValue)
6686  {
6689  case NTV2_INVALID_HDMI_RANGE: break;
6690  }
6691  return "";
6692 }
6693 
6694 string NTV2HDMIColorSpaceToString (const NTV2HDMIColorSpace inValue, const bool inCompact)
6695 {
6696  switch(inValue)
6697  {
6701  case NTV2_INVALID_HDMI_COLORSPACE: break;
6702  }
6703  return "";
6704 }
6705 
6706 string NTV2AudioFormatToString (const NTV2AudioFormat inValue, const bool inCompact)
6707 {
6708  switch(inValue)
6709  {
6712  case NTV2_AUDIO_FORMAT_INVALID: break;
6713  }
6714  return "";
6715 }
6716 
6717 string NTV2EmbeddedAudioInputToString (const NTV2EmbeddedAudioInput inValue, const bool inCompactDisplay)
6718 {
6719  switch(inValue)
6720  {
6730  }
6731  return "";
6732 }
6733 
6734 
6735 string NTV2AudioSourceToString (const NTV2AudioSource inValue, const bool inCompactDisplay)
6736 {
6737  switch (inValue)
6738  {
6745  }
6746  return "";
6747 }
6748 
6749 
6750 string NTV2VideoFormatToString (const NTV2VideoFormat inFormat, const bool inUseFrameRate)
6751 {
6752  switch (inFormat)
6753  {
6754  case NTV2_FORMAT_1080i_5000: return inUseFrameRate ? "1080i25" : "1080i50";
6755  case NTV2_FORMAT_1080i_5994: return inUseFrameRate ? "1080i29.97" : "1080i59.94";
6756  case NTV2_FORMAT_1080i_6000: return inUseFrameRate ? "1080i30" : "1080i60";
6757  case NTV2_FORMAT_720p_5994: return "720p59.94";
6758  case NTV2_FORMAT_720p_6000: return "720p60";
6759  case NTV2_FORMAT_1080psf_2398: return "1080sf23.98";
6760  case NTV2_FORMAT_1080psf_2400: return "1080sf24";
6761  case NTV2_FORMAT_1080p_2997: return "1080p29.97";
6762  case NTV2_FORMAT_1080p_3000: return "1080p30";
6763  case NTV2_FORMAT_1080p_2500: return "1080p25";
6764  case NTV2_FORMAT_1080p_2398: return "1080p23.98";
6765  case NTV2_FORMAT_1080p_2400: return "1080p24";
6766  case NTV2_FORMAT_1080p_2K_2398: return "2Kp23.98";
6767  case NTV2_FORMAT_1080p_2K_2400: return "2Kp24";
6768  case NTV2_FORMAT_1080psf_2K_2398: return "2Ksf23.98";
6769  case NTV2_FORMAT_1080psf_2K_2400: return "2Ksf24";
6770  case NTV2_FORMAT_720p_5000: return "720p50";
6771  case NTV2_FORMAT_1080p_5000_B: return "1080p50b";
6772  case NTV2_FORMAT_1080p_5994_B: return "1080p59.94b";
6773  case NTV2_FORMAT_1080p_6000_B: return "1080p60b";
6774  case NTV2_FORMAT_720p_2398: return "720p23.98";
6775  case NTV2_FORMAT_720p_2500: return "720p25";
6776  case NTV2_FORMAT_1080p_5000_A: return "1080p50a";
6777  case NTV2_FORMAT_1080p_5994_A: return "1080p59.94a";
6778  case NTV2_FORMAT_1080p_6000_A: return "1080p60a";
6779  case NTV2_FORMAT_1080p_2K_2500: return "2Kp25";
6780  case NTV2_FORMAT_1080psf_2K_2500: return "2Ksf25";
6781  case NTV2_FORMAT_1080psf_2500_2: return "1080sf25";
6782  case NTV2_FORMAT_1080psf_2997_2: return "1080sf29.97";
6783  case NTV2_FORMAT_1080psf_3000_2: return "1080sf30";
6784  case NTV2_FORMAT_525_5994: return inUseFrameRate ? "525i29.97" : "525i59.94";
6785  case NTV2_FORMAT_625_5000: return inUseFrameRate ? "625i25" : "625i50";
6786  case NTV2_FORMAT_525_2398: return "525i23.98";
6787  case NTV2_FORMAT_525_2400: return "525i24";
6788  case NTV2_FORMAT_525psf_2997: return "525sf29.97";
6789  case NTV2_FORMAT_625psf_2500: return "625sf25";
6790  case NTV2_FORMAT_2K_1498: return "2Kx1556sf14.98";
6791  case NTV2_FORMAT_2K_1500: return "2Kx1556sf15";
6792  case NTV2_FORMAT_2K_2398: return "2Kx1556sf23.98";
6793  case NTV2_FORMAT_2K_2400: return "2Kx1556sf24";
6794  case NTV2_FORMAT_2K_2500: return "2Kx1556sf25";
6795  case NTV2_FORMAT_4x1920x1080psf_2398: return "UHDsf23.98";
6796  case NTV2_FORMAT_4x1920x1080psf_2400: return "UHDsf24";
6797  case NTV2_FORMAT_4x1920x1080psf_2500: return "UHDsf25";
6798  case NTV2_FORMAT_4x1920x1080p_2398: return "UHDp23.98";
6799  case NTV2_FORMAT_4x1920x1080p_2400: return "UHDp24";
6800  case NTV2_FORMAT_4x1920x1080p_2500: return "UHDp25";
6801  case NTV2_FORMAT_4x2048x1080psf_2398: return "4Ksf23.98";
6802  case NTV2_FORMAT_4x2048x1080psf_2400: return "4Ksf24";
6803  case NTV2_FORMAT_4x2048x1080psf_2500: return "4Ksf25";
6804  case NTV2_FORMAT_4x2048x1080p_2398: return "4Kp23.98";
6805  case NTV2_FORMAT_4x2048x1080p_2400: return "4Kp24";
6806  case NTV2_FORMAT_4x2048x1080p_2500: return "4Kp25";
6807  case NTV2_FORMAT_4x1920x1080p_2997: return "UHDp29.97";
6808  case NTV2_FORMAT_4x1920x1080p_3000: return "UHDp30";
6809  case NTV2_FORMAT_4x1920x1080psf_2997: return "UHDsf29.97";
6810  case NTV2_FORMAT_4x1920x1080psf_3000: return "UHDsf30";
6811  case NTV2_FORMAT_4x2048x1080p_2997: return "4Kp29.97";
6812  case NTV2_FORMAT_4x2048x1080p_3000: return "4Kp30";
6813  case NTV2_FORMAT_4x2048x1080psf_2997: return "4Ksf29.97";
6814  case NTV2_FORMAT_4x2048x1080psf_3000: return "4Ksf30";
6815  case NTV2_FORMAT_4x1920x1080p_5000: return "UHDp50";
6816  case NTV2_FORMAT_4x1920x1080p_5994: return "UHDp59.94";
6817  case NTV2_FORMAT_4x1920x1080p_6000: return "UHDp60";
6818  case NTV2_FORMAT_4x2048x1080p_5000: return "4Kp50";
6819  case NTV2_FORMAT_4x2048x1080p_5994: return "4Kp59.94";
6820  case NTV2_FORMAT_4x2048x1080p_6000: return "4Kp60";
6821  case NTV2_FORMAT_4x2048x1080p_4795: return "4Kp47.95";
6822  case NTV2_FORMAT_4x2048x1080p_4800: return "4Kp48";
6823  case NTV2_FORMAT_4x2048x1080p_11988: return "4Kp119";
6824  case NTV2_FORMAT_4x2048x1080p_12000: return "4Kp120";
6825  case NTV2_FORMAT_1080p_2K_6000_A: return "2Kp60a";
6826  case NTV2_FORMAT_1080p_2K_5994_A: return "2Kp59.94a";
6827  case NTV2_FORMAT_1080p_2K_2997: return "2Kp29.97";
6828  case NTV2_FORMAT_1080p_2K_3000: return "2Kp30";
6829  case NTV2_FORMAT_1080p_2K_5000_A: return "2Kp50a";
6830  case NTV2_FORMAT_1080p_2K_4795_A: return "2Kp47.95a";
6831  case NTV2_FORMAT_1080p_2K_4800_A: return "2Kp48a";
6832  case NTV2_FORMAT_1080p_2K_4795_B: return "2Kp47.95b";
6833  case NTV2_FORMAT_1080p_2K_4800_B: return "2Kp48b";
6834  case NTV2_FORMAT_1080p_2K_5000_B: return "2Kp50b";
6835  case NTV2_FORMAT_1080p_2K_5994_B: return "2Kp59.94b";
6836  case NTV2_FORMAT_1080p_2K_6000_B: return "2Kp60b";
6837  case NTV2_FORMAT_3840x2160psf_2398: return "UHDsf23.98";
6838  case NTV2_FORMAT_3840x2160psf_2400: return "UHDsf24";
6839  case NTV2_FORMAT_3840x2160psf_2500: return "UHDsf25";
6840  case NTV2_FORMAT_3840x2160p_2398: return "UHDp23.98";
6841  case NTV2_FORMAT_3840x2160p_2400: return "UHDp24";
6842  case NTV2_FORMAT_3840x2160p_2500: return "UHDp25";
6843  case NTV2_FORMAT_3840x2160p_2997: return "UHDp29.97";
6844  case NTV2_FORMAT_3840x2160p_3000: return "UHDp30";
6845  case NTV2_FORMAT_3840x2160psf_2997: return "UHDsf29.97";
6846  case NTV2_FORMAT_3840x2160psf_3000: return "UHDsf30";
6847  case NTV2_FORMAT_3840x2160p_5000: return "UHDp50";
6848  case NTV2_FORMAT_3840x2160p_5994: return "UHDp59.94";
6849  case NTV2_FORMAT_3840x2160p_6000: return "UHDp60";
6850  case NTV2_FORMAT_4096x2160psf_2398: return "4Ksf23.98";
6851  case NTV2_FORMAT_4096x2160psf_2400: return "4Ksf24";
6852  case NTV2_FORMAT_4096x2160psf_2500: return "4Ksf25";
6853  case NTV2_FORMAT_4096x2160p_2398: return "4Kp23.98";
6854  case NTV2_FORMAT_4096x2160p_2400: return "4Kp24";
6855  case NTV2_FORMAT_4096x2160p_2500: return "4Kp25";
6856  case NTV2_FORMAT_4096x2160p_2997: return "4Kp29.97";
6857  case NTV2_FORMAT_4096x2160p_3000: return "4Kp30";
6858  case NTV2_FORMAT_4096x2160psf_2997: return "4Ksf29.97";
6859  case NTV2_FORMAT_4096x2160psf_3000: return "4Ksf30";
6860  case NTV2_FORMAT_4096x2160p_4795: return "4Kp47.95";
6861  case NTV2_FORMAT_4096x2160p_4800: return "4Kp48";
6862  case NTV2_FORMAT_4096x2160p_5000: return "4Kp50";
6863  case NTV2_FORMAT_4096x2160p_5994: return "4Kp59.94";
6864  case NTV2_FORMAT_4096x2160p_6000: return "4Kp60";
6865  case NTV2_FORMAT_4096x2160p_11988: return "4Kp119";
6866  case NTV2_FORMAT_4096x2160p_12000: return "4Kp120";
6867  case NTV2_FORMAT_4x1920x1080p_5000_B: return "UHDp50b";
6868  case NTV2_FORMAT_4x1920x1080p_5994_B: return "UHDp59.94b";
6869  case NTV2_FORMAT_4x1920x1080p_6000_B: return "UHDp60b";
6870  case NTV2_FORMAT_4x2048x1080p_5000_B: return "4Kp50b";
6871  case NTV2_FORMAT_4x2048x1080p_5994_B: return "4Kp59.94b";
6872  case NTV2_FORMAT_4x2048x1080p_6000_B: return "4Kp60b";
6873  case NTV2_FORMAT_4x2048x1080p_4795_B: return "4Kp47.95b";
6874  case NTV2_FORMAT_4x2048x1080p_4800_B: return "4Kp48b";
6875  case NTV2_FORMAT_3840x2160p_5000_B: return "UHDp50b";
6876  case NTV2_FORMAT_3840x2160p_5994_B: return "UHDp59.94b";
6877  case NTV2_FORMAT_3840x2160p_6000_B: return "UHDp60b";
6878  case NTV2_FORMAT_4096x2160p_4795_B: return "4Kp47.95b";
6879  case NTV2_FORMAT_4096x2160p_4800_B: return "4Kp48b";
6880  case NTV2_FORMAT_4096x2160p_5000_B: return "4Kp50b";
6881  case NTV2_FORMAT_4096x2160p_5994_B: return "4Kp59.94b";
6882  case NTV2_FORMAT_4096x2160p_6000_B: return "4Kp60b";
6883  case NTV2_FORMAT_4x3840x2160p_2398: return "UHD2p23.98";
6884  case NTV2_FORMAT_4x3840x2160p_2400: return "UHD2p24";
6885  case NTV2_FORMAT_4x3840x2160p_2500: return "UHD2p25";
6886  case NTV2_FORMAT_4x3840x2160p_2997: return "UHD2p29.97";
6887  case NTV2_FORMAT_4x3840x2160p_3000: return "UHD2p30";
6888  case NTV2_FORMAT_4x3840x2160p_5000: return "UHD2p50";
6889  case NTV2_FORMAT_4x3840x2160p_5994: return "UHD2p59.94";
6890  case NTV2_FORMAT_4x3840x2160p_6000: return "UHD2p60";
6891  case NTV2_FORMAT_4x3840x2160p_5000_B: return "UHD2p50b";
6892  case NTV2_FORMAT_4x3840x2160p_5994_B: return "UHD2p59.94b";
6893  case NTV2_FORMAT_4x3840x2160p_6000_B: return "UHD2p60b";
6894  case NTV2_FORMAT_4x4096x2160p_2398: return "8Kp23.98";
6895  case NTV2_FORMAT_4x4096x2160p_2400: return "8Kp24";
6896  case NTV2_FORMAT_4x4096x2160p_2500: return "8Kp25";
6897  case NTV2_FORMAT_4x4096x2160p_2997: return "8Kp29.97";
6898  case NTV2_FORMAT_4x4096x2160p_3000: return "8Kp30";
6899  case NTV2_FORMAT_4x4096x2160p_4795: return "8Kp47.95";
6900  case NTV2_FORMAT_4x4096x2160p_4800: return "8Kp48";
6901  case NTV2_FORMAT_4x4096x2160p_5000: return "8Kp50";
6902  case NTV2_FORMAT_4x4096x2160p_5994: return "8Kp59.94";
6903  case NTV2_FORMAT_4x4096x2160p_6000: return "8Kp60";
6904  case NTV2_FORMAT_4x4096x2160p_4795_B: return "8Kp47.95b";
6905  case NTV2_FORMAT_4x4096x2160p_4800_B: return "8Kp48b";
6906  case NTV2_FORMAT_4x4096x2160p_5000_B: return "8Kp50b";
6907  case NTV2_FORMAT_4x4096x2160p_5994_B: return "8Kp59.94b";
6908  case NTV2_FORMAT_4x4096x2160p_6000_B: return "8Kp60b";
6909  default: return "Unknown";
6910  }
6911 } // NTV2VideoFormatToString
6912 
6913 
6914 string NTV2StandardToString (const NTV2Standard inValue, const bool inForRetailDisplay)
6915 {
6916  switch (inValue)
6917  {
6918  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1080i", NTV2_STANDARD_1080);
6928  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "UHD HFR", NTV2_STANDARD_3840HFR);
6935  }
6936  return "";
6937 }
6938 
6939 
6940 string NTV2FrameBufferFormatToString (const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay)
6941 {
6942  switch (inValue)
6943  {
6946  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGBA-8", NTV2_FBF_ARGB);
6947  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ARGB-8", NTV2_FBF_RGBA);
6948  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-10", NTV2_FBF_10BIT_RGB);
6950  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ABGR-8", NTV2_FBF_ABGR);
6951  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-10DPX", NTV2_FBF_10BIT_DPX);
6952  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "YUV-10DPX", NTV2_FBF_10BIT_YCBCR_DPX);
6953  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DVCProHD", NTV2_FBF_8BIT_DVCPRO);
6956  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-8", NTV2_FBF_24BIT_RGB);
6957  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "BGR-8", NTV2_FBF_24BIT_BGR);
6958  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "YUVA-10", NTV2_FBF_10BIT_YCBCRA);
6959  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-10LDPX", NTV2_FBF_10BIT_DPX_LE);
6960  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-12", NTV2_FBF_48BIT_RGB);
6962  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ProRes-DVC", NTV2_FBF_PRORES_DVCPRO);
6963  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ProRes-HDV", NTV2_FBF_PRORES_HDV);
6965  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ARGB-10", NTV2_FBF_10BIT_ARGB);
6966  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ARGB-16", NTV2_FBF_16BIT_ARGB);
6968  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RAW-RGB10", NTV2_FBF_10BIT_RAW_RGB);
6969  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RAW-YUV10", NTV2_FBF_10BIT_RAW_YCBCR);
6972  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "YUV-P420-10", NTV2_FBF_10BIT_YCBCR_420PL2);
6976  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Unknown", NTV2_FBF_INVALID);
6977  }
6978  return "";
6979 }
6980 
6981 
6982 string NTV2FrameGeometryToString (const NTV2FrameGeometry inValue, const bool inForRetailDisplay)
6983 {
6984  switch (inValue)
6985  {
6986  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1920x1080", NTV2_FG_1920x1080);
6987  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1280x720", NTV2_FG_1280x720);
6988  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x486", NTV2_FG_720x486);
6989  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x576", NTV2_FG_720x576);
6990  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1920x1114", NTV2_FG_1920x1114);
6991  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1114", NTV2_FG_2048x1114);
6992  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x508", NTV2_FG_720x508);
6993  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x598", NTV2_FG_720x598);
6994  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1920x1112", NTV2_FG_1920x1112);
6995  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1280x740", NTV2_FG_1280x740);
6996  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1080", NTV2_FG_2048x1080);
6997  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1556", NTV2_FG_2048x1556);
6998  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1588", NTV2_FG_2048x1588);
6999  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1112", NTV2_FG_2048x1112);
7000  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x514", NTV2_FG_720x514);
7001  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x612", NTV2_FG_720x612);
7002  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3840x2160", NTV2_FG_4x1920x1080);
7003  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4096x2160", NTV2_FG_4x2048x1080);
7004  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "7680x4320", NTV2_FG_4x3840x2160);
7005  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "8192x4320", NTV2_FG_4x4096x2160);
7006  case NTV2_FG_NUMFRAMEGEOMETRIES: return ""; //special case
7007  }
7008  return "";
7009 }
7010 
7011 
7012 string NTV2FrameRateToString (const NTV2FrameRate inValue, const bool inForRetailDisplay)
7013 {
7014  switch (inValue)
7015  {
7031 #if !defined(NTV2_DEPRECATE_16_0)
7036 #endif
7037  case NTV2_NUM_FRAMERATES: return ""; //special case
7038  }
7039  return "";
7040 }
7041 
7042 
7043 string NTV2InputSourceToString (const NTV2InputSource inValue, const bool inForRetailDisplay)
7044 {
7045  switch (inValue)
7046  {
7061  }
7062  return "";
7063 }
7064 
7065 
7066 string NTV2OutputDestinationToString (const NTV2OutputDestination inValue, const bool inForRetailDisplay)
7067 {
7068  switch (inValue)
7069  {
7081  }
7082  return "";
7083 }
7084 
7085 
7086 string NTV2ReferenceSourceToString (const NTV2ReferenceSource inValue, const bool inForRetailDisplay)
7087 {
7088  switch (inValue)
7089  {
7090  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Reference In", NTV2_REFERENCE_EXTERNAL);
7091  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 1", NTV2_REFERENCE_INPUT1);
7092  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 2", NTV2_REFERENCE_INPUT2);
7093  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Free Run", NTV2_REFERENCE_FREERUN);
7096  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 3", NTV2_REFERENCE_INPUT3);
7097  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 4", NTV2_REFERENCE_INPUT4);
7098  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 5", NTV2_REFERENCE_INPUT5);
7099  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 6", NTV2_REFERENCE_INPUT6);
7100  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 7", NTV2_REFERENCE_INPUT7);
7101  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 8", NTV2_REFERENCE_INPUT8);
7102  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 1 PCR", NTV2_REFERENCE_SFP1_PCR);
7103  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 1 PTP", NTV2_REFERENCE_SFP1_PTP);
7104  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 2 PCR", NTV2_REFERENCE_SFP2_PCR);
7105  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 2 PTP", NTV2_REFERENCE_SFP2_PTP);
7109  case NTV2_NUM_REFERENCE_INPUTS: return ""; //special case
7110  }
7111  return "";
7112 }
7113 
7114 
7115 string NTV2RegisterWriteModeToString (const NTV2RegisterWriteMode inValue, const bool inForRetailDisplay)
7116 {
7117  switch (inValue)
7118  {
7119  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Sync To Field", NTV2_REGWRITE_SYNCTOFIELD);
7120  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Sync To Frame", NTV2_REGWRITE_SYNCTOFRAME);
7121  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Immediate", NTV2_REGWRITE_IMMEDIATE);
7122  case NTV2_REGWRITE_SYNCTOFIELD_AFTER10LINES: return ""; //special case
7123  }
7124  return "";
7125 }
7126 
7127 
7128 std::string NTV2InterruptEnumToString (const INTERRUPT_ENUMS inInterruptEnumValue)
7129 {
7130  switch(inInterruptEnumValue)
7131  {
7173  case eNumInterruptTypes: return ""; //special case
7174  }
7175  return "";
7176 }
7177 
7178 std::string NTV2IpErrorEnumToString (const NTV2IpError inIpErrorEnumValue)
7179 {
7180  switch (inIpErrorEnumValue)
7181  {
7182  case NTV2IpErrNone: return "";
7183  case NTV2IpErrInvalidChannel: return "Invalid channel";
7184  case NTV2IpErrInvalidFormat: return "Invalid format";
7185  case NTV2IpErrInvalidBitdepth: return "Invalid bit depth";
7186  case NTV2IpErrInvalidUllHeight: return "Invalid height in ull mode";
7187  case NTV2IpErrInvalidUllLevels: return "Invalid number of levels in ull mode";
7188  case NTV2IpErrUllNotSupported: return "Ull mode not supported";
7189  case NTV2IpErrNotReady: return "KonaIP card not ready";
7190  case NTV2IpErrSoftwareMismatch: return "Host software does not match device firmware";
7191  case NTV2IpErrSFP1NotConfigured: return "SFP 1 not configured";
7192  case NTV2IpErrSFP2NotConfigured: return "SFP 2 not configured";
7193  case NTV2IpErrInvalidIGMPVersion: return "Invalid IGMP version";
7194  case NTV2IpErrCannotGetMacAddress: return "Failed to retrieve MAC address from ARP table";
7195  case NTV2IpErrNotSupported: return "Not supported for by this firmware";
7196  case NTV2IpErrWriteSOMToMB: return "Could not write SOM to MB";
7197  case NTV2IpErrWriteSeqToMB: return "Could not write sequence number to MB";
7198  case NTV2IpErrWriteCountToMB: return "Could not write count to MB";
7199  case NTV2IpErrTimeoutNoSOM: return "MB response timeout (no SOM)";
7200  case NTV2IpErrTimeoutNoSeq: return "MB response timeout (no sequence number)";
7201  case NTV2IpErrTimeoutNoBytecount: return "MB response timeout (no bytecount)";
7202  case NTV2IpErrExceedsFifo: return "Response exceeds FIFO length";
7203  case NTV2IpErrNoResponseFromMB: return "No response from MB";
7204  case NTV2IpErrAcquireMBTimeout: return "AcquireMailBoxLock timeout";
7205  case NTV2IpErrInvalidMBResponse: return "Invalid response from MB";
7206  case NTV2IpErrInvalidMBResponseSize: return "Invalid response size from MB";
7207  case NTV2IpErrInvalidMBResponseNoMac: return "MAC Address not found in response from MB";
7208  case NTV2IpErrMBStatusFail: return "MB Status Failure";
7209  case NTV2IpErrGrandMasterInfo: return "PTP Grand Master Info not found";
7210  case NTV2IpErrSDPTooLong: return "SDP too long";
7211  case NTV2IpErrSDPNotFound: return "SDP not found";
7212  case NTV2IpErrSDPEmpty: return "SDP is empty";
7213  case NTV2IpErrSDPInvalid: return "SDP is not valid";
7214  case NTV2IpErrSDPURLInvalid: return "Invalid SDP URL";
7215  case NTV2IpErrSDPNoVideo: return "SDP does not contain video";
7216  case NTV2IpErrSDPNoAudio: return "SDP does not contain audio";
7217  case NTV2IpErrSDPNoANC: return "SDP does not contain metadata";
7218  case NTV2IpErrSFPNotFound: return "SFP data not found";
7219  case NTV2IpErrInvalidConfig: return "Invalid configuration";
7220  default: return "Unknown IP error";
7221  }
7222 }
7223 
7224 ostream & operator << (ostream & inOutStream, const RP188_STRUCT & inObj)
7225 {
7226  return inOutStream << "DBB=0x" << hex << setw (8) << setfill ('0') << inObj.DBB
7227  << "|HI=0x" << hex << setw (8) << setfill ('0') << inObj.High
7228  << "|LO=0x" << hex << setw (8) << setfill ('0') << inObj.Low
7229  << dec;
7230 } // RP188_STRUCT ostream operator
7231 
7232 
7233 string NTV2GetBitfileName (const NTV2DeviceID inBoardID)
7234 {
7235  switch (inBoardID)
7236  {
7237  case DEVICE_ID_NOTFOUND: break;
7238  case DEVICE_ID_CORVID1: return "corvid1.bit";
7239  case DEVICE_ID_CORVID22: return "corvid22.bit";
7240  case DEVICE_ID_CORVID24: return "corvid24.bit";
7241  case DEVICE_ID_CORVID3G: return "corvid3G.bit";
7242  case DEVICE_ID_CORVID44: return "corvid44.bit";
7243  case DEVICE_ID_CORVID88: return "corvid88.bit";
7244  case DEVICE_ID_CORVIDHEVC: return "corvid.bit";
7245  case DEVICE_ID_IO4K: return "io4k.bit";
7246  case DEVICE_ID_IO4KUFC: return "io4kufc.bit";
7247  case DEVICE_ID_IOEXPRESS: return "ioexpress.bit";
7248  case DEVICE_ID_IOXT: return "ioxt.bit";
7249  case DEVICE_ID_KONA3G: return "kona3gufc.bit";
7250  case DEVICE_ID_KONA3GQUAD: return "kona3gquad.bit";
7251  case DEVICE_ID_KONA4: return "kona4.bit";
7252  case DEVICE_ID_KONA4UFC: return "kona4ufc.bit";
7253 // case DEVICE_ID_KONAIP_2022: return "konaip2022.mcs";
7254 // case DEVICE_ID_KONAIP_4CH_2SFP: return "s2022_56_2p2ch_rxtx.mcs";
7255 // case DEVICE_ID_KONAIP_1RX_1TX_1SFP_J2K: return "kip_j2k_1i1o.mcs";
7256 // case DEVICE_ID_KONAIP_2TX_1SFP_J2K: return "kip_j2k_2o.mcs";
7257 // case DEVICE_ID_KONAIP_1RX_1TX_2110: return "s2110_1rx_1tx.mcs";
7258  case DEVICE_ID_KONALHEPLUS: return "konalheplus.bit";
7259  case DEVICE_ID_KONALHI: return "konalhi.bit";
7260  case DEVICE_ID_TTAP: return "ttap.bit";
7261  case DEVICE_ID_IO4KPLUS: return "io4kplus.bit";
7262 // case DEVICE_ID_IOIP_2022: return "ioip2022.mcs";
7263 // case DEVICE_ID_IOIP_2110: return "ioip2110.mcs";
7264 // case DEVICE_ID_IOIP_2110_RGB12: return "ioip2110rgb.mcs";
7265 // case DEVICE_ID_KONAIP_2110: return "konaip2110.mcs";
7266 // case DEVICE_ID_KONAIP_2110_RGB12: return "konaip2110rgb.mcs";
7267  case DEVICE_ID_KONAHDMI: return "konahdmi4rx.bit";
7268  case DEVICE_ID_KONA1: return "kona1.bit";
7269  case DEVICE_ID_KONA5: return "kona5_retail_tprom.bit";
7270  case DEVICE_ID_KONA5_2X4K: return "kona5_2x4k_tprom.bit";
7271  case DEVICE_ID_KONA5_8KMK: return "kona5_8k_mk_tprom.bit";
7272  case DEVICE_ID_KONA5_8K: return "kona5_8k_tprom.bit";
7273  case DEVICE_ID_KONA5_3DLUT: return "kona5_3d_lut_tprom.bit";
7274  case DEVICE_ID_KONA5_OE1: return "kona5_oe_cfg1_tprom.bit";
7275  case DEVICE_ID_KONA5_OE2: return "kona5_oe_cfg3_tprom.bit";
7276  case DEVICE_ID_KONA5_OE3: return "kona5_oe_cfg3_tprom.bit";
7277  case DEVICE_ID_KONA5_OE4: return "kona5_oe_cfg4_tprom.bit";
7278  case DEVICE_ID_KONA5_OE5: return "kona5_oe_cfg5_tprom.bit";
7279  case DEVICE_ID_KONA5_OE6: return "kona5_oe_cfg6_tprom.bit";
7280  case DEVICE_ID_KONA5_OE7: return "kona5_oe_cfg7_tprom.bit";
7281  case DEVICE_ID_KONA5_OE8: return "kona5_oe_cfg8_tprom.bit";
7282  case DEVICE_ID_KONA5_OE9: return "kona5_oe_cfg9_tprom.bit";
7283  case DEVICE_ID_KONA5_OE10: return "kona5_oe_cfg10_tprom.bit";
7284  case DEVICE_ID_KONA5_OE11: return "kona5_oe_cfg11_tprom.bit";
7285  case DEVICE_ID_KONA5_OE12: return "kona5_oe_cfg12_tprom.bit";
7286  case DEVICE_ID_SOJI_OE1: return "soji_oe_cfg1.bit";
7287  case DEVICE_ID_SOJI_OE2: return "soji_oe_cfg3.bit";
7288  case DEVICE_ID_SOJI_OE3: return "soji_oe_cfg3.bit";
7289  case DEVICE_ID_SOJI_OE4: return "soji_oe_cfg4.bit";
7290  case DEVICE_ID_SOJI_OE5: return "soji_oe_cfg5.bit";
7291  case DEVICE_ID_SOJI_OE6: return "soji_oe_cfg6.bit";
7292  case DEVICE_ID_SOJI_OE7: return "soji_oe_cfg7.bit";
7293  case DEVICE_ID_SOJI_3DLUT: return "soji_3dlut.bit";
7294  case DEVICE_ID_SOJI_DIAGS: return "soji_diags.bit";
7295  case DEVICE_ID_KONA5_8K_MV_TX: return "kona5_8k_mv_tx_tprom.bit";
7296  case DEVICE_ID_CORVID44_8KMK: return "c44_12g_8k_mk_tprom.bit";
7297  case DEVICE_ID_CORVID44_8K: return "corvid44_12g_8k.bit";
7298  case DEVICE_ID_CORVID44_2X4K: return "c44_12g_2x4k_tprom.bit";
7299  case DEVICE_ID_CORVID44_PLNR: return "c44_12g_plnr_tprom.bit";
7300  case DEVICE_ID_TTAP_PRO: return "ttappro.bit";
7301  case DEVICE_ID_IOX3: return "iox3.bit";
7302  case DEVICE_ID_KONAX: return "konax.bit";
7303  case DEVICE_ID_KONAXM: return "konaxm.bit";
7304  case DEVICE_ID_KONAX_4CH: return "konax_4ch.bit";
7305  case DEVICE_ID_CORVID44_GEN3: return "corvid44gen3.bit";
7306  case DEVICE_ID_CORVID88_GEN3: return "corvid88gen3.bit";
7307  default: return "";
7308  }
7309  return "";
7310 } // NTV2GetBitfileName
7311 
7312 
7313 bool NTV2IsCompatibleBitfileName (const string & inBitfileName, const NTV2DeviceID inDeviceID)
7314 {
7315  const string deviceBitfileName (::NTV2GetBitfileName(inDeviceID));
7316  if (inBitfileName == deviceBitfileName)
7317  return true;
7318 
7319  switch (inDeviceID)
7320  {
7323 
7326 
7329 
7330  default: break;
7331  }
7332  return false;
7333 
7334 } // IsCompatibleBitfileName
7335 
7336 
7337 NTV2DeviceID NTV2GetDeviceIDFromBitfileName (const string & inBitfileName)
7338 {
7339  typedef map<string, NTV2DeviceID> BitfileName2DevID;
7340  typedef BitfileName2DevID::const_iterator BitfileName2DevCI;
7341  static BitfileName2DevID sBitfileName2DevID;
7342  static AJALock sBFN2DevIDMutex;
7343  AJAAutoLock tmpLock(&sBFN2DevIDMutex);
7344  if (sBitfileName2DevID.empty())
7345  {
7346  const NTV2DeviceIDSet supportedDevices (::NTV2GetSupportedDevices());
7347  for (NTV2DeviceIDSetConstIter it(supportedDevices.begin()); it != supportedDevices.end(); ++it)
7348  {
7349  const string bitFileName(::NTV2GetBitfileName(*it));
7350  if (!bitFileName.empty())
7351  sBitfileName2DevID[bitFileName] = *it;
7352  }
7353  }
7354  BitfileName2DevCI it(sBitfileName2DevID.find(inBitfileName));
7355  return it != sBitfileName2DevID.end() ? it->second : DEVICE_ID_INVALID;
7356 }
7357 
7358 
7359 string NTV2GetFirmwareFolderPath (const bool inAddTrailingPathDelim)
7360 {
7361  string fwPath;
7364  const char c (fwPath.empty() ? 0 : fwPath.at(fwPath.length()-1));
7365  if (!inAddTrailingPathDelim)
7366  if (c == '/' || c == '\\')
7367  fwPath.erase(fwPath.length()-1, 1); // lop off trailing '/'
7368  return fwPath;
7369 }
7370 
7371 string NTV2GetPluginsFolderPath (const bool inAddTrailingPathDelim)
7372 {
7373  string fwPath;
7376  const char c (fwPath.empty() ? 0 : fwPath.at(fwPath.length()-1));
7377  if (!inAddTrailingPathDelim)
7378  if (c == '/' || c == '\\')
7379  fwPath.erase(fwPath.length()-1, 1); // lop off trailing '/'
7380  return fwPath;
7381 }
7382 
7383 string NTV2GetVDevFolderPath (const bool inAddTrailingPathDelim)
7384 {
7385  string fwPath;
7388  const char c (fwPath.empty() ? 0 : fwPath.at(fwPath.length()-1));
7389  if (!inAddTrailingPathDelim)
7390  if (c == '/' || c == '\\')
7391  fwPath.erase(fwPath.length()-1, 1); // lop off trailing '/'
7392  return fwPath;
7393 }
7394 
7395 #define IsAJAInternalDevice(_d_) (((_d_) == DEVICE_ID_IP25_R) || ((_d_) == DEVICE_ID_IP25_T) || ((_d_) == DEVICE_ID_FS8))
7396 
7398 {
7399  static const NTV2DeviceID sValidDeviceIDs [] = { DEVICE_ID_CORVID1,
7413  DEVICE_ID_FS8,
7418 // DEVICE_ID_IOIP_2022,
7419 // DEVICE_ID_IOIP_2110_RGB12,
7420 // DEVICE_ID_IOIP_2110,
7449 // DEVICE_ID_KONAIP_1RX_1TX_1SFP_J2K,
7450 // DEVICE_ID_KONAIP_1RX_1TX_2110,
7451 // DEVICE_ID_KONAIP_2022,
7452 // DEVICE_ID_KONAIP_2110_RGB12,
7453 // DEVICE_ID_KONAIP_2110,
7454 // DEVICE_ID_KONAIP_2TX_1SFP_J2K,
7455 // DEVICE_ID_KONAIP_4CH_2SFP,
7478  if (inKinds == NTV2_DEVICEKIND_NONE)
7479  return NTV2DeviceIDSet();
7480 
7481  NTV2DeviceIDSet result;
7482  if (inKinds == NTV2_DEVICEKIND_SOFTWARE)
7483  {result.insert(DEVICE_ID_SOFTWARE); result.insert(DEVICE_ID_VKONA); return result;}
7484 
7485  for (unsigned ndx(0); ndx < sizeof(sValidDeviceIDs) / sizeof(NTV2DeviceID); ndx++)
7486  {
7487  const NTV2DeviceID deviceID(sValidDeviceIDs[ndx]);
7488  if (deviceID == DEVICE_ID_NOTFOUND)
7489  continue;
7490  bool insertIt (false);
7491  if (inKinds == NTV2_DEVICEKIND_ALL)
7492  insertIt = true;
7493  else if (inKinds & NTV2_DEVICEKIND_INPUT && ::NTV2DeviceCanDoCapture(deviceID))
7494  insertIt = true;
7495  else if (inKinds & NTV2_DEVICEKIND_OUTPUT && ::NTV2DeviceCanDoPlayback(deviceID))
7496  insertIt = true;
7497  else if (inKinds & NTV2_DEVICEKIND_SDI && (::NTV2DeviceGetNumVideoInputs(deviceID)+::NTV2DeviceGetNumVideoOutputs(deviceID)) > 0)
7498  insertIt = true;
7499  else if (inKinds & NTV2_DEVICEKIND_HDMI && (::NTV2DeviceGetNumHDMIVideoInputs(deviceID)+::NTV2DeviceGetNumHDMIVideoOutputs(deviceID)) > 0)
7500  insertIt = true;
7501  else if (inKinds & NTV2_DEVICEKIND_ANALOG && (::NTV2DeviceGetNumAnalogVideoInputs(deviceID)+::NTV2DeviceGetNumAnalogVideoOutputs(deviceID)) > 0)
7502  insertIt = true;
7503  else if (inKinds & NTV2_DEVICEKIND_SFP && (::NTV2DeviceCanDoIP(deviceID) || ::NTV2DeviceCanDo25GIP(deviceID)))
7504  insertIt = true;
7505  else if (inKinds & NTV2_DEVICEKIND_EXTERNAL && ::NTV2DeviceIsExternalToHost(deviceID))
7506  insertIt = true;
7507  else if (inKinds & NTV2_DEVICEKIND_4K && ::NTV2DeviceCanDo4KVideo(deviceID))
7508  insertIt = true;
7509  else if (inKinds & NTV2_DEVICEKIND_12G && ::NTV2DeviceCanDo12GSDI(deviceID))
7510  insertIt = true;
7511  else if (inKinds & NTV2_DEVICEKIND_6G && ::NTV2DeviceCanDo12GSDI(deviceID))
7512  insertIt = true;
7513  else if (inKinds & NTV2_DEVICEKIND_CUSTOM_ANC && ::NTV2DeviceCanDoCustomAnc(deviceID))
7514  insertIt = true;
7515  else if (inKinds & NTV2_DEVICEKIND_RELAYS && ::NTV2DeviceHasSDIRelays(deviceID))
7516  insertIt = true;
7517  else if (inKinds & NTV2_DEVICEKIND_AJA_INTERNAL && IsAJAInternalDevice(deviceID))
7518  insertIt = true;
7519  if (insertIt)
7520  result.insert (deviceID);
7521  } // for each supported device
7522  return result;
7523 }
7524 
7525 ostream & operator << (std::ostream & inOutStr, const NTV2DeviceIDList & inList)
7526 {
7527  for (NTV2DeviceIDListConstIter iter(inList.begin()); iter != inList.end (); ++iter)
7528  inOutStr << (iter != inList.begin() ? ", " : "") << ::NTV2DeviceIDToString(*iter);
7529  return inOutStr;
7530 }
7531 
7532 ostream & operator << (ostream & inOutStr, const NTV2DeviceIDSet & inSet)
7533 {
7534  for (NTV2DeviceIDSetConstIter iter(inSet.begin()); iter != inSet.end(); ++iter)
7535  inOutStr << (iter != inSet.begin() ? ", " : "") << ::NTV2DeviceIDToString(*iter);
7536  return inOutStr;
7537 }
7538 
7539 
7540 std::string NTV2GetVersionString (const bool inDetailed)
7541 {
7542  ostringstream oss;
7543 
7545  if (!string (AJA_NTV2_SDK_BUILD_TYPE).empty ())
7547  if (inDetailed)
7548  oss << " built on " << AJA_NTV2_SDK_BUILD_DATETIME;
7549  return oss.str ();
7550 }
7551 
7552 UWord NTV2GetSDKVersionComponent (const int inVersionComponent)
7553 {
7554  switch (inVersionComponent)
7555  {
7556  case 0: return AJA_NTV2_SDK_VERSION_MAJOR;
7557  case 1: return AJA_NTV2_SDK_VERSION_MINOR;
7558  case 2: return AJA_NTV2_SDK_VERSION_POINT;
7559  case 3: return AJA_NTV2_SDK_BUILD_NUMBER;
7560  default: break;
7561  }
7562  return 0;
7563 }
7564 
7565 
7567 {
7568  return CNTV2RegisterExpert::GetDisplayName(inValue);
7569 }
7570 
7571 
7572 string AutoCircVidProcModeToString (const AutoCircVidProcMode inValue, const bool inCompactDisplay)
7573 {
7574  switch (inValue)
7575  {
7581  }
7582  return "??";
7583 }
7584 
7585 
7586 string NTV2ColorCorrectionModeToString (const NTV2ColorCorrectionMode inValue, const bool inCompactDisplay)
7587 {
7588  switch (inValue)
7589  {
7595  }
7596  return "??";
7597 }
7598 
7599 string NTV2BitfileTypeToString (const NTV2BitfileType inValue, const bool inCompactDisplay)
7600 {
7601  switch (inValue)
7602  {
7603  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid1 Main", NTV2_BITFILE_CORVID1_MAIN);
7604  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid22 Main", NTV2_BITFILE_CORVID22_MAIN);
7605  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona 3G Main", NTV2_BITFILE_KONA3G_MAIN);
7607  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IoExpress Main", NTV2_BITFILE_IOEXPRESS_MAIN);
7608  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid3G Main", NTV2_BITFILE_CORVID3G_MAIN);
7609  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona 3G Quad", NTV2_BITFILE_KONA3G_QUAD);
7612  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid24 Main", NTV2_BITFILE_CORVID24_MAIN);
7613  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "T-Tap Main", NTV2_BITFILE_TTAP_MAIN);
7619  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid88 Main", NTV2_BITFILE_CORVID88);
7620  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid88Gen3 Main", NTV2_BITFILE_CORVID88_GEN3);
7621  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44 Main", NTV2_BITFILE_CORVID44);
7622  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44Gen3 Main", NTV2_BITFILE_CORVID44_GEN3);
7623  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid HEVC", NTV2_BITFILE_CORVIDHEVC);
7624  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2022", NTV2_BITFILE_KONAIP_2022);
7625  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 4CH 2SFP", NTV2_BITFILE_KONAIP_4CH_2SFP);
7626  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 1Rx 1Tx 1SFP J2K", NTV2_BITFILE_KONAIP_1RX_1TX_1SFP_J2K);
7627  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2Tx 1SFP J2K", NTV2_BITFILE_KONAIP_2TX_1SFP_J2K);
7628  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 1Rx 1Tx 2110", NTV2_BITFILE_KONAIP_1RX_1TX_2110);
7633  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2110", NTV2_BITFILE_KONAIP_2110);
7635  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona HDMI", NTV2_BITFILE_KONAHDMI);
7641  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "T-Tap Pro Main", NTV2_BITFILE_TTAP_PRO_MAIN);
7642  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 2x4K Main", NTV2_BITFILE_KONA5_2X4K_MAIN);
7643  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44 2x4K Main", NTV2_BITFILE_CORVID44_2X4K_MAIN);
7644  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 3D LUT Main", NTV2_BITFILE_KONA5_3DLUT_MAIN);
7645  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44 Planar Main", NTV2_BITFILE_CORVID44_PLNR_MAIN);
7647  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE1 Main", NTV2_BITFILE_KONA5_OE1_MAIN);
7648  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE2 Main", NTV2_BITFILE_KONA5_OE2_MAIN);
7649  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE3 Main", NTV2_BITFILE_KONA5_OE3_MAIN);
7650  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE4 Main", NTV2_BITFILE_KONA5_OE4_MAIN);
7651  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE5 Main", NTV2_BITFILE_KONA5_OE5_MAIN);
7652  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE6 Main", NTV2_BITFILE_KONA5_OE6_MAIN);
7653  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE7 Main", NTV2_BITFILE_KONA5_OE7_MAIN);
7654  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE8 Main", NTV2_BITFILE_KONA5_OE8_MAIN);
7655  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE9 Main", NTV2_BITFILE_KONA5_OE9_MAIN);
7656  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE10 Main", NTV2_BITFILE_KONA5_OE10_MAIN);
7657  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE11 Main", NTV2_BITFILE_KONA5_OE11_MAIN);
7658  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE12 Main", NTV2_BITFILE_KONA5_OE12_MAIN);
7659  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE1 Main", NTV2_BITFILE_SOJI_OE1_MAIN);
7660  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE2 Main", NTV2_BITFILE_SOJI_OE2_MAIN);
7661  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE3 Main", NTV2_BITFILE_SOJI_OE3_MAIN);
7662  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE4 Main", NTV2_BITFILE_SOJI_OE4_MAIN);
7663  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE5 Main", NTV2_BITFILE_SOJI_OE5_MAIN);
7664  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE6 Main", NTV2_BITFILE_SOJI_OE6_MAIN);
7665  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE7 Main", NTV2_BITFILE_SOJI_OE7_MAIN);
7666  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI 3DLUT Main", NTV2_BITFILE_SOJI_3DLUT_MAIN);
7667  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI DIAGS Main", NTV2_BITFILE_SOJI_DIAGS_MAIN);
7669  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2110 RGB12", NTV2_BITFILE_KONAIP_2110_RGB12);
7670  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IoIP 2110 RGB12", NTV2_BITFILE_IOIP_2110_RGB12);
7676  }
7677  return "(bad bitfile type)";
7678 }
7679 
7680 string NTV2DieTempScaleToString (const NTV2DieTempScale inValue, const bool inUseUTF8)
7681 {
7682  static const NTV2StringList sScalesUTF8 = { "\xE2\x84\x83", "\xE2\x84\x89", "\xC2\xB0""K", "\xC2\xB0""R"};
7683  static const NTV2StringList sScales = { "C", "F", "K", "R"};
7684  if (size_t(inValue) < sScales.size())
7685  return inUseUTF8 ? sScalesUTF8.at(inValue) : sScales.at(inValue);
7686  return "";
7687 }
7688 
7689 #if !defined(NTV2_DEPRECATE_17_6)
7690  bool convertHDRFloatToRegisterValues (const HDRFloatValues & inFloatValues, HDRRegValues & outRegisterValues)
7691  {
7692  return inFloatValues.toRegValues(outRegisterValues);
7693  }
7694 
7695  bool convertHDRRegisterToFloatValues (const HDRRegValues & inRegisterValues, HDRFloatValues & outFloatValues)
7696  {
7697  return outFloatValues.setFromRegValues(inRegisterValues);
7698  }
7699 
7700  void setHDRDefaultsForBT2020 (HDRRegValues & outRegisterValues)
7701  {
7702  outRegisterValues.setBT2020();
7703  }
7704 
7705  void setHDRDefaultsForDCIP3(HDRRegValues & outRegisterValues)
7706  {
7707  outRegisterValues.setDCIP3();
7708  }
7709 #endif // !defined(NTV2_DEPRECATE_17_6)
7710 
7711 
7712 ostream & operator << (ostream & inOutStr, const NTV2OutputCrosspointIDs & inList)
7713 {
7714  inOutStr << "[";
7715  for (NTV2OutputCrosspointIDsConstIter it (inList.begin()); it != inList.end(); )
7716  {
7717  inOutStr << ::NTV2OutputCrosspointIDToString(*it);
7718  ++it;
7719  if (it != inList.end())
7720  inOutStr << ",";
7721  }
7722  inOutStr << "]";
7723  return inOutStr;
7724 }
7725 
7726 /*
7727 static ostream & operator << (ostream & inOutStr, const NTV2InputCrosspointIDs & inList)
7728 {
7729  inOutStr << "[";
7730  for (NTV2InputCrosspointIDsConstIter it (inList.begin()); it != inList.end(); )
7731  {
7732  inOutStr << ::NTV2InputCrosspointIDToString(*it);
7733  ++it;
7734  if (it != inList.end())
7735  inOutStr << ",";
7736  }
7737  inOutStr << "]";
7738  return inOutStr;
7739 }
7740 */
7741 
7742 
7744 {
7745  NTV2RegisterReads result;
7746  for (NTV2RegNumSetConstIter it (inRegNumSet.begin()); it != inRegNumSet.end(); ++it)
7747  result.push_back (NTV2RegInfo (*it));
7748  return result;
7749 }
7750 
7752 {
7753  NTV2RegNumSet result;
7754  for (NTV2RegisterReadsConstIter it (inRegReads.begin()); it != inRegReads.end(); ++it)
7755  result.insert (it->registerNumber);
7756  return result;
7757 }
7758 
7759 bool GetRegNumChanges (const NTV2RegNumSet & inBefore, const NTV2RegNumSet & inAfter, NTV2RegNumSet & outGone, NTV2RegNumSet & outSame, NTV2RegNumSet & outNew)
7760 {
7761  outGone.clear(); outSame.clear(); outNew.clear();
7762  set_difference (inBefore.begin(), inBefore.end(), inAfter.begin(), inAfter.end(), std::inserter(outGone, outGone.begin()));
7763  set_difference (inAfter.begin(), inAfter.end(), inBefore.begin(), inBefore.end(), std::inserter(outNew, outNew.begin()));
7764  set_intersection (inBefore.begin(), inBefore.end(), inAfter.begin(), inAfter.end(), std::inserter(outSame, outSame.begin()));
7765  return true;
7766 }
7767 
7768 bool GetChangedRegisters (const NTV2RegisterReads & inBefore, const NTV2RegisterReads & inAfter, NTV2RegNumSet & outChanged)
7769 {
7770  outChanged.clear();
7771  if (&inBefore == &inAfter)
7772  return false; // Same vector, identical!
7773  if (inBefore.size() != inAfter.size())
7774  { // Only check common reg nums...
7775  NTV2RegNumSet before(::ToRegNumSet(inBefore)), after(::ToRegNumSet(inAfter)), commonRegNums;
7776  set_intersection (before.begin(), before.end(), after.begin(), after.end(),
7777  std::inserter(commonRegNums, commonRegNums.begin()));
7778  for (NTV2RegNumSetConstIter it(commonRegNums.begin()); it != commonRegNums.end(); ++it)
7779  {
7782  if (beforeIt != inBefore.end() && afterIt != inAfter.end() && beforeIt->registerValue != afterIt->registerValue)
7783  outChanged.insert(*it);
7784  }
7785  }
7786  else if (inBefore.at(0).registerNumber == inAfter.at(0).registerNumber
7787  && inBefore.at(inBefore.size()-1).registerNumber == inAfter.at(inAfter.size()-1).registerNumber)
7788  { // Assume identical reg num layout
7789  for (size_t ndx(0); ndx < inBefore.size(); ndx++)
7790  if (inBefore[ndx].registerValue != inAfter[ndx].registerValue)
7791  outChanged.insert(inBefore[ndx].registerNumber);
7792  }
7793  else for (size_t ndx(0); ndx < inBefore.size(); ndx++)
7794  {
7795  const NTV2RegInfo & beforeInfo(inBefore.at(ndx));
7796  const NTV2RegInfo & afterInfo(inAfter.at(ndx));
7797  if (beforeInfo.registerNumber == afterInfo.registerNumber)
7798  {
7799  if (beforeInfo.registerValue != afterInfo.registerValue)
7800  outChanged.insert(beforeInfo.registerNumber);
7801  }
7802  else
7803  {
7804  NTV2RegisterReadsConstIter it(::FindFirstMatchingRegisterNumber(beforeInfo.registerNumber, inAfter));
7805  if (it != inAfter.end())
7806  if (beforeInfo.registerValue != it->registerValue)
7807  outChanged.insert(beforeInfo.registerNumber);
7808  }
7809  }
7810  return !outChanged.empty();
7811 }
7812 
7813 
7814 string PercentEncode (const string & inStr)
7815 { ostringstream oss;
7816  for (size_t ndx(0); ndx < inStr.size(); ndx++)
7817  {
7818  const char chr(inStr.at(size_t(ndx)));
7819  if (::isalnum(chr) || chr == '-' || chr == '_' || chr == '.' || chr == '~' || chr == ':')
7820  oss << chr;
7821  else
7822  oss << "%" << HEX0N(unsigned(chr),2);
7823  }
7824  return oss.str();
7825 }
7826 
7827 string PercentDecode (const string & inStr)
7828 { ostringstream oss;
7829  unsigned hexNum(0), state(0); // 0=unreserved expected, 1=1st hex digit expected, 2=2nd hex digit expected
7830  for (size_t ndx(0); ndx < inStr.size(); ndx++)
7831  {
7832  const char chr(inStr.at(size_t(ndx)));
7833  switch (state)
7834  {
7835  case 0:
7836  if (::isalnum(chr) || chr == '-' || chr == '_' || chr == '.' || chr == '~' || chr == ':')
7837  oss << chr;
7838  if (chr == '%')
7839  {state++; break;}
7840  break;
7841  case 1:
7842  if (chr >= 'A' && chr <= 'F')
7843  hexNum = unsigned(chr + 10 - 'A') << 4;
7844  else if (chr >= 'a' && chr <= 'f')
7845  hexNum = unsigned(chr + 10 - 'a') << 4;
7846  else if (chr >= '0' && chr <= '9')
7847  hexNum = unsigned(chr - '0') << 4;
7848  else
7849  hexNum = 0;
7850  state++;
7851  break;
7852  case 2:
7853  if (chr >= 'A' && chr <= 'F')
7854  hexNum += unsigned(chr + 10 - 'A');
7855  else if (chr >= 'a' && chr <= 'f')
7856  hexNum += unsigned(chr + 10 - 'a');
7857  else if (chr >= '0' && chr <= '9')
7858  hexNum += unsigned(chr - '0');
7859  oss << char(hexNum);
7860  hexNum = 0;
7861  state = 0;
7862  break;
7863  default: NTV2_ASSERT(false); break;
7864  }
7865  }
7866  return oss.str();
7867 }
7868 
7869 bool StringToSerialNum64 (const string & inSerNumStr, uint64_t & outSerNum)
7870 {
7871  outSerNum = 0;
7872  if (inSerNumStr.length() < 8 || inSerNumStr.length() > 9)
7873  return false;
7874  string serNumStr(inSerNumStr);
7875  if (inSerNumStr.length() == 9) // Special case Io4K/DNXIV
7876  serNumStr.erase(0,1); // Lop off the first character
7877  uint64_t serNum(0);
7878  for (size_t ndx(0); ndx < serNumStr.length(); ndx++)
7879  {
7880  const char ch (serNumStr.at(ndx));
7881  // Allow only 0-9, A-Z, a-z, blank, and dash only
7882  if ( ! ( ( (ch >= '0') && (ch <= '9') ) ||
7883  ( (ch >= 'A') && (ch <= 'Z') ) ||
7884  ( (ch >= 'a') && (ch <= 'z') ) ||
7885  (ch == ' ') || (ch == '-') ) )
7886  return false; // Invalid character -- assume no Serial Number programmed
7887  serNum |= uint64_t(ch) << (ndx*8); // ((7-ndx)*8);
7888  }
7889  outSerNum = serNum;
7890  return true;
7891 }
7892 
7893 string SerialNum64ToString (const uint64_t & inSerNum)
7894 {
7895  const ULWord serialNumHigh (inSerNum >> 32);
7896  const ULWord serialNumLow (inSerNum & 0x00000000FFFFFFFF);
7897  char serialNum [9];
7898 
7899  serialNum[0] = char((serialNumLow & 0x000000FF) );
7900  serialNum[1] = char((serialNumLow & 0x0000FF00) >> 8);
7901  serialNum[2] = char((serialNumLow & 0x00FF0000) >> 16);
7902  serialNum[3] = char((serialNumLow & 0xFF000000) >> 24);
7903  serialNum[4] = char((serialNumHigh & 0x000000FF) );
7904  serialNum[5] = char((serialNumHigh & 0x0000FF00) >> 8);
7905  serialNum[6] = char((serialNumHigh & 0x00FF0000) >> 16);
7906  serialNum[7] = char((serialNumHigh & 0xFF000000) >> 24);
7907  serialNum[8] = '\0';
7908 
7909  for (unsigned ndx(0); ndx < 8; ndx++)
7910  {
7911  if (serialNum[ndx] == 0)
7912  {
7913  if (ndx == 0)
7914  return ""; // No characters: no serial number
7915  break; // End of string -- stop scanning
7916  }
7917 
7918  // Allow only 0-9, A-Z, a-z, blank, and dash only.
7919  if ( ! ( ( (serialNum[ndx] >= '0') && (serialNum[ndx] <= '9') ) ||
7920  ( (serialNum[ndx] >= 'A') && (serialNum[ndx] <= 'Z') ) ||
7921  ( (serialNum[ndx] >= 'a') && (serialNum[ndx] <= 'z') ) ||
7922  (serialNum[ndx] == ' ') || (serialNum[ndx] == '-') ) )
7923  return ""; // Invalid character -- assume no Serial Number programmed...
7924  }
7925  return serialNum;
7926 }
7927 
7928 #if !defined(NTV2_DEPRECATE_17_6)
7929 #if defined (AJAMac)
7930  #include <fstream>
7931  #include "ajabase/common/common.h"
7932  // Poor man's plist reader
7933  // Fetches version components out of CFBundleShortVersionString
7934  // Returns true if the Info.plist exists; otherwise false
7935  // NOTE: This will fail for binary plist files!
7936  static const string AJAMacDriverInfoPlistPath ("/Library/Extensions/AJANTV2.kext/Contents/Info.plist");
7937  bool GetInstalledMacDriverVersion (UWord & outMaj, UWord & outMin, UWord & outPt, UWord & outBld, UWord & outType)
7938  {
7939  outMaj = outMin = outPt = outBld = outType = 0;
7940  ifstream ifs;
7941  ifs.open(AJAMacDriverInfoPlistPath.c_str(), std::ios::in);
7942  if (!ifs.is_open())
7943  return false;
7944  if (!ifs.good())
7945  return false;
7946  const string key("<key>CFBundleShortVersionString</key>");
7947  for (string line; std::getline(ifs, line); )
7948  {
7949  size_t keyPos(line.find(key));
7950  if (keyPos == string::npos)
7951  continue;
7952  if (!std::getline(ifs, line))
7953  break;
7954  //"<string>16.1.0b58</string>" or "<string>16.0.1</string>"
7955  size_t startPos(line.find("<string>")), endPos(line.find("</string>"));
7956  if (startPos == string::npos || endPos == string::npos)
7957  continue;
7958  startPos += 8;
7959  if (endPos < startPos)
7960  continue;
7961  string versStr(line.substr(startPos, endPos-startPos)); // "16.1.0b58" or "16.0.1"
7962  NTV2StringList versComps;
7963  aja::split(versStr, '.', versComps);
7964  if (versComps.size() < 3 || versComps.size() > 4)
7965  continue;
7966  const string sBuildTypes("_bad"); // 1=beta 2=alpha 3=dev
7967  for (size_t bt(1); bt < 4; bt++)
7968  if (versComps.at(2).find(sBuildTypes[bt]) != string::npos)
7969  { NTV2StringList lastComps;
7970  aja::split(versComps.at(2), sBuildTypes[bt], lastComps);
7971  versComps.erase(versComps.begin()+2);
7972  versComps.push_back(lastComps.at(0));
7973  outBld = UWord(aja::stoul(lastComps.at(1)));
7974  outType = UWord(bt);
7975  break;
7976  }
7977  for (size_t ndx(0); ndx < versComps.size(); ndx++)
7978  {
7979  if (versComps.at(ndx).empty())
7980  continue;
7981  UWord val(UWord(aja::stoul(versComps.at(ndx))));
7982  if (ndx == 0)
7983  outMaj = val;
7984  else if (ndx == 1)
7985  outMin = val;
7986  else if (ndx == 2)
7987  outPt = val;
7988  else if (ndx == 3 && outType == 0)
7989  outBld = val;
7990  else
7991  break;
7992  }
7993  break;
7994  }
7995  return true;
7996  }
7997 #endif // AJAMac
7998 #endif // !defined(NTV2_DEPRECATE_17_6)
bool IsProgressivePicture(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5395
Fractional rate of 15,000 frames per 1,001 seconds.
Definition: ntv2enums.h:433
string NTV2ScanMethodToString(const NTV2ScanMethod inValue, const bool inCompact)
Definition: ntv2utils.cpp:6622
Declares common video macros and structs used in the SDK.
void ConvertARGBYCbCrToRGBA(UByte *rgbaBuffer, ULWord numPixels)
Passes only foreground video + key to the Mixer output.
Definition: ntv2enums.h:1798
See Io XT.
Definition: ntv2enums.h:44
ULWord GetVideoActiveSize(const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, const NTV2VANCMode inVancMode)
Definition: ntv2utils.cpp:2858
Levels are 0 - 255 (Full)
Definition: ntv2enums.h:3644
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
The invalid video input.
Definition: ntv2enums.h:1281
void MaskYCbCrLine(UWord *ycbcrLine, UWord signalMask, ULWord numPixels)
Definition: ntv2utils.cpp:728
void Make10BitLine(UWord *pOutLineData, const UWord Y, const UWord Cb, const UWord Cr, const ULWord inNumPixels)
Definition: ntv2utils.cpp:829
bool AddAudioTone(ULWord &outNumBytesWritten, NTV2Buffer &inAudioBuffer, ULWord &inOutCurrentSample, const ULWord inNumSamples, const double inSampleRate, const double inAmplitude, const double inFrequency, const ULWord inNumBitsPerSample, const bool inByteSwap, const ULWord inNumChannels)
Fills the given buffer with 32-bit (ULWord) audio tone samples.
Definition: ntv2utils.cpp:4413
#define NTV2_NUMAUDIO_CHANNELS
Specifies devices with SFP connectors.
Definition: ntv2enums.h:1392
string NTV2GetVDevFolderPath(const bool inAddTrailingPathDelim)
Definition: ntv2utils.cpp:7383
#define NTV2UTILS_ENUM_CASE_RETURN_STR(enum_name)
Definition: ntv2utils.cpp:37
string NTV2FramesizeToString(const NTV2Framesize inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6471
Identifies the 4th HDMI video input.
Definition: ntv2enums.h:1272
Identifies the 5th SDI video input.
Definition: ntv2enums.h:1277
Specifies devices with HDMI connectors.
Definition: ntv2enums.h:1390
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3901
#define AJA_NTV2_SDK_BUILD_NUMBER
The SDK build number, an unsigned decimal integer.
Definition: ntv2version.h:16
double GetAudioSamplesPerSecond(const NTV2AudioRate inAudioRate)
Returns the audio sample rate as a number of audio samples per second.
Definition: ntv2utils.cpp:3303
ULWord GetNTV2FrameGeometryHeight(const NTV2FrameGeometry inGeometry)
Definition: ntv2utils.cpp:4185
bool NTV2IsCompatibleBitfileName(const string &inBitfileName, const NTV2DeviceID inDeviceID)
Definition: ntv2utils.cpp:7313
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
Definition: ntv2utils.cpp:4873
Declares a number of pixel format transcoder functions.
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2375
YCbCr color space.
Definition: ntv2enums.h:3615
Declares the AJALock class.
Specifies SDI input/output kinds.
Definition: ntv2enums.h:1296
std::set< NTV2TCIndex > NTV2TCIndexes
NTV2FrameRate GetNTV2FrameRateFromNumeratorDenominator(const ULWord inNumerator, const ULWord inDenominator)
Definition: ntv2utils.cpp:3588
SDI 3 embedded VITC 2.
Definition: ntv2enums.h:3980
bool CopyRaster(const NTV2PixelFormat inPixelFormat, UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Copies all or part of a source raster image into a destination raster at a given position.
Definition: ntv2utils.cpp:1735
Specifies the SDI In 6 connector.
Definition: ntv2enums.h:1470
string NTV2HDMIColorSpaceToString(const NTV2HDMIColorSpace inValue, const bool inCompact)
Definition: ntv2utils.cpp:6694
Identifies SMPTE HD 1080p.
Definition: ntv2enums.h:175
NTV2FrameGeometry GetGeometryFromStandard(const NTV2Standard inStandard)
Definition: ntv2utils.cpp:4068
Specifies devices with analog video connectors.
Definition: ntv2enums.h:1391
Specifies devices with SDI connectors.
Definition: ntv2enums.h:1389
bool UnpackLine_10BitYUVtoU16s(vector< uint16_t > &outYCbCrLine, const NTV2Buffer &inFrameBuffer, const NTV2FormatDescriptor &inDescriptor, const UWord inLineOffset)
Unpacks up to one raster line of an NTV2_FBF_10BIT_YCBCR frame buffer into an array of uint16_t value...
Definition: ntv2utils.cpp:646
NTV2FrameBufferFormat GetPixelFormat(void) const
NTV2Crosspoint
Logically, these are an NTV2Channel combined with an NTV2Mode.
Definition: ntv2enums.h:1705
Specifies the device&#39;s internal clock.
Definition: ntv2enums.h:1464
#define NTV2_VIDEO_FORMAT_IS_B(__f__)
Definition: ntv2enums.h:1133
This identifies the invalid (unspecified, uninitialized) VANC mode.
Definition: ntv2enums.h:3808
void UnPack10BitDPXtoRGBAlpha10BitPixel(RGBAlpha10BitPixel *rgba10BitBuffer, const ULWord *DPXLinebuffer, ULWord numPixels, bool bigEndian)
Definition: ntv2utils.cpp:685
bool NTV2DeviceCanDo25GIP(const NTV2DeviceID inDeviceID)
string SerialNum64ToString(const uint64_t &inSerNum)
Definition: ntv2utils.cpp:7893
void StackQuadrants(uint8_t *pSrc, uint32_t srcWidth, uint32_t srcHeight, uint32_t srcRowBytes, uint8_t *pDst)
Definition: ntv2utils.cpp:450
NTV2AudioBufferSize
Represents the size of the audio buffer used by a device audio system for storing captured samples or...
Definition: ntv2enums.h:1919
NTV2HDMIColorSpace
Indicates or specifies HDMI Color Space.
Definition: ntv2enums.h:3611
ULWordSet NTV2RegisterNumberSet
A set of distinct ULWord values.
string NTV2AncDataRgnToStr(const NTV2AncDataRgn inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6581
#define NTV2_IS_2K_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:760
ULWord GetBytesPerRow(const UWord inPlaneIndex0=0) const
bool IsNULL(void) const
Specifies devices that have 12G SDI connectors.
Definition: ntv2enums.h:1397
Identifies the 2nd HDMI video input.
Definition: ntv2enums.h:1270
NTV2InputSource GetNTV2InputSourceForIndex(const ULWord inIndex0, const NTV2IOKinds inKinds)
Definition: ntv2utils.cpp:5228
See KONA IP.
Definition: ntv2enums.h:71
See Io IP.
Definition: ntv2enums.h:41
1920x1080, for 1080i and 1080p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:363
See KONA 5.
Definition: ntv2enums.h:55
ostream & operator<<(ostream &inOutStream, const NTV2FrameSize &inFrameDimensions)
Definition: ntv2utils.cpp:5719
static bool SetRasterLinesBlack10BitYCbCr(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines)
Definition: ntv2utils.cpp:1058
NTV2FieldID
These values are used to identify fields for interlaced video. See Field/Frame Interrupts and CNTV2Ca...
Definition: ntv2enums.h:1845
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:223
defined(NTV2_DEPRECATE_17_6)
NTV2TaskMode
Describes the task mode state. See also: NTV2 Device Sharing.
Doesn&#39;t specify any kind of device.
Definition: ntv2enums.h:1403
#define NTV2_VIDEO_FORMAT_IS_A(__f__)
Definition: ntv2enums.h:1098
uint32_t * PULWord
Definition: ajatypes.h:237
Obtain audio samples from the device AES inputs, if available.
Definition: ntv2enums.h:2013
std::string NTV2GetVersionString(const bool inDetailed)
Definition: ntv2utils.cpp:7540
See KONA 5.
Definition: ntv2enums.h:63
Specifies the HDMI In 1 connector.
Definition: ntv2enums.h:1466
10-Bit 4:2:2 2-Plane YCbCr
Definition: ntv2enums.h:256
NTV2OutputDestination
Identifies a specific video output destination.
Definition: ntv2enums.h:1328
NTV2DeviceIDSet NTV2GetSupportedDevices(const NTV2DeviceKinds inKinds)
Returns an NTV2DeviceIDSet of devices supported by the SDK.
Definition: ntv2utils.cpp:7397
See KONA LHe Plus.
Definition: ntv2enums.h:78
bool CopyFrom(const void *pInSrcBuffer, const ULWord inByteCount)
Replaces my contents from the given memory buffer, resizing me to the new byte count.
720x576, for PAL 625i, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:362
Obtain audio samples from the device HDMI input, if available.
Definition: ntv2enums.h:2015
See 10-Bit YCbCr Format.
Definition: ntv2enums.h:226
See KONA 5.
Definition: ntv2enums.h:56
See Corvid 88.
Definition: ntv2enums.h:32
enum _NTV2ScanMethod NTV2ScanMethod
Identifies a particular scan method.
SDI 1 embedded VITC 2.
Definition: ntv2enums.h:3978
Apple ProRes DVC Pro.
Definition: ntv2enums.h:245
1280x720, for 720p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:356
string NTV2EmbeddedAudioClockToString(const NTV2EmbeddedAudioClock inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5797
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
ULWord GetDisplayWidth(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:4199
SDI 3 embedded VITC.
Definition: ntv2enums.h:3962
Used to describe Start of Active Video (SAV) location and field dominance for a given NTV2Standard...
Definition: ntv2utils.h:878
#define NTV2_VIDEO_FORMAT_IS_J2K_SUPPORTED(__f__)
Definition: ntv2enums.h:1168
string NTV2RegisterWriteModeToString(const NTV2RegisterWriteMode inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7115
#define NTV2_IS_TALLER_VANC_GEOMETRY(__g__)
Definition: ntv2enums.h:404
ULWord width(void) const
std::string NTV2InterruptEnumToString(const INTERRUPT_ENUMS inInterruptEnumValue)
Definition: ntv2utils.cpp:7128
SDI 4 embedded ATC LTC.
Definition: ntv2enums.h:3973
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1269
string NTV2ReferenceSourceToString(const NTV2ReferenceSource inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7086
Fractional rate of 120,000 frames per 1,001 seconds.
Definition: ntv2enums.h:431
static AJALock sFRFamMutex
Definition: ntv2utils.cpp:5320
NTV2StringList::const_iterator NTV2StringListConstIter
NTV2GeometrySet GetRelatedGeometries(const NTV2FrameGeometry inFG)
Definition: ntv2utils.cpp:4002
See Corvid 24.
Definition: ntv2enums.h:24
#define NTV2_IS_VALID_AUDIO_RATE(_x_)
Definition: ntv2enums.h:1942
Identifies the "monitor" or "auxiliary" Field 2 ancillary data region.
Definition: ntv2enums.h:4238
Identifies SMPTE SD 525i.
Definition: ntv2enums.h:173
void ConvertARGBYCbCrToABGR(UByte *rgbaBuffer, ULWord numPixels)
New in SDK 16.0.
Definition: ntv2enums.h:2569
See 10-Bit Raw YCbCr (CION).
Definition: ntv2enums.h:252
Identifies 4K psf.
Definition: ntv2enums.h:186
bool NTV2DeviceCanDo12GSDI(const NTV2DeviceID inDeviceID)
string NTV2CrosspointToString(const NTV2Crosspoint inChannel)
Definition: ntv2utils.cpp:5809
ULWord GetFullRasterHeight(void) const
AutoCircVidProcMode
#define NTV2_IS_TALL_VANC_GEOMETRY(__g__)
Definition: ntv2enums.h:397
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1053
static const NTV2TCIndex gChanVITC1[]
Definition: ntv2utils.cpp:4961
Identifies the AES/EBU audio breakout cable that has XLR connectors.
Definition: ntv2enums.h:3111
ULWord GetByteCount(void) const
bool GetRegNumChanges(const NTV2RegNumSet &inBefore, const NTV2RegNumSet &inAfter, NTV2RegNumSet &outGone, NTV2RegNumSet &outSame, NTV2RegNumSet &outNew)
Definition: ntv2utils.cpp:7759
string NTV2BitfileTypeToString(const NTV2BitfileType inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:7599
NTV2FrameGeometry GetVANCFrameGeometry(const NTV2FrameGeometry inFrameGeometry, const NTV2VANCMode inVancMode)
Definition: ntv2utils.cpp:3904
Capture (input) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1247
See Alternate 8-Bit YCbCr (&#39;YUY2&#39;).
Definition: ntv2enums.h:231
ULWord GetIndexForNTV2Crosspoint(const NTV2Crosspoint channel)
Definition: ntv2utils.cpp:4828
#define NTV2_IS_VALID_AUDIO_BUFFER_SIZE(_x_)
Definition: ntv2enums.h:1930
See 10-Bit YCbCr - DPX Format.
Definition: ntv2enums.h:235
void PackRGB10BitFor10BitRGBPacked(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Identifies high frame-rate UHD.
Definition: ntv2enums.h:181
NTV2AudioSystem NTV2InputSourceToAudioSystem(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2AudioSystem value.
Definition: ntv2utils.cpp:5075
ULWordSetConstIter NTV2RegNumSetConstIter
A const iterator that iterates over a set of distinct NTV2RegisterNumbers.
void UnPack10BitYCbCrBuffer(uint32_t *packedBuffer, uint16_t *ycbcrBuffer, uint32_t numPixels)
Definition: ntv2utils.cpp:201
int32_t LWord
Definition: ajatypes.h:235
NTV2InputSource GetNTV2HDMIInputSourceForIndex(const ULWord inIndex0)
Definition: ntv2utils.cpp:5272
NTV2FrameRates::const_iterator NTV2FrameRatesConstIter
Definition: ntv2utils.cpp:5315
Specifies devices that have 6G SDI connectors.
Definition: ntv2enums.h:1396
See KONA IP25.
Definition: ntv2enums.h:75
Analog LTC 2.
Definition: ntv2enums.h:3967
bool GetInstalledMacDriverVersion(UWord &outMaj, UWord &outMin, UWord &outPt, UWord &outBld, UWord &outType)
Definition: ntv2utils.cpp:7937
See 3-Plane 10-Bit YCbCr 4:2:2 (&#39;I422_10LE&#39; a.k.a. &#39;YUV-P-L10&#39;).
Definition: ntv2enums.h:254
Specifies HDMI input/output kinds.
Definition: ntv2enums.h:1297
bool IsMultiFormatCompatible(const NTV2FrameRate inFrameRate1, const NTV2FrameRate inFrameRate2)
Compares two frame rates and returns true if they are "compatible" (with respect to a multiformat-cap...
Definition: ntv2utils.cpp:5361
void PackLine_16BitYUVto10BitYUV(const UWord *pIn16BitYUVLine, ULWord *pOut10BitYUVLine, const ULWord inNumPixels)
Packs a line of 16-bit-per-component YCbCr (NTV2_FBF_10BIT_YCBCR) video into 10-bit-per-component YCb...
Definition: ntv2utils.cpp:564
Obtain audio samples from the audio that&#39;s embedded in the video HANC.
Definition: ntv2enums.h:2012
NTV2EmbeddedAudioClock
This enum value determines/states the device audio clock reference source. It was important to set th...
Definition: ntv2enums.h:1995
NTV2InputSource NTV2TimecodeIndexToInputSource(const NTV2TCIndex inTCIndex)
Converts the given NTV2TCIndex value into the appropriate NTV2InputSource value.
Definition: ntv2utils.cpp:4992
The ordinally first geometry (New in SDK 16.0)
Definition: ntv2enums.h:355
ULWord GetTotalBytes(void) const
string NTV2HDMIBitDepthToString(const NTV2HDMIBitDepth inValue, const bool inCompact)
Definition: ntv2utils.cpp:6649
NTV2Channel NTV2CrosspointToNTV2Channel(const NTV2Crosspoint inCrosspointChannel)
Definition: ntv2utils.cpp:4712
LWord64 GetTotalAudioSamplesFromFrameNbrZeroUpToFrameNbr(const NTV2FrameRate inFrameRate, const NTV2AudioRate inAudioRate, const ULWord inFrameNumNonInclusive)
Definition: ntv2utils.cpp:3146
See KONA 4 (Quad Mode).
Definition: ntv2enums.h:48
void Convert8BitYCbCrToYUY2(UByte *ycbcrBuffer, ULWord numPixels)
Specifies any/all input/output kinds.
Definition: ntv2enums.h:1299
#define NTV2_IS_2K_1080_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:767
Definition: lock.h:28
#define NTV2_IS_VALID_OUTPUT_DEST(_dest_)
Definition: ntv2enums.h:1351
Defines a number of handy byte-swapping macros.
#define CCIR601_8BIT_BLACK
Identifies 8K.
Definition: ntv2enums.h:184
The "default" timecode (mostly used by the AJA "Retail" service and Control Panel) ...
Definition: ntv2enums.h:3959
std::string setFromString(const std::string &inStr)
Resets me from the given character string that should contain a human-readable frame range...
Definition: ntv2utils.cpp:4256
void ConvertLineto10BitRGB(UWord *ycbcrBuffer, RGBAlpha10BitPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange=false, bool fAlphaFromLuma=false)
#define NTV2_IS_VALID_AUDIO_CHANNEL_OCTET(__p__)
Definition: ntv2enums.h:3349
This identifies the mode in which there are some + extra VANC lines in the frame buffer.
Definition: ntv2enums.h:3807
string NTV2AudioRateToString(const NTV2AudioRate inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5760
See 3-Plane 8-Bit YCbCr 4:2:0 (&#39;I420&#39; a.k.a. &#39;YUV-P420&#39;).
Definition: ntv2enums.h:237
HDMI protocol.
Definition: ntv2enums.h:3629
#define NTV2_IS_VALID_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3990
2048x1080, for 2Kx1080p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:368
Definition: json.hpp:5362
Output Cb if set, elso Output Cb to 0x200.
Definition: ntv2enums.h:1696
NTV2HDMIAudioChannels
Indicates or specifies the HDMI audio channel count.
Definition: ntv2enums.h:3673
Interlaced.
Definition: ntv2enums.h:501
This identifies the 3rd Audio System.
Definition: ntv2enums.h:3905
bool UnpackLine_10BitARGBtoUWordSequence(const void *pIn10BitARGBLine, const NTV2FormatDescriptor &inFormatDesc, UWordSequence &out16BitARGBLine)
Unpacks a line of NTV2_FBF_10BIT_ARGB video into 16-bit-per-component ARGB data.
Definition: ntv2utils.cpp:172
Fractional rate of 60,000 frames per 1,001 seconds.
Definition: ntv2enums.h:421
See KONA 5.
Definition: ntv2enums.h:58
Declares common audio macros and structs used in the SDK.
static const UByte * GetReadAddress_2vuy(const UByte *pInFrameBuffer, const ULWord inBytesPerVertLine, const UWord inVertLineOffset, const UWord inHorzPixelOffset, const UWord inBytesPerHorzPixel)
Definition: ntv2utils.cpp:1238
bool IsYCbCrFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5420
UWord NTV2DeviceGetNumAnalogVideoInputs(const NTV2DeviceID inDeviceID)
See 8-Bit DVCPro.
Definition: ntv2enums.h:236
string NTV2MixerKeyerModeToString(const NTV2MixerKeyerMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6522
See KONA 1.
Definition: ntv2enums.h:45
#define AJA_NTV2_SDK_VERSION_POINT
The SDK "point" release version, an unsigned decimal integer.
Definition: ntv2version.h:15
NTV2HDMIRange
Indicates or specifies the HDMI RGB range.
Definition: ntv2enums.h:3641
uint32_t ULWord
Definition: ajatypes.h:236
static bool SetRasterLinesWhite10BitYCbCr(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines)
Definition: ntv2utils.cpp:1096
Embeds SDI input source audio into the data stream.
Definition: ntv2enums.h:2036
static const NTV2TCIndex gChanVITC2[]
Definition: ntv2utils.cpp:4962
NTV2AudioFormat
Definition: ntv2enums.h:1956
See KONA 5.
Definition: ntv2enums.h:65
ULWord GetVideoWriteSize(const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, const NTV2VANCMode inVancMode)
Identical to the GetVideoActiveSize function, except rounds the result up to the nearest 4K page size...
Definition: ntv2utils.cpp:2875
NTV2Channel
These enum values are mostly used to identify a specific widget_framestore. They&#39;re also commonly use...
Definition: ntv2enums.h:1361
NTV2Standard Get4xSizedStandard(const NTV2Standard inStandard, const bool bIs4k)
Definition: ntv2utils.cpp:2357
string NTV2GetBitfileName(const NTV2DeviceID inBoardID)
Definition: ntv2utils.cpp:7233
const void * GetRowAddress(const void *pInStartAddress, const ULWord inRowIndex0, const UWord inPlaneIndex0=0) const
string NTV2OutputCrosspointIDToString(const NTV2OutputCrosspointID inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5961
Identifies the 8th SDI video input.
Definition: ntv2enums.h:1280
See Io 4K Plus.
Definition: ntv2enums.h:37
Specifies devices that internally use NTV2.
Definition: ntv2enums.h:1402
NTV2VideoFormat GetOutputForConversionMode(const NTV2ConversionMode conversionMode)
Definition: ntv2utils.cpp:5671
NTV2WidgetType
Definition: ntv2enums.h:3052
string NTV2AudioChannelPairToString(const NTV2AudioChannelPair inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6435
bool NTV2DeviceCanDoFormat(const NTV2DeviceID inDeviceID, const NTV2FrameRate inFrameRate, const NTV2FrameGeometry inFrameGeometry, const NTV2Standard inStandard)
Definition: ntv2utils.cpp:4158
3840x2160, for UHD, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:371
This identifies the 5th Audio System.
Definition: ntv2enums.h:3907
See Corvid 44.
Definition: ntv2enums.h:26
bool Is4KFormat(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5438
void PackRGB10BitFor10BitRGB(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1274
bool IsRaw(const NTV2FrameBufferFormat frameBufferFormat)
Definition: ntv2utils.cpp:5450
NTV2VideoFormat GetQuadSizedVideoFormat(const NTV2VideoFormat inVideoFormat, const bool isSquareDivision)
Definition: ntv2utils.cpp:2129
#define NTV2_ASSERT(_expr_)
Definition: ajatypes.h:489
Identifies SMPTE HD 2K1080psf.
Definition: ntv2enums.h:178
See 3-Plane 8-Bit YCbCr 4:2:2 (Weitek &#39;Y42B&#39; a.k.a. &#39;YUV-P8&#39;).
Definition: ntv2enums.h:250
See KONA 3G (Quad Mode).
Definition: ntv2enums.h:47
SDI 8 embedded VITC.
Definition: ntv2enums.h:3971
Represents an unknown or invalid frame rate.
Definition: ntv2enums.h:418
bool SetRasterLinesWhite(const NTV2PixelFormat inPixelFormat, UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines)
Sets all or part of a destination raster image to legal white.
Definition: ntv2utils.cpp:1178
Obtain audio samples from the device analog input(s), if available.
Definition: ntv2enums.h:2014
string NTV2FrameGeometryToString(const NTV2FrameGeometry inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:6982
NTV2VideoFormat GetInputForConversionMode(const NTV2ConversionMode conversionMode)
Definition: ntv2utils.cpp:5627
NTV2RegWritesConstIter NTV2RegisterReadsConstIter
SDI 8 embedded ATC LTC.
Definition: ntv2enums.h:3977
50 frames per second
Definition: ntv2enums.h:427
ULWord height(void) const
unsigned long stoul(const std::string &str, std::size_t *idx, int base)
Definition: common.cpp:143
New in SDK 16.0.
Definition: ntv2enums.h:2567
NTV2InputSource NTV2ChannelToInputSource(const NTV2Channel inChannel, const NTV2IOKinds inSourceType)
Definition: ntv2utils.cpp:5136
SDI 6 embedded VITC 2.
Definition: ntv2enums.h:3983
static UByte * GetWriteAddress_2vuy(UByte *pInFrameBuffer, const ULWord inBytesPerVertLine, const UWord inVertLineOffset, const UWord inHorzPixelOffset, const UWord inBytesPerHorzPixel)
Definition: ntv2utils.cpp:1249
ULWord numPixels
Width – total number of pixels per line.
Identifies SMPTE HD 720p.
Definition: ntv2enums.h:172
void setHDRDefaultsForBT2020(HDRRegValues &outRegisterValues)
Definition: ntv2utils.cpp:7700
See KONA 5.
Definition: ntv2enums.h:66
string PercentDecode(const string &inStr)
Definition: ntv2utils.cpp:7827
Specifies devices that output (playout).
Definition: ntv2enums.h:1386
See T-TAP.
Definition: ntv2enums.h:94
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:366
static bool CopyRaster36BytesPer8Pixels(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1451
NTV2TCIndex
These enum values are indexes into the capture/playout AutoCirculate timecode arrays.
Definition: ntv2enums.h:3957
bool Fill(const T &inValue)
Fills me with the given scalar value.
Specifies the External Reference connector.
Definition: ntv2enums.h:1461
Fractional rate of 48,000 frames per 1,001 seconds.
Definition: ntv2enums.h:429
30 frames per second
Definition: ntv2enums.h:422
string NTV2DieTempScaleToString(const NTV2DieTempScale inValue, const bool inUseUTF8)
Definition: ntv2utils.cpp:7680
Field Mode: Register changes take effect at the next field VBI.
Definition: ntv2enums.h:1686
#define NTV2_IS_VALID_AUDIO_CHANNEL_QUAD(__p__)
Definition: ntv2enums.h:3316
Specifies the SDI In 2 connector.
Definition: ntv2enums.h:1463
UWord NTV2DeviceGetNumHDMIVideoOutputs(const NTV2DeviceID inDeviceID)
SDI 3 embedded ATC LTC.
Definition: ntv2enums.h:3972
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:416
7680x4320, for UHD2, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:375
See KONA 5.
Definition: ntv2enums.h:62
Analog LTC 1.
Definition: ntv2enums.h:3966
2048x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:360
8-Bit 4:2:2 2-Plane YCbCr
Definition: ntv2enums.h:258
0: Disabled (never recommended): device configured exclusively by client application(s).
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:169
string NTV2GetFirmwareFolderPath(const bool inAddTrailingPathDelim)
Definition: ntv2utils.cpp:7359
Playout (output) mode, which reads from device SDRAM.
Definition: ntv2enums.h:1245
bool IsProgressiveTransport(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5401
This identifies the 6th Audio System.
Definition: ntv2enums.h:3908
NTV2DeviceID
Identifies a specific AJA NTV2 device model number. The NTV2DeviceID is actually the PROM part number...
Definition: ntv2enums.h:20
static const NTV2TCIndex gChanATCLTC[]
Definition: ntv2utils.cpp:4963
void * GetWriteableRowAddress(void *pInStartAddress, const ULWord inRowIndex0, const UWord inPlaneIndex0=0) const
Specifies the HDMI In 3 connector.
Definition: ntv2enums.h:1478
See KONA 5.
Definition: ntv2enums.h:57
bool NTV2DeviceCanDoVideoFormat(const NTV2DeviceID inDeviceID, const NTV2VideoFormat inVideoFormat)
static bool CopyRaster16BytesPer6Pixels(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1330
Identifies UHD2.
Definition: ntv2enums.h:183
ULWord GetIndexForNTV2Channel(const NTV2Channel inChannel)
Definition: ntv2utils.cpp:4706
int16_t Word
Definition: ajatypes.h:233
1920x1080, for 1080i and 1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:354
void ConvertLineTo8BitYCbCr(const uint16_t *ycbcr10BitBuffer, uint8_t *ycbcr8BitBuffer, const uint32_t numPixels)
Definition: ntv2utils.cpp:244
See Io 4K (Quad Mode).
Definition: ntv2enums.h:36
string NTV2AudioSystemToString(const NTV2AudioSystem inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:5749
void ConvertLineto16BitRGB(UWord *ycbcrBuffer, RGBAlpha16BitPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange=false)
The invalid mode.
Definition: ntv2enums.h:1249
#define CCIR601_10BIT_WHITE
16-Bit ARGB
Definition: ntv2enums.h:249
ULWord GetRasterHeight(const bool inVisibleOnly=false) const
string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5731
See KONA LHi.
Definition: ntv2enums.h:79
Invalid or "not found".
Definition: ntv2enums.h:101
NTV2Crosspoint GetNTV2CrosspointInputForIndex(const ULWord index)
Definition: ntv2utils.cpp:4772
static bool CopyRaster4BytesPerPixel(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1568
void setHDRDefaultsForDCIP3(HDRRegValues &outRegisterValues)
Definition: ntv2utils.cpp:7705
NTV2VideoFormat GetSupportedNTV2VideoFormatFromInputVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2598
#define AJA_NTV2_SDK_VERSION_MAJOR
The SDK major version number, an unsigned decimal integer.
Definition: ntv2version.h:13
See Corvid HB-R.
Definition: ntv2enums.h:34
NTV2DeviceIDSet::const_iterator NTV2DeviceIDSetConstIter
A convenient const iterator for NTV2DeviceIDSet.
Definition: ntv2utils.h:1100
NTV2ReferenceSource
These enum values identify a specific source for the device&#39;s (output) reference clock.
Definition: ntv2enums.h:1459
RGB color space.
Definition: ntv2enums.h:3614
NTV2BreakoutType
Identifies the Breakout Boxes and Cables that may be attached to an AJA NTV2 device.
Definition: ntv2enums.h:3108
Identifies "all" ancillary data regions.
Definition: ntv2enums.h:4243
#define NTV2_INPUT_SOURCE_IS_HDMI(_inpSrc_)
Definition: ntv2enums.h:1285
ULWord GetIndexForNTV2CrosspointChannel(const NTV2Crosspoint channel)
Definition: ntv2utils.cpp:4756
bool IsNTV2CrosspointInput(const NTV2Crosspoint inChannel)
Definition: ntv2utils.cpp:4853
Specifies analog input/output kinds.
Definition: ntv2enums.h:1298
Identifies Ultra-High-Definition (UHD) psf.
Definition: ntv2enums.h:185
1280x720, for 720p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:364
enum NTV2AncillaryDataRegion NTV2AncDataRgn
SDI 6 embedded ATC LTC.
Definition: ntv2enums.h:3975
#define AJA_NULL
Definition: ajatypes.h:180
#define NTV2_IS_VALID_IOKINDS(_k_)
Definition: ntv2enums.h:1316
See 10-Bit RGB Format.
Definition: ntv2enums.h:230
ULWord GetVaricamRepeatCount(const NTV2FrameRate inSequenceRate, const NTV2FrameRate inPlayRate, const ULWord inCadenceFrame)
Definition: ntv2utils.cpp:3315
#define NTV2_IS_FBF_RGB(__fbf__)
Definition: ntv2enums.h:287
NTV2Channel NTV2TimecodeIndexToChannel(const NTV2TCIndex inTCIndex)
Converts the given NTV2TCIndex value into the appropriate NTV2Channel value.
Definition: ntv2utils.cpp:4983
See KONA 5.
Definition: ntv2enums.h:61
Identifies the 3rd SDI video input.
Definition: ntv2enums.h:1275
bool IsTransportCompatibleFormat(const NTV2VideoFormat inFormat1, const NTV2VideoFormat inFormat2)
Definition: ntv2utils.cpp:5210
See KONA 5.
Definition: ntv2enums.h:67
New in SDK 16.0.
Definition: ntv2enums.h:2590
NTV2FrameGeometry GetQuarterSizedGeometry(const NTV2FrameGeometry inGeometry)
Definition: ntv2utils.cpp:2315
Declares the most fundamental data types used by NTV2. Since Windows NT was the first principal devel...
NTV2AudioLoopBack
This enum value determines/states if an audio output embedder will embed silence (zeroes) or de-embed...
Definition: ntv2enums.h:2033
See Corvid 44 12G.
Definition: ntv2enums.h:31
NTV2FrameGeometry GetNormalizedFrameGeometry(const NTV2FrameGeometry inFrameGeometry)
Definition: ntv2utils.cpp:3856
Disables normal FrameBuffer Y/C value read limiting (NOT RECOMMENDED).
Definition: ntv2enums.h:3787
bool YUVComponentsTo10BitYUVPackedBuffer(const vector< uint16_t > &inYCbCrLine, NTV2Buffer &inFrameBuffer, const NTV2FormatDescriptor &inDescriptor, const UWord inLineOffset)
Packs up to one raster line of uint16_t YUV components into an NTV2_FBF_10BIT_YCBCR frame buffer...
Definition: ntv2utils.cpp:603
Describes a video frame for a given video standard or format and pixel format, including the total nu...
NTV2FrameRate GetFrameRateFromScale(long scale, long duration, NTV2FrameRate playFrameRate)
Definition: ntv2utils.cpp:3491
Defines for the NTV2 SDK version number, used by ajantv2/includes/ntv2enums.h. See the ajantv2/includ...
enum _INTERRUPT_ENUMS_ INTERRUPT_ENUMS
string NTV2OutputDestinationToString(const NTV2OutputDestination inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7066
void Fill4k8BitYCbCrVideoFrame(PULWord _baseVideoAddress, NTV2FrameBufferFormat frameBufferFormat, YCbCrPixel color, bool vancEnabled, bool b4k, bool wideVANC)
Definition: ntv2utils.cpp:954
See KONA 5.
Definition: ntv2enums.h:54
void split(const std::string &str, const char delim, std::vector< std::string > &elems)
Definition: common.cpp:350
string NTV2InputSourceToString(const NTV2InputSource inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7043
void PackRGB10BitFor10BitARGBPacked(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
string NTV2AudioSourceToString(const NTV2AudioSource inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6735
NTV2ColorCorrectionMode
Definition: ntv2enums.h:2084
void Make10BitBlackLine(UWord *pOutLineData, const ULWord inNumPixels)
Writes a line of unpacked, legal SMPTE 10-bit Y/C black values into the given buffer.
Definition: ntv2utils.cpp:803
NTV2VideoFormat GetFirstMatchingVideoFormat(const NTV2FrameRate inFrameRate, const UWord inHeightLines, const UWord inWidthPixels, const bool inIsInterlaced, const bool inIsLevelB, const bool inIsPSF)
Definition: ntv2utils.cpp:1921
Specifies the SDI In 8 connector.
Definition: ntv2enums.h:1472
2: OEM (recommended): device configured by client application(s) with some driver involvement...
New in SDK 16.0.
Definition: ntv2enums.h:2566
NTV2RegisterNumberSet NTV2RegNumSet
A set of distinct NTV2RegisterNumbers.
bool Is8BitFrameBufferFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5456
NTV2AudioChannelPair
Identifies a pair of audio channels.
Definition: ntv2enums.h:3136
NTV2FrameRateFamilies::const_iterator NTV2FrameRateFamiliesConstIter
Definition: ntv2utils.cpp:5317
bool UnpackLine_10BitYUVtoUWordSequence(const void *pIn10BitYUVLine, UWordSequence &out16BitYUVLine, ULWord inNumPixels)
Unpacks a line of NTV2_FBF_10BIT_YCBCR video into 16-bit-per-component YUV data.
Definition: ntv2utils.cpp:123
void Make8BitBlackLine(UByte *lineData, ULWord numPixels, NTV2FrameBufferFormat fbFormat)
Definition: ntv2utils.cpp:865
bool SetRasterLinesBlack(const NTV2PixelFormat inPixelFormat, UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines)
Sets all or part of a destination raster image to legal black.
Definition: ntv2utils.cpp:1118
Specifies any/all devices.
Definition: ntv2enums.h:1384
NTV2EmbeddedAudioInput NTV2ChannelToEmbeddedAudioInput(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2EmbeddedAudioInput.
Definition: ntv2utils.cpp:4865
NTV2MixerKeyerInputControl
These enum values identify the Mixer/Keyer foreground and background input control values...
Definition: ntv2enums.h:1781
Software device that doesn&#39;t emulate one of the above devices.
Definition: ntv2enums.h:84
NTV2Channel GetNTV2ChannelForIndex(const ULWord inIndex)
Definition: ntv2utils.cpp:4701
Automatic (not for OEM use)
Definition: ntv2enums.h:3613
#define NTV2_IS_PSF_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:1020
int64_t LWord64
Definition: ajatypes.h:238
uint32_t CalcRowBytesForFormat(const NTV2FrameBufferFormat inPixelFormat, const uint32_t inPixelWidth)
Definition: ntv2utils.cpp:46
NTV2RegWrites NTV2RegisterReads
string NTV2ModeToString(const NTV2Mode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6497
ULWord firstActiveLine
First active line of video (0 if NTV2_VANCMODE_OFF)
New in SDK 16.0.
Definition: ntv2enums.h:2589
std::vector< uint16_t > UWordSequence
An ordered sequence of UWord (uint16_t) values.
NTV2UpConvertMode
Definition: ntv2enums.h:2224
Specifies the SDI In 3 connector.
Definition: ntv2enums.h:1467
SDI 4 embedded VITC.
Definition: ntv2enums.h:3963
#define NTV2_IS_INPUT_CROSSPOINT(__x__)
Definition: ntv2enums.h:1729
std::set< NTV2FrameGeometry > NTV2GeometrySet
A set of distinct NTV2FrameGeometry values.
#define NTV2_IS_3Gb_FORMAT(__f__)
Definition: ntv2enums.h:979
string NTV2MixerInputControlToString(const NTV2MixerKeyerInputControl inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6536
See KONA 5.
Definition: ntv2enums.h:59
NTV2Crosspoint NTV2ChannelToInputCrosspoint(const NTV2Channel inChannel)
Definition: ntv2utils.cpp:4919
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:232
NTV2HDMIProtocol
Indicates or specifies the HDMI protocol.
Definition: ntv2enums.h:3627
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:228
void ConvertARGBToRGB(UByte *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:2035
string AutoCircVidProcModeToString(const AutoCircVidProcMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:7572
string NTV2HDMIAudioChannelsToString(const NTV2HDMIAudioChannels inValue, const bool inCompact)
Definition: ntv2utils.cpp:6661
#define IsAJAInternalDevice(_d_)
Definition: ntv2utils.cpp:7395
Passes only background video + key to the Mixer output.
Definition: ntv2enums.h:1801
UWord NTV2DeviceGetNumAnalogVideoOutputs(const NTV2DeviceID inDeviceID)
NTV2Channel NTV2OutputDestinationToChannel(const NTV2OutputDestination inOutputDest)
Converts a given NTV2OutputDestination to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5159
Specifies channel or FrameStore 8 (or the 8th item).
Definition: ntv2enums.h:1370
See KONA HDMI.
Definition: ntv2enums.h:68
New in SDK 16.0.
Definition: ntv2enums.h:2802
#define NTV2_IS_FBF_8BIT(__fbf__)
Definition: ntv2enums.h:303
Identifies SMPTE HD 2K1080p.
Definition: ntv2enums.h:177
Specifies the PTP source on SFP 1.
Definition: ntv2enums.h:1473
NTV2DownConvertMode
Definition: ntv2enums.h:2247
Register changes take effect immediately, without waiting for a field or frame VBI.
Definition: ntv2enums.h:1688
string NTV2IsoConvertModeToString(const NTV2IsoConvertMode inValue, const bool inCompact)
Definition: ntv2utils.cpp:6634
string NTV2RegisterNumberToString(const NTV2RegisterNumber inValue)
Definition: ntv2utils.cpp:7566
Specifies software devices (that don&#39;t model "real" ones).
Definition: ntv2enums.h:1388
bool NTV2DeviceCanDoPlayback(const NTV2DeviceID inDeviceID)
Specifies channel or FrameStore 2 (or the 2nd item).
Definition: ntv2enums.h:1364
See Corvid 44 12G.
Definition: ntv2enums.h:27
bool NTV2DeviceHasSDIRelays(const NTV2DeviceID inDeviceID)
Specifies the SDI In 1 connector.
Definition: ntv2enums.h:1462
string NTV2FrameRateToString(const NTV2FrameRate inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7012
This identifies the 7th Audio System.
Definition: ntv2enums.h:3909
Specifies the PCR source on SFP 1.
Definition: ntv2enums.h:1474
void PackTo10BitYCbCrBuffer(const uint16_t *ycbcrBuffer, uint32_t *packedBuffer, const uint32_t numPixels)
Definition: ntv2utils.cpp:216
NTV2BitfileType
Definition: ntv2enums.h:3373
See 12-Bit Packed RGB.
Definition: ntv2enums.h:244
NTV2OutputDestination NTV2ChannelToOutputDestination(const NTV2Channel inChannel, const NTV2IOKinds inKinds)
Converts the given NTV2Channel value into its ordinary equivalent NTV2OutputDestination.
Definition: ntv2utils.cpp:5171
Register changes take effect after 10 lines after the next field VBI (not commonly used)...
Definition: ntv2enums.h:1689
string NTV2FrameBufferFormatToString(const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:6940
void Make8BitLine(UByte *lineData, UByte Y, UByte Cb, UByte Cr, ULWord numPixels, NTV2FrameBufferFormat fbFormat)
Definition: ntv2utils.cpp:911
Output Cr if set, elso Output Cr to 0x200.
Definition: ntv2enums.h:1697
See Io Express.
Definition: ntv2enums.h:39
HDRRegValues & setDCIP3(void)
std::string NTV2DeviceIDToString(const NTV2DeviceID inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:4608
static bool CopyRaster3BytesPerPixel(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1624
string NTV2DownConvertModeToString(const NTV2DownConvertMode inValue, const bool inCompact)
Definition: ntv2utils.cpp:6609
uint8_t UByte
Definition: ajatypes.h:231
NTV2Crosspoint NTV2ChannelToOutputCrosspoint(const NTV2Channel inChannel)
Definition: ntv2utils.cpp:4930
NTV2VANCMode GetVANCModeForGeometry(const NTV2FrameGeometry inFG)
Definition: ntv2utils.cpp:4056
static const INTERRUPT_ENUMS gChannelToInputInterrupt[]
Specifies the HDMI In 2 connector.
Definition: ntv2enums.h:1477
ULWord GetNTV2FrameGeometryWidth(const NTV2FrameGeometry inGeometry)
Definition: ntv2utils.cpp:4191
1920x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:359
UWord NTV2DeviceGetNumVideoInputs(const NTV2DeviceID inDeviceID)
720x486, for NTSC 525i, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:361
INTERRUPT_ENUMS NTV2ChannelToInputInterrupt(const NTV2Channel inChannel)
Converts the given NTV2Channel value into the equivalent input INTERRUPT_ENUMS value.
Definition: ntv2utils.cpp:4941
See 3-Plane 10-Bit YCbCr 4:2:0 (&#39;I420_10LE&#39; a.k.a. &#39;YUV-P420-L10&#39;).
Definition: ntv2enums.h:253
See KONA LHi.
Definition: ntv2enums.h:80
string NTV2VideoLimitingToString(const NTV2VideoLimiting inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6549
void ConvertARGBToBGR(const UByte *pInRGBALineBuffer, UByte *pOutRGBLineBuffer, const ULWord inNumPixels)
ULWord GetScaleFromFrameRate(const NTV2FrameRate inFrameRate)
Definition: ntv2utils.cpp:3454
NTV2Crosspoint NTV2InputSourceToChannelSpec(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Crosspoint value.
Definition: ntv2utils.cpp:5003
NTV2Crosspoint GetNTV2CrosspointForIndex(const ULWord index)
Definition: ntv2utils.cpp:4804
bool PackLine_UWordSequenceTo10BitYUV(const UWordSequence &in16BitYUVLine, ULWord *pOut10BitYUVLine, const ULWord inNumPixels)
Packs a line of 16-bit-per-component YCbCr (NTV2_FBF_10BIT_YCBCR) video into 10-bit-per-component YCb...
Definition: ntv2utils.cpp:581
bool NTV2DeviceCanDo4KVideo(const NTV2DeviceID inDeviceID)
#define NTV2_IS_VANCMODE_ON(__v__)
Definition: ntv2enums.h:3814
Overlays foreground video on top of background video.
Definition: ntv2enums.h:1799
#define AJA_NTV2_SDK_BUILD_TYPE
The SDK build type, where "a"=alpha, "b"=beta, "d"=development, ""=release.
Definition: ntv2version.h:18
void MakeUnPacked10BitYCbCrBuffer(uint16_t *buffer, uint16_t Y, uint16_t Cb, uint16_t Cr, uint32_t numPixels)
Definition: ntv2utils.cpp:229
4096x2160, for 4K, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:373
Identifies the 4th SDI video input.
Definition: ntv2enums.h:1276
NTV2Framesize
Kona2/Xena2 specific enums.
Definition: ntv2enums.h:2121
Specifies the PCR source on SFP 2.
Definition: ntv2enums.h:1476
static bool SetRasterLinesWhite8BitYCbCr(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines)
Definition: ntv2utils.cpp:1080
NTV2VideoFormat GetTransportCompatibleFormat(const NTV2VideoFormat inFormat, const NTV2VideoFormat inTargetFormat)
Definition: ntv2utils.cpp:5198
void Convert16BitARGBTo12BitRGBPacked(RGBAlpha16BitPixel *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
8192x4320, for 8K, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:377
void Make8BitWhiteLine(UByte *lineData, ULWord numPixels, NTV2FrameBufferFormat fbFormat)
Definition: ntv2utils.cpp:887
#define NTV2_IS_VALID_CHANNEL(__x__)
Definition: ntv2enums.h:1375
10-Bit DPX Little-Endian
Definition: ntv2enums.h:242
string NTV2AudioLoopBackToString(const NTV2AudioLoopBack inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5785
See KONA 5.
Definition: ntv2enums.h:50
bool Fill10BitYCbCrVideoFrame(void *pBaseVideoAddress, const NTV2Standard inStandard, const NTV2FrameBufferFormat inFBF, const YCbCr10BitPixel inPixelColor, const NTV2VANCMode inVancMode)
Definition: ntv2utils.cpp:842
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.).
unsigned char cr
string NTV2StandardToString(const NTV2Standard inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:6914
Identifies SMPTE HD 1080i or 1080psf.
Definition: ntv2enums.h:171
Identifies Ultra-High-Definition (UHD)
Definition: ntv2enums.h:179
NTV2Mode
Used to identify the mode of a widget_framestore, or the direction of an AutoCirculate stream: either...
Definition: ntv2enums.h:1243
See KONA IP.
Definition: ntv2enums.h:72
std::string toString(const bool inNormalized=false) const
Converts me into a character string.
Definition: ntv2utils.cpp:4306
Fractional rate of 30,000 frames per 1,001 seconds.
Definition: ntv2enums.h:423
10-Bit 4:2:0 2-Plane YCbCr
Definition: ntv2enums.h:255
Identifies the "Legal SDI" mode (Ymax=0x3AC, Cmax=0x3C0)
Definition: ntv2enums.h:3786
string NTV2GetPluginsFolderPath(const bool inAddTrailingPathDelim)
Definition: ntv2utils.cpp:7371
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1266
unsigned char y
Identifies SMPTE SD 625i.
Definition: ntv2enums.h:174
static bool CopyRaster20BytesPer16Pixels(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1391
#define M_PI
Definition: ntv2utils.cpp:4409
Identifies the 6th SDI video input.
Definition: ntv2enums.h:1278
std::string & strip(std::string &str, const std::string &ws)
Definition: common.cpp:461
double GetFramesPerSecond(const NTV2FrameRate inFrameRate)
Definition: ntv2utils.cpp:1833
UWord NTV2GetSDKVersionComponent(const int inVersionComponent)
Returns an SDK version component value.
Definition: ntv2utils.cpp:7552
NTV2TimecodeIndex NTV2InputSourceToTimecodeIndex(const NTV2InputSource inInputSource, const bool inEmbeddedLTC)
Converts a given NTV2InputSource to its equivalent NTV2TimecodeIndex value.
Definition: ntv2utils.cpp:5099
2048x1080, for 2Kx1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:365
Invalid/uninitialized.
Definition: ntv2enums.h:1802
Identifies 4K.
Definition: ntv2enums.h:180
static bool CopyRaster5BytesPerPixel(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1512
See KONA 5.
Definition: ntv2enums.h:64
bool IsRGBFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5414
#define AJA_NTV2_SDK_BUILD_DATETIME
The date and time the SDK was built, in ISO-8601 format.
Definition: ntv2version.h:17
2 audio channels
Definition: ntv2enums.h:3675
#define DEC(__x__)
NTV2RegisterNumber
See Corvid 22.
Definition: ntv2enums.h:23
#define AJAExport
Definition: export.h:33
NTV2FrameGeometry
Identifies a particular video frame geometry.
Definition: ntv2enums.h:352
ULWord GetIndexForNTV2CrosspointInput(const NTV2Crosspoint channel)
Definition: ntv2utils.cpp:4788
ULWord NTV2FramesizeToByteCount(const NTV2Framesize inFrameSize)
Converts the given NTV2Framesize value into an exact byte count.
Definition: ntv2utils.cpp:5291
720x576, for PAL 625i, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:358
NTV2FrameGeometry GetNTV2FrameGeometryFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2644
This identifies the first Audio System.
Definition: ntv2enums.h:3903
Progressive Segmented Frame.
Definition: ntv2enums.h:502
See Corvid HEVC.
Definition: ntv2enums.h:35
std::string NTV2IpErrorEnumToString(const NTV2IpError inIpErrorEnumValue)
Definition: ntv2utils.cpp:7178
See 8-Bit HDV.
Definition: ntv2enums.h:238
SDI 2 embedded VITC 2.
Definition: ntv2enums.h:3979
Apple ProRes HDV.
Definition: ntv2enums.h:246
60 frames per second
Definition: ntv2enums.h:419
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
Definition: ntv2enums.h:1288
15 frames per second
Definition: ntv2enums.h:432
string NTV2UpConvertModeToString(const NTV2UpConvertMode inValue, const bool inCompact)
Definition: ntv2utils.cpp:6595
void UnPack10BitDPXtoForRP215(UWord *rawrp215Buffer, ULWord *DPXLinebuffer, ULWord numPixels)
Definition: ntv2utils.cpp:716
10-Bit ARGB
Definition: ntv2enums.h:248
Identifies the 7th SDI video input.
Definition: ntv2enums.h:1279
bool Is8KFormat(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5444
Declares numerous NTV2 utility functions.
static const INTERRUPT_ENUMS gChannelToOutputInterrupt[]
static bool CheckFrameRateFamiliesInitialized(void)
Definition: ntv2utils.cpp:5323
void ConvertLinetoRGB(UByte *ycbcrBuffer, RGBAlphaPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange=false)
ULWord numLines
Height – total number of lines.
static bool SetRasterLinesBlack8BitYCbCr(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines)
Definition: ntv2utils.cpp:1042
void RePackLineDataForYCbCrDPX(ULWord *packedycbcrLine, ULWord numULWords)
Definition: ntv2utils.cpp:674
Describes the horizontal and vertical size dimensions of a raster, bitmap, frame or image...
#define CCIR601_8BIT_CHROMAOFFSET
Specifies the SDI In 7 connector.
Definition: ntv2enums.h:1471
SDI 4 embedded VITC 2.
Definition: ntv2enums.h:3981
New in SDK 16.0.
Definition: ntv2enums.h:2878
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget&#39;s input (ident...
Definition: ntv2enums.h:2532
#define CCIR601_8BIT_WHITE
Declares the AJASystemInfo class.
NTV2IsoConvertMode
Definition: ntv2enums.h:2258
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget&#39;s output (...
Definition: ntv2enums.h:2757
Identifies the "normal" Field 2 ancillary data region.
Definition: ntv2enums.h:4236
This identifies the 4th Audio System.
Definition: ntv2enums.h:3906
SDI 7 embedded ATC LTC.
Definition: ntv2enums.h:3976
ULWord GetFirstActiveLine(const NTV2FieldID inRasterFieldID=NTV2_FIELD0) const
Definition: ntv2utils.cpp:4219
uint16_t NTV2DeviceKinds
A combination of NTV2DeviceKindFilter values.
Definition: ntv2enums.h:1406
#define NTV2_AUDIOSAMPLESIZE
SDI 8 embedded VITC 2.
Definition: ntv2enums.h:3985
static const string AJAMacDriverInfoPlistPath("/Library/Extensions/AJANTV2.kext/Contents/Info.plist")
Specifies devices that input (capture).
Definition: ntv2enums.h:1385
Specifies the Analog In 1 connector.
Definition: ntv2enums.h:1465
string NTV2HDMIProtocolToString(const NTV2HDMIProtocol inValue, const bool inCompact)
Definition: ntv2utils.cpp:6672
string NTV2BreakoutTypeToString(const NTV2BreakoutType inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6562
Specifies the PTP source on SFP 2.
Definition: ntv2enums.h:1475
#define NTV2_IS_QUAD_QUAD_FORMAT(__f__)
Definition: ntv2enums.h:823
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:229
SDI 6 embedded VITC.
Definition: ntv2enums.h:3969
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:357
#define NTV2_IS_VANCMODE_TALL(__v__)
Definition: ntv2enums.h:3812
See Io X3.
Definition: ntv2enums.h:43
NTV2WidgetID
Definition: ntv2enums.h:2914
New in SDK 16.0.
Definition: ntv2enums.h:2800
#define NTV2_IS_OUTPUT_CROSSPOINT(__x__)
Definition: ntv2enums.h:1738
Identifies high frame-rate 4K.
Definition: ntv2enums.h:182
ULWord GetVisibleRasterHeight(void) const
uint16_t UWord
Definition: ajatypes.h:234
ULWord GetRasterWidth(void) const
1: Standard/Retail: device configured by AJA ControlPanel, service/daemon, and driver.
Specifies channel or FrameStore 1 (or the first item).
Definition: ntv2enums.h:1363
120 frames per second
Definition: ntv2enums.h:430
See 48-Bit RGB.
Definition: ntv2enums.h:243
string NTV2AudioBufferSizeToString(const NTV2AudioBufferSize inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5773
Obtain audio samples from the device microphone input, if available.
Definition: ntv2enums.h:2016
NTV2VideoLimiting
These enum values identify the available SDI video output limiting modes.
Definition: ntv2enums.h:3784
string NTV2AudioFormatToString(const NTV2AudioFormat inValue, const bool inCompact)
Definition: ntv2utils.cpp:6706
bool Fill8BitYCbCrVideoFrame(void *pBaseVideoAddress, const NTV2Standard inStandard, const NTV2FrameBufferFormat inFBF, const YCbCrPixel inPixelColor, const NTV2VANCMode inVancMode)
Definition: ntv2utils.cpp:937
NTV2DeviceID NTV2GetDeviceIDFromBitfileName(const string &inBitfileName)
Definition: ntv2utils.cpp:7337
See Corvid 44 12G.
Definition: ntv2enums.h:29
NTV2FrameGeometry Get4xSizedGeometry(const NTV2FrameGeometry inGeometry)
Definition: ntv2utils.cpp:2328
See Io IP.
Definition: ntv2enums.h:40
std::set< NTV2FrameRate > NTV2FrameRates
Definition: ntv2utils.cpp:5314
void PackRGB10BitFor10BitDPX(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels, const bool bigEndian=true)
bool NTV2DeviceIsExternalToHost(const NTV2DeviceID inDeviceID)
Output Black.
Definition: ntv2enums.h:1694
NTV2VANCMode
These enum values identify the available VANC modes.
Definition: ntv2enums.h:3803
NTV2TCIndexes GetTCIndexesForSDIConnector(const NTV2Channel inSDI)
Definition: ntv2utils.cpp:4974
NTV2EmbeddedAudioInput NTV2InputSourceToEmbeddedAudioInput(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2EmbeddedAudioInput value.
Definition: ntv2utils.cpp:4881
25 frames per second
Definition: ntv2enums.h:424
Doesn&#39;t specify any kind of input/output.
Definition: ntv2enums.h:1295
static std::string GetDisplayName(const uint32_t inRegNum)
string NTV2ColorCorrectionModeToString(const NTV2ColorCorrectionMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:7586
std::vector< NTV2OutputCrosspointID > NTV2OutputCrosspointIDs
An ordered sequence of NTV2OutputCrosspointID values.
Definition: ntv2utils.h:1121
See Io 4K (UFC Mode).
Definition: ntv2enums.h:38
NTV2Standard GetNTV2StandardFromScanGeometry(const UByte inScanGeometry, const bool inIsProgressiveTransport)
Definition: ntv2utils.cpp:1903
#define NTV2_IS_SUPPORTED_NTV2FrameRate(__r__)
Definition: ntv2enums.h:449
string NTV2EmbeddedAudioInputToString(const NTV2EmbeddedAudioInput inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6717
Identifies the AES/EBU audio breakout cable that has BNC connectors.
Definition: ntv2enums.h:3112
#define NTV2_IS_VALID_AUDIO_SYSTEM(__x__)
Definition: ntv2enums.h:3920
Identifies the 3rd HDMI video input.
Definition: ntv2enums.h:1271
NTV2RegisterWriteMode
These values are used to determine when certain register writes actually take effect. See CNTV2Card::SetRegisterWriteMode or Field/Frame Interrupts.
Definition: ntv2enums.h:1684
See Corvid, Corvid 3G.
Definition: ntv2enums.h:22
string NTV2WidgetIDToString(const NTV2WidgetID inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6166
10-Bit YCbCrA
Definition: ntv2enums.h:241
Declares the NTV2FormatDescriptor class.
#define NTV2_INPUT_SOURCE_IS_ANALOG(_inpSrc_)
Definition: ntv2enums.h:1286
NTV2FrameRate GetFrameRateFamily(const NTV2FrameRate inFrameRate)
Definition: ntv2utils.cpp:5347
bool toRegValues(HDRRegValues &outVals) const
ULWord AddAudioTestPattern(ULWord *pAudioBuffer, ULWord &inOutCurrentSample, const ULWord inNumSamples, const ULWord inModulus, const bool inEndianConvert, const ULWord inNumChannels)
Definition: ntv2utils.cpp:4587
std::string PrintLineNumber(const ULWord inLineOffset=0, const NTV2FieldID inRasterFieldID=NTV2_FIELD0) const
Definition: ntv2utils.cpp:4246
NTV2ReferenceSource NTV2InputSourceToReferenceSource(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2ReferenceSource value.
Definition: ntv2utils.cpp:5027
string NTV2WidgetTypeToString(const NTV2WidgetType inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6305
static bool CopyRaster4BytesPer2Pixels(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1261
string NTV2TaskModeToString(const NTV2TaskMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6357
std::vector< NTV2FrameRates > NTV2FrameRateFamilies
Definition: ntv2utils.cpp:5316
See KONA 5.
Definition: ntv2enums.h:51
string NTV2HDMIRangeToString(const NTV2HDMIRange inValue, const bool inCompact)
Definition: ntv2utils.cpp:6683
bool setFromRegValues(const HDRRegValues &inRegValues)
void CopyToQuadrant(uint8_t *srcBuffer, uint32_t srcHeight, uint32_t srcRowBytes, uint32_t dstQuadrant, uint8_t *dstBuffer, uint32_t quad13Offset)
Definition: ntv2utils.cpp:519
string PercentEncode(const string &inStr)
Definition: ntv2utils.cpp:7814
See Corvid 88 (Gen3).
Definition: ntv2enums.h:33
NTV2AudioSource
This enum value determines/states where an audio system will obtain its audio samples.
Definition: ntv2enums.h:2010
bool convertHDRRegisterToFloatValues(const HDRRegValues &inRegisterValues, HDRFloatValues &outFloatValues)
Definition: ntv2utils.cpp:7695
Levels are 16 - 235 (SMPTE)
Definition: ntv2enums.h:3643
Identifies the "monitor" or "auxiliary" Field 1 ancillary data region.
Definition: ntv2enums.h:4237
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat videoFormat)
Definition: ntv2utils.cpp:3630
Specifies channel or FrameStore 4 (or the 4th item).
Definition: ntv2enums.h:1366
static bool CopyRaster6BytesPerPixel(UByte *pDstBuffer, const ULWord inDstBytesPerLine, const UWord inDstTotalLines, const UWord inDstVertLineOffset, const UWord inDstHorzPixelOffset, const UByte *pSrcBuffer, const ULWord inSrcBytesPerLine, const UWord inSrcTotalLines, const UWord inSrcVertLineOffset, const UWord inSrcVertLinesToCopy, const UWord inSrcHorzPixelOffset, const UWord inSrcHorzPixelsToCopy)
Definition: ntv2utils.cpp:1680
See Corvid 44 12G.
Definition: ntv2enums.h:28
SDI 5 embedded VITC 2.
Definition: ntv2enums.h:3982
bool convertHDRFloatToRegisterValues(const HDRFloatValues &inFloatValues, HDRRegValues &outRegisterValues)
Definition: ntv2utils.cpp:7690
std::ostream & Print(std::ostream &inOutStream) const
Writes a human-readable description of me into the given output stream.
Definition: ntv2utils.cpp:4231
string NTV2TCIndexToString(const NTV2TCIndex inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6398
UWord NTV2DeviceGetNumVideoOutputs(const NTV2DeviceID inDeviceID)
#define NTV2_IS_VALID_FIELD(__x__)
Definition: ntv2enums.h:1852
NTV2OutputCrosspointIDs::const_iterator NTV2OutputCrosspointIDsConstIter
A convenient const iterator for NTV2OutputCrosspointIDs.
Definition: ntv2utils.h:1123
int RecordCopyAudio(PULWord pAja, PULWord pSR, int iStartSample, int iNumBytes, int iChan0, int iNumChans, bool bKeepAudio24Bits)
Definition: ntv2utils.cpp:4338
Specifies channel or FrameStore 5 (or the 5th item).
Definition: ntv2enums.h:1367
string NTV2VideoFormatToString(const NTV2VideoFormat inFormat, const bool inUseFrameRate)
Definition: ntv2utils.cpp:6750
Identifies the first analog video input.
Definition: ntv2enums.h:1268
Private include file for all ajabase sources.
New in SDK 16.0.
Definition: ntv2enums.h:2562
See 10-Bit RGB - DPX Format.
Definition: ntv2enums.h:234
bool NTV2DeviceCanDoCustomAnc(const NTV2DeviceID inDeviceID)
This identifies the 8th Audio System.
Definition: ntv2enums.h:3910
NTV2AudioRate
Definition: ntv2enums.h:1933
#define NTV2_IS_VALID_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:729
New in SDK 16.0.
Definition: ntv2enums.h:2561
Specifies the HDMI In 4 connector.
Definition: ntv2enums.h:1479
static NTV2FrameRateFamilies sFRFamilies
Definition: ntv2utils.cpp:5319
SDI 2 embedded ATC LTC.
Definition: ntv2enums.h:3965
Output Y if set, else Output Y=0x40.
Definition: ntv2enums.h:1695
bool IsVideoFormatA(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5462
virtual AJAStatus GetValue(const AJASystemInfoTag inTag, std::string &outValue) const
Answers with the host system info value string for the given AJASystemInfoTag.
Definition: info.cpp:153
NTV2ConversionMode
Definition: ntv2enums.h:3720
See 24-Bit RGB.
Definition: ntv2enums.h:239
SDI 1 embedded ATC LTC.
Definition: ntv2enums.h:3964
10-Bit Raw RGB
Definition: ntv2enums.h:251
No identifiable breakout hardware appears to be attached.
Definition: ntv2enums.h:3110
#define NTV2_FBF_HAS_ALPHA(__fbf__)
Definition: ntv2enums.h:327
Progressive.
Definition: ntv2enums.h:499
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1098
void CopyRGBAImageToFrame(ULWord *pSrcBuffer, ULWord srcWidth, ULWord srcHeight, ULWord *pDstBuffer, ULWord dstWidth, ULWord dstHeight)
Definition: ntv2utils.cpp:986
void * GetHostPointer(void) const
See KONA X™.
Definition: ntv2enums.h:83
#define CCIR601_10BIT_CHROMAOFFSET
New in SDK 16.0.
Definition: ntv2enums.h:2568
Identifies the first field in time for an interlaced video frame, or the first and only field in a pr...
Definition: ntv2enums.h:1847
NTV2FrameGeometry GetGeometryFromFrameDimensions(const NTV2FrameSize &inFD)
Definition: ntv2utils.cpp:3957
bool NTV2DeviceCanDoCapture(const NTV2DeviceID inDeviceID)
SDI 2 embedded VITC.
Definition: ntv2enums.h:3961
ULWord GetDisplayHeight(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:4207
ULWord linePitch
Number of 32-bit words per line – shadows mLinePitch[0] / sizeof(ULWord)
Specifies the SDI In 4 connector.
Definition: ntv2enums.h:1468
See Corvid 44 (Gen3).
Definition: ntv2enums.h:30
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:367
Audio clock derived from the device reference.
Definition: ntv2enums.h:1997
bool NTV2DeviceCanDoIP(const NTV2DeviceID inDeviceID)
NTV2RegisterReads FromRegNumSet(const NTV2RegNumSet &inRegNumSet)
Definition: ntv2utils.cpp:7743
Identifies the "Legal Broadcast" mode (Ymax=0x340, Cmax=0x340)
Definition: ntv2enums.h:3788
This identifies the 2nd Audio System.
Definition: ntv2enums.h:3904
SDI 5 embedded VITC.
Definition: ntv2enums.h:3968
8 audio channels
Definition: ntv2enums.h:3676
NTV2Audio4ChannelSelect
Identifies a contiguous, adjacent group of four audio channels.
Definition: ntv2enums.h:3276
NTV2ConversionMode GetConversionMode(const NTV2VideoFormat inFormat, const NTV2VideoFormat outFormat)
Definition: ntv2utils.cpp:5479
NTV2RegNumSet ToRegNumSet(const NTV2RegisterReads &inRegReads)
Definition: ntv2utils.cpp:7751
std::vector< std::string > NTV2StringList
Specifies channel or FrameStore 6 (or the 6th item).
Definition: ntv2enums.h:1368
NTV2TCIndex NTV2ChannelToTimecodeIndex(const NTV2Channel inChannel, const bool inEmbeddedLTC, const bool inIsF2)
Converts the given NTV2Channel value into the equivalent NTV2TCIndex value.
Definition: ntv2utils.cpp:4966
See KONA 3G (UFC Mode).
Definition: ntv2enums.h:46
#define HEX0N(__x__, __n__)
Definition: debug.cpp:1181
#define NTV2_IS_VALID_VANCMODE(__v__)
Definition: ntv2enums.h:3811
string NTV2AudioChannelQuadToString(const NTV2Audio4ChannelSelect inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6447
48 frames per second
Definition: ntv2enums.h:428
NTV2AudioSource NTV2InputSourceToAudioSource(const NTV2InputSource inInputSource)
Definition: ntv2utils.cpp:4905
bool StringToSerialNum64(const string &inSerNumStr, uint64_t &outSerNum)
Definition: ntv2utils.cpp:7869
DVI protocol.
Definition: ntv2enums.h:3630
#define NTV2_IS_4K_QUADHD_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:864
Frame Mode: Register changes take effect at the next frame VBI (power-up default).
Definition: ntv2enums.h:1687
Specifies channel or FrameStore 7 (or the 7th item).
Definition: ntv2enums.h:1369
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1287
NTV2IOKinds GetNTV2InputSourceKind(const NTV2InputSource inSrc)
Definition: ntv2utils.cpp:5260
NTV2Crosspoint GetNTV2CrosspointChannelForIndex(const ULWord index)
Definition: ntv2utils.cpp:4740
void UnpackLine_10BitYUVto16BitYUV(const ULWord *pIn10BitYUVLine, UWord *pOut16BitYUVLine, const ULWord inNumPixels)
Unpacks a line of 10-bit-per-component YCbCr video into 16-bit-per-component YCbCr (NTV2_FBF_10BIT_YC...
Definition: ntv2utils.cpp:548
See KONA X™.
Definition: ntv2enums.h:81
SDI 7 embedded VITC 2.
Definition: ntv2enums.h:3984
Specifies devices that have Anc/Aux inserters/extractors.
Definition: ntv2enums.h:1398
NTV2IpError
Definition: ntv2enums.h:4323
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
string NTV2AudioChannelOctetToString(const NTV2Audio8ChannelSelect inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6459
See KONA 4 (UFC Mode).
Definition: ntv2enums.h:49
bool IsVideoFormatB(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5468
Identifies the "normal" Field 1 ancillary data region.
Definition: ntv2enums.h:4235
24 frames per second
Definition: ntv2enums.h:425
#define NTV2EndianSwap16(__val__)
Definition: ntv2endian.h:15
10-Bit Packed RGB
Definition: ntv2enums.h:247
8-Bit 4:2:0 2-Plane YCbCr
Definition: ntv2enums.h:257
720x576, for PAL 625i, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:370
unsigned char cb
void MaskUnPacked10BitYCbCrBuffer(uint16_t *ycbcrUnPackedBuffer, uint16_t signalMask, uint32_t numPixels)
Definition: ntv2utils.cpp:367
UWord NTV2DeviceGetNumHDMIVideoInputs(const NTV2DeviceID inDeviceID)
string NTV2VANCModeToString(const NTV2VANCMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6509
void ConvertUnpacked10BitYCbCrToPixelFormat(uint16_t *unPackedBuffer, uint32_t *packedBuffer, uint32_t numPixels, NTV2FrameBufferFormat pixelFormat, bool bUseSmpteRange, bool bAlphaFromLuma)
Definition: ntv2utils.cpp:255
Specifies devices that have SDI bypass relays.
Definition: ntv2enums.h:1400
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1273
ULWord GetIndexForNTV2InputSource(const NTV2InputSource inValue)
Definition: ntv2utils.cpp:5278
bool IsNTV2CrosspointOutput(const NTV2Crosspoint inChannel)
Definition: ntv2utils.cpp:4859
INTERRUPT_ENUMS NTV2ChannelToOutputInterrupt(const NTV2Channel inChannel)
Converts the given NTV2Channel value into the equivalent output INTERRUPT_ENUMS value.
Definition: ntv2utils.cpp:4951
void CopyFromQuadrant(uint8_t *srcBuffer, uint32_t srcHeight, uint32_t srcRowBytes, uint32_t srcQuadrant, uint8_t *dstBuffer, uint32_t quad13Offset)
Definition: ntv2utils.cpp:491
NTV2Standard GetQuarterSizedStandard(const NTV2Standard inStandard)
Definition: ntv2utils.cpp:2340
Specifies external devices (e.g. Thunderbolt).
Definition: ntv2enums.h:1387
bool Is2KFormat(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5432
std::vector< NTV2DeviceID > NTV2DeviceIDList
An ordered list of NTV2DeviceIDs.
Definition: ntv2utils.h:1091
Specifies devices that can do 4K video.
Definition: ntv2enums.h:1394
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5051
bool IsAlphaChannelFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5426
#define NTV2_IS_PROGRESSIVE_STANDARD(__s__)
Definition: ntv2enums.h:193
ULWord NTV2AudioBufferSizeToByteCount(const NTV2AudioBufferSize inBufferSize)
Converts the given NTV2BufferSize value into its exact byte count.
Definition: ntv2utils.cpp:5306
NTV2DeviceIDList::const_iterator NTV2DeviceIDListConstIter
A convenient const iterator for NTV2DeviceIDList.
Definition: ntv2utils.h:1093
#define NTV2_IS_VALID_NTV2FrameGeometry(__s__)
Definition: ntv2enums.h:384
Specifies the SDI In 5 connector.
Definition: ntv2enums.h:1469
NTV2EmbeddedAudioInput
This enum value determines/states which SDI video input will be used to supply audio samples to an au...
Definition: ntv2enums.h:1972
bool IsVideoFormatJ2KSupported(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5473
ULWord GetAudioSamplesPerFrame(const NTV2FrameRate inFrameRate, const NTV2AudioRate inAudioRate, ULWord inCadenceFrame, const bool inIsSMPTE372Enabled)
Returns the number of audio samples for a given video frame rate, audio sample rate, and frame number. This is useful since AJA devices use fixed audio sample rates (typically 48KHz), and some video frame rates will necessarily result in some frames having more audio samples than others.
Definition: ntv2utils.cpp:2889
NTV2HDMIBitDepth
Indicates or specifies the HDMI video bit depth.
Definition: ntv2enums.h:3698
#define NTV2_IS_VALID_AUDIO_CHANNEL_PAIR(__p__)
Definition: ntv2enums.h:3208
#define NTV2EndianSwap32(__val__)
Definition: ntv2endian.h:19
#define AJA_NTV2_SDK_VERSION_MINOR
The SDK minor version number, an unsigned decimal integer.
Definition: ntv2version.h:14
void Make10BitWhiteLine(UWord *pOutLineData, const ULWord inNumPixels)
Writes a line of unpacked, legal SMPTE 10-bit Y/C white values into the given buffer.
Definition: ntv2utils.cpp:816
void UnPack10BitDPXtoForRP215withEndianSwap(UWord *rawrp215Buffer, ULWord *DPXLinebuffer, ULWord numPixels)
Definition: ntv2utils.cpp:706
bool GetChangedRegisters(const NTV2RegisterReads &inBefore, const NTV2RegisterReads &inAfter, NTV2RegNumSet &outChanged)
Definition: ntv2utils.cpp:7768
Declares device capability functions.
See 24-Bit BGR.
Definition: ntv2enums.h:240
SDI 1 embedded VITC.
Definition: ntv2enums.h:3960
This identifies the "tall" mode in which there are some VANC lines in the frame buffer.
Definition: ntv2enums.h:3806
HDRRegValues & setBT2020(void)
NTV2VideoFormat GetQuarterSizedVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:1940
NTV2MixerKeyerMode
These enum values identify the mixer mode.
Definition: ntv2enums.h:1796
NTV2Audio8ChannelSelect
Identifies a contiguous, adjacent group of eight audio channels.
Definition: ntv2enums.h:3325
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3805
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:369
Fractional rate of 24,000 frames per 1,001 seconds.
Definition: ntv2enums.h:426
bool IsPSF(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5389
Specifies channel or FrameStore 3 (or the 3rd item).
Definition: ntv2enums.h:1365
See KONA 5.
Definition: ntv2enums.h:52
See T-TAP Pro.
Definition: ntv2enums.h:95
#define NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(condition, retail_name, enum_name)
Definition: ntv2utils.cpp:39
string NTV2InputCrosspointIDToString(const NTV2InputCrosspointID inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5818
enum NTV2TCIndex NTV2TimecodeIndex
See KONA IP25.
Definition: ntv2enums.h:74
void Convert16BitARGBTo16BitRGB(RGBAlpha16BitPixel *rgbaLineBuffer, UWord *rgbLineBuffer, ULWord numPixels)
bool HasVANCGeometries(const NTV2FrameGeometry inFG)
Definition: ntv2utils.cpp:3966
ULWord NTV2IOKinds
Definition: ntv2enums.h:1314
#define NTV2_FBF_IS_RAW(__fbf__)
Definition: ntv2enums.h:335
Declares the CNTV2RegisterExpert class.
NTV2RegReadsConstIter FindFirstMatchingRegisterNumber(const uint32_t inRegNum, const NTV2RegReads &inRegInfos)
Returns a const iterator to the first entry in the NTV2RegInfo collection with a matching register nu...
SDI 7 embedded VITC.
Definition: ntv2enums.h:3970
See KONA XM™.
Definition: ntv2enums.h:82
See 8-Bit YCbCr Format.
Definition: ntv2enums.h:227
#define NTV2_IS_4K_4096_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:837
Audio clock derived from the video input.
Definition: ntv2enums.h:1998
See Corvid, Corvid 3G.
Definition: ntv2enums.h:25
See KONA 5.
Definition: ntv2enums.h:60
NTV2Standard GetStandardFromGeometry(const NTV2FrameGeometry inGeometry, const bool inIsProgressive)
Definition: ntv2utils.cpp:4104
SDI 5 embedded ATC LTC.
Definition: ntv2enums.h:3974
string NTV2RegNumSetToString(const NTV2RegisterNumberSet &inObj)
Definition: ntv2utils.cpp:6370
virtual bool IsValid(void) const
Definition: lock.h:65
NTV2DieTempScale
Definition: ntv2enums.h:4216
#define CCIR601_10BIT_BLACK