AJA NTV2 SDK  18.1.0.2262
NTV2 SDK 18.1.0.2262
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_SOJI_3DLUT: return "SOJI-3DLUT";
4667  case DEVICE_ID_SOJI_DIAGS: return "SOJI-DIAGS";
4668  case DEVICE_ID_SOJI_OE1: return "SOJI-OE1";
4669  case DEVICE_ID_SOJI_OE2: return "SOJI-OE2";
4670  case DEVICE_ID_SOJI_OE3: return "SOJI-OE3";
4671  case DEVICE_ID_SOJI_OE4: return "SOJI-OE4";
4672  case DEVICE_ID_SOJI_OE5: return "SOJI-OE5";
4673  case DEVICE_ID_SOJI_OE6: return "SOJI-OE6";
4674  case DEVICE_ID_SOJI_OE7: return "SOJI-OE7";
4675  case DEVICE_ID_TTAP: return inForRetailDisplay ? "T-TAP" : "TTap";
4676  case DEVICE_ID_TTAP_PRO: return inForRetailDisplay ? "T-TAP Pro" : "TTapPro";
4677  case DEVICE_ID_VKONA: return inForRetailDisplay ? "VKONA" : "VKona";
4678  case DEVICE_ID_SOFTWARE: return inForRetailDisplay ? "Software" : "Software";
4679  case DEVICE_ID_NOTFOUND: return inForRetailDisplay ? "AJA Device" : "(Not Found)";
4680 #if defined(_DEBUG)
4681  // IoIP/KonaIP10g purge:
4682  case DEVICE_ID_IOIP_2022:
4683  case DEVICE_ID_IOIP_2110:
4687  case DEVICE_ID_KONAIP_2022:
4688  case DEVICE_ID_KONAIP_2110:
4691  case DEVICE_ID_KONAIP_4CH_2SFP: break;
4692 #else
4693  default: break;
4694 #endif
4695  }
4696  return inForRetailDisplay ? "Unknown" : "???";
4697 } // NTV2DeviceIDToString
4698 
4699 
4701 {
4702  return inIndex < NTV2_MAX_NUM_CHANNELS ? NTV2Channel(inIndex) : NTV2_CHANNEL1;
4703 }
4704 
4706 {
4707  return NTV2_IS_VALID_CHANNEL(inChannel) ? ULWord(inChannel) : 0;
4708 }
4709 
4710 
4712 {
4713  switch (inCrosspointChannel)
4714  {
4717  case NTV2CROSSPOINT_INPUT1: return NTV2_CHANNEL1;
4718  case NTV2CROSSPOINT_INPUT2: return NTV2_CHANNEL2;
4723  case NTV2CROSSPOINT_INPUT3: return NTV2_CHANNEL3;
4724  case NTV2CROSSPOINT_INPUT4: return NTV2_CHANNEL4;
4729  case NTV2CROSSPOINT_INPUT5: return NTV2_CHANNEL5;
4730  case NTV2CROSSPOINT_INPUT6: return NTV2_CHANNEL6;
4731  case NTV2CROSSPOINT_INPUT7: return NTV2_CHANNEL7;
4732  case NTV2CROSSPOINT_INPUT8: return NTV2_CHANNEL8;
4734  }
4735  return NTV2_CHANNEL_INVALID;
4736 }
4737 
4738 
4740 {
4741  switch(index)
4742  {
4743  default:
4744  case 0: return NTV2CROSSPOINT_CHANNEL1;
4745  case 1: return NTV2CROSSPOINT_CHANNEL2;
4746  case 2: return NTV2CROSSPOINT_CHANNEL3;
4747  case 3: return NTV2CROSSPOINT_CHANNEL4;
4748  case 4: return NTV2CROSSPOINT_CHANNEL5;
4749  case 5: return NTV2CROSSPOINT_CHANNEL6;
4750  case 6: return NTV2CROSSPOINT_CHANNEL7;
4751  case 7: return NTV2CROSSPOINT_CHANNEL8;
4752  }
4753 }
4754 
4756 {
4757  switch(channel)
4758  {
4759  default:
4760  case NTV2CROSSPOINT_CHANNEL1: return 0;
4761  case NTV2CROSSPOINT_CHANNEL2: return 1;
4762  case NTV2CROSSPOINT_CHANNEL3: return 2;
4763  case NTV2CROSSPOINT_CHANNEL4: return 3;
4764  case NTV2CROSSPOINT_CHANNEL5: return 4;
4765  case NTV2CROSSPOINT_CHANNEL6: return 5;
4766  case NTV2CROSSPOINT_CHANNEL7: return 6;
4767  case NTV2CROSSPOINT_CHANNEL8: return 7;
4768  }
4769 }
4770 
4772 {
4773  switch(index)
4774  {
4775  default:
4776  case 0: return NTV2CROSSPOINT_INPUT1;
4777  case 1: return NTV2CROSSPOINT_INPUT2;
4778  case 2: return NTV2CROSSPOINT_INPUT3;
4779  case 3: return NTV2CROSSPOINT_INPUT4;
4780  case 4: return NTV2CROSSPOINT_INPUT5;
4781  case 5: return NTV2CROSSPOINT_INPUT6;
4782  case 6: return NTV2CROSSPOINT_INPUT7;
4783  case 7: return NTV2CROSSPOINT_INPUT8;
4784  }
4785 }
4786 
4788 {
4789  switch(channel)
4790  {
4791  default:
4792  case NTV2CROSSPOINT_INPUT1: return 0;
4793  case NTV2CROSSPOINT_INPUT2: return 1;
4794  case NTV2CROSSPOINT_INPUT3: return 2;
4795  case NTV2CROSSPOINT_INPUT4: return 3;
4796  case NTV2CROSSPOINT_INPUT5: return 4;
4797  case NTV2CROSSPOINT_INPUT6: return 5;
4798  case NTV2CROSSPOINT_INPUT7: return 6;
4799  case NTV2CROSSPOINT_INPUT8: return 7;
4800  }
4801 }
4802 
4804 {
4805  switch(index)
4806  {
4807  default:
4808  case 0: return NTV2CROSSPOINT_CHANNEL1;
4809  case 1: return NTV2CROSSPOINT_CHANNEL2;
4810  case 2: return NTV2CROSSPOINT_CHANNEL3;
4811  case 3: return NTV2CROSSPOINT_CHANNEL4;
4812  case 4: return NTV2CROSSPOINT_INPUT1;
4813  case 5: return NTV2CROSSPOINT_INPUT2;
4814  case 6: return NTV2CROSSPOINT_INPUT3;
4815  case 7: return NTV2CROSSPOINT_INPUT4;
4816  case 8: return NTV2CROSSPOINT_CHANNEL5;
4817  case 9: return NTV2CROSSPOINT_CHANNEL6;
4818  case 10:return NTV2CROSSPOINT_CHANNEL7;
4819  case 11:return NTV2CROSSPOINT_CHANNEL8;
4820  case 12:return NTV2CROSSPOINT_INPUT5;
4821  case 13:return NTV2CROSSPOINT_INPUT6;
4822  case 14:return NTV2CROSSPOINT_INPUT7;
4823  case 15:return NTV2CROSSPOINT_INPUT8;
4824  }
4825 }
4826 
4828 {
4829  switch(channel)
4830  {
4831  default:
4832  case NTV2CROSSPOINT_CHANNEL1: return 0;
4833  case NTV2CROSSPOINT_CHANNEL2: return 1;
4834  case NTV2CROSSPOINT_CHANNEL3: return 2;
4835  case NTV2CROSSPOINT_CHANNEL4: return 3;
4836  case NTV2CROSSPOINT_INPUT1: return 4;
4837  case NTV2CROSSPOINT_INPUT2: return 5;
4838  case NTV2CROSSPOINT_INPUT3: return 6;
4839  case NTV2CROSSPOINT_INPUT4: return 7;
4840  case NTV2CROSSPOINT_CHANNEL5: return 8;
4841  case NTV2CROSSPOINT_CHANNEL6: return 9;
4842  case NTV2CROSSPOINT_CHANNEL7: return 10;
4843  case NTV2CROSSPOINT_CHANNEL8: return 11;
4844  case NTV2CROSSPOINT_INPUT5: return 12;
4845  case NTV2CROSSPOINT_INPUT6: return 13;
4846  case NTV2CROSSPOINT_INPUT7: return 14;
4847  case NTV2CROSSPOINT_INPUT8: return 15;
4848  }
4849 }
4850 
4851 
4853 {
4854  return NTV2_IS_INPUT_CROSSPOINT(inChannel);
4855 }
4856 
4857 
4859 {
4860  return NTV2_IS_OUTPUT_CROSSPOINT(inChannel);
4861 }
4862 
4863 
4865 {
4868  return static_cast<NTV2EmbeddedAudioInput>(inChannel);
4869 }
4870 
4871 
4873 {
4876  return static_cast<NTV2AudioSystem>(inChannel);
4877 }
4878 
4879 
4881 {
4882  static const NTV2EmbeddedAudioInput gInputSourceToEmbeddedAudioInputs [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_MAX_NUM_EmbeddedAudioInputs,
4883  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_1,
4884  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_2,
4885  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_3,
4886  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_4,
4887  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_1,
4888  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_2,
4889  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_3,
4890  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_4,
4891  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_5,
4892  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_6,
4893  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_7,
4894  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_EMBEDDED_AUDIO_INPUT_VIDEO_8,
4895  /* NTV2_INPUTSOURCE_INVALID */ NTV2_MAX_NUM_EmbeddedAudioInputs};
4896  if (inInputSource < NTV2_NUM_INPUTSOURCES && inInputSource < NTV2InputSource(sizeof(gInputSourceToEmbeddedAudioInputs) / sizeof(NTV2EmbeddedAudioInput)))
4897  return gInputSourceToEmbeddedAudioInputs [inInputSource];
4898  else
4900 
4901 } // InputSourceToEmbeddedAudioInput
4902 
4903 
4905 {
4906  if (!NTV2_IS_VALID_INPUT_SOURCE (inInputSource))
4908  if (NTV2_INPUT_SOURCE_IS_SDI (inInputSource))
4909  return NTV2_AUDIO_EMBEDDED;
4910  else if (NTV2_INPUT_SOURCE_IS_HDMI (inInputSource))
4911  return NTV2_AUDIO_HDMI;
4912  else if (NTV2_INPUT_SOURCE_IS_ANALOG (inInputSource))
4913  return NTV2_AUDIO_ANALOG;
4915 }
4916 
4917 
4919 {
4922  if (NTV2_IS_VALID_CHANNEL (inChannel))
4923  return gChannelToInputChannelSpec [inChannel];
4924  else
4925  return NTV2CROSSPOINT_INVALID;
4926 }
4927 
4928 
4930 {
4933  if (inChannel >= NTV2_CHANNEL1 && inChannel < NTV2_MAX_NUM_CHANNELS)
4934  return gChannelToOutputChannelSpec [inChannel];
4935  else
4936  return NTV2CROSSPOINT_INVALID;
4937 }
4938 
4939 
4941 {
4943  if (NTV2_IS_VALID_CHANNEL (inChannel))
4944  return gChannelToInputInterrupt [inChannel];
4945  else
4946  return eNumInterruptTypes;
4947 }
4948 
4949 
4951 {
4953  if (NTV2_IS_VALID_CHANNEL (inChannel))
4954  return gChannelToOutputInterrupt [inChannel];
4955  else
4956  return eNumInterruptTypes;
4957 }
4958 
4959 
4963 
4964 
4965 NTV2TCIndex NTV2ChannelToTimecodeIndex (const NTV2Channel inChannel, const bool inEmbeddedLTC, const bool inIsF2)
4966 {
4967  if (NTV2_IS_VALID_CHANNEL(inChannel))
4968  return inEmbeddedLTC ? gChanATCLTC[inChannel] : (inIsF2 ? gChanVITC2[inChannel] : gChanVITC1[inChannel]);
4969  return NTV2_TCINDEX_INVALID;
4970 }
4971 
4972 
4974 {
4975  NTV2TCIndexes result;
4976  if (NTV2_IS_VALID_CHANNEL(inSDI))
4977  {result.insert(gChanVITC1[inSDI]); result.insert(gChanVITC2[inSDI]); result.insert(gChanATCLTC[inSDI]);}
4978  return result;
4979 }
4980 
4981 
4983 {
4987  return NTV2_IS_VALID_TIMECODE_INDEX (inTCIndex) ? gTCIndexToChannel [inTCIndex] : NTV2_CHANNEL_INVALID;
4988 }
4989 
4990 
4992 {
4998  return NTV2_IS_VALID_TIMECODE_INDEX (inTCIndex) ? gTCIndexToInputSource [inTCIndex] : NTV2_INPUTSOURCE_INVALID;
4999 }
5000 
5001 
5003 {
5004  static const NTV2Crosspoint gInputSourceToChannelSpec [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2CROSSPOINT_INPUT1,
5005  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2CROSSPOINT_INPUT1,
5006  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2CROSSPOINT_INPUT2,
5007  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2CROSSPOINT_INPUT3,
5008  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2CROSSPOINT_INPUT4,
5009  /* NTV2_INPUTSOURCE_SDI1 */ NTV2CROSSPOINT_INPUT1,
5010  /* NTV2_INPUTSOURCE_SDI2 */ NTV2CROSSPOINT_INPUT2,
5011  /* NTV2_INPUTSOURCE_SDI3 */ NTV2CROSSPOINT_INPUT3,
5012  /* NTV2_INPUTSOURCE_SDI4 */ NTV2CROSSPOINT_INPUT4,
5013  /* NTV2_INPUTSOURCE_SDI5 */ NTV2CROSSPOINT_INPUT5,
5014  /* NTV2_INPUTSOURCE_SDI6 */ NTV2CROSSPOINT_INPUT6,
5015  /* NTV2_INPUTSOURCE_SDI7 */ NTV2CROSSPOINT_INPUT7,
5016  /* NTV2_INPUTSOURCE_SDI8 */ NTV2CROSSPOINT_INPUT8,
5017  /* NTV2_NUM_INPUTSOURCES */ NTV2_NUM_CROSSPOINTS};
5018  if (inInputSource < NTV2_NUM_INPUTSOURCES && size_t (inInputSource) < sizeof (gInputSourceToChannelSpec) / sizeof (NTV2Channel))
5019  return gInputSourceToChannelSpec [inInputSource];
5020  else
5021  return NTV2_NUM_CROSSPOINTS;
5022 
5023 } // NTV2InputSourceToChannelSpec
5024 
5025 
5027 {
5028  static const NTV2ReferenceSource gInputSourceToReferenceSource [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_REFERENCE_ANALOG_INPUT1,
5029  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_REFERENCE_HDMI_INPUT1,
5030  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_REFERENCE_HDMI_INPUT2,
5031  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_REFERENCE_HDMI_INPUT3,
5032  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_REFERENCE_HDMI_INPUT4,
5033  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_REFERENCE_INPUT1,
5034  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_REFERENCE_INPUT2,
5035  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_REFERENCE_INPUT3,
5036  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_REFERENCE_INPUT4,
5037  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_REFERENCE_INPUT5,
5038  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_REFERENCE_INPUT6,
5039  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_REFERENCE_INPUT7,
5040  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_REFERENCE_INPUT8,
5041  /* NTV2_NUM_INPUTSOURCES */ NTV2_NUM_REFERENCE_INPUTS};
5042  if (NTV2_IS_VALID_INPUT_SOURCE (inInputSource) && size_t (inInputSource) < sizeof (gInputSourceToReferenceSource) / sizeof (NTV2ReferenceSource))
5043  return gInputSourceToReferenceSource [inInputSource];
5044  else
5045  return NTV2_REFERENCE_INVALID;
5046 
5047 } // NTV2InputSourceToReferenceSource
5048 
5049 
5051 {
5052  static const NTV2Channel gInputSourceToChannel [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_CHANNEL1,
5053  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_CHANNEL1,
5054  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_CHANNEL2,
5055  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_CHANNEL3,
5056  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_CHANNEL4,
5057  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_CHANNEL1,
5058  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_CHANNEL2,
5059  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_CHANNEL3,
5060  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_CHANNEL4,
5061  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_CHANNEL5,
5062  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_CHANNEL6,
5063  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_CHANNEL7,
5064  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_CHANNEL8,
5065  /* NTV2_NUM_INPUTSOURCES */ NTV2_CHANNEL_INVALID};
5066  if (inInputSource < NTV2_NUM_INPUTSOURCES && size_t (inInputSource) < sizeof (gInputSourceToChannel) / sizeof (NTV2Channel))
5067  return gInputSourceToChannel [inInputSource];
5068  else
5069  return NTV2_MAX_NUM_CHANNELS;
5070 
5071 } // NTV2InputSourceToChannel
5072 
5073 
5075 {
5076  static const NTV2AudioSystem gInputSourceToAudioSystem [] = { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_AUDIOSYSTEM_1,
5077  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_AUDIOSYSTEM_1,
5078  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_AUDIOSYSTEM_2,
5079  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_AUDIOSYSTEM_3,
5080  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_AUDIOSYSTEM_4,
5081  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_AUDIOSYSTEM_1,
5082  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_AUDIOSYSTEM_2,
5083  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_AUDIOSYSTEM_3,
5084  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_AUDIOSYSTEM_4,
5085  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_AUDIOSYSTEM_5,
5086  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_AUDIOSYSTEM_6,
5087  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_AUDIOSYSTEM_7,
5088  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_AUDIOSYSTEM_8,
5089  /* NTV2_NUM_INPUTSOURCES */ NTV2_NUM_AUDIOSYSTEMS};
5090  if (inInputSource < NTV2_NUM_INPUTSOURCES && inInputSource < NTV2InputSource(sizeof(gInputSourceToAudioSystem) / sizeof(NTV2AudioSystem)))
5091  return gInputSourceToAudioSystem [inInputSource];
5092  else
5093  return NTV2_AUDIOSYSTEM_INVALID;
5094 
5095 } // NTV2InputSourceToAudioSystem
5096 
5097 
5098 NTV2TimecodeIndex NTV2InputSourceToTimecodeIndex (const NTV2InputSource inInputSource, const bool inEmbeddedLTC)
5099 {
5100  static const NTV2TimecodeIndex gInputSourceToTCIndex []= { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_TCINDEX_LTC1,
5101  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_TCINDEX_INVALID,
5102  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_TCINDEX_INVALID,
5103  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_TCINDEX_INVALID,
5104  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_TCINDEX_INVALID,
5105  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_TCINDEX_SDI1,
5106  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_TCINDEX_SDI2,
5107  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_TCINDEX_SDI3,
5108  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_TCINDEX_SDI4,
5109  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_TCINDEX_SDI5,
5110  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_TCINDEX_SDI6,
5111  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_TCINDEX_SDI7,
5112  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_TCINDEX_SDI8,
5113  /* NTV2_NUM_INPUTSOURCES */ NTV2_TCINDEX_INVALID};
5114  static const NTV2TimecodeIndex gInputSourceToLTCIndex []= { /* NTV2_INPUTSOURCE_ANALOG1 */ NTV2_TCINDEX_LTC1,
5115  /* NTV2_INPUTSOURCE_HDMI1 */ NTV2_TCINDEX_INVALID,
5116  /* NTV2_INPUTSOURCE_HDMI2 */ NTV2_TCINDEX_INVALID,
5117  /* NTV2_INPUTSOURCE_HDMI3 */ NTV2_TCINDEX_INVALID,
5118  /* NTV2_INPUTSOURCE_HDMI4 */ NTV2_TCINDEX_INVALID,
5119  /* NTV2_INPUTSOURCE_SDI1 */ NTV2_TCINDEX_SDI1_LTC,
5120  /* NTV2_INPUTSOURCE_SDI2 */ NTV2_TCINDEX_SDI2_LTC,
5121  /* NTV2_INPUTSOURCE_SDI3 */ NTV2_TCINDEX_SDI3_LTC,
5122  /* NTV2_INPUTSOURCE_SDI4 */ NTV2_TCINDEX_SDI4_LTC,
5123  /* NTV2_INPUTSOURCE_SDI5 */ NTV2_TCINDEX_SDI5_LTC,
5124  /* NTV2_INPUTSOURCE_SDI6 */ NTV2_TCINDEX_SDI6_LTC,
5125  /* NTV2_INPUTSOURCE_SDI7 */ NTV2_TCINDEX_SDI7_LTC,
5126  /* NTV2_INPUTSOURCE_SDI8 */ NTV2_TCINDEX_SDI8_LTC,
5127  /* NTV2_NUM_INPUTSOURCES */ NTV2_TCINDEX_INVALID};
5128  if (inInputSource < NTV2_NUM_INPUTSOURCES && size_t (inInputSource) < sizeof (gInputSourceToTCIndex) / sizeof (NTV2TimecodeIndex))
5129  return inEmbeddedLTC ? gInputSourceToLTCIndex [inInputSource] : gInputSourceToTCIndex [inInputSource];
5130  else
5131  return NTV2_TCINDEX_INVALID;
5132 }
5133 
5134 
5136 {
5146  if (NTV2_IS_VALID_CHANNEL(inChannel))
5147  switch (inSourceType)
5148  {
5149  case NTV2_IOKINDS_SDI: return gChannelToSDIInputSource[inChannel];
5150  case NTV2_IOKINDS_HDMI: return gChannelToHDMIInputSource[inChannel];
5151  case NTV2_IOKINDS_ANALOG: return gChannelToAnlgInputSource[inChannel];
5152  default: break;
5153  }
5154  return NTV2_INPUTSOURCE_INVALID;
5155 }
5156 
5157 
5159 {
5160  if (!NTV2_IS_VALID_OUTPUT_DEST (inOutputDest))
5161  return NTV2_CHANNEL_INVALID;
5162 
5163  static const NTV2Channel gOutputDestToChannel [] = { NTV2_CHANNEL1, NTV2_CHANNEL1,
5166  return gOutputDestToChannel [inOutputDest];
5167 }
5168 
5169 
5171 {
5172  if (!NTV2_IS_VALID_CHANNEL(inChannel))
5174  if (!NTV2_IS_VALID_IOKINDS(inKinds))
5177  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5179  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5181  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5182  if ((inKinds & NTV2_IOKINDS_ALL) == NTV2_IOKINDS_ALL)
5183  return NTV2_OUTPUTDESTINATION_INVALID; // Ambiguous request
5184  if ((inKinds & NTV2_IOKINDS_HDMI) == NTV2_IOKINDS_HDMI)
5186  if ((inKinds & NTV2_IOKINDS_ANALOG) == NTV2_IOKINDS_ANALOG)
5188 
5192  return gChannelToOutputDest [inChannel];
5193 }
5194 
5195 
5196 // if formats are transport equivalent (e.g. 1080i30 / 1080psf30) return the target version of the format
5198 {
5199  // compatible return target version
5200  if (::IsTransportCompatibleFormat (inFormat, inTargetFormat))
5201  return inTargetFormat;
5202 
5203  // not compatible, return original format
5204  return inFormat;
5205 }
5206 
5207 
5208 // determine if 2 formats are transport compatible (e.g. 1080i30 / 1080psf30)
5209 bool IsTransportCompatibleFormat (const NTV2VideoFormat inFormat1, const NTV2VideoFormat inFormat2)
5210 {
5211  if (inFormat1 == inFormat2)
5212  return true;
5213 
5214  switch (inFormat1)
5215  {
5216  case NTV2_FORMAT_1080i_5000: return inFormat2 == NTV2_FORMAT_1080psf_2500_2;
5217  case NTV2_FORMAT_1080i_5994: return inFormat2 == NTV2_FORMAT_1080psf_2997_2;
5218  case NTV2_FORMAT_1080i_6000: return inFormat2 == NTV2_FORMAT_1080psf_3000_2;
5219  case NTV2_FORMAT_1080psf_2500_2: return inFormat2 == NTV2_FORMAT_1080i_5000;
5220  case NTV2_FORMAT_1080psf_2997_2: return inFormat2 == NTV2_FORMAT_1080i_5994;
5221  case NTV2_FORMAT_1080psf_3000_2: return inFormat2 == NTV2_FORMAT_1080i_6000;
5222  default: return false;
5223  }
5224 }
5225 
5226 
5228 {
5232  static const NTV2InputSource sANLGInputSources[] = { NTV2_INPUTSOURCE_ANALOG1 };
5233  switch (inKinds)
5234  {
5235  case NTV2_IOKINDS_SDI:
5236  if (inIndex0 < sizeof(sSDIInputSources) / sizeof(NTV2InputSource))
5237  return sSDIInputSources[inIndex0];
5238  break;
5239  case NTV2_IOKINDS_HDMI:
5240  if (inIndex0 < sizeof(sHDMIInputSources) / sizeof(NTV2InputSource))
5241  return sHDMIInputSources[inIndex0];
5242  break;
5243  case NTV2_IOKINDS_ANALOG:
5244  if (inIndex0 < sizeof(sANLGInputSources) / sizeof(NTV2InputSource))
5245  return sANLGInputSources[inIndex0];
5246  break;
5247  #if defined(_DEBUG)
5248  case NTV2_IOKINDS_NONE:
5249  case NTV2_IOKINDS_ALL:
5250  break;
5251  #else
5252  default: break;
5253  #endif
5254  }
5255  return NTV2_INPUTSOURCE_INVALID;
5256 }
5257 
5258 
5260 {
5261  if (NTV2_INPUT_SOURCE_IS_SDI(inSrc))
5262  return NTV2_IOKINDS_SDI;
5263  if (NTV2_INPUT_SOURCE_IS_HDMI(inSrc))
5264  return NTV2_IOKINDS_HDMI;
5265  if (NTV2_INPUT_SOURCE_IS_ANALOG(inSrc))
5266  return NTV2_IOKINDS_ANALOG;
5267  return NTV2_IOKINDS_NONE;
5268 }
5269 
5270 
5271 NTV2InputSource GetNTV2HDMIInputSourceForIndex (const ULWord inIndex0) // NTV2_SHOULD_BE_DEPRECATED
5272 {
5274 }
5275 
5276 
5278 {
5279  static const ULWord sInputSourcesIndexes [] = { 0, // NTV2_INPUTSOURCE_ANALOG1,
5280  0, 1, 2, 3, // NTV2_INPUTSOURCE_HDMI1 ... NTV2_INPUTSOURCE_HDMI4,
5281  0, 1, 2, 3, 4, 5, 6, 7 }; // NTV2_INPUTSOURCE_SDI1 ... NTV2_INPUTSOURCE_SDI8
5282  if (size_t(inValue) < sizeof(sInputSourcesIndexes) / sizeof(ULWord))
5283  return sInputSourcesIndexes [inValue];
5284  else
5285  return 0xFFFFFFFF;
5286 
5287 } // GetIndexForNTV2InputSource
5288 
5289 
5291 {
5292  static const ULWord gFrameSizeToByteCount[] = { 2 /* NTV2_FRAMESIZE_2MB */, 4 /* NTV2_FRAMESIZE_4MB */, 8 /* NTV2_FRAMESIZE_8MB */, 16 /* NTV2_FRAMESIZE_16MB */,
5293  6 /* NTV2_FRAMESIZE_6MB */, 10 /* NTV2_FRAMESIZE_10MB */, 12 /* NTV2_FRAMESIZE_12MB */, 14 /* NTV2_FRAMESIZE_14MB */,
5294  18 /* NTV2_FRAMESIZE_18MB */, 20 /* NTV2_FRAMESIZE_20MB */, 22 /* NTV2_FRAMESIZE_22MB */, 24 /* NTV2_FRAMESIZE_24MB */,
5295  26 /* NTV2_FRAMESIZE_26MB */, 28 /* NTV2_FRAMESIZE_28MB */, 30 /* NTV2_FRAMESIZE_30MB */, 32 /* NTV2_FRAMESIZE_32MB */,
5296  0 };
5297  if (inFrameSize < NTV2_MAX_NUM_Framesizes && inFrameSize < NTV2Framesize(sizeof(gFrameSizeToByteCount) / sizeof(ULWord)))
5298  return gFrameSizeToByteCount [inFrameSize] * 1024 * 1024;
5299  else
5300  return 0;
5301 
5302 } // NTV2FramesizeToByteCount
5303 
5304 
5306 { // STANDARD BIG MEDIUM BIGGER INVALID
5307  static const ULWord gBufferSizeToByteCount[] = { 1 * 1024*1024, 4 * 1024*1024, 2 * 1024*1024, 3 * 1024*1024, 0 };
5308  if (NTV2_IS_VALID_AUDIO_BUFFER_SIZE(inBufferSize))
5309  return gBufferSizeToByteCount[inBufferSize];
5310  return 0;
5311 }
5312 
5313 typedef std::set<NTV2FrameRate> NTV2FrameRates;
5314 typedef NTV2FrameRates::const_iterator NTV2FrameRatesConstIter;
5315 typedef std::vector<NTV2FrameRates> NTV2FrameRateFamilies;
5316 typedef NTV2FrameRateFamilies::const_iterator NTV2FrameRateFamiliesConstIter;
5317 
5320 
5321 
5323 {
5324  if (!sFRFamMutex.IsValid())
5325  return false;
5326 
5327  AJAAutoLock autoLock (&sFRFamMutex);
5328  if (sFRFamilies.empty())
5329  {
5330  NTV2FrameRates FR1498, FR1500, FR2398, FR2400, FR2500;
5331  FR1498.insert(NTV2_FRAMERATE_1498); FR1498.insert(NTV2_FRAMERATE_2997); FR1498.insert(NTV2_FRAMERATE_5994); FR1498.insert(NTV2_FRAMERATE_11988);
5332  sFRFamilies.push_back(FR1498);
5333  FR1500.insert(NTV2_FRAMERATE_1500); FR1500.insert(NTV2_FRAMERATE_3000); FR1500.insert(NTV2_FRAMERATE_6000); FR1500.insert(NTV2_FRAMERATE_12000);
5334  sFRFamilies.push_back(FR1500);
5335  FR2398.insert(NTV2_FRAMERATE_2398); FR2398.insert(NTV2_FRAMERATE_4795);
5336  sFRFamilies.push_back(FR2398);
5337  FR2400.insert(NTV2_FRAMERATE_2400); FR2400.insert(NTV2_FRAMERATE_4800);
5338  sFRFamilies.push_back(FR2400);
5339  FR2500.insert(NTV2_FRAMERATE_2500); FR2500.insert(NTV2_FRAMERATE_5000);
5340  sFRFamilies.push_back(FR2500);
5341  }
5342  return !sFRFamilies.empty();
5343 }
5344 
5345 
5347 {
5349  for (NTV2FrameRateFamiliesConstIter it(sFRFamilies.begin()); it != sFRFamilies.end(); ++it)
5350  {
5351  const NTV2FrameRates & family (*it);
5352  NTV2FrameRatesConstIter iter(family.find(inFrameRate));
5353  if (iter != family.end())
5354  return *(family.begin());
5355  }
5356  return NTV2_FRAMERATE_INVALID;
5357 }
5358 
5359 
5360 bool IsMultiFormatCompatible (const NTV2FrameRate inFrameRate1, const NTV2FrameRate inFrameRate2)
5361 {
5362  if (inFrameRate1 == inFrameRate2)
5363  return true;
5364 
5365  if (!NTV2_IS_SUPPORTED_NTV2FrameRate(inFrameRate1) || !NTV2_IS_SUPPORTED_NTV2FrameRate(inFrameRate2))
5366  return false;
5367 
5368  const NTV2FrameRate frFamily1 (GetFrameRateFamily(inFrameRate1));
5369  const NTV2FrameRate frFamily2 (GetFrameRateFamily(inFrameRate2));
5370 
5372  return false; // Probably uninitialized
5373 
5374  return frFamily1 == frFamily2;
5375 
5376 } // IsMultiFormatCompatible (NTV2FrameRate)
5377 
5378 
5379 AJAExport bool IsMultiFormatCompatible (const NTV2VideoFormat inFormat1, const NTV2VideoFormat inFormat2)
5380 {
5381  if (inFormat1 == NTV2_FORMAT_UNKNOWN || inFormat2 == NTV2_FORMAT_UNKNOWN)
5382  return false;
5384 
5385 } // IsMultiFormatCompatible (NTV2VideoFormat)
5386 
5387 
5388 AJAExport bool IsPSF (const NTV2VideoFormat format)
5389 {
5390  return NTV2_IS_PSF_VIDEO_FORMAT(format);
5391 }
5392 
5393 
5395 {
5397 }
5398 
5399 
5401 {
5402  NTV2Standard standard (::GetNTV2StandardFromVideoFormat(format));
5403  return IsProgressiveTransport(standard);
5404 }
5405 
5406 
5408 {
5409  return NTV2_IS_PROGRESSIVE_STANDARD(standard);
5410 }
5411 
5412 
5414 {
5415  return NTV2_IS_FBF_RGB(format);
5416 }
5417 
5418 
5420 {
5421  return !NTV2_IS_FBF_RGB(format); // works for now
5422 }
5423 
5424 
5426 {
5427  return NTV2_FBF_HAS_ALPHA(format);
5428 }
5429 
5430 
5432 {
5433  return NTV2_IS_2K_1080_VIDEO_FORMAT(format) || NTV2_IS_2K_VIDEO_FORMAT(format);
5434 }
5435 
5436 
5438 {
5440 }
5441 
5442 
5444 {
5445  return NTV2_IS_QUAD_QUAD_FORMAT(format);
5446 }
5447 
5448 
5449 AJAExport bool IsRaw (const NTV2FrameBufferFormat frameBufferFormat)
5450 {
5451  return NTV2_FBF_IS_RAW(frameBufferFormat);
5452 }
5453 
5454 
5456 {
5457  return NTV2_IS_FBF_8BIT(format);
5458 }
5459 
5460 
5462 {
5463  return NTV2_VIDEO_FORMAT_IS_A(format);
5464 }
5465 
5466 
5468 {
5469  return NTV2_IS_3Gb_FORMAT(format);
5470 }
5471 
5473 {
5474  return NTV2_VIDEO_FORMAT_IS_J2K_SUPPORTED(format);
5475 }
5476 
5477 
5479 {
5481 
5482  switch( inFormat )
5483  {
5484  case NTV2_FORMAT_720p_5994:
5485  if ( outFormat == NTV2_FORMAT_525_5994 )
5486  cMode = NTV2_720p_5994to525_5994;
5487  else if ( outFormat == NTV2_FORMAT_1080i_5994)
5489  else if ( outFormat == NTV2_FORMAT_1080psf_2997_2)
5491  break;
5492 
5493  case NTV2_FORMAT_720p_5000:
5494  if ( outFormat == NTV2_FORMAT_625_5000 )
5495  cMode = NTV2_720p_5000to625_2500;
5496  else if ( outFormat == NTV2_FORMAT_1080i_5000) // NTV2_FORMAT_1080psf_2500
5498  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2)
5500  break;
5501 
5502  case NTV2_FORMAT_525_2398:
5503  if ( outFormat == NTV2_FORMAT_1080psf_2398 )
5504  cMode = NTV2_525_2398to1080i_2398;
5505  break;
5506 
5507  case NTV2_FORMAT_525_5994:
5508  if ( outFormat == NTV2_FORMAT_1080i_5994 )
5509  cMode = NTV2_525_5994to1080i_5994;
5510  else if (outFormat == NTV2_FORMAT_1080psf_2997_2)
5511  cMode = NTV2_525_5994to1080i_5994;
5512  else if ( outFormat == NTV2_FORMAT_720p_5994 )
5513  cMode = NTV2_525_5994to720p_5994;
5514  else if ( outFormat == NTV2_FORMAT_525_5994 )
5515  cMode = NTV2_525_5994to525_5994;
5516  else if ( outFormat == NTV2_FORMAT_525psf_2997 )
5518  break;
5519 
5520  case NTV2_FORMAT_625_5000:
5521  if ( outFormat == NTV2_FORMAT_1080i_5000) // NTV2_FORMAT_1080psf_2500
5522  cMode = NTV2_625_2500to1080i_2500;
5523  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2)
5524  cMode = NTV2_625_2500to1080i_2500;
5525  else if ( outFormat == NTV2_FORMAT_720p_5000 )
5526  cMode = NTV2_625_2500to720p_5000;
5527  else if ( outFormat == NTV2_FORMAT_625_5000 )
5528  cMode = NTV2_625_2500to625_2500;
5529  else if ( outFormat == NTV2_FORMAT_625psf_2500 )
5531  break;
5532 
5533  case NTV2_FORMAT_720p_6000:
5534  if ( outFormat == NTV2_FORMAT_1080i_6000) // NTV2_FORMAT_1080psf_3000
5536  else if (outFormat == NTV2_FORMAT_1080psf_3000_2 )
5538  break;
5539 
5541  if ( outFormat == NTV2_FORMAT_525_2398 )
5542  cMode = NTV2_1080i2398to525_2398;
5543  else if ( outFormat == NTV2_FORMAT_525_5994 )
5544  cMode = NTV2_1080i2398to525_2997;
5545  else if ( outFormat == NTV2_FORMAT_720p_2398 )
5547  else if ( outFormat == NTV2_FORMAT_1080i_5994 )
5549  break;
5550 
5552  if ( outFormat == NTV2_FORMAT_1080i_6000 )
5554  break;
5555 
5557  if ( outFormat == NTV2_FORMAT_625_5000 )
5558  cMode = NTV2_1080i_2500to625_2500;
5559  else if ( outFormat == NTV2_FORMAT_720p_5000 )
5561  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2 )
5563  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2 )
5565  break;
5566 
5568  if ( outFormat == NTV2_FORMAT_1080i_5994 )
5570  break;
5571 
5573  if ( outFormat == NTV2_FORMAT_1080i_6000 )
5575  break;
5576 
5578  if ( outFormat == NTV2_FORMAT_1080i_5000 )
5580  break;
5581 
5583  if ( outFormat == NTV2_FORMAT_625_5000 )
5584  cMode = NTV2_1080i_2500to625_2500;
5585  else if ( outFormat == NTV2_FORMAT_720p_5000 )
5587  else if ( outFormat == NTV2_FORMAT_1080psf_2500_2 )
5589  break;
5590 
5593  if ( outFormat == NTV2_FORMAT_525_5994 )
5594  cMode = NTV2_1080i_5994to525_5994;
5595  else if ( outFormat == NTV2_FORMAT_720p_5994 )
5597  else if ( outFormat == NTV2_FORMAT_1080psf_2997_2 )
5599  break;
5600 
5603  if ( outFormat == NTV2_FORMAT_720p_6000 )
5605  else if ( outFormat == NTV2_FORMAT_1080psf_3000_2 )
5607  break;
5608 
5609  case NTV2_FORMAT_720p_2398:
5610  if ( outFormat == NTV2_FORMAT_1080psf_2398 )
5612  break;
5613 
5615  if ( outFormat == NTV2_FORMAT_720p_6000 )
5617  break;
5618 
5619  default:
5620  break;
5621  }
5622 
5623  return cMode;
5624 }
5625 
5627 {
5628  NTV2VideoFormat inputFormat = NTV2_FORMAT_UNKNOWN;
5629 
5630  switch( conversionMode )
5631  {
5632  case NTV2_525_5994to525_5994: inputFormat = NTV2_FORMAT_525_5994; break;
5633  case NTV2_525_5994to720p_5994: inputFormat = NTV2_FORMAT_525_5994; break;
5634  case NTV2_525_5994to1080i_5994: inputFormat = NTV2_FORMAT_525_5994; break;
5635  case NTV2_525_2398to1080i_2398: inputFormat = NTV2_FORMAT_525_2398; break;
5636  case NTV2_525_5994to525psf_2997: inputFormat = NTV2_FORMAT_525_5994; break;
5637 
5638  case NTV2_625_2500to625_2500: inputFormat = NTV2_FORMAT_625_5000; break;
5639  case NTV2_625_2500to720p_5000: inputFormat = NTV2_FORMAT_625_5000; break;
5640  case NTV2_625_2500to1080i_2500: inputFormat = NTV2_FORMAT_625_5000; break;
5641  case NTV2_625_5000to625psf_2500: inputFormat = NTV2_FORMAT_625_5000; break;
5642 
5643  case NTV2_720p_5000to625_2500: inputFormat = NTV2_FORMAT_720p_5000; break;
5644  case NTV2_720p_5000to1080i_2500: inputFormat = NTV2_FORMAT_720p_5000; break;
5645  case NTV2_720p_5994to525_5994: inputFormat = NTV2_FORMAT_720p_5994; break;
5646  case NTV2_720p_5994to1080i_5994: inputFormat = NTV2_FORMAT_720p_5994; break;
5647  case NTV2_720p_6000to1080i_3000: inputFormat = NTV2_FORMAT_720p_6000; break;
5648  case NTV2_720p_2398to1080i_2398: inputFormat = NTV2_FORMAT_720p_2398; break;
5649 
5650  case NTV2_1080i2398to525_2398: inputFormat = NTV2_FORMAT_1080psf_2398; break;
5651  case NTV2_1080i2398to525_2997: inputFormat = NTV2_FORMAT_1080psf_2398; break;
5652  case NTV2_1080i_2398to720p_2398: inputFormat = NTV2_FORMAT_1080psf_2398; break;
5653 
5654  case NTV2_1080i_2500to625_2500: inputFormat = NTV2_FORMAT_1080i_5000; break;
5655  case NTV2_1080i_2500to720p_5000: inputFormat = NTV2_FORMAT_1080i_5000; break;
5656  case NTV2_1080i_5994to525_5994: inputFormat = NTV2_FORMAT_1080i_5994; break;
5657  case NTV2_1080i_5994to720p_5994: inputFormat = NTV2_FORMAT_1080i_5994; break;
5658  case NTV2_1080i_3000to720p_6000: inputFormat = NTV2_FORMAT_1080i_6000; break;
5659  case NTV2_1080i_5000to1080psf_2500: inputFormat = NTV2_FORMAT_1080i_5000; break;
5660  case NTV2_1080i_5994to1080psf_2997: inputFormat = NTV2_FORMAT_1080i_5994; break;
5661  case NTV2_1080i_6000to1080psf_3000: inputFormat = NTV2_FORMAT_1080i_6000; break;
5662  case NTV2_1080p_3000to720p_6000: inputFormat = NTV2_FORMAT_1080p_3000; break;
5663 
5664  default: inputFormat = NTV2_FORMAT_UNKNOWN; break;
5665  }
5666  return inputFormat;
5667 }
5668 
5669 
5671 {
5672  NTV2VideoFormat outputFormat = NTV2_FORMAT_UNKNOWN;
5673 
5674  switch( conversionMode )
5675  {
5676  case NTV2_525_5994to525_5994: outputFormat = NTV2_FORMAT_525_5994; break;
5677  case NTV2_525_5994to720p_5994: outputFormat = NTV2_FORMAT_720p_5994; break;
5678  case NTV2_525_5994to1080i_5994: outputFormat = NTV2_FORMAT_1080i_5994; break;
5679  case NTV2_525_2398to1080i_2398: outputFormat = NTV2_FORMAT_1080psf_2398; break;
5680  case NTV2_525_5994to525psf_2997: outputFormat = NTV2_FORMAT_525psf_2997; break;
5681 
5682  case NTV2_625_2500to625_2500: outputFormat = NTV2_FORMAT_625_5000; break;
5683  case NTV2_625_2500to720p_5000: outputFormat = NTV2_FORMAT_720p_5000; break;
5684  case NTV2_625_2500to1080i_2500: outputFormat = NTV2_FORMAT_1080i_5000; break;
5685  case NTV2_625_5000to625psf_2500: outputFormat = NTV2_FORMAT_625psf_2500; break;
5686 
5687  case NTV2_720p_5000to625_2500: outputFormat = NTV2_FORMAT_625_5000; break;
5688  case NTV2_720p_5000to1080i_2500: outputFormat = NTV2_FORMAT_1080i_5000; break;
5689  case NTV2_720p_5994to525_5994: outputFormat = NTV2_FORMAT_525_5994; break;
5690  case NTV2_720p_5994to1080i_5994: outputFormat = NTV2_FORMAT_1080i_5994; break;
5691  case NTV2_720p_6000to1080i_3000: outputFormat = NTV2_FORMAT_1080i_6000; break;
5692  case NTV2_720p_2398to1080i_2398: outputFormat = NTV2_FORMAT_1080psf_2398; break;
5693 
5694  case NTV2_1080i2398to525_2398: outputFormat = NTV2_FORMAT_525_2398; break;
5695  case NTV2_1080i2398to525_2997: outputFormat = NTV2_FORMAT_525_5994; break;
5696  case NTV2_1080i_2398to720p_2398: outputFormat = NTV2_FORMAT_720p_2398; break;
5697  //case NTV2_1080i2400to525_2400: outputFormat = NTV2_FORMAT_525_2400; break;
5698 
5699  //case NTV2_1080p2398to525_2398: outputFormat = NTV2_FORMAT_525_2398; break;
5700  //case NTV2_1080p2398to525_2997: outputFormat = NTV2_FORMAT_525_5994; break;
5701  //case NTV2_1080p2400to525_2400: outputFormat = NTV2_FORMAT_525_2400; break;
5702 
5703  case NTV2_1080i_2500to625_2500: outputFormat = NTV2_FORMAT_625_5000; break;
5704  case NTV2_1080i_2500to720p_5000: outputFormat = NTV2_FORMAT_720p_5000; break;
5705  case NTV2_1080i_5994to525_5994: outputFormat = NTV2_FORMAT_525_5994; break;
5706  case NTV2_1080i_5994to720p_5994: outputFormat = NTV2_FORMAT_720p_5994; break;
5707  case NTV2_1080i_3000to720p_6000: outputFormat = NTV2_FORMAT_720p_6000; break;
5708  case NTV2_1080i_5000to1080psf_2500: outputFormat = NTV2_FORMAT_1080psf_2500_2; break;
5709  case NTV2_1080i_5994to1080psf_2997: outputFormat = NTV2_FORMAT_1080psf_2997_2; break;
5710  case NTV2_1080i_6000to1080psf_3000: outputFormat = NTV2_FORMAT_1080psf_3000_2; break;
5711  case NTV2_1080p_3000to720p_6000: outputFormat = NTV2_FORMAT_720p_6000; break;
5712  default: outputFormat = NTV2_FORMAT_UNKNOWN; break;
5713  }
5714  return outputFormat;
5715 }
5716 
5717 
5718 ostream & operator << (ostream & inOutStream, const NTV2FrameSize & inFrameDimensions)
5719 {
5720  return inOutStream << inFrameDimensions.width() << "Wx" << inFrameDimensions.height() << "H";
5721 }
5722 
5723 
5724 ostream & operator << (ostream & inOutStream, const NTV2SmpteLineNumber & inSmpteLineNumber)
5725 {
5726  return inSmpteLineNumber.Print (inOutStream);
5727 }
5728 
5729 
5730 string NTV2ChannelToString (const NTV2Channel inValue, const bool inForRetailDisplay)
5731 {
5732  switch (inValue)
5733  {
5734  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch1", NTV2_CHANNEL1);
5735  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch2", NTV2_CHANNEL2);
5736  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch3", NTV2_CHANNEL3);
5737  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch4", NTV2_CHANNEL4);
5738  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch5", NTV2_CHANNEL5);
5739  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch6", NTV2_CHANNEL6);
5740  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch7", NTV2_CHANNEL7);
5741  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Ch8", NTV2_CHANNEL8);
5743  }
5744  return "";
5745 }
5746 
5747 
5748 string NTV2AudioSystemToString (const NTV2AudioSystem inValue, const bool inCompactDisplay)
5749 {
5750  ostringstream oss;
5751  if (NTV2_IS_VALID_AUDIO_SYSTEM(inValue))
5752  oss << (inCompactDisplay ? "AudSys" : "NTV2_AUDIOSYSTEM_") << (inValue + 1);
5753  else
5754  oss << (inCompactDisplay ? "NoAudio" : "NTV2_AUDIOSYSTEM_INVALID");
5755  return oss.str();
5756 }
5757 
5758 
5759 string NTV2AudioRateToString (const NTV2AudioRate inValue, const bool inForRetailDisplay)
5760 {
5761  switch (inValue)
5762  {
5763  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "48 kHz", NTV2_AUDIO_48K);
5764  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "96 kHz", NTV2_AUDIO_96K);
5765  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "192 kHz", NTV2_AUDIO_192K);
5767  }
5768  return "";
5769 }
5770 
5771 
5772 string NTV2AudioBufferSizeToString (const NTV2AudioBufferSize inValue, const bool inForRetailDisplay)
5773 {
5774  switch (inValue)
5775  {
5779  }
5780  return "";
5781 }
5782 
5783 
5784 string NTV2AudioLoopBackToString (const NTV2AudioLoopBack inValue, const bool inForRetailDisplay)
5785 {
5786  switch (inValue)
5787  {
5790  case NTV2_AUDIO_LOOPBACK_INVALID: break; //special case
5791  }
5792  return "???";
5793 }
5794 
5795 
5796 string NTV2EmbeddedAudioClockToString (const NTV2EmbeddedAudioClock inValue, const bool inForRetailDisplay)
5797 {
5798  switch (inValue)
5799  {
5800  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "from device reference", NTV2_EMBEDDED_AUDIO_CLOCK_REFERENCE);
5803  }
5804  return "???";
5805 }
5806 
5807 
5808 string NTV2CrosspointToString (const NTV2Crosspoint inChannel)
5809 {
5810  std::ostringstream oss;
5811  oss << (::IsNTV2CrosspointInput(inChannel) ? "Capture " : "Playout ")
5812  << (::IsNTV2CrosspointInput(inChannel) ? ::GetIndexForNTV2CrosspointInput(inChannel) : ::GetIndexForNTV2CrosspointChannel(inChannel)) + 1;
5813  return oss.str ();
5814 }
5815 
5816 
5817 string NTV2InputCrosspointIDToString (const NTV2InputCrosspointID inValue, const bool inForRetailDisplay)
5818 {
5819  switch (inValue)
5820  {
5837  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Vid", NTV2_XptCSC1VidInput);
5838  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Key", NTV2_XptCSC1KeyInput);
5839  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Vid", NTV2_XptCSC2VidInput);
5840  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Key", NTV2_XptCSC2KeyInput);
5841  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Vid", NTV2_XptCSC3VidInput);
5842  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Key", NTV2_XptCSC3KeyInput);
5843  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Vid", NTV2_XptCSC4VidInput);
5844  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Key", NTV2_XptCSC4KeyInput);
5845  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Vid", NTV2_XptCSC5VidInput);
5846  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Key", NTV2_XptCSC5KeyInput);
5847  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Vid", NTV2_XptCSC6VidInput);
5848  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Key", NTV2_XptCSC6KeyInput);
5849  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Vid", NTV2_XptCSC7VidInput);
5850  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Key", NTV2_XptCSC7KeyInput);
5851  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Vid", NTV2_XptCSC8VidInput);
5852  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Key", NTV2_XptCSC8KeyInput);
5853  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 1", NTV2_XptLUT1Input);
5854  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 2", NTV2_XptLUT2Input);
5855  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 3", NTV2_XptLUT3Input);
5856  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 4", NTV2_XptLUT4Input);
5857  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 5", NTV2_XptLUT5Input);
5858  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 6", NTV2_XptLUT6Input);
5859  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 7", NTV2_XptLUT7Input);
5860  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 8", NTV2_XptLUT8Input);
5865  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 1", NTV2_XptSDIOut1Input);
5866  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 1 DS2", NTV2_XptSDIOut1InputDS2);
5867  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 2", NTV2_XptSDIOut2Input);
5868  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 2 DS2", NTV2_XptSDIOut2InputDS2);
5869  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 3", NTV2_XptSDIOut3Input);
5870  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 3 DS2", NTV2_XptSDIOut3InputDS2);
5871  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 4", NTV2_XptSDIOut4Input);
5872  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 4 DS2", NTV2_XptSDIOut4InputDS2);
5873  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 5", NTV2_XptSDIOut5Input);
5874  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 5 DS2", NTV2_XptSDIOut5InputDS2);
5875  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 6", NTV2_XptSDIOut6Input);
5876  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 6 DS2", NTV2_XptSDIOut6InputDS2);
5877  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 7", NTV2_XptSDIOut7Input);
5878  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 7 DS2", NTV2_XptSDIOut7InputDS2);
5879  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 8", NTV2_XptSDIOut8Input);
5880  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI Out 8 DS2", NTV2_XptSDIOut8InputDS2);
5905  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 BG Key", NTV2_XptMixer1BGKeyInput);
5906  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 BG Vid", NTV2_XptMixer1BGVidInput);
5907  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 FG Key", NTV2_XptMixer1FGKeyInput);
5908  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 FG Vid", NTV2_XptMixer1FGVidInput);
5909  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 BG Key", NTV2_XptMixer2BGKeyInput);
5910  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 BG Vid", NTV2_XptMixer2BGVidInput);
5911  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 FG Key", NTV2_XptMixer2FGKeyInput);
5912  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 FG Vid", NTV2_XptMixer2FGVidInput);
5913  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 BG Key", NTV2_XptMixer3BGKeyInput);
5914  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 BG Vid", NTV2_XptMixer3BGVidInput);
5915  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 FG Key", NTV2_XptMixer3FGKeyInput);
5916  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 FG Vid", NTV2_XptMixer3FGVidInput);
5917  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 BG Key", NTV2_XptMixer4BGKeyInput);
5918  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 BG Vid", NTV2_XptMixer4BGVidInput);
5919  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 FG Key", NTV2_XptMixer4FGKeyInput);
5920  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 FG Vid", NTV2_XptMixer4FGVidInput);
5921  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out", NTV2_XptHDMIOutInput);
5922  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out Q2", NTV2_XptHDMIOutQ2Input);
5923  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out Q3", NTV2_XptHDMIOutQ3Input);
5924  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI Out Q4", NTV2_XptHDMIOutQ4Input);
5925  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q1", NTV2_Xpt4KDCQ1Input);
5926  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q2", NTV2_Xpt4KDCQ2Input);
5927  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q3", NTV2_Xpt4KDCQ3Input);
5928  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Q4", NTV2_Xpt4KDCQ4Input);
5929  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1A", NTV2_Xpt425Mux1AInput);
5930  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1B", NTV2_Xpt425Mux1BInput);
5931  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2A", NTV2_Xpt425Mux2AInput);
5932  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2B", NTV2_Xpt425Mux2BInput);
5933  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3A", NTV2_Xpt425Mux3AInput);
5934  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3B", NTV2_Xpt425Mux3BInput);
5935  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4A", NTV2_Xpt425Mux4AInput);
5936  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4B", NTV2_Xpt425Mux4BInput);
5937  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Analog Out", NTV2_XptAnalogOutInput);
5938  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Analog Composite Out", NTV2_XptAnalogOutCompositeOut);
5939  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Stereo Left", NTV2_XptStereoLeftInput);
5940  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Stereo Right", NTV2_XptStereoRightInput);
5941  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Pro Amp", NTV2_XptProAmpInput);
5942  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "IICT1", NTV2_XptIICT1Input);
5943  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Water Marker 1", NTV2_XptWaterMarker1Input);
5944  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Water Marker 2", NTV2_XptWaterMarker2Input);
5945  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Update Register", NTV2_XptUpdateRegister);
5946  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Compression Module", NTV2_XptCompressionModInput);
5947  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Conversion Module", NTV2_XptConversionModInput);
5948  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Key From In 2", NTV2_XptCSC1KeyFromInput2);
5949  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync2", NTV2_XptFrameSync2Input);
5950  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync1", NTV2_XptFrameSync1Input);
5951  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3D LUT 1", NTV2_Xpt3DLUT1Input);
5954  }
5955  return "";
5956 
5957 } // NTV2InputCrosspointIDToString
5958 
5959 
5960 string NTV2OutputCrosspointIDToString (const NTV2OutputCrosspointID inValue, const bool inForRetailDisplay)
5961 {
5962  switch (inValue)
5963  {
5964  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Black", NTV2_XptBlack);
5965  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 1", NTV2_XptSDIIn1);
5966  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 1 DS2", NTV2_XptSDIIn1DS2);
5967  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 2", NTV2_XptSDIIn2);
5968  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 2 DS2", NTV2_XptSDIIn2DS2);
5969  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 1 YUV", NTV2_XptLUT1YUV);
5970  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Vid YUV", NTV2_XptCSC1VidYUV);
5971  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Conversion Module", NTV2_XptConversionModule);
5972  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Compression Module", NTV2_XptCompressionModule);
5974  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 1 YUV", NTV2_XptFrameSync1YUV);
5975  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 2 YUV", NTV2_XptFrameSync2YUV);
5976  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 1", NTV2_XptDuallinkOut1);
5977  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 1 DS2", NTV2_XptDuallinkOut1DS2);
5978  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 2", NTV2_XptDuallinkOut2);
5979  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 2 DS2", NTV2_XptDuallinkOut2DS2);
5980  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 3", NTV2_XptDuallinkOut3);
5981  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 3 DS2", NTV2_XptDuallinkOut3DS2);
5982  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 4", NTV2_XptDuallinkOut4);
5983  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 4 DS2", NTV2_XptDuallinkOut4DS2);
5984  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Alpha Out", NTV2_XptAlphaOut);
5985  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Analog In", NTV2_XptAnalogIn);
5986  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1", NTV2_XptHDMIIn1);
5987  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q2", NTV2_XptHDMIIn1Q2);
5988  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q3", NTV2_XptHDMIIn1Q3);
5989  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q4", NTV2_XptHDMIIn1Q4);
5990  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 RGB", NTV2_XptHDMIIn1RGB);
5991  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q2 RGB", NTV2_XptHDMIIn1Q2RGB);
5992  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q3 RGB", NTV2_XptHDMIIn1Q3RGB);
5993  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 1 Q4 RGB", NTV2_XptHDMIIn1Q4RGB);
5994  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2", NTV2_XptHDMIIn2);
5995  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q2", NTV2_XptHDMIIn2Q2);
5996  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q3", NTV2_XptHDMIIn2Q3);
5997  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q4", NTV2_XptHDMIIn2Q4);
5998  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 RGB", NTV2_XptHDMIIn2RGB);
5999  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q2 RGB", NTV2_XptHDMIIn2Q2RGB);
6000  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q3 RGB", NTV2_XptHDMIIn2Q3RGB);
6001  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 2 Q4 RGB", NTV2_XptHDMIIn2Q4RGB);
6002  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 3", NTV2_XptHDMIIn3);
6003  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 3 RGB", NTV2_XptHDMIIn3RGB);
6004  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 4", NTV2_XptHDMIIn4);
6005  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "HDMI In 4 RGB", NTV2_XptHDMIIn4RGB);
6006  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 1", NTV2_XptDuallinkIn1);
6007  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 2", NTV2_XptDuallinkIn2);
6008  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 3", NTV2_XptDuallinkIn3);
6009  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 4", NTV2_XptDuallinkIn4);
6010  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 1", NTV2_XptLUT1Out);
6011  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Vid RGB", NTV2_XptCSC1VidRGB);
6013  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 1 RGB", NTV2_XptFrameSync1RGB);
6014  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FrameSync 2 RGB", NTV2_XptFrameSync2RGB);
6015  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 2", NTV2_XptLUT2Out);
6016  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 1 Key YUV", NTV2_XptCSC1KeyYUV);
6019  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Vid YUV", NTV2_XptCSC2VidYUV);
6020  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Vid RGB", NTV2_XptCSC2VidRGB);
6021  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 2 Key YUV", NTV2_XptCSC2KeyYUV);
6022  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 Vid YUV", NTV2_XptMixer1VidYUV);
6023  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 Key YUV", NTV2_XptMixer1KeyYUV);
6024  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 1 Vid RGB", NTV2_XptMixer1VidRGB);
6025  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "IICT RGB", NTV2_XptIICTRGB);
6026  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "IICT 2 RGB", NTV2_XptIICT2RGB);
6027  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Test Pattern YUV", NTV2_XptTestPatternYUV);
6028  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 Vid YUV", NTV2_XptMixer2VidYUV);
6029  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 Key YUV", NTV2_XptMixer2KeyYUV);
6030  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 2 Vid RGB", NTV2_XptMixer2VidRGB);
6031  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Stereo Compressor Out", NTV2_XptStereoCompressorOut);
6032  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 3", NTV2_XptLUT3Out);
6033  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 4", NTV2_XptLUT4Out);
6038  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 3", NTV2_XptSDIIn3);
6039  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 3 DS2", NTV2_XptSDIIn3DS2);
6040  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 4", NTV2_XptSDIIn4);
6041  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 4 DS2", NTV2_XptSDIIn4DS2);
6042  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Vid YUV", NTV2_XptCSC3VidYUV);
6043  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Vid RGB", NTV2_XptCSC3VidRGB);
6044  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 3 Key YUV", NTV2_XptCSC3KeyYUV);
6045  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Vid YUV", NTV2_XptCSC4VidYUV);
6046  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Vid RGB", NTV2_XptCSC4VidRGB);
6047  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 4 Key YUV", NTV2_XptCSC4KeyYUV);
6048  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Vid YUV", NTV2_XptCSC5VidYUV);
6049  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Vid RGB", NTV2_XptCSC5VidRGB);
6050  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 5 Key YUV", NTV2_XptCSC5KeyYUV);
6051  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 5", NTV2_XptLUT5Out);
6052  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 5", NTV2_XptDuallinkOut5);
6053  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 5 DS2", NTV2_XptDuallinkOut5DS2);
6054  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Out", NTV2_Xpt4KDownConverterOut);
6055  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4K DownConv Out RGB", NTV2_Xpt4KDownConverterOutRGB);
6064  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 5", NTV2_XptSDIIn5);
6065  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 5 DS2", NTV2_XptSDIIn5DS2);
6066  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 6", NTV2_XptSDIIn6);
6067  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 6 DS2", NTV2_XptSDIIn6DS2);
6068  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 7", NTV2_XptSDIIn7);
6069  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 7 DS2", NTV2_XptSDIIn7DS2);
6070  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 8", NTV2_XptSDIIn8);
6071  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 8 DS2", NTV2_XptSDIIn8DS2);
6072  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Vid YUV", NTV2_XptCSC6VidYUV);
6073  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Vid RGB", NTV2_XptCSC6VidRGB);
6074  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 6 Key YUV", NTV2_XptCSC6KeyYUV);
6075  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Vid YUV", NTV2_XptCSC7VidYUV);
6076  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Vid RGB", NTV2_XptCSC7VidRGB);
6077  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 7 Key YUV", NTV2_XptCSC7KeyYUV);
6078  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Vid YUV", NTV2_XptCSC8VidYUV);
6079  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Vid RGB", NTV2_XptCSC8VidRGB);
6080  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "CSC 8 Key YUV", NTV2_XptCSC8KeyYUV);
6081  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 6", NTV2_XptLUT6Out);
6082  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 7", NTV2_XptLUT7Out);
6083  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "LUT 8", NTV2_XptLUT8Out);
6084  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 6", NTV2_XptDuallinkOut6);
6085  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 6 DS2", NTV2_XptDuallinkOut6DS2);
6086  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 7", NTV2_XptDuallinkOut7);
6087  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 7 DS2", NTV2_XptDuallinkOut7DS2);
6088  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 8", NTV2_XptDuallinkOut8);
6089  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL Out 8 DS2", NTV2_XptDuallinkOut8DS2);
6090  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 Vid YUV", NTV2_XptMixer3VidYUV);
6091  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 Key YUV", NTV2_XptMixer3KeyYUV);
6092  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 3 Vid RGB", NTV2_XptMixer3VidRGB);
6093  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 Vid YUV", NTV2_XptMixer4VidYUV);
6094  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 Key YUV", NTV2_XptMixer4KeyYUV);
6095  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Mixer 4 Vid RGB", NTV2_XptMixer4VidRGB);
6096  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 5", NTV2_XptDuallinkIn5);
6097  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 6", NTV2_XptDuallinkIn6);
6098  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 7", NTV2_XptDuallinkIn7);
6099  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 8", NTV2_XptDuallinkIn8);
6100  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 1 DS2", NTV2_XptDuallinkIn1DS2);
6101  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 2 DS2", NTV2_XptDuallinkIn2DS2);
6102  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 3 DS2", NTV2_XptDuallinkIn3DS2);
6103  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 4 DS2", NTV2_XptDuallinkIn4DS2);
6104  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 5 DS2", NTV2_XptDuallinkIn5DS2);
6105  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 6 DS2", NTV2_XptDuallinkIn6DS2);
6106  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 7 DS2", NTV2_XptDuallinkIn7DS2);
6107  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DL In 8 DS2", NTV2_XptDuallinkIn8DS2);
6108  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1a YUV", NTV2_Xpt425Mux1AYUV);
6109  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1a RGB", NTV2_Xpt425Mux1ARGB);
6110  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1b YUV", NTV2_Xpt425Mux1BYUV);
6111  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 1b RGB", NTV2_Xpt425Mux1BRGB);
6112  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2a YUV", NTV2_Xpt425Mux2AYUV);
6113  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2a RGB", NTV2_Xpt425Mux2ARGB);
6114  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2b YUV", NTV2_Xpt425Mux2BYUV);
6115  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 2b RGB", NTV2_Xpt425Mux2BRGB);
6116  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3a YUV", NTV2_Xpt425Mux3AYUV);
6117  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3a RGB", NTV2_Xpt425Mux3ARGB);
6118  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3b YUV", NTV2_Xpt425Mux3BYUV);
6119  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 3b RGB", NTV2_Xpt425Mux3BRGB);
6120  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4a YUV", NTV2_Xpt425Mux4AYUV);
6121  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4a RGB", NTV2_Xpt425Mux4ARGB);
6122  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4b YUV", NTV2_Xpt425Mux4BYUV);
6123  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "425Mux 4b RGB", NTV2_Xpt425Mux4BRGB);
6124  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 1 DS2 YUV", NTV2_XptFrameBuffer1_DS2YUV);
6125  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 1 DS2 RGB", NTV2_XptFrameBuffer1_DS2RGB);
6126  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 2 DS2 YUV", NTV2_XptFrameBuffer2_DS2YUV);
6127  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 2 DS2 RGB", NTV2_XptFrameBuffer2_DS2RGB);
6128  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 3 DS2 YUV", NTV2_XptFrameBuffer3_DS2YUV);
6129  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 3 DS2 RGB", NTV2_XptFrameBuffer3_DS2RGB);
6130  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 4 DS2 YUV", NTV2_XptFrameBuffer4_DS2YUV);
6131  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 4 DS2 RGB", NTV2_XptFrameBuffer4_DS2RGB);
6132  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 5 DS2 YUV", NTV2_XptFrameBuffer5_DS2YUV);
6133  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 5 DS2 RGB", NTV2_XptFrameBuffer5_DS2RGB);
6134  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 6 DS2 YUV", NTV2_XptFrameBuffer6_DS2YUV);
6135  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 6 DS2 RGB", NTV2_XptFrameBuffer6_DS2RGB);
6136  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 7 DS2 YUV", NTV2_XptFrameBuffer7_DS2YUV);
6137  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 7 DS2 RGB", NTV2_XptFrameBuffer7_DS2RGB);
6138  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 8 DS2 YUV", NTV2_XptFrameBuffer8_DS2YUV);
6139  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "FB 8 DS2 RGB", NTV2_XptFrameBuffer8_DS2RGB);
6140  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Runtime Calc", NTV2_XptRuntimeCalc);
6141  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS1", NTV2_XptMultiLinkOut1DS1);
6142  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS2", NTV2_XptMultiLinkOut1DS2);
6143  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS3", NTV2_XptMultiLinkOut1DS3);
6144  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 1 DS4", NTV2_XptMultiLinkOut1DS4);
6145  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS1", NTV2_XptMultiLinkOut2DS1);
6146  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS2", NTV2_XptMultiLinkOut2DS2);
6147  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS3", NTV2_XptMultiLinkOut2DS3);
6148  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Multi-Link Out 2 DS4", NTV2_XptMultiLinkOut2DS4);
6149  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3D LUT 1 YUV", NTV2_Xpt3DLUT1YUV);
6150  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3D LUT 1 RGB", NTV2_Xpt3DLUT1RGB);
6151  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "OE Out YUV", NTV2_XptOEOutYUV);
6152  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "OE Out RGB", NTV2_XptOEOutRGB);
6153  #if !defined(NTV2_DEPRECATE_16_0)
6154  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "WaterMarker 1 RGB", NTV2_XptWaterMarkerRGB);
6155  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "WaterMarker 2 RGB", NTV2_XptWaterMarker2RGB);
6156  #endif
6157  #if !defined(_DEBUG)
6158  default: break;
6159  #endif
6160  } // switch on inValue
6161  return "";
6162 } // NTV2OutputCrosspointIDToString
6163 
6164 
6165 string NTV2WidgetIDToString (const NTV2WidgetID inValue, const bool inCompactDisplay)
6166 {
6167  switch (inValue)
6168  {
6173  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC1", NTV2_WgtCSC1);
6174  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC2", NTV2_WgtCSC2);
6175  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT1", NTV2_WgtLUT1);
6176  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT2", NTV2_WgtLUT2);
6179  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIIn1", NTV2_WgtSDIIn1);
6180  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIIn2", NTV2_WgtSDIIn2);
6181  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn1", NTV2_Wgt3GSDIIn1);
6182  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn2", NTV2_Wgt3GSDIIn2);
6183  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn3", NTV2_Wgt3GSDIIn3);
6184  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn4", NTV2_Wgt3GSDIIn4);
6185  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut1", NTV2_WgtSDIOut1);
6186  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut2", NTV2_WgtSDIOut2);
6187  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut3", NTV2_WgtSDIOut3);
6188  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIOut4", NTV2_WgtSDIOut4);
6189  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut1", NTV2_Wgt3GSDIOut1);
6190  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut2", NTV2_Wgt3GSDIOut2);
6191  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut3", NTV2_Wgt3GSDIOut3);
6192  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut4", NTV2_Wgt3GSDIOut4);
6200  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "AnlgIn1", NTV2_WgtAnalogIn1);
6201  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "AnlgOut1", NTV2_WgtAnalogOut1);
6203  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIIn1", NTV2_WgtHDMIIn1);
6204  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIOut1", NTV2_WgtHDMIOut1);
6207  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer1", NTV2_WgtMixer1);
6208  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Compress1", NTV2_WgtCompression1);
6209  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "ProcAmp1", NTV2_WgtProcAmp1);
6210  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "WaterMrkr1", NTV2_WgtWaterMarker1);
6211  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "WaterMrkr2", NTV2_WgtWaterMarker2);
6212  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IICT1", NTV2_WgtIICT1);
6213  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IICT2", NTV2_WgtIICT2);
6215  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "GenLock", NTV2_WgtGenLock);
6216  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DCIMixer1", NTV2_WgtDCIMixer1);
6217  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer2", NTV2_WgtMixer2);
6219  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT3", NTV2_WgtLUT3);
6220  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT4", NTV2_WgtLUT4);
6225  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC3", NTV2_WgtCSC3);
6226  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC4", NTV2_WgtCSC4);
6227  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv2In1", NTV2_WgtHDMIIn1v2);
6228  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv2Out1", NTV2_WgtHDMIOut1v2);
6229  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDIMonOut1", NTV2_WgtSDIMonOut1);
6230  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC5", NTV2_WgtCSC5);
6231  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT5", NTV2_WgtLUT5);
6234  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn5", NTV2_Wgt3GSDIIn5);
6235  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn6", NTV2_Wgt3GSDIIn6);
6236  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn7", NTV2_Wgt3GSDIIn7);
6237  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIIn8", NTV2_Wgt3GSDIIn8);
6238  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut5", NTV2_Wgt3GSDIOut5);
6239  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut6", NTV2_Wgt3GSDIOut6);
6240  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut7", NTV2_Wgt3GSDIOut7);
6241  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3GSDIOut8", NTV2_Wgt3GSDIOut8);
6249  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC6", NTV2_WgtCSC6);
6250  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC7", NTV2_WgtCSC7);
6251  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "CSC8", NTV2_WgtCSC8);
6252  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT6", NTV2_WgtLUT6);
6253  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT7", NTV2_WgtLUT7);
6254  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "LUT8", NTV2_WgtLUT8);
6255  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer3", NTV2_WgtMixer3);
6256  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Mixer4", NTV2_WgtMixer4);
6261  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv3In1", NTV2_WgtHDMIIn1v3);
6262  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv3Out1", NTV2_WgtHDMIOut1v3);
6263  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux1", NTV2_Wgt425Mux1);
6264  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux2", NTV2_Wgt425Mux2);
6265  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux3", NTV2_Wgt425Mux3);
6266  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "425Mux4", NTV2_Wgt425Mux4);
6267  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn1", NTV2_Wgt12GSDIIn1);
6268  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn2", NTV2_Wgt12GSDIIn2);
6269  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn3", NTV2_Wgt12GSDIIn3);
6270  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn4", NTV2_Wgt12GSDIIn4);
6271  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn5", NTV2_Wgt12GSDIIn5);
6272  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn6", NTV2_Wgt12GSDIIn6);
6273  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn7", NTV2_Wgt12GSDIIn7);
6274  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIIn8", NTV2_Wgt12GSDIIn8);
6275  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut1", NTV2_Wgt12GSDIOut1);
6276  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut2", NTV2_Wgt12GSDIOut2);
6277  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut3", NTV2_Wgt12GSDIOut3);
6278  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut4", NTV2_Wgt12GSDIOut4);
6279  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut5", NTV2_Wgt12GSDIOut5);
6280  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut6", NTV2_Wgt12GSDIOut6);
6281  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut7", NTV2_Wgt12GSDIOut7);
6282  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "12GSDIOut8", NTV2_Wgt12GSDIOut8);
6283  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In1", NTV2_WgtHDMIIn1v4);
6284  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In2", NTV2_WgtHDMIIn2v4);
6285  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In3", NTV2_WgtHDMIIn3v4);
6286  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4In4", NTV2_WgtHDMIIn4v4);
6287  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv5In1", NTV2_WgtHDMIIn1v5);
6288  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv4Out1", NTV2_WgtHDMIOut1v4);
6289  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv5Out1", NTV2_WgtHDMIOut1v5);
6290  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out1", NTV2_WgtHDMIOut1v6);
6291  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out2", NTV2_WgtHDMIOut2v6);
6292  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out3", NTV2_WgtHDMIOut3v6);
6293  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMIv6Out4", NTV2_WgtHDMIOut4v6);
6294  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "MultiLinkOut1", NTV2_WgtMultiLinkOut1);
6295  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "MultiLinkOut2", NTV2_WgtMultiLinkOut2);
6296  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "3DLUT1", NTV2_Wgt3DLUT1);
6297  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "OE1", NTV2_WgtOE1);
6298  case NTV2_WgtModuleTypeCount: return "???"; //special case
6299  }
6300  return "";
6301 
6302 } // NTV2WidgetIDToString
6303 
6304 string NTV2WidgetTypeToString (const NTV2WidgetType inValue, const bool inCompactDisplay)
6305 {
6306  switch (inValue) {
6311  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Input", NTV2WidgetType_SDIIn);
6312  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Input 3G", NTV2WidgetType_SDIIn3G);
6313  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Output", NTV2WidgetType_SDIOut);
6314  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Output 3G", NTV2WidgetType_SDIOut3G);
6315  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Monitor Output", NTV2WidgetType_SDIMonOut);
6316  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Input V1", NTV2WidgetType_DualLinkV1In);
6317  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Input V2", NTV2WidgetType_DualLinkV2In);
6318  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Output V1", NTV2WidgetType_DualLinkV1Out);
6319  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "DualLink Output V2", NTV2WidgetType_DualLinkV2Out);
6320  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Analog Input", NTV2WidgetType_AnalogIn);
6321  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Analog Output", NTV2WidgetType_AnalogOut);
6322  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Analog Composite Output", NTV2WidgetType_AnalogCompositeOut);
6323  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V1", NTV2WidgetType_HDMIInV1);
6324  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V2", NTV2WidgetType_HDMIInV2);
6325  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V3", NTV2WidgetType_HDMIInV3);
6326  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V4", NTV2WidgetType_HDMIInV4);
6327  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Input V5", NTV2WidgetType_HDMIInV5);
6328  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Up-Down Converter", NTV2WidgetType_UpDownConverter);
6332  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Stereo Compressor", NTV2WidgetType_StereoCompressor);
6335  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "4K Down Converter", NTV2WidgetType_4KDownConverter);
6336  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V1", NTV2WidgetType_HDMIOutV1);
6337  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V2", NTV2WidgetType_HDMIOutV2);
6338  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V3", NTV2WidgetType_HDMIOutV3);
6339  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V4", NTV2WidgetType_HDMIOutV4);
6340  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V5", NTV2WidgetType_HDMIOutV5);
6341  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "HDMI Output V6", NTV2WidgetType_HDMIOutV6);
6342  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SMPTE 425 Mux", NTV2WidgetType_SMPTE425Mux);
6343  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Input 12G", NTV2WidgetType_SDIIn12G);
6344  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI Output 12G", NTV2WidgetType_SDIOut12G);
6345  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Multi-Link Output", NTV2WidgetType_MultiLinkOut);
6351  case NTV2WidgetType_Max: return "???";
6352  }
6353  return "";
6354 }
6355 
6356 string NTV2TaskModeToString (const NTV2TaskMode inValue, const bool inCompactDisplay)
6357 {
6358  switch (inValue)
6359  {
6360  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Disabled", NTV2_DISABLE_TASKS);
6361  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Standard", NTV2_STANDARD_TASKS);
6364  }
6365  return "";
6366 }
6367 
6368 
6370 {
6371  ostringstream oss;
6372  oss << inObj;
6373  return oss.str ();
6374 }
6375 
6376 
6377 ostream & operator << (ostream & inOutStr, const NTV2RegisterNumberSet & inObj)
6378 {
6379  inOutStr << "[" << inObj.size () << " regs: ";
6380  for (NTV2RegNumSetConstIter iter (inObj.begin ()); iter != inObj.end (); )
6381  {
6382  inOutStr << ::NTV2RegisterNumberToString (NTV2RegisterNumber (*iter));
6383  if (++iter != inObj.end ())
6384  inOutStr << ", ";
6385  }
6386  return inOutStr << "]";
6387 }
6388 
6389 
6391 {
6392  inOutSet.insert (inRegisterNumber);
6393  return inOutSet;
6394 }
6395 
6396 
6397 string NTV2TCIndexToString (const NTV2TCIndex inValue, const bool inCompactDisplay)
6398 {
6399  switch (inValue)
6400  {
6402  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI1-VITC", NTV2_TCINDEX_SDI1);
6403  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI2-VITC", NTV2_TCINDEX_SDI2);
6404  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI3-VITC", NTV2_TCINDEX_SDI3);
6405  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI4-VITC", NTV2_TCINDEX_SDI4);
6410  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI5-VITC", NTV2_TCINDEX_SDI5);
6411  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI6-VITC", NTV2_TCINDEX_SDI6);
6412  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI7-VITC", NTV2_TCINDEX_SDI7);
6413  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI8-VITC", NTV2_TCINDEX_SDI8);
6420  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI1-VITC2", NTV2_TCINDEX_SDI1_2);
6421  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI2-VITC2", NTV2_TCINDEX_SDI2_2);
6422  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI3-VITC2", NTV2_TCINDEX_SDI3_2);
6423  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI4-VITC2", NTV2_TCINDEX_SDI4_2);
6424  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI5-VITC2", NTV2_TCINDEX_SDI5_2);
6425  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI6-VITC2", NTV2_TCINDEX_SDI6_2);
6426  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI7-VITC2", NTV2_TCINDEX_SDI7_2);
6427  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SDI8-VITC2", NTV2_TCINDEX_SDI8_2);
6429  }
6430  return "";
6431 }
6432 
6433 
6434 string NTV2AudioChannelPairToString (const NTV2AudioChannelPair inValue, const bool inCompactDisplay)
6435 {
6436  ostringstream oss;
6437  if (NTV2_IS_VALID_AUDIO_CHANNEL_PAIR(inValue))
6438  oss << (inCompactDisplay ? "" : "NTV2_AudioChannel")
6439  << DEC(inValue * 2 + 1) << (inCompactDisplay ? "-" : "_") << DEC(inValue * 2 + 2);
6440  else if (!inCompactDisplay)
6441  oss << "NTV2_AUDIO_CHANNEL_PAIR_INVALID";
6442  return oss.str();
6443 }
6444 
6445 
6446 string NTV2AudioChannelQuadToString (const NTV2Audio4ChannelSelect inValue, const bool inCompactDisplay)
6447 {
6448  ostringstream oss;
6449  if (NTV2_IS_VALID_AUDIO_CHANNEL_QUAD(inValue))
6450  oss << (inCompactDisplay ? "" : "NTV2_AudioChannel")
6451  << (inValue * 4 + 1) << (inCompactDisplay ? "-" : "_") << (inValue * 4 + 4);
6452  else if (!inCompactDisplay)
6453  oss << "NTV2_AUDIO_CHANNEL_QUAD_INVALID";
6454  return oss.str ();
6455 }
6456 
6457 
6458 string NTV2AudioChannelOctetToString (const NTV2Audio8ChannelSelect inValue, const bool inCompactDisplay)
6459 {
6460  ostringstream oss;
6461  if (NTV2_IS_VALID_AUDIO_CHANNEL_OCTET(inValue))
6462  oss << (inCompactDisplay ? "" : "NTV2_AudioChannel")
6463  << (inValue * 8 + 1) << (inCompactDisplay ? "-" : "_") << (inValue * 8 + 8);
6464  else if (!inCompactDisplay)
6465  oss << "NTV2_AUDIO_CHANNEL_OCTET_INVALID";
6466  return oss.str ();
6467 }
6468 
6469 
6470 string NTV2FramesizeToString (const NTV2Framesize inValue, const bool inCompactDisplay)
6471 {
6472  switch (inValue)
6473  {
6491  }
6492  return "";
6493 }
6494 
6495 
6496 string NTV2ModeToString (const NTV2Mode inValue, const bool inCompactDisplay)
6497 {
6498  switch (inValue)
6499  {
6503  }
6504  return "";
6505 }
6506 
6507 
6508 string NTV2VANCModeToString (const NTV2VANCMode inValue, const bool inCompactDisplay)
6509 {
6510  switch (inValue)
6511  {
6516  }
6517  return "";
6518 }
6519 
6520 
6521 string NTV2MixerKeyerModeToString (const NTV2MixerKeyerMode inValue, const bool inCompactDisplay)
6522 {
6523  switch(inValue)
6524  {
6530  }
6531  return "";
6532 }
6533 
6534 
6535 string NTV2MixerInputControlToString (const NTV2MixerKeyerInputControl inValue, const bool inCompactDisplay)
6536 {
6537  switch(inValue)
6538  {
6543  }
6544  return "";
6545 }
6546 
6547 
6548 string NTV2VideoLimitingToString (const NTV2VideoLimiting inValue, const bool inCompactDisplay)
6549 {
6550  switch(inValue)
6551  {
6556  }
6557  return "";
6558 }
6559 
6560 
6561 string NTV2BreakoutTypeToString (const NTV2BreakoutType inValue, const bool inCompactDisplay)
6562 {
6563  switch(inValue)
6564  {
6568  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KBox", NTV2_KBox);
6569  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KLBox", NTV2_KLBox);
6570  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "K3Box", NTV2_K3Box);
6571  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KLHiBox", NTV2_KLHiBox);
6572  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KLHePlusBox", NTV2_KLHePlusBox);
6573  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "K3GBox", NTV2_K3GBox);
6575  case NTV2_MAX_NUM_BreakoutTypes: break; //special case
6576  }
6577  return "";
6578 }
6579 
6580 string NTV2AncDataRgnToStr (const NTV2AncDataRgn inValue, const bool inCompactDisplay)
6581 {
6582  switch(inValue)
6583  {
6588  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "AncAll", NTV2_AncRgn_All);
6589  case NTV2_MAX_NUM_AncRgns: break; //special case
6590  }
6591  return "";
6592 }
6593 
6594 string NTV2UpConvertModeToString (const NTV2UpConvertMode inValue, const bool inCompact)
6595 {
6596  switch(inValue)
6597  {
6599  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "4" "\xC3\x97" "3 Pillar Box", NTV2_UpConvertPillarbox4x3);
6600  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Zoomed 14" "\xC3\x97" "9", NTV2_UpConvertZoom14x9);
6603  case NTV2_MAX_NUM_UpConvertModes: break; //special case
6604  }
6605  return "";
6606 }
6607 
6608 string NTV2DownConvertModeToString (const NTV2DownConvertMode inValue, const bool inCompact)
6609 {
6610  switch(inValue)
6611  {
6615  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Zoomed 14" "\xC3\x97" "9", NTV2_DownConvert14x9);
6616  case NTV2_MAX_NUM_DownConvertModes: break; //special case
6617  }
6618  return "";
6619 }
6620 
6621 string NTV2ScanMethodToString (const NTV2ScanMethod inValue, const bool inCompact)
6622 {
6623  switch(inValue)
6624  {
6628  case NTV2_NUM_SCANMETHODS: break;
6629  }
6630  return "";
6631 }
6632 
6633 string NTV2IsoConvertModeToString (const NTV2IsoConvertMode inValue, const bool inCompact)
6634 {
6635  switch(inValue)
6636  {
6638  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Horiz Cropped", NTV2_IsoHCrop);
6639  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "Vert Cropped", NTV2_IsoVCrop);
6641  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompact, "14" "\xC3\x97" "9", NTV2_Iso14x9);
6643  case NTV2_MAX_NUM_IsoConvertModes: break; //special case
6644  }
6645  return "";
6646 }
6647 
6648 string NTV2HDMIBitDepthToString (const NTV2HDMIBitDepth inValue, const bool inCompact)
6649 {
6650  switch(inValue)
6651  {
6655  case NTV2_INVALID_HDMIBitDepth: break;
6656  }
6657  return "";
6658 }
6659 
6660 string NTV2HDMIAudioChannelsToString (const NTV2HDMIAudioChannels inValue, const bool inCompact)
6661 {
6662  switch(inValue)
6663  {
6667  }
6668  return "";
6669 }
6670 
6671 string NTV2HDMIProtocolToString (const NTV2HDMIProtocol inValue, const bool inCompact)
6672 {
6673  switch(inValue)
6674  {
6677  case NTV2_INVALID_HDMI_PROTOCOL: break;
6678  }
6679  return "";
6680 }
6681 
6682 string NTV2HDMIRangeToString (const NTV2HDMIRange inValue, const bool inCompact)
6683 {
6684  switch(inValue)
6685  {
6688  case NTV2_INVALID_HDMI_RANGE: break;
6689  }
6690  return "";
6691 }
6692 
6693 string NTV2HDMIColorSpaceToString (const NTV2HDMIColorSpace inValue, const bool inCompact)
6694 {
6695  switch(inValue)
6696  {
6700  case NTV2_INVALID_HDMI_COLORSPACE: break;
6701  }
6702  return "";
6703 }
6704 
6705 string NTV2AudioFormatToString (const NTV2AudioFormat inValue, const bool inCompact)
6706 {
6707  switch(inValue)
6708  {
6711  case NTV2_AUDIO_FORMAT_INVALID: break;
6712  }
6713  return "";
6714 }
6715 
6716 string NTV2EmbeddedAudioInputToString (const NTV2EmbeddedAudioInput inValue, const bool inCompactDisplay)
6717 {
6718  switch(inValue)
6719  {
6729  }
6730  return "";
6731 }
6732 
6733 
6734 string NTV2AudioSourceToString (const NTV2AudioSource inValue, const bool inCompactDisplay)
6735 {
6736  switch (inValue)
6737  {
6744  }
6745  return "";
6746 }
6747 
6748 
6749 string NTV2VideoFormatToString (const NTV2VideoFormat inFormat, const bool inUseFrameRate)
6750 {
6751  switch (inFormat)
6752  {
6753  case NTV2_FORMAT_1080i_5000: return inUseFrameRate ? "1080i25" : "1080i50";
6754  case NTV2_FORMAT_1080i_5994: return inUseFrameRate ? "1080i29.97" : "1080i59.94";
6755  case NTV2_FORMAT_1080i_6000: return inUseFrameRate ? "1080i30" : "1080i60";
6756  case NTV2_FORMAT_720p_5994: return "720p59.94";
6757  case NTV2_FORMAT_720p_6000: return "720p60";
6758  case NTV2_FORMAT_1080psf_2398: return "1080sf23.98";
6759  case NTV2_FORMAT_1080psf_2400: return "1080sf24";
6760  case NTV2_FORMAT_1080p_2997: return "1080p29.97";
6761  case NTV2_FORMAT_1080p_3000: return "1080p30";
6762  case NTV2_FORMAT_1080p_2500: return "1080p25";
6763  case NTV2_FORMAT_1080p_2398: return "1080p23.98";
6764  case NTV2_FORMAT_1080p_2400: return "1080p24";
6765  case NTV2_FORMAT_1080p_2K_2398: return "2Kp23.98";
6766  case NTV2_FORMAT_1080p_2K_2400: return "2Kp24";
6767  case NTV2_FORMAT_1080psf_2K_2398: return "2Ksf23.98";
6768  case NTV2_FORMAT_1080psf_2K_2400: return "2Ksf24";
6769  case NTV2_FORMAT_720p_5000: return "720p50";
6770  case NTV2_FORMAT_1080p_5000_B: return "1080p50b";
6771  case NTV2_FORMAT_1080p_5994_B: return "1080p59.94b";
6772  case NTV2_FORMAT_1080p_6000_B: return "1080p60b";
6773  case NTV2_FORMAT_720p_2398: return "720p23.98";
6774  case NTV2_FORMAT_720p_2500: return "720p25";
6775  case NTV2_FORMAT_1080p_5000_A: return "1080p50a";
6776  case NTV2_FORMAT_1080p_5994_A: return "1080p59.94a";
6777  case NTV2_FORMAT_1080p_6000_A: return "1080p60a";
6778  case NTV2_FORMAT_1080p_2K_2500: return "2Kp25";
6779  case NTV2_FORMAT_1080psf_2K_2500: return "2Ksf25";
6780  case NTV2_FORMAT_1080psf_2500_2: return "1080sf25";
6781  case NTV2_FORMAT_1080psf_2997_2: return "1080sf29.97";
6782  case NTV2_FORMAT_1080psf_3000_2: return "1080sf30";
6783  case NTV2_FORMAT_525_5994: return inUseFrameRate ? "525i29.97" : "525i59.94";
6784  case NTV2_FORMAT_625_5000: return inUseFrameRate ? "625i25" : "625i50";
6785  case NTV2_FORMAT_525_2398: return "525i23.98";
6786  case NTV2_FORMAT_525_2400: return "525i24";
6787  case NTV2_FORMAT_525psf_2997: return "525sf29.97";
6788  case NTV2_FORMAT_625psf_2500: return "625sf25";
6789  case NTV2_FORMAT_2K_1498: return "2Kx1556sf14.98";
6790  case NTV2_FORMAT_2K_1500: return "2Kx1556sf15";
6791  case NTV2_FORMAT_2K_2398: return "2Kx1556sf23.98";
6792  case NTV2_FORMAT_2K_2400: return "2Kx1556sf24";
6793  case NTV2_FORMAT_2K_2500: return "2Kx1556sf25";
6794  case NTV2_FORMAT_4x1920x1080psf_2398: return "UHDsf23.98";
6795  case NTV2_FORMAT_4x1920x1080psf_2400: return "UHDsf24";
6796  case NTV2_FORMAT_4x1920x1080psf_2500: return "UHDsf25";
6797  case NTV2_FORMAT_4x1920x1080p_2398: return "UHDp23.98";
6798  case NTV2_FORMAT_4x1920x1080p_2400: return "UHDp24";
6799  case NTV2_FORMAT_4x1920x1080p_2500: return "UHDp25";
6800  case NTV2_FORMAT_4x2048x1080psf_2398: return "4Ksf23.98";
6801  case NTV2_FORMAT_4x2048x1080psf_2400: return "4Ksf24";
6802  case NTV2_FORMAT_4x2048x1080psf_2500: return "4Ksf25";
6803  case NTV2_FORMAT_4x2048x1080p_2398: return "4Kp23.98";
6804  case NTV2_FORMAT_4x2048x1080p_2400: return "4Kp24";
6805  case NTV2_FORMAT_4x2048x1080p_2500: return "4Kp25";
6806  case NTV2_FORMAT_4x1920x1080p_2997: return "UHDp29.97";
6807  case NTV2_FORMAT_4x1920x1080p_3000: return "UHDp30";
6808  case NTV2_FORMAT_4x1920x1080psf_2997: return "UHDsf29.97";
6809  case NTV2_FORMAT_4x1920x1080psf_3000: return "UHDsf30";
6810  case NTV2_FORMAT_4x2048x1080p_2997: return "4Kp29.97";
6811  case NTV2_FORMAT_4x2048x1080p_3000: return "4Kp30";
6812  case NTV2_FORMAT_4x2048x1080psf_2997: return "4Ksf29.97";
6813  case NTV2_FORMAT_4x2048x1080psf_3000: return "4Ksf30";
6814  case NTV2_FORMAT_4x1920x1080p_5000: return "UHDp50";
6815  case NTV2_FORMAT_4x1920x1080p_5994: return "UHDp59.94";
6816  case NTV2_FORMAT_4x1920x1080p_6000: return "UHDp60";
6817  case NTV2_FORMAT_4x2048x1080p_5000: return "4Kp50";
6818  case NTV2_FORMAT_4x2048x1080p_5994: return "4Kp59.94";
6819  case NTV2_FORMAT_4x2048x1080p_6000: return "4Kp60";
6820  case NTV2_FORMAT_4x2048x1080p_4795: return "4Kp47.95";
6821  case NTV2_FORMAT_4x2048x1080p_4800: return "4Kp48";
6822  case NTV2_FORMAT_4x2048x1080p_11988: return "4Kp119";
6823  case NTV2_FORMAT_4x2048x1080p_12000: return "4Kp120";
6824  case NTV2_FORMAT_1080p_2K_6000_A: return "2Kp60a";
6825  case NTV2_FORMAT_1080p_2K_5994_A: return "2Kp59.94a";
6826  case NTV2_FORMAT_1080p_2K_2997: return "2Kp29.97";
6827  case NTV2_FORMAT_1080p_2K_3000: return "2Kp30";
6828  case NTV2_FORMAT_1080p_2K_5000_A: return "2Kp50a";
6829  case NTV2_FORMAT_1080p_2K_4795_A: return "2Kp47.95a";
6830  case NTV2_FORMAT_1080p_2K_4800_A: return "2Kp48a";
6831  case NTV2_FORMAT_1080p_2K_4795_B: return "2Kp47.95b";
6832  case NTV2_FORMAT_1080p_2K_4800_B: return "2Kp48b";
6833  case NTV2_FORMAT_1080p_2K_5000_B: return "2Kp50b";
6834  case NTV2_FORMAT_1080p_2K_5994_B: return "2Kp59.94b";
6835  case NTV2_FORMAT_1080p_2K_6000_B: return "2Kp60b";
6836  case NTV2_FORMAT_3840x2160psf_2398: return "UHDsf23.98";
6837  case NTV2_FORMAT_3840x2160psf_2400: return "UHDsf24";
6838  case NTV2_FORMAT_3840x2160psf_2500: return "UHDsf25";
6839  case NTV2_FORMAT_3840x2160p_2398: return "UHDp23.98";
6840  case NTV2_FORMAT_3840x2160p_2400: return "UHDp24";
6841  case NTV2_FORMAT_3840x2160p_2500: return "UHDp25";
6842  case NTV2_FORMAT_3840x2160p_2997: return "UHDp29.97";
6843  case NTV2_FORMAT_3840x2160p_3000: return "UHDp30";
6844  case NTV2_FORMAT_3840x2160psf_2997: return "UHDsf29.97";
6845  case NTV2_FORMAT_3840x2160psf_3000: return "UHDsf30";
6846  case NTV2_FORMAT_3840x2160p_5000: return "UHDp50";
6847  case NTV2_FORMAT_3840x2160p_5994: return "UHDp59.94";
6848  case NTV2_FORMAT_3840x2160p_6000: return "UHDp60";
6849  case NTV2_FORMAT_4096x2160psf_2398: return "4Ksf23.98";
6850  case NTV2_FORMAT_4096x2160psf_2400: return "4Ksf24";
6851  case NTV2_FORMAT_4096x2160psf_2500: return "4Ksf25";
6852  case NTV2_FORMAT_4096x2160p_2398: return "4Kp23.98";
6853  case NTV2_FORMAT_4096x2160p_2400: return "4Kp24";
6854  case NTV2_FORMAT_4096x2160p_2500: return "4Kp25";
6855  case NTV2_FORMAT_4096x2160p_2997: return "4Kp29.97";
6856  case NTV2_FORMAT_4096x2160p_3000: return "4Kp30";
6857  case NTV2_FORMAT_4096x2160psf_2997: return "4Ksf29.97";
6858  case NTV2_FORMAT_4096x2160psf_3000: return "4Ksf30";
6859  case NTV2_FORMAT_4096x2160p_4795: return "4Kp47.95";
6860  case NTV2_FORMAT_4096x2160p_4800: return "4Kp48";
6861  case NTV2_FORMAT_4096x2160p_5000: return "4Kp50";
6862  case NTV2_FORMAT_4096x2160p_5994: return "4Kp59.94";
6863  case NTV2_FORMAT_4096x2160p_6000: return "4Kp60";
6864  case NTV2_FORMAT_4096x2160p_11988: return "4Kp119";
6865  case NTV2_FORMAT_4096x2160p_12000: return "4Kp120";
6866  case NTV2_FORMAT_4x1920x1080p_5000_B: return "UHDp50b";
6867  case NTV2_FORMAT_4x1920x1080p_5994_B: return "UHDp59.94b";
6868  case NTV2_FORMAT_4x1920x1080p_6000_B: return "UHDp60b";
6869  case NTV2_FORMAT_4x2048x1080p_5000_B: return "4Kp50b";
6870  case NTV2_FORMAT_4x2048x1080p_5994_B: return "4Kp59.94b";
6871  case NTV2_FORMAT_4x2048x1080p_6000_B: return "4Kp60b";
6872  case NTV2_FORMAT_4x2048x1080p_4795_B: return "4Kp47.95b";
6873  case NTV2_FORMAT_4x2048x1080p_4800_B: return "4Kp48b";
6874  case NTV2_FORMAT_3840x2160p_5000_B: return "UHDp50b";
6875  case NTV2_FORMAT_3840x2160p_5994_B: return "UHDp59.94b";
6876  case NTV2_FORMAT_3840x2160p_6000_B: return "UHDp60b";
6877  case NTV2_FORMAT_4096x2160p_4795_B: return "4Kp47.95b";
6878  case NTV2_FORMAT_4096x2160p_4800_B: return "4Kp48b";
6879  case NTV2_FORMAT_4096x2160p_5000_B: return "4Kp50b";
6880  case NTV2_FORMAT_4096x2160p_5994_B: return "4Kp59.94b";
6881  case NTV2_FORMAT_4096x2160p_6000_B: return "4Kp60b";
6882  case NTV2_FORMAT_4x3840x2160p_2398: return "UHD2p23.98";
6883  case NTV2_FORMAT_4x3840x2160p_2400: return "UHD2p24";
6884  case NTV2_FORMAT_4x3840x2160p_2500: return "UHD2p25";
6885  case NTV2_FORMAT_4x3840x2160p_2997: return "UHD2p29.97";
6886  case NTV2_FORMAT_4x3840x2160p_3000: return "UHD2p30";
6887  case NTV2_FORMAT_4x3840x2160p_5000: return "UHD2p50";
6888  case NTV2_FORMAT_4x3840x2160p_5994: return "UHD2p59.94";
6889  case NTV2_FORMAT_4x3840x2160p_6000: return "UHD2p60";
6890  case NTV2_FORMAT_4x3840x2160p_5000_B: return "UHD2p50b";
6891  case NTV2_FORMAT_4x3840x2160p_5994_B: return "UHD2p59.94b";
6892  case NTV2_FORMAT_4x3840x2160p_6000_B: return "UHD2p60b";
6893  case NTV2_FORMAT_4x4096x2160p_2398: return "8Kp23.98";
6894  case NTV2_FORMAT_4x4096x2160p_2400: return "8Kp24";
6895  case NTV2_FORMAT_4x4096x2160p_2500: return "8Kp25";
6896  case NTV2_FORMAT_4x4096x2160p_2997: return "8Kp29.97";
6897  case NTV2_FORMAT_4x4096x2160p_3000: return "8Kp30";
6898  case NTV2_FORMAT_4x4096x2160p_4795: return "8Kp47.95";
6899  case NTV2_FORMAT_4x4096x2160p_4800: return "8Kp48";
6900  case NTV2_FORMAT_4x4096x2160p_5000: return "8Kp50";
6901  case NTV2_FORMAT_4x4096x2160p_5994: return "8Kp59.94";
6902  case NTV2_FORMAT_4x4096x2160p_6000: return "8Kp60";
6903  case NTV2_FORMAT_4x4096x2160p_4795_B: return "8Kp47.95b";
6904  case NTV2_FORMAT_4x4096x2160p_4800_B: return "8Kp48b";
6905  case NTV2_FORMAT_4x4096x2160p_5000_B: return "8Kp50b";
6906  case NTV2_FORMAT_4x4096x2160p_5994_B: return "8Kp59.94b";
6907  case NTV2_FORMAT_4x4096x2160p_6000_B: return "8Kp60b";
6908  default: return "Unknown";
6909  }
6910 } // NTV2VideoFormatToString
6911 
6912 
6913 string NTV2StandardToString (const NTV2Standard inValue, const bool inForRetailDisplay)
6914 {
6915  switch (inValue)
6916  {
6917  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1080i", NTV2_STANDARD_1080);
6927  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "UHD HFR", NTV2_STANDARD_3840HFR);
6934  }
6935  return "";
6936 }
6937 
6938 
6939 string NTV2FrameBufferFormatToString (const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay)
6940 {
6941  switch (inValue)
6942  {
6945  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGBA-8", NTV2_FBF_ARGB);
6946  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ARGB-8", NTV2_FBF_RGBA);
6947  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-10", NTV2_FBF_10BIT_RGB);
6949  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ABGR-8", NTV2_FBF_ABGR);
6950  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-10DPX", NTV2_FBF_10BIT_DPX);
6951  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "YUV-10DPX", NTV2_FBF_10BIT_YCBCR_DPX);
6952  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "DVCProHD", NTV2_FBF_8BIT_DVCPRO);
6955  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-8", NTV2_FBF_24BIT_RGB);
6956  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "BGR-8", NTV2_FBF_24BIT_BGR);
6957  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "YUVA-10", NTV2_FBF_10BIT_YCBCRA);
6958  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-10LDPX", NTV2_FBF_10BIT_DPX_LE);
6959  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RGB-12", NTV2_FBF_48BIT_RGB);
6961  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ProRes-DVC", NTV2_FBF_PRORES_DVCPRO);
6962  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ProRes-HDV", NTV2_FBF_PRORES_HDV);
6964  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ARGB-10", NTV2_FBF_10BIT_ARGB);
6965  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "ARGB-16", NTV2_FBF_16BIT_ARGB);
6967  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RAW-RGB10", NTV2_FBF_10BIT_RAW_RGB);
6968  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "RAW-YUV10", NTV2_FBF_10BIT_RAW_YCBCR);
6971  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "YUV-P420-10", NTV2_FBF_10BIT_YCBCR_420PL2);
6975  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Unknown", NTV2_FBF_INVALID);
6976  }
6977  return "";
6978 }
6979 
6980 
6981 string NTV2FrameGeometryToString (const NTV2FrameGeometry inValue, const bool inForRetailDisplay)
6982 {
6983  switch (inValue)
6984  {
6985  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1920x1080", NTV2_FG_1920x1080);
6986  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1280x720", NTV2_FG_1280x720);
6987  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x486", NTV2_FG_720x486);
6988  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x576", NTV2_FG_720x576);
6989  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1920x1114", NTV2_FG_1920x1114);
6990  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1114", NTV2_FG_2048x1114);
6991  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x508", NTV2_FG_720x508);
6992  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x598", NTV2_FG_720x598);
6993  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1920x1112", NTV2_FG_1920x1112);
6994  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "1280x740", NTV2_FG_1280x740);
6995  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1080", NTV2_FG_2048x1080);
6996  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1556", NTV2_FG_2048x1556);
6997  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1588", NTV2_FG_2048x1588);
6998  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "2048x1112", NTV2_FG_2048x1112);
6999  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x514", NTV2_FG_720x514);
7000  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "720x612", NTV2_FG_720x612);
7001  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "3840x2160", NTV2_FG_4x1920x1080);
7002  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "4096x2160", NTV2_FG_4x2048x1080);
7003  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "7680x4320", NTV2_FG_4x3840x2160);
7004  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "8192x4320", NTV2_FG_4x4096x2160);
7005  case NTV2_FG_NUMFRAMEGEOMETRIES: return ""; //special case
7006  }
7007  return "";
7008 }
7009 
7010 
7011 string NTV2FrameRateToString (const NTV2FrameRate inValue, const bool inForRetailDisplay)
7012 {
7013  switch (inValue)
7014  {
7030 #if !defined(NTV2_DEPRECATE_16_0)
7035 #endif
7036  case NTV2_NUM_FRAMERATES: return ""; //special case
7037  }
7038  return "";
7039 }
7040 
7041 
7042 string NTV2InputSourceToString (const NTV2InputSource inValue, const bool inForRetailDisplay)
7043 {
7044  switch (inValue)
7045  {
7060  }
7061  return "";
7062 }
7063 
7064 
7065 string NTV2OutputDestinationToString (const NTV2OutputDestination inValue, const bool inForRetailDisplay)
7066 {
7067  switch (inValue)
7068  {
7080  }
7081  return "";
7082 }
7083 
7084 
7085 string NTV2ReferenceSourceToString (const NTV2ReferenceSource inValue, const bool inForRetailDisplay)
7086 {
7087  switch (inValue)
7088  {
7089  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Reference In", NTV2_REFERENCE_EXTERNAL);
7090  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 1", NTV2_REFERENCE_INPUT1);
7091  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 2", NTV2_REFERENCE_INPUT2);
7092  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Free Run", NTV2_REFERENCE_FREERUN);
7095  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 3", NTV2_REFERENCE_INPUT3);
7096  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 4", NTV2_REFERENCE_INPUT4);
7097  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 5", NTV2_REFERENCE_INPUT5);
7098  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 6", NTV2_REFERENCE_INPUT6);
7099  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 7", NTV2_REFERENCE_INPUT7);
7100  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SDI In 8", NTV2_REFERENCE_INPUT8);
7101  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 1 PCR", NTV2_REFERENCE_SFP1_PCR);
7102  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 1 PTP", NTV2_REFERENCE_SFP1_PTP);
7103  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 2 PCR", NTV2_REFERENCE_SFP2_PCR);
7104  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "SFP 2 PTP", NTV2_REFERENCE_SFP2_PTP);
7108  case NTV2_NUM_REFERENCE_INPUTS: return ""; //special case
7109  }
7110  return "";
7111 }
7112 
7113 
7114 string NTV2RegisterWriteModeToString (const NTV2RegisterWriteMode inValue, const bool inForRetailDisplay)
7115 {
7116  switch (inValue)
7117  {
7118  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Sync To Field", NTV2_REGWRITE_SYNCTOFIELD);
7119  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Sync To Frame", NTV2_REGWRITE_SYNCTOFRAME);
7120  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inForRetailDisplay, "Immediate", NTV2_REGWRITE_IMMEDIATE);
7121  case NTV2_REGWRITE_SYNCTOFIELD_AFTER10LINES: return ""; //special case
7122  }
7123  return "";
7124 }
7125 
7126 
7127 std::string NTV2InterruptEnumToString (const INTERRUPT_ENUMS inInterruptEnumValue)
7128 {
7129  switch(inInterruptEnumValue)
7130  {
7172  case eNumInterruptTypes: return ""; //special case
7173  }
7174  return "";
7175 }
7176 
7177 std::string NTV2IpErrorEnumToString (const NTV2IpError inIpErrorEnumValue)
7178 {
7179  switch (inIpErrorEnumValue)
7180  {
7181  case NTV2IpErrNone: return "";
7182  case NTV2IpErrInvalidChannel: return "Invalid channel";
7183  case NTV2IpErrInvalidFormat: return "Invalid format";
7184  case NTV2IpErrInvalidBitdepth: return "Invalid bit depth";
7185  case NTV2IpErrInvalidUllHeight: return "Invalid height in ull mode";
7186  case NTV2IpErrInvalidUllLevels: return "Invalid number of levels in ull mode";
7187  case NTV2IpErrUllNotSupported: return "Ull mode not supported";
7188  case NTV2IpErrNotReady: return "KonaIP card not ready";
7189  case NTV2IpErrSoftwareMismatch: return "Host software does not match device firmware";
7190  case NTV2IpErrSFP1NotConfigured: return "SFP 1 not configured";
7191  case NTV2IpErrSFP2NotConfigured: return "SFP 2 not configured";
7192  case NTV2IpErrInvalidIGMPVersion: return "Invalid IGMP version";
7193  case NTV2IpErrCannotGetMacAddress: return "Failed to retrieve MAC address from ARP table";
7194  case NTV2IpErrNotSupported: return "Not supported for by this firmware";
7195  case NTV2IpErrWriteSOMToMB: return "Could not write SOM to MB";
7196  case NTV2IpErrWriteSeqToMB: return "Could not write sequence number to MB";
7197  case NTV2IpErrWriteCountToMB: return "Could not write count to MB";
7198  case NTV2IpErrTimeoutNoSOM: return "MB response timeout (no SOM)";
7199  case NTV2IpErrTimeoutNoSeq: return "MB response timeout (no sequence number)";
7200  case NTV2IpErrTimeoutNoBytecount: return "MB response timeout (no bytecount)";
7201  case NTV2IpErrExceedsFifo: return "Response exceeds FIFO length";
7202  case NTV2IpErrNoResponseFromMB: return "No response from MB";
7203  case NTV2IpErrAcquireMBTimeout: return "AcquireMailBoxLock timeout";
7204  case NTV2IpErrInvalidMBResponse: return "Invalid response from MB";
7205  case NTV2IpErrInvalidMBResponseSize: return "Invalid response size from MB";
7206  case NTV2IpErrInvalidMBResponseNoMac: return "MAC Address not found in response from MB";
7207  case NTV2IpErrMBStatusFail: return "MB Status Failure";
7208  case NTV2IpErrGrandMasterInfo: return "PTP Grand Master Info not found";
7209  case NTV2IpErrSDPTooLong: return "SDP too long";
7210  case NTV2IpErrSDPNotFound: return "SDP not found";
7211  case NTV2IpErrSDPEmpty: return "SDP is empty";
7212  case NTV2IpErrSDPInvalid: return "SDP is not valid";
7213  case NTV2IpErrSDPURLInvalid: return "Invalid SDP URL";
7214  case NTV2IpErrSDPNoVideo: return "SDP does not contain video";
7215  case NTV2IpErrSDPNoAudio: return "SDP does not contain audio";
7216  case NTV2IpErrSDPNoANC: return "SDP does not contain metadata";
7217  case NTV2IpErrSFPNotFound: return "SFP data not found";
7218  case NTV2IpErrInvalidConfig: return "Invalid configuration";
7219  default: return "Unknown IP error";
7220  }
7221 }
7222 
7223 ostream & operator << (ostream & inOutStream, const RP188_STRUCT & inObj)
7224 {
7225  return inOutStream << "DBB=0x" << hex << setw (8) << setfill ('0') << inObj.DBB
7226  << "|HI=0x" << hex << setw (8) << setfill ('0') << inObj.High
7227  << "|LO=0x" << hex << setw (8) << setfill ('0') << inObj.Low
7228  << dec;
7229 } // RP188_STRUCT ostream operator
7230 
7231 
7232 string NTV2GetBitfileName (const NTV2DeviceID inBoardID)
7233 {
7234  switch (inBoardID)
7235  {
7236  case DEVICE_ID_NOTFOUND: break;
7237  case DEVICE_ID_CORVID1: return "corvid1.bit";
7238  case DEVICE_ID_CORVID22: return "corvid22.bit";
7239  case DEVICE_ID_CORVID24: return "corvid24.bit";
7240  case DEVICE_ID_CORVID3G: return "corvid3G.bit";
7241  case DEVICE_ID_CORVID44: return "corvid44.bit";
7242  case DEVICE_ID_CORVID88: return "corvid88.bit";
7243  case DEVICE_ID_CORVIDHEVC: return "corvid.bit";
7244  case DEVICE_ID_IO4K: return "io4k.bit";
7245  case DEVICE_ID_IO4KUFC: return "io4kufc.bit";
7246  case DEVICE_ID_IOEXPRESS: return "ioexpress.bit";
7247  case DEVICE_ID_IOXT: return "ioxt.bit";
7248  case DEVICE_ID_KONA3G: return "kona3gufc.bit";
7249  case DEVICE_ID_KONA3GQUAD: return "kona3gquad.bit";
7250  case DEVICE_ID_KONA4: return "kona4.bit";
7251  case DEVICE_ID_KONA4UFC: return "kona4ufc.bit";
7252 // case DEVICE_ID_KONAIP_2022: return "konaip2022.mcs";
7253 // case DEVICE_ID_KONAIP_4CH_2SFP: return "s2022_56_2p2ch_rxtx.mcs";
7254 // case DEVICE_ID_KONAIP_1RX_1TX_1SFP_J2K: return "kip_j2k_1i1o.mcs";
7255 // case DEVICE_ID_KONAIP_2TX_1SFP_J2K: return "kip_j2k_2o.mcs";
7256 // case DEVICE_ID_KONAIP_1RX_1TX_2110: return "s2110_1rx_1tx.mcs";
7257  case DEVICE_ID_KONALHEPLUS: return "konalheplus.bit";
7258  case DEVICE_ID_KONALHI: return "konalhi.bit";
7259  case DEVICE_ID_TTAP: return "ttap.bit";
7260  case DEVICE_ID_IO4KPLUS: return "io4kplus.bit";
7261 // case DEVICE_ID_IOIP_2022: return "ioip2022.mcs";
7262 // case DEVICE_ID_IOIP_2110: return "ioip2110.mcs";
7263 // case DEVICE_ID_IOIP_2110_RGB12: return "ioip2110rgb.mcs";
7264 // case DEVICE_ID_KONAIP_2110: return "konaip2110.mcs";
7265 // case DEVICE_ID_KONAIP_2110_RGB12: return "konaip2110rgb.mcs";
7266  case DEVICE_ID_KONAHDMI: return "konahdmi4rx.bit";
7267  case DEVICE_ID_KONA1: return "kona1.bit";
7268  case DEVICE_ID_KONA5: return "kona5_retail_tprom.bit";
7269  case DEVICE_ID_KONA5_2X4K: return "kona5_2x4k_tprom.bit";
7270  case DEVICE_ID_KONA5_8KMK: return "kona5_8k_mk_tprom.bit";
7271  case DEVICE_ID_KONA5_8K: return "kona5_8k_tprom.bit";
7272  case DEVICE_ID_KONA5_3DLUT: return "kona5_3d_lut_tprom.bit";
7273  case DEVICE_ID_KONA5_OE1: return "kona5_oe_cfg1_tprom.bit";
7274  case DEVICE_ID_KONA5_OE2: return "kona5_oe_cfg3_tprom.bit";
7275  case DEVICE_ID_KONA5_OE3: return "kona5_oe_cfg3_tprom.bit";
7276  case DEVICE_ID_KONA5_OE4: return "kona5_oe_cfg4_tprom.bit";
7277  case DEVICE_ID_KONA5_OE5: return "kona5_oe_cfg5_tprom.bit";
7278  case DEVICE_ID_KONA5_OE6: return "kona5_oe_cfg6_tprom.bit";
7279  case DEVICE_ID_KONA5_OE7: return "kona5_oe_cfg7_tprom.bit";
7280  case DEVICE_ID_KONA5_OE8: return "kona5_oe_cfg8_tprom.bit";
7281  case DEVICE_ID_KONA5_OE9: return "kona5_oe_cfg9_tprom.bit";
7282  case DEVICE_ID_KONA5_OE10: return "kona5_oe_cfg10_tprom.bit";
7283  case DEVICE_ID_KONA5_OE11: return "kona5_oe_cfg11_tprom.bit";
7284  case DEVICE_ID_KONA5_OE12: return "kona5_oe_cfg12_tprom.bit";
7285  case DEVICE_ID_SOJI_OE1: return "soji_oe_cfg1.bit";
7286  case DEVICE_ID_SOJI_OE2: return "soji_oe_cfg3.bit";
7287  case DEVICE_ID_SOJI_OE3: return "soji_oe_cfg3.bit";
7288  case DEVICE_ID_SOJI_OE4: return "soji_oe_cfg4.bit";
7289  case DEVICE_ID_SOJI_OE5: return "soji_oe_cfg5.bit";
7290  case DEVICE_ID_SOJI_OE6: return "soji_oe_cfg6.bit";
7291  case DEVICE_ID_SOJI_OE7: return "soji_oe_cfg7.bit";
7292  case DEVICE_ID_SOJI_3DLUT: return "soji_3dlut.bit";
7293  case DEVICE_ID_SOJI_DIAGS: return "soji_diags.bit";
7294  case DEVICE_ID_KONA5_8K_MV_TX: return "kona5_8k_mv_tx_tprom.bit";
7295  case DEVICE_ID_CORVID44_8KMK: return "c44_12g_8k_mk_tprom.bit";
7296  case DEVICE_ID_CORVID44_8K: return "corvid44_12g_8k.bit";
7297  case DEVICE_ID_CORVID44_2X4K: return "c44_12g_2x4k_tprom.bit";
7298  case DEVICE_ID_CORVID44_PLNR: return "c44_12g_plnr_tprom.bit";
7299  case DEVICE_ID_TTAP_PRO: return "ttappro.bit";
7300  case DEVICE_ID_IOX3: return "iox3.bit";
7301  case DEVICE_ID_KONAX: return "konax.bit";
7302  case DEVICE_ID_KONAXM: return "konaxm.bit";
7303  case DEVICE_ID_KONAX_4CH: return "konax_4ch.bit";
7304  case DEVICE_ID_CORVID44_GEN3: return "corvid44gen3.bit";
7305  case DEVICE_ID_CORVID88_GEN3: return "corvid88gen3.bit";
7306  default: return "";
7307  }
7308  return "";
7309 } // NTV2GetBitfileName
7310 
7311 
7312 bool NTV2IsCompatibleBitfileName (const string & inBitfileName, const NTV2DeviceID inDeviceID)
7313 {
7314  const string deviceBitfileName (::NTV2GetBitfileName(inDeviceID));
7315  if (inBitfileName == deviceBitfileName)
7316  return true;
7317 
7318  switch (inDeviceID)
7319  {
7322 
7325 
7328 
7329  default: break;
7330  }
7331  return false;
7332 
7333 } // IsCompatibleBitfileName
7334 
7335 
7336 NTV2DeviceID NTV2GetDeviceIDFromBitfileName (const string & inBitfileName)
7337 {
7338  typedef map<string, NTV2DeviceID> BitfileName2DevID;
7339  typedef BitfileName2DevID::const_iterator BitfileName2DevCI;
7340  static BitfileName2DevID sBitfileName2DevID;
7341  static AJALock sBFN2DevIDMutex;
7342  AJAAutoLock tmpLock(&sBFN2DevIDMutex);
7343  if (sBitfileName2DevID.empty())
7344  {
7345  const NTV2DeviceIDSet supportedDevices (::NTV2GetSupportedDevices());
7346  for (NTV2DeviceIDSetConstIter it(supportedDevices.begin()); it != supportedDevices.end(); ++it)
7347  {
7348  const string bitFileName(::NTV2GetBitfileName(*it));
7349  if (!bitFileName.empty())
7350  sBitfileName2DevID[bitFileName] = *it;
7351  }
7352  }
7353  BitfileName2DevCI it(sBitfileName2DevID.find(inBitfileName));
7354  return it != sBitfileName2DevID.end() ? it->second : DEVICE_ID_INVALID;
7355 }
7356 
7357 
7358 string NTV2GetFirmwareFolderPath (const bool inAddTrailingPathDelim)
7359 {
7360  string fwPath;
7363  const char c (fwPath.empty() ? 0 : fwPath.at(fwPath.length()-1));
7364  if (!inAddTrailingPathDelim)
7365  if (c == '/' || c == '\\')
7366  fwPath.erase(fwPath.length()-1, 1); // lop off trailing '/'
7367  return fwPath;
7368 }
7369 
7370 string NTV2GetPluginsFolderPath (const bool inAddTrailingPathDelim)
7371 {
7372  string fwPath;
7375  const char c (fwPath.empty() ? 0 : fwPath.at(fwPath.length()-1));
7376  if (!inAddTrailingPathDelim)
7377  if (c == '/' || c == '\\')
7378  fwPath.erase(fwPath.length()-1, 1); // lop off trailing '/'
7379  return fwPath;
7380 }
7381 
7382 string NTV2GetVDevFolderPath (const bool inAddTrailingPathDelim)
7383 {
7384  string fwPath;
7387  const char c (fwPath.empty() ? 0 : fwPath.at(fwPath.length()-1));
7388  if (!inAddTrailingPathDelim)
7389  if (c == '/' || c == '\\')
7390  fwPath.erase(fwPath.length()-1, 1); // lop off trailing '/'
7391  return fwPath;
7392 }
7393 
7394 #define IsAJAInternalDevice(_d_) (((_d_) == DEVICE_ID_IP25_R) || ((_d_) == DEVICE_ID_IP25_T) || ((_d_) == DEVICE_ID_FS8))
7395 
7397 {
7398  static const NTV2DeviceID sValidDeviceIDs [] = { DEVICE_ID_CORVID1,
7412  DEVICE_ID_FS8,
7417 // DEVICE_ID_IOIP_2022,
7418 // DEVICE_ID_IOIP_2110_RGB12,
7419 // DEVICE_ID_IOIP_2110,
7448 // DEVICE_ID_KONAIP_1RX_1TX_1SFP_J2K,
7449 // DEVICE_ID_KONAIP_1RX_1TX_2110,
7450 // DEVICE_ID_KONAIP_2022,
7451 // DEVICE_ID_KONAIP_2110_RGB12,
7452 // DEVICE_ID_KONAIP_2110,
7453 // DEVICE_ID_KONAIP_2TX_1SFP_J2K,
7454 // DEVICE_ID_KONAIP_4CH_2SFP,
7476  if (inKinds == NTV2_DEVICEKIND_NONE)
7477  return NTV2DeviceIDSet();
7478 
7479  NTV2DeviceIDSet result;
7480  if (inKinds == NTV2_DEVICEKIND_SOFTWARE)
7481  {result.insert(DEVICE_ID_SOFTWARE); result.insert(DEVICE_ID_VKONA); return result;}
7482 
7483  for (unsigned ndx(0); ndx < sizeof(sValidDeviceIDs) / sizeof(NTV2DeviceID); ndx++)
7484  {
7485  const NTV2DeviceID deviceID(sValidDeviceIDs[ndx]);
7486  if (deviceID == DEVICE_ID_NOTFOUND)
7487  continue;
7488  bool insertIt (false);
7489  if (inKinds == NTV2_DEVICEKIND_ALL)
7490  insertIt = true;
7491  else if (inKinds & NTV2_DEVICEKIND_INPUT && ::NTV2DeviceCanDoCapture(deviceID))
7492  insertIt = true;
7493  else if (inKinds & NTV2_DEVICEKIND_OUTPUT && ::NTV2DeviceCanDoPlayback(deviceID))
7494  insertIt = true;
7495  else if (inKinds & NTV2_DEVICEKIND_SDI && (::NTV2DeviceGetNumVideoInputs(deviceID)+::NTV2DeviceGetNumVideoOutputs(deviceID)) > 0)
7496  insertIt = true;
7497  else if (inKinds & NTV2_DEVICEKIND_HDMI && (::NTV2DeviceGetNumHDMIVideoInputs(deviceID)+::NTV2DeviceGetNumHDMIVideoOutputs(deviceID)) > 0)
7498  insertIt = true;
7499  else if (inKinds & NTV2_DEVICEKIND_ANALOG && (::NTV2DeviceGetNumAnalogVideoInputs(deviceID)+::NTV2DeviceGetNumAnalogVideoOutputs(deviceID)) > 0)
7500  insertIt = true;
7501  else if (inKinds & NTV2_DEVICEKIND_SFP && (::NTV2DeviceCanDoIP(deviceID) || ::NTV2DeviceCanDo25GIP(deviceID)))
7502  insertIt = true;
7503  else if (inKinds & NTV2_DEVICEKIND_EXTERNAL && ::NTV2DeviceIsExternalToHost(deviceID))
7504  insertIt = true;
7505  else if (inKinds & NTV2_DEVICEKIND_4K && ::NTV2DeviceCanDo4KVideo(deviceID))
7506  insertIt = true;
7507  else if (inKinds & NTV2_DEVICEKIND_12G && ::NTV2DeviceCanDo12GSDI(deviceID))
7508  insertIt = true;
7509  else if (inKinds & NTV2_DEVICEKIND_6G && ::NTV2DeviceCanDo12GSDI(deviceID))
7510  insertIt = true;
7511  else if (inKinds & NTV2_DEVICEKIND_CUSTOM_ANC && ::NTV2DeviceCanDoCustomAnc(deviceID))
7512  insertIt = true;
7513  else if (inKinds & NTV2_DEVICEKIND_RELAYS && ::NTV2DeviceHasSDIRelays(deviceID))
7514  insertIt = true;
7515  else if (inKinds & NTV2_DEVICEKIND_AJA_INTERNAL && IsAJAInternalDevice(deviceID))
7516  insertIt = true;
7517  if (insertIt)
7518  result.insert (deviceID);
7519  } // for each supported device
7520  return result;
7521 }
7522 
7523 ostream & operator << (std::ostream & inOutStr, const NTV2DeviceIDList & inList)
7524 {
7525  for (NTV2DeviceIDListConstIter iter(inList.begin()); iter != inList.end (); ++iter)
7526  inOutStr << (iter != inList.begin() ? ", " : "") << ::NTV2DeviceIDToString(*iter);
7527  return inOutStr;
7528 }
7529 
7530 ostream & operator << (ostream & inOutStr, const NTV2DeviceIDSet & inSet)
7531 {
7532  for (NTV2DeviceIDSetConstIter iter(inSet.begin()); iter != inSet.end(); ++iter)
7533  inOutStr << (iter != inSet.begin() ? ", " : "") << ::NTV2DeviceIDToString(*iter);
7534  return inOutStr;
7535 }
7536 
7537 
7538 std::string NTV2GetVersionString (const bool inDetailed)
7539 {
7540  ostringstream oss;
7541 
7543  if (!string (AJA_NTV2_SDK_BUILD_TYPE).empty ())
7545  if (inDetailed)
7546  oss << " built on " << AJA_NTV2_SDK_BUILD_DATETIME;
7547  return oss.str ();
7548 }
7549 
7550 UWord NTV2GetSDKVersionComponent (const int inVersionComponent)
7551 {
7552  switch (inVersionComponent)
7553  {
7554  case 0: return AJA_NTV2_SDK_VERSION_MAJOR;
7555  case 1: return AJA_NTV2_SDK_VERSION_MINOR;
7556  case 2: return AJA_NTV2_SDK_VERSION_POINT;
7557  case 3: return AJA_NTV2_SDK_BUILD_NUMBER;
7558  default: break;
7559  }
7560  return 0;
7561 }
7562 
7563 
7565 {
7566  return CNTV2RegisterExpert::GetDisplayName(inValue);
7567 }
7568 
7569 
7570 string AutoCircVidProcModeToString (const AutoCircVidProcMode inValue, const bool inCompactDisplay)
7571 {
7572  switch (inValue)
7573  {
7579  }
7580  return "??";
7581 }
7582 
7583 
7584 string NTV2ColorCorrectionModeToString (const NTV2ColorCorrectionMode inValue, const bool inCompactDisplay)
7585 {
7586  switch (inValue)
7587  {
7593  }
7594  return "??";
7595 }
7596 
7597 string NTV2BitfileTypeToString (const NTV2BitfileType inValue, const bool inCompactDisplay)
7598 {
7599  switch (inValue)
7600  {
7601  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid1 Main", NTV2_BITFILE_CORVID1_MAIN);
7602  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid22 Main", NTV2_BITFILE_CORVID22_MAIN);
7603  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona 3G Main", NTV2_BITFILE_KONA3G_MAIN);
7605  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IoExpress Main", NTV2_BITFILE_IOEXPRESS_MAIN);
7606  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid3G Main", NTV2_BITFILE_CORVID3G_MAIN);
7607  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona 3G Quad", NTV2_BITFILE_KONA3G_QUAD);
7610  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid24 Main", NTV2_BITFILE_CORVID24_MAIN);
7611  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "T-Tap Main", NTV2_BITFILE_TTAP_MAIN);
7617  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid88 Main", NTV2_BITFILE_CORVID88);
7618  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid88Gen3 Main", NTV2_BITFILE_CORVID88_GEN3);
7619  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44 Main", NTV2_BITFILE_CORVID44);
7620  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44Gen3 Main", NTV2_BITFILE_CORVID44_GEN3);
7621  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid HEVC", NTV2_BITFILE_CORVIDHEVC);
7622  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2022", NTV2_BITFILE_KONAIP_2022);
7623  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 4CH 2SFP", NTV2_BITFILE_KONAIP_4CH_2SFP);
7624  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 1Rx 1Tx 1SFP J2K", NTV2_BITFILE_KONAIP_1RX_1TX_1SFP_J2K);
7625  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2Tx 1SFP J2K", NTV2_BITFILE_KONAIP_2TX_1SFP_J2K);
7626  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 1Rx 1Tx 2110", NTV2_BITFILE_KONAIP_1RX_1TX_2110);
7631  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2110", NTV2_BITFILE_KONAIP_2110);
7633  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona HDMI", NTV2_BITFILE_KONAHDMI);
7639  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "T-Tap Pro Main", NTV2_BITFILE_TTAP_PRO_MAIN);
7640  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 2x4K Main", NTV2_BITFILE_KONA5_2X4K_MAIN);
7641  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44 2x4K Main", NTV2_BITFILE_CORVID44_2X4K_MAIN);
7642  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 3D LUT Main", NTV2_BITFILE_KONA5_3DLUT_MAIN);
7643  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Corvid44 Planar Main", NTV2_BITFILE_CORVID44_PLNR_MAIN);
7645  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE1 Main", NTV2_BITFILE_KONA5_OE1_MAIN);
7646  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE2 Main", NTV2_BITFILE_KONA5_OE2_MAIN);
7647  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE3 Main", NTV2_BITFILE_KONA5_OE3_MAIN);
7648  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE4 Main", NTV2_BITFILE_KONA5_OE4_MAIN);
7649  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE5 Main", NTV2_BITFILE_KONA5_OE5_MAIN);
7650  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE6 Main", NTV2_BITFILE_KONA5_OE6_MAIN);
7651  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE7 Main", NTV2_BITFILE_KONA5_OE7_MAIN);
7652  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE8 Main", NTV2_BITFILE_KONA5_OE8_MAIN);
7653  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE9 Main", NTV2_BITFILE_KONA5_OE9_MAIN);
7654  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE10 Main", NTV2_BITFILE_KONA5_OE10_MAIN);
7655  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE11 Main", NTV2_BITFILE_KONA5_OE11_MAIN);
7656  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "Kona5 OE12 Main", NTV2_BITFILE_KONA5_OE12_MAIN);
7657  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE1 Main", NTV2_BITFILE_SOJI_OE1_MAIN);
7658  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE2 Main", NTV2_BITFILE_SOJI_OE2_MAIN);
7659  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE3 Main", NTV2_BITFILE_SOJI_OE3_MAIN);
7660  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE4 Main", NTV2_BITFILE_SOJI_OE4_MAIN);
7661  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE5 Main", NTV2_BITFILE_SOJI_OE5_MAIN);
7662  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE6 Main", NTV2_BITFILE_SOJI_OE6_MAIN);
7663  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI OE7 Main", NTV2_BITFILE_SOJI_OE7_MAIN);
7664  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI 3DLUT Main", NTV2_BITFILE_SOJI_3DLUT_MAIN);
7665  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "SOJI DIAGS Main", NTV2_BITFILE_SOJI_DIAGS_MAIN);
7667  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "KonaIP 2110 RGB12", NTV2_BITFILE_KONAIP_2110_RGB12);
7668  NTV2UTILS_ENUM_CASE_RETURN_VAL_OR_ENUM_STR(inCompactDisplay, "IoIP 2110 RGB12", NTV2_BITFILE_IOIP_2110_RGB12);
7674  }
7675  return "(bad bitfile type)";
7676 }
7677 
7678 string NTV2DieTempScaleToString (const NTV2DieTempScale inValue, const bool inUseUTF8)
7679 {
7680  static const NTV2StringList sScalesUTF8 = { "\xE2\x84\x83", "\xE2\x84\x89", "\xC2\xB0""K", "\xC2\xB0""R"};
7681  static const NTV2StringList sScales = { "C", "F", "K", "R"};
7682  if (size_t(inValue) < sScales.size())
7683  return inUseUTF8 ? sScalesUTF8.at(inValue) : sScales.at(inValue);
7684  return "";
7685 }
7686 
7687 #if !defined(NTV2_DEPRECATE_17_6)
7688  bool convertHDRFloatToRegisterValues (const HDRFloatValues & inFloatValues, HDRRegValues & outRegisterValues)
7689  {
7690  return inFloatValues.toRegValues(outRegisterValues);
7691  }
7692 
7693  bool convertHDRRegisterToFloatValues (const HDRRegValues & inRegisterValues, HDRFloatValues & outFloatValues)
7694  {
7695  return outFloatValues.setFromRegValues(inRegisterValues);
7696  }
7697 
7698  void setHDRDefaultsForBT2020 (HDRRegValues & outRegisterValues)
7699  {
7700  outRegisterValues.setBT2020();
7701  }
7702 
7703  void setHDRDefaultsForDCIP3(HDRRegValues & outRegisterValues)
7704  {
7705  outRegisterValues.setDCIP3();
7706  }
7707 #endif // !defined(NTV2_DEPRECATE_17_6)
7708 
7709 
7710 ostream & operator << (ostream & inOutStr, const NTV2OutputCrosspointIDs & inList)
7711 {
7712  inOutStr << "[";
7713  for (NTV2OutputCrosspointIDsConstIter it (inList.begin()); it != inList.end(); )
7714  {
7715  inOutStr << ::NTV2OutputCrosspointIDToString(*it);
7716  ++it;
7717  if (it != inList.end())
7718  inOutStr << ",";
7719  }
7720  inOutStr << "]";
7721  return inOutStr;
7722 }
7723 
7724 /*
7725 static ostream & operator << (ostream & inOutStr, const NTV2InputCrosspointIDs & inList)
7726 {
7727  inOutStr << "[";
7728  for (NTV2InputCrosspointIDsConstIter it (inList.begin()); it != inList.end(); )
7729  {
7730  inOutStr << ::NTV2InputCrosspointIDToString(*it);
7731  ++it;
7732  if (it != inList.end())
7733  inOutStr << ",";
7734  }
7735  inOutStr << "]";
7736  return inOutStr;
7737 }
7738 */
7739 
7740 
7742 {
7743  NTV2RegisterReads result;
7744  for (NTV2RegNumSetConstIter it (inRegNumSet.begin()); it != inRegNumSet.end(); ++it)
7745  result.push_back (NTV2RegInfo (*it));
7746  return result;
7747 }
7748 
7750 {
7751  NTV2RegNumSet result;
7752  for (NTV2RegisterReadsConstIter it (inRegReads.begin()); it != inRegReads.end(); ++it)
7753  result.insert (it->registerNumber);
7754  return result;
7755 }
7756 
7757 bool GetRegNumChanges (const NTV2RegNumSet & inBefore, const NTV2RegNumSet & inAfter, NTV2RegNumSet & outGone, NTV2RegNumSet & outSame, NTV2RegNumSet & outNew)
7758 {
7759  outGone.clear(); outSame.clear(); outNew.clear();
7760  set_difference (inBefore.begin(), inBefore.end(), inAfter.begin(), inAfter.end(), std::inserter(outGone, outGone.begin()));
7761  set_difference (inAfter.begin(), inAfter.end(), inBefore.begin(), inBefore.end(), std::inserter(outNew, outNew.begin()));
7762  set_intersection (inBefore.begin(), inBefore.end(), inAfter.begin(), inAfter.end(), std::inserter(outSame, outSame.begin()));
7763  return true;
7764 }
7765 
7766 bool GetChangedRegisters (const NTV2RegisterReads & inBefore, const NTV2RegisterReads & inAfter, NTV2RegNumSet & outChanged)
7767 {
7768  outChanged.clear();
7769  if (&inBefore == &inAfter)
7770  return false; // Same vector, identical!
7771  if (inBefore.size() != inAfter.size())
7772  { // Only check common reg nums...
7773  NTV2RegNumSet before(::ToRegNumSet(inBefore)), after(::ToRegNumSet(inAfter)), commonRegNums;
7774  set_intersection (before.begin(), before.end(), after.begin(), after.end(),
7775  std::inserter(commonRegNums, commonRegNums.begin()));
7776  for (NTV2RegNumSetConstIter it(commonRegNums.begin()); it != commonRegNums.end(); ++it)
7777  {
7780  if (beforeIt != inBefore.end() && afterIt != inAfter.end() && beforeIt->registerValue != afterIt->registerValue)
7781  outChanged.insert(*it);
7782  }
7783  }
7784  else if (inBefore.at(0).registerNumber == inAfter.at(0).registerNumber
7785  && inBefore.at(inBefore.size()-1).registerNumber == inAfter.at(inAfter.size()-1).registerNumber)
7786  { // Assume identical reg num layout
7787  for (size_t ndx(0); ndx < inBefore.size(); ndx++)
7788  if (inBefore[ndx].registerValue != inAfter[ndx].registerValue)
7789  outChanged.insert(inBefore[ndx].registerNumber);
7790  }
7791  else for (size_t ndx(0); ndx < inBefore.size(); ndx++)
7792  {
7793  const NTV2RegInfo & beforeInfo(inBefore.at(ndx));
7794  const NTV2RegInfo & afterInfo(inAfter.at(ndx));
7795  if (beforeInfo.registerNumber == afterInfo.registerNumber)
7796  {
7797  if (beforeInfo.registerValue != afterInfo.registerValue)
7798  outChanged.insert(beforeInfo.registerNumber);
7799  }
7800  else
7801  {
7802  NTV2RegisterReadsConstIter it(::FindFirstMatchingRegisterNumber(beforeInfo.registerNumber, inAfter));
7803  if (it != inAfter.end())
7804  if (beforeInfo.registerValue != it->registerValue)
7805  outChanged.insert(beforeInfo.registerNumber);
7806  }
7807  }
7808  return !outChanged.empty();
7809 }
7810 
7811 
7812 string PercentEncode (const string & inStr)
7813 { ostringstream oss;
7814  for (size_t ndx(0); ndx < inStr.size(); ndx++)
7815  {
7816  const char chr(inStr.at(size_t(ndx)));
7817  if (::isalnum(chr) || chr == '-' || chr == '_' || chr == '.' || chr == '~' || chr == ':')
7818  oss << chr;
7819  else
7820  oss << "%" << HEX0N(unsigned(chr),2);
7821  }
7822  return oss.str();
7823 }
7824 
7825 string PercentDecode (const string & inStr)
7826 { ostringstream oss;
7827  unsigned hexNum(0), state(0); // 0=unreserved expected, 1=1st hex digit expected, 2=2nd hex digit expected
7828  for (size_t ndx(0); ndx < inStr.size(); ndx++)
7829  {
7830  const char chr(inStr.at(size_t(ndx)));
7831  switch (state)
7832  {
7833  case 0:
7834  if (::isalnum(chr) || chr == '-' || chr == '_' || chr == '.' || chr == '~' || chr == ':')
7835  oss << chr;
7836  if (chr == '%')
7837  {state++; break;}
7838  break;
7839  case 1:
7840  if (chr >= 'A' && chr <= 'F')
7841  hexNum = unsigned(chr + 10 - 'A') << 4;
7842  else if (chr >= 'a' && chr <= 'f')
7843  hexNum = unsigned(chr + 10 - 'a') << 4;
7844  else if (chr >= '0' && chr <= '9')
7845  hexNum = unsigned(chr - '0') << 4;
7846  else
7847  hexNum = 0;
7848  state++;
7849  break;
7850  case 2:
7851  if (chr >= 'A' && chr <= 'F')
7852  hexNum += unsigned(chr + 10 - 'A');
7853  else if (chr >= 'a' && chr <= 'f')
7854  hexNum += unsigned(chr + 10 - 'a');
7855  else if (chr >= '0' && chr <= '9')
7856  hexNum += unsigned(chr - '0');
7857  oss << char(hexNum);
7858  hexNum = 0;
7859  state = 0;
7860  break;
7861  default: NTV2_ASSERT(false); break;
7862  }
7863  }
7864  return oss.str();
7865 }
7866 
7867 bool StringToSerialNum64 (const string & inSerNumStr, uint64_t & outSerNum)
7868 {
7869  outSerNum = 0;
7870  if (inSerNumStr.length() < 8 || inSerNumStr.length() > 9)
7871  return false;
7872  string serNumStr(inSerNumStr);
7873  if (inSerNumStr.length() == 9) // Special case Io4K/DNXIV
7874  serNumStr.erase(0,1); // Lop off the first character
7875  uint64_t serNum(0);
7876  for (size_t ndx(0); ndx < serNumStr.length(); ndx++)
7877  {
7878  const char ch (serNumStr.at(ndx));
7879  // Allow only 0-9, A-Z, a-z, blank, and dash only
7880  if ( ! ( ( (ch >= '0') && (ch <= '9') ) ||
7881  ( (ch >= 'A') && (ch <= 'Z') ) ||
7882  ( (ch >= 'a') && (ch <= 'z') ) ||
7883  (ch == ' ') || (ch == '-') ) )
7884  return false; // Invalid character -- assume no Serial Number programmed
7885  serNum |= uint64_t(ch) << (ndx*8); // ((7-ndx)*8);
7886  }
7887  outSerNum = serNum;
7888  return true;
7889 }
7890 
7891 string SerialNum64ToString (const uint64_t & inSerNum)
7892 {
7893  const ULWord serialNumHigh (inSerNum >> 32);
7894  const ULWord serialNumLow (inSerNum & 0x00000000FFFFFFFF);
7895  char serialNum [9];
7896 
7897  serialNum[0] = char((serialNumLow & 0x000000FF) );
7898  serialNum[1] = char((serialNumLow & 0x0000FF00) >> 8);
7899  serialNum[2] = char((serialNumLow & 0x00FF0000) >> 16);
7900  serialNum[3] = char((serialNumLow & 0xFF000000) >> 24);
7901  serialNum[4] = char((serialNumHigh & 0x000000FF) );
7902  serialNum[5] = char((serialNumHigh & 0x0000FF00) >> 8);
7903  serialNum[6] = char((serialNumHigh & 0x00FF0000) >> 16);
7904  serialNum[7] = char((serialNumHigh & 0xFF000000) >> 24);
7905  serialNum[8] = '\0';
7906 
7907  for (unsigned ndx(0); ndx < 8; ndx++)
7908  {
7909  if (serialNum[ndx] == 0)
7910  {
7911  if (ndx == 0)
7912  return ""; // No characters: no serial number
7913  break; // End of string -- stop scanning
7914  }
7915 
7916  // Allow only 0-9, A-Z, a-z, blank, and dash only.
7917  if ( ! ( ( (serialNum[ndx] >= '0') && (serialNum[ndx] <= '9') ) ||
7918  ( (serialNum[ndx] >= 'A') && (serialNum[ndx] <= 'Z') ) ||
7919  ( (serialNum[ndx] >= 'a') && (serialNum[ndx] <= 'z') ) ||
7920  (serialNum[ndx] == ' ') || (serialNum[ndx] == '-') ) )
7921  return ""; // Invalid character -- assume no Serial Number programmed...
7922  }
7923  return serialNum;
7924 }
7925 
7926 #if !defined(NTV2_DEPRECATE_17_6)
7927 #if defined (AJAMac)
7928  #include <fstream>
7929  #include "ajabase/common/common.h"
7930  // Poor man's plist reader
7931  // Fetches version components out of CFBundleShortVersionString
7932  // Returns true if the Info.plist exists; otherwise false
7933  // NOTE: This will fail for binary plist files!
7934  static const string AJAMacDriverInfoPlistPath ("/Library/Extensions/AJANTV2.kext/Contents/Info.plist");
7935  bool GetInstalledMacDriverVersion (UWord & outMaj, UWord & outMin, UWord & outPt, UWord & outBld, UWord & outType)
7936  {
7937  outMaj = outMin = outPt = outBld = outType = 0;
7938  ifstream ifs;
7939  ifs.open(AJAMacDriverInfoPlistPath.c_str(), std::ios::in);
7940  if (!ifs.is_open())
7941  return false;
7942  if (!ifs.good())
7943  return false;
7944  const string key("<key>CFBundleShortVersionString</key>");
7945  for (string line; std::getline(ifs, line); )
7946  {
7947  size_t keyPos(line.find(key));
7948  if (keyPos == string::npos)
7949  continue;
7950  if (!std::getline(ifs, line))
7951  break;
7952  //"<string>16.1.0b58</string>" or "<string>16.0.1</string>"
7953  size_t startPos(line.find("<string>")), endPos(line.find("</string>"));
7954  if (startPos == string::npos || endPos == string::npos)
7955  continue;
7956  startPos += 8;
7957  if (endPos < startPos)
7958  continue;
7959  string versStr(line.substr(startPos, endPos-startPos)); // "16.1.0b58" or "16.0.1"
7960  NTV2StringList versComps;
7961  aja::split(versStr, '.', versComps);
7962  if (versComps.size() < 3 || versComps.size() > 4)
7963  continue;
7964  const string sBuildTypes("_bad"); // 1=beta 2=alpha 3=dev
7965  for (size_t bt(1); bt < 4; bt++)
7966  if (versComps.at(2).find(sBuildTypes[bt]) != string::npos)
7967  { NTV2StringList lastComps;
7968  aja::split(versComps.at(2), sBuildTypes[bt], lastComps);
7969  versComps.erase(versComps.begin()+2);
7970  versComps.push_back(lastComps.at(0));
7971  outBld = UWord(aja::stoul(lastComps.at(1)));
7972  outType = UWord(bt);
7973  break;
7974  }
7975  for (size_t ndx(0); ndx < versComps.size(); ndx++)
7976  {
7977  if (versComps.at(ndx).empty())
7978  continue;
7979  UWord val(UWord(aja::stoul(versComps.at(ndx))));
7980  if (ndx == 0)
7981  outMaj = val;
7982  else if (ndx == 1)
7983  outMin = val;
7984  else if (ndx == 2)
7985  outPt = val;
7986  else if (ndx == 3 && outType == 0)
7987  outBld = val;
7988  else
7989  break;
7990  }
7991  break;
7992  }
7993  return true;
7994  }
7995 #endif // AJAMac
7996 #endif // !defined(NTV2_DEPRECATE_17_6)
bool IsProgressivePicture(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5394
Fractional rate of 15,000 frames per 1,001 seconds.
Definition: ntv2enums.h:431
string NTV2ScanMethodToString(const NTV2ScanMethod inValue, const bool inCompact)
Definition: ntv2utils.cpp:6621
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:1796
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:3641
Everything needed to call CNTV2Card::ReadRegister or CNTV2Card::WriteRegister functions.
The invalid video input.
Definition: ntv2enums.h:1279
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:1390
string NTV2GetVDevFolderPath(const bool inAddTrailingPathDelim)
Definition: ntv2utils.cpp:7382
#define NTV2UTILS_ENUM_CASE_RETURN_STR(enum_name)
Definition: ntv2utils.cpp:37
string NTV2FramesizeToString(const NTV2Framesize inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6470
Identifies the 4th HDMI video input.
Definition: ntv2enums.h:1270
Identifies the 5th SDI video input.
Definition: ntv2enums.h:1275
Specifies devices with HDMI connectors.
Definition: ntv2enums.h:1388
NTV2AudioSystem
Used to identify an Audio System on an NTV2 device. See Audio System Operation for more information...
Definition: ntv2enums.h:3898
#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:7312
NTV2AudioSystem NTV2ChannelToAudioSystem(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2AudioSystem.
Definition: ntv2utils.cpp:4872
Declares a number of pixel format transcoder functions.
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2375
YCbCr color space.
Definition: ntv2enums.h:3612
Declares the AJALock class.
Specifies SDI input/output kinds.
Definition: ntv2enums.h:1294
std::set< NTV2TCIndex > NTV2TCIndexes
NTV2FrameRate GetNTV2FrameRateFromNumeratorDenominator(const ULWord inNumerator, const ULWord inDenominator)
Definition: ntv2utils.cpp:3588
SDI 3 embedded VITC 2.
Definition: ntv2enums.h:3977
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:1468
string NTV2HDMIColorSpaceToString(const NTV2HDMIColorSpace inValue, const bool inCompact)
Definition: ntv2utils.cpp:6693
Identifies SMPTE HD 1080p.
Definition: ntv2enums.h:173
NTV2FrameGeometry GetGeometryFromStandard(const NTV2Standard inStandard)
Definition: ntv2utils.cpp:4068
Specifies devices with analog video connectors.
Definition: ntv2enums.h:1389
Specifies devices with SDI connectors.
Definition: ntv2enums.h:1387
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:1703
Specifies the device&#39;s internal clock.
Definition: ntv2enums.h:1462
#define NTV2_VIDEO_FORMAT_IS_B(__f__)
Definition: ntv2enums.h:1131
This identifies the invalid (unspecified, uninitialized) VANC mode.
Definition: ntv2enums.h:3805
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:7891
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:1917
NTV2HDMIColorSpace
Indicates or specifies HDMI Color Space.
Definition: ntv2enums.h:3608
ULWordSet NTV2RegisterNumberSet
A set of distinct ULWord values.
string NTV2AncDataRgnToStr(const NTV2AncDataRgn inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6580
#define NTV2_IS_2K_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:758
ULWord GetBytesPerRow(const UWord inPlaneIndex0=0) const
bool IsNULL(void) const
Specifies devices that have 12G SDI connectors.
Definition: ntv2enums.h:1395
Identifies the 2nd HDMI video input.
Definition: ntv2enums.h:1268
NTV2InputSource GetNTV2InputSourceForIndex(const ULWord inIndex0, const NTV2IOKinds inKinds)
Definition: ntv2utils.cpp:5227
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:361
See KONA 5.
Definition: ntv2enums.h:55
ostream & operator<<(ostream &inOutStream, const NTV2FrameSize &inFrameDimensions)
Definition: ntv2utils.cpp:5718
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:1843
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
Definition: ntv2enums.h:221
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:1401
#define NTV2_VIDEO_FORMAT_IS_A(__f__)
Definition: ntv2enums.h:1096
uint32_t * PULWord
Definition: ajatypes.h:237
Obtain audio samples from the device AES inputs, if available.
Definition: ntv2enums.h:2011
std::string NTV2GetVersionString(const bool inDetailed)
Definition: ntv2utils.cpp:7538
See KONA 5.
Definition: ntv2enums.h:63
Specifies the HDMI In 1 connector.
Definition: ntv2enums.h:1464
10-Bit 4:2:2 2-Plane YCbCr
Definition: ntv2enums.h:254
NTV2OutputDestination
Identifies a specific video output destination.
Definition: ntv2enums.h:1326
NTV2DeviceIDSet NTV2GetSupportedDevices(const NTV2DeviceKinds inKinds)
Returns an NTV2DeviceIDSet of devices supported by the SDK.
Definition: ntv2utils.cpp:7396
See KONA LHe Plus.
Definition: ntv2enums.h:77
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:360
Obtain audio samples from the device HDMI input, if available.
Definition: ntv2enums.h:2013
See 10-Bit YCbCr Format.
Definition: ntv2enums.h:224
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:3975
Apple ProRes DVC Pro.
Definition: ntv2enums.h:243
1280x720, for 720p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:354
string NTV2EmbeddedAudioClockToString(const NTV2EmbeddedAudioClock inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5796
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
size_t GetByteCount(void) const
ULWord GetDisplayWidth(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:4199
SDI 3 embedded VITC.
Definition: ntv2enums.h:3959
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:1166
string NTV2RegisterWriteModeToString(const NTV2RegisterWriteMode inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7114
#define NTV2_IS_TALLER_VANC_GEOMETRY(__g__)
Definition: ntv2enums.h:402
ULWord width(void) const
std::string NTV2InterruptEnumToString(const INTERRUPT_ENUMS inInterruptEnumValue)
Definition: ntv2utils.cpp:7127
SDI 4 embedded ATC LTC.
Definition: ntv2enums.h:3970
Identifies the 1st HDMI video input.
Definition: ntv2enums.h:1267
string NTV2ReferenceSourceToString(const NTV2ReferenceSource inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7085
Fractional rate of 120,000 frames per 1,001 seconds.
Definition: ntv2enums.h:429
static AJALock sFRFamMutex
Definition: ntv2utils.cpp:5319
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:1940
Identifies the "monitor" or "auxiliary" Field 2 ancillary data region.
Definition: ntv2enums.h:4235
Identifies SMPTE SD 525i.
Definition: ntv2enums.h:171
void ConvertARGBYCbCrToABGR(UByte *rgbaBuffer, ULWord numPixels)
New in SDK 16.0.
Definition: ntv2enums.h:2567
See 10-Bit Raw YCbCr (CION).
Definition: ntv2enums.h:250
Identifies 4K psf.
Definition: ntv2enums.h:184
bool NTV2DeviceCanDo12GSDI(const NTV2DeviceID inDeviceID)
string NTV2CrosspointToString(const NTV2Crosspoint inChannel)
Definition: ntv2utils.cpp:5808
ULWord GetFullRasterHeight(void) const
AutoCircVidProcMode
#define NTV2_IS_TALL_VANC_GEOMETRY(__g__)
Definition: ntv2enums.h:395
#define NTV2_VIDEO_FORMAT_HAS_PROGRESSIVE_PICTURE(__f__)
Definition: ntv2enums.h:1051
static const NTV2TCIndex gChanVITC1[]
Definition: ntv2utils.cpp:4960
Identifies the AES/EBU audio breakout cable that has XLR connectors.
Definition: ntv2enums.h:3109
bool GetRegNumChanges(const NTV2RegNumSet &inBefore, const NTV2RegNumSet &inAfter, NTV2RegNumSet &outGone, NTV2RegNumSet &outSame, NTV2RegNumSet &outNew)
Definition: ntv2utils.cpp:7757
string NTV2BitfileTypeToString(const NTV2BitfileType inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:7597
NTV2FrameGeometry GetVANCFrameGeometry(const NTV2FrameGeometry inFrameGeometry, const NTV2VANCMode inVancMode)
Definition: ntv2utils.cpp:3904
Capture (input) mode, which writes into device SDRAM.
Definition: ntv2enums.h:1245
See Alternate 8-Bit YCbCr (&#39;YUY2&#39;).
Definition: ntv2enums.h:229
ULWord GetIndexForNTV2Crosspoint(const NTV2Crosspoint channel)
Definition: ntv2utils.cpp:4827
#define NTV2_IS_VALID_AUDIO_BUFFER_SIZE(_x_)
Definition: ntv2enums.h:1928
See 10-Bit YCbCr - DPX Format.
Definition: ntv2enums.h:233
void PackRGB10BitFor10BitRGBPacked(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Identifies high frame-rate UHD.
Definition: ntv2enums.h:179
NTV2AudioSystem NTV2InputSourceToAudioSystem(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2AudioSystem value.
Definition: ntv2utils.cpp:5074
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:5271
NTV2FrameRates::const_iterator NTV2FrameRatesConstIter
Definition: ntv2utils.cpp:5314
Specifies devices that have 6G SDI connectors.
Definition: ntv2enums.h:1394
Analog LTC 2.
Definition: ntv2enums.h:3964
bool GetInstalledMacDriverVersion(UWord &outMaj, UWord &outMin, UWord &outPt, UWord &outBld, UWord &outType)
Definition: ntv2utils.cpp:7935
See 3-Plane 10-Bit YCbCr 4:2:2 (&#39;I422_10LE&#39; a.k.a. &#39;YUV-P-L10&#39;).
Definition: ntv2enums.h:252
Specifies HDMI input/output kinds.
Definition: ntv2enums.h:1295
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:5360
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:2010
NTV2EmbeddedAudioClock
This enum value determines/states the device audio clock reference source. It was important to set th...
Definition: ntv2enums.h:1993
NTV2InputSource NTV2TimecodeIndexToInputSource(const NTV2TCIndex inTCIndex)
Converts the given NTV2TCIndex value into the appropriate NTV2InputSource value.
Definition: ntv2utils.cpp:4991
The ordinally first geometry (New in SDK 16.0)
Definition: ntv2enums.h:353
ULWord GetTotalBytes(void) const
string NTV2HDMIBitDepthToString(const NTV2HDMIBitDepth inValue, const bool inCompact)
Definition: ntv2utils.cpp:6648
NTV2Channel NTV2CrosspointToNTV2Channel(const NTV2Crosspoint inCrosspointChannel)
Definition: ntv2utils.cpp:4711
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:1297
#define NTV2_IS_2K_1080_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:765
Definition: lock.h:28
#define NTV2_IS_VALID_OUTPUT_DEST(_dest_)
Definition: ntv2enums.h:1349
Defines a number of handy byte-swapping macros.
#define CCIR601_8BIT_BLACK
Identifies 8K.
Definition: ntv2enums.h:182
The "default" timecode (mostly used by the AJA "Retail" service and Control Panel) ...
Definition: ntv2enums.h:3956
std::string setFromString(const std::string &inStr)
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:3347
This identifies the mode in which there are some + extra VANC lines in the frame buffer.
Definition: ntv2enums.h:3804
string NTV2AudioRateToString(const NTV2AudioRate inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5759
See 3-Plane 8-Bit YCbCr 4:2:0 (&#39;I420&#39; a.k.a. &#39;YUV-P420&#39;).
Definition: ntv2enums.h:235
HDMI protocol.
Definition: ntv2enums.h:3626
#define NTV2_IS_VALID_TIMECODE_INDEX(__x__)
Definition: ntv2enums.h:3987
2048x1080, for 2Kx1080p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:366
Definition: json.hpp:5362
Output Cb if set, elso Output Cb to 0x200.
Definition: ntv2enums.h:1694
NTV2HDMIAudioChannels
Indicates or specifies the HDMI audio channel count.
Definition: ntv2enums.h:3670
Interlaced.
Definition: ntv2enums.h:499
This identifies the 3rd Audio System.
Definition: ntv2enums.h:3902
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:419
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:5419
UWord NTV2DeviceGetNumAnalogVideoInputs(const NTV2DeviceID inDeviceID)
See 8-Bit DVCPro.
Definition: ntv2enums.h:234
string NTV2MixerKeyerModeToString(const NTV2MixerKeyerMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6521
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:3638
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:2034
static const NTV2TCIndex gChanVITC2[]
Definition: ntv2utils.cpp:4961
NTV2AudioFormat
Definition: ntv2enums.h:1954
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:1359
NTV2Standard Get4xSizedStandard(const NTV2Standard inStandard, const bool bIs4k)
Definition: ntv2utils.cpp:2357
string NTV2GetBitfileName(const NTV2DeviceID inBoardID)
Definition: ntv2utils.cpp:7232
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:5960
Identifies the 8th SDI video input.
Definition: ntv2enums.h:1278
See Io 4K Plus.
Definition: ntv2enums.h:37
Specifies devices that internally use NTV2.
Definition: ntv2enums.h:1400
NTV2VideoFormat GetOutputForConversionMode(const NTV2ConversionMode conversionMode)
Definition: ntv2utils.cpp:5670
NTV2WidgetType
Definition: ntv2enums.h:3050
string NTV2AudioChannelPairToString(const NTV2AudioChannelPair inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6434
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:369
This identifies the 5th Audio System.
Definition: ntv2enums.h:3904
See Corvid 44.
Definition: ntv2enums.h:26
bool Is4KFormat(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5437
void PackRGB10BitFor10BitRGB(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
Identifies the 2nd SDI video input.
Definition: ntv2enums.h:1272
bool IsRaw(const NTV2FrameBufferFormat frameBufferFormat)
Definition: ntv2utils.cpp:5449
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:176
See 3-Plane 8-Bit YCbCr 4:2:2 (Weitek &#39;Y42B&#39; a.k.a. &#39;YUV-P8&#39;).
Definition: ntv2enums.h:248
See KONA 3G (Quad Mode).
Definition: ntv2enums.h:47
SDI 8 embedded VITC.
Definition: ntv2enums.h:3968
Represents an unknown or invalid frame rate.
Definition: ntv2enums.h:416
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:2012
string NTV2FrameGeometryToString(const NTV2FrameGeometry inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:6981
NTV2VideoFormat GetInputForConversionMode(const NTV2ConversionMode conversionMode)
Definition: ntv2utils.cpp:5626
NTV2RegWritesConstIter NTV2RegisterReadsConstIter
SDI 8 embedded ATC LTC.
Definition: ntv2enums.h:3974
50 frames per second
Definition: ntv2enums.h:425
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:2565
NTV2InputSource NTV2ChannelToInputSource(const NTV2Channel inChannel, const NTV2IOKinds inSourceType)
Definition: ntv2utils.cpp:5135
SDI 6 embedded VITC 2.
Definition: ntv2enums.h:3980
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:170
void setHDRDefaultsForBT2020(HDRRegValues &outRegisterValues)
Definition: ntv2utils.cpp:7698
See KONA 5.
Definition: ntv2enums.h:66
string PercentDecode(const string &inStr)
Definition: ntv2utils.cpp:7825
Specifies devices that output (playout).
Definition: ntv2enums.h:1384
See T-TAP.
Definition: ntv2enums.h:93
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:364
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:3954
bool Fill(const T &inValue)
Fills me with the given scalar value.
Specifies the External Reference connector.
Definition: ntv2enums.h:1459
Fractional rate of 48,000 frames per 1,001 seconds.
Definition: ntv2enums.h:427
30 frames per second
Definition: ntv2enums.h:420
string NTV2DieTempScaleToString(const NTV2DieTempScale inValue, const bool inUseUTF8)
Definition: ntv2utils.cpp:7678
Field Mode: Register changes take effect at the next field VBI.
Definition: ntv2enums.h:1684
#define NTV2_IS_VALID_AUDIO_CHANNEL_QUAD(__p__)
Definition: ntv2enums.h:3314
Specifies the SDI In 2 connector.
Definition: ntv2enums.h:1461
UWord NTV2DeviceGetNumHDMIVideoOutputs(const NTV2DeviceID inDeviceID)
SDI 3 embedded ATC LTC.
Definition: ntv2enums.h:3969
NTV2FrameRate
Identifies a particular video frame rate.
Definition: ntv2enums.h:414
7680x4320, for UHD2, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:373
See KONA 5.
Definition: ntv2enums.h:62
Analog LTC 1.
Definition: ntv2enums.h:3963
2048x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:358
8-Bit 4:2:2 2-Plane YCbCr
Definition: ntv2enums.h:256
0: Disabled (never recommended): device configured exclusively by client application(s).
NTV2Standard
Identifies a particular video standard.
Definition: ntv2enums.h:167
string NTV2GetFirmwareFolderPath(const bool inAddTrailingPathDelim)
Definition: ntv2utils.cpp:7358
Playout (output) mode, which reads from device SDRAM.
Definition: ntv2enums.h:1243
bool IsProgressiveTransport(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5400
This identifies the 6th Audio System.
Definition: ntv2enums.h:3905
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:4962
void * GetWriteableRowAddress(void *pInStartAddress, const ULWord inRowIndex0, const UWord inPlaneIndex0=0) const
Specifies the HDMI In 3 connector.
Definition: ntv2enums.h:1476
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:181
ULWord GetIndexForNTV2Channel(const NTV2Channel inChannel)
Definition: ntv2utils.cpp:4705
int16_t Word
Definition: ajatypes.h:233
1920x1080, for 1080i and 1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:352
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:5748
void ConvertLineto16BitRGB(UWord *ycbcrBuffer, RGBAlpha16BitPixel *rgbaBuffer, ULWord numPixels, bool fUseSDMatrix, bool fUseSMPTERange=false)
The invalid mode.
Definition: ntv2enums.h:1247
#define CCIR601_10BIT_WHITE
16-Bit ARGB
Definition: ntv2enums.h:247
ULWord GetRasterHeight(const bool inVisibleOnly=false) const
string NTV2ChannelToString(const NTV2Channel inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5730
See KONA LHi.
Definition: ntv2enums.h:78
Invalid or "not found".
Definition: ntv2enums.h:100
NTV2Crosspoint GetNTV2CrosspointInputForIndex(const ULWord index)
Definition: ntv2utils.cpp:4771
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:7703
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:1045
NTV2ReferenceSource
These enum values identify a specific source for the device&#39;s (output) reference clock.
Definition: ntv2enums.h:1457
RGB color space.
Definition: ntv2enums.h:3611
NTV2BreakoutType
Identifies the Breakout Boxes and Cables that may be attached to an AJA NTV2 device.
Definition: ntv2enums.h:3106
Identifies "all" ancillary data regions.
Definition: ntv2enums.h:4240
#define NTV2_INPUT_SOURCE_IS_HDMI(_inpSrc_)
Definition: ntv2enums.h:1283
ULWord GetIndexForNTV2CrosspointChannel(const NTV2Crosspoint channel)
Definition: ntv2utils.cpp:4755
bool IsNTV2CrosspointInput(const NTV2Crosspoint inChannel)
Definition: ntv2utils.cpp:4852
Specifies analog input/output kinds.
Definition: ntv2enums.h:1296
Identifies Ultra-High-Definition (UHD) psf.
Definition: ntv2enums.h:183
1280x720, for 720p, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:362
enum NTV2AncillaryDataRegion NTV2AncDataRgn
SDI 6 embedded ATC LTC.
Definition: ntv2enums.h:3972
#define AJA_NULL
Definition: ajatypes.h:180
#define NTV2_IS_VALID_IOKINDS(_k_)
Definition: ntv2enums.h:1314
See 10-Bit RGB Format.
Definition: ntv2enums.h:228
ULWord GetVaricamRepeatCount(const NTV2FrameRate inSequenceRate, const NTV2FrameRate inPlayRate, const ULWord inCadenceFrame)
Definition: ntv2utils.cpp:3315
#define NTV2_IS_FBF_RGB(__fbf__)
Definition: ntv2enums.h:285
NTV2Channel NTV2TimecodeIndexToChannel(const NTV2TCIndex inTCIndex)
Converts the given NTV2TCIndex value into the appropriate NTV2Channel value.
Definition: ntv2utils.cpp:4982
See KONA 5.
Definition: ntv2enums.h:61
Identifies the 3rd SDI video input.
Definition: ntv2enums.h:1273
bool IsTransportCompatibleFormat(const NTV2VideoFormat inFormat1, const NTV2VideoFormat inFormat2)
Definition: ntv2utils.cpp:5209
See KONA 5.
Definition: ntv2enums.h:67
New in SDK 16.0.
Definition: ntv2enums.h:2588
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:2031
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:3784
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:7065
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:7042
void PackRGB10BitFor10BitARGBPacked(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels)
string NTV2AudioSourceToString(const NTV2AudioSource inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6734
NTV2ColorCorrectionMode
Definition: ntv2enums.h:2082
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:1470
2: OEM (recommended): device configured by client application(s) with some driver involvement...
New in SDK 16.0.
Definition: ntv2enums.h:2564
NTV2RegisterNumberSet NTV2RegNumSet
A set of distinct NTV2RegisterNumbers.
bool Is8BitFrameBufferFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5455
NTV2AudioChannelPair
Identifies a pair of audio channels.
Definition: ntv2enums.h:3134
NTV2FrameRateFamilies::const_iterator NTV2FrameRateFamiliesConstIter
Definition: ntv2utils.cpp:5316
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:1382
NTV2EmbeddedAudioInput NTV2ChannelToEmbeddedAudioInput(const NTV2Channel inChannel)
Converts the given NTV2Channel value into its equivalent NTV2EmbeddedAudioInput.
Definition: ntv2utils.cpp:4864
NTV2MixerKeyerInputControl
These enum values identify the Mixer/Keyer foreground and background input control values...
Definition: ntv2enums.h:1779
Software device that doesn&#39;t emulate one of the above devices.
Definition: ntv2enums.h:83
NTV2Channel GetNTV2ChannelForIndex(const ULWord inIndex)
Definition: ntv2utils.cpp:4700
Automatic (not for OEM use)
Definition: ntv2enums.h:3610
#define NTV2_IS_PSF_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:1018
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:6496
ULWord firstActiveLine
First active line of video (0 if NTV2_VANCMODE_OFF)
New in SDK 16.0.
Definition: ntv2enums.h:2587
std::vector< uint16_t > UWordSequence
An ordered sequence of UWord (uint16_t) values.
NTV2UpConvertMode
Definition: ntv2enums.h:2222
Specifies the SDI In 3 connector.
Definition: ntv2enums.h:1465
SDI 4 embedded VITC.
Definition: ntv2enums.h:3960
#define NTV2_IS_INPUT_CROSSPOINT(__x__)
Definition: ntv2enums.h:1727
std::set< NTV2FrameGeometry > NTV2GeometrySet
A set of distinct NTV2FrameGeometry values.
#define NTV2_IS_3Gb_FORMAT(__f__)
Definition: ntv2enums.h:977
string NTV2MixerInputControlToString(const NTV2MixerKeyerInputControl inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6535
See KONA 5.
Definition: ntv2enums.h:59
NTV2Crosspoint NTV2ChannelToInputCrosspoint(const NTV2Channel inChannel)
Definition: ntv2utils.cpp:4918
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:230
NTV2HDMIProtocol
Indicates or specifies the HDMI protocol.
Definition: ntv2enums.h:3624
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:226
void ConvertARGBToRGB(UByte *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
Embeds silence (zeroes) into the data stream.
Definition: ntv2enums.h:2033
string AutoCircVidProcModeToString(const AutoCircVidProcMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:7570
string NTV2HDMIAudioChannelsToString(const NTV2HDMIAudioChannels inValue, const bool inCompact)
Definition: ntv2utils.cpp:6660
#define IsAJAInternalDevice(_d_)
Definition: ntv2utils.cpp:7394
Passes only background video + key to the Mixer output.
Definition: ntv2enums.h:1799
UWord NTV2DeviceGetNumAnalogVideoOutputs(const NTV2DeviceID inDeviceID)
NTV2Channel NTV2OutputDestinationToChannel(const NTV2OutputDestination inOutputDest)
Converts a given NTV2OutputDestination to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5158
Specifies channel or FrameStore 8 (or the 8th item).
Definition: ntv2enums.h:1368
See KONA HDMI.
Definition: ntv2enums.h:68
New in SDK 16.0.
Definition: ntv2enums.h:2800
#define NTV2_IS_FBF_8BIT(__fbf__)
Definition: ntv2enums.h:301
Identifies SMPTE HD 2K1080p.
Definition: ntv2enums.h:175
Specifies the PTP source on SFP 1.
Definition: ntv2enums.h:1471
NTV2DownConvertMode
Definition: ntv2enums.h:2245
Register changes take effect immediately, without waiting for a field or frame VBI.
Definition: ntv2enums.h:1686
string NTV2IsoConvertModeToString(const NTV2IsoConvertMode inValue, const bool inCompact)
Definition: ntv2utils.cpp:6633
string NTV2RegisterNumberToString(const NTV2RegisterNumber inValue)
Definition: ntv2utils.cpp:7564
Specifies software devices (that don&#39;t model "real" ones).
Definition: ntv2enums.h:1386
bool NTV2DeviceCanDoPlayback(const NTV2DeviceID inDeviceID)
Specifies channel or FrameStore 2 (or the 2nd item).
Definition: ntv2enums.h:1362
See Corvid 44 12G.
Definition: ntv2enums.h:27
bool NTV2DeviceHasSDIRelays(const NTV2DeviceID inDeviceID)
Specifies the SDI In 1 connector.
Definition: ntv2enums.h:1460
string NTV2FrameRateToString(const NTV2FrameRate inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:7011
This identifies the 7th Audio System.
Definition: ntv2enums.h:3906
Specifies the PCR source on SFP 1.
Definition: ntv2enums.h:1472
void PackTo10BitYCbCrBuffer(const uint16_t *ycbcrBuffer, uint32_t *packedBuffer, const uint32_t numPixels)
Definition: ntv2utils.cpp:216
NTV2BitfileType
Definition: ntv2enums.h:3371
See 12-Bit Packed RGB.
Definition: ntv2enums.h:242
NTV2OutputDestination NTV2ChannelToOutputDestination(const NTV2Channel inChannel, const NTV2IOKinds inKinds)
Converts the given NTV2Channel value into its ordinary equivalent NTV2OutputDestination.
Definition: ntv2utils.cpp:5170
Register changes take effect after 10 lines after the next field VBI (not commonly used)...
Definition: ntv2enums.h:1687
string NTV2FrameBufferFormatToString(const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:6939
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:1695
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:6608
uint8_t UByte
Definition: ajatypes.h:231
NTV2Crosspoint NTV2ChannelToOutputCrosspoint(const NTV2Channel inChannel)
Definition: ntv2utils.cpp:4929
NTV2VANCMode GetVANCModeForGeometry(const NTV2FrameGeometry inFG)
Definition: ntv2utils.cpp:4056
static const INTERRUPT_ENUMS gChannelToInputInterrupt[]
Specifies the HDMI In 2 connector.
Definition: ntv2enums.h:1475
ULWord GetNTV2FrameGeometryWidth(const NTV2FrameGeometry inGeometry)
Definition: ntv2utils.cpp:4191
1920x1080, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:357
UWord NTV2DeviceGetNumVideoInputs(const NTV2DeviceID inDeviceID)
720x486, for NTSC 525i, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:359
INTERRUPT_ENUMS NTV2ChannelToInputInterrupt(const NTV2Channel inChannel)
Converts the given NTV2Channel value into the equivalent input INTERRUPT_ENUMS value.
Definition: ntv2utils.cpp:4940
See 3-Plane 10-Bit YCbCr 4:2:0 (&#39;I420_10LE&#39; a.k.a. &#39;YUV-P420-L10&#39;).
Definition: ntv2enums.h:251
See KONA LHi.
Definition: ntv2enums.h:79
string NTV2VideoLimitingToString(const NTV2VideoLimiting inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6548
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:5002
NTV2Crosspoint GetNTV2CrosspointForIndex(const ULWord index)
Definition: ntv2utils.cpp:4803
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:3811
Overlays foreground video on top of background video.
Definition: ntv2enums.h:1797
#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:371
Identifies the 4th SDI video input.
Definition: ntv2enums.h:1274
NTV2Framesize
Kona2/Xena2 specific enums.
Definition: ntv2enums.h:2119
Specifies the PCR source on SFP 2.
Definition: ntv2enums.h:1474
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:5197
void Convert16BitARGBTo12BitRGBPacked(RGBAlpha16BitPixel *rgbaLineBuffer, UByte *rgbLineBuffer, ULWord numPixels)
8192x4320, for 8K, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:375
void Make8BitWhiteLine(UByte *lineData, ULWord numPixels, NTV2FrameBufferFormat fbFormat)
Definition: ntv2utils.cpp:887
#define NTV2_IS_VALID_CHANNEL(__x__)
Definition: ntv2enums.h:1373
10-Bit DPX Little-Endian
Definition: ntv2enums.h:240
string NTV2AudioLoopBackToString(const NTV2AudioLoopBack inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5784
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:6913
Identifies SMPTE HD 1080i or 1080psf.
Definition: ntv2enums.h:169
Identifies Ultra-High-Definition (UHD)
Definition: ntv2enums.h:177
NTV2Mode
Used to identify the mode of a widget_framestore, or the direction of an AutoCirculate stream: either...
Definition: ntv2enums.h:1241
See KONA IP.
Definition: ntv2enums.h:72
std::string toString(const bool inNormalized=false) const
Definition: ntv2utils.cpp:4306
Fractional rate of 30,000 frames per 1,001 seconds.
Definition: ntv2enums.h:421
10-Bit 4:2:0 2-Plane YCbCr
Definition: ntv2enums.h:253
Identifies the "Legal SDI" mode (Ymax=0x3AC, Cmax=0x3C0)
Definition: ntv2enums.h:3783
string NTV2GetPluginsFolderPath(const bool inAddTrailingPathDelim)
Definition: ntv2utils.cpp:7370
NTV2InputSource
Identifies a specific video input source.
Definition: ntv2enums.h:1264
unsigned char y
Identifies SMPTE SD 625i.
Definition: ntv2enums.h:172
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:1276
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:7550
NTV2TimecodeIndex NTV2InputSourceToTimecodeIndex(const NTV2InputSource inInputSource, const bool inEmbeddedLTC)
Converts a given NTV2InputSource to its equivalent NTV2TimecodeIndex value.
Definition: ntv2utils.cpp:5098
2048x1080, for 2Kx1080p, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:363
Invalid/uninitialized.
Definition: ntv2enums.h:1800
Identifies 4K.
Definition: ntv2enums.h:178
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:5413
#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:3672
#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:350
ULWord GetIndexForNTV2CrosspointInput(const NTV2Crosspoint channel)
Definition: ntv2utils.cpp:4787
ULWord NTV2FramesizeToByteCount(const NTV2Framesize inFrameSize)
Converts the given NTV2Framesize value into an exact byte count.
Definition: ntv2utils.cpp:5290
720x576, for PAL 625i, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:356
NTV2FrameGeometry GetNTV2FrameGeometryFromVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:2644
This identifies the first Audio System.
Definition: ntv2enums.h:3900
Progressive Segmented Frame.
Definition: ntv2enums.h:500
See Corvid HEVC.
Definition: ntv2enums.h:35
std::string NTV2IpErrorEnumToString(const NTV2IpError inIpErrorEnumValue)
Definition: ntv2utils.cpp:7177
See 8-Bit HDV.
Definition: ntv2enums.h:236
SDI 2 embedded VITC 2.
Definition: ntv2enums.h:3976
Apple ProRes HDV.
Definition: ntv2enums.h:244
60 frames per second
Definition: ntv2enums.h:417
#define NTV2_IS_VALID_INPUT_SOURCE(_inpSrc_)
Definition: ntv2enums.h:1286
15 frames per second
Definition: ntv2enums.h:430
string NTV2UpConvertModeToString(const NTV2UpConvertMode inValue, const bool inCompact)
Definition: ntv2utils.cpp:6594
void UnPack10BitDPXtoForRP215(UWord *rawrp215Buffer, ULWord *DPXLinebuffer, ULWord numPixels)
Definition: ntv2utils.cpp:716
10-Bit ARGB
Definition: ntv2enums.h:246
Identifies the 7th SDI video input.
Definition: ntv2enums.h:1277
bool Is8KFormat(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5443
Declares numerous NTV2 utility functions.
static const INTERRUPT_ENUMS gChannelToOutputInterrupt[]
static bool CheckFrameRateFamiliesInitialized(void)
Definition: ntv2utils.cpp:5322
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:1469
SDI 4 embedded VITC 2.
Definition: ntv2enums.h:3978
New in SDK 16.0.
Definition: ntv2enums.h:2876
NTV2OutputCrosspointID
Identifies a widget output, a signal source, that potentially can drive another widget&#39;s input (ident...
Definition: ntv2enums.h:2530
#define CCIR601_8BIT_WHITE
Declares the AJASystemInfo class.
NTV2IsoConvertMode
Definition: ntv2enums.h:2256
NTV2InputCrosspointID
Identifies a widget input that potentially can accept a signal emitted from another widget&#39;s output (...
Definition: ntv2enums.h:2755
Identifies the "normal" Field 2 ancillary data region.
Definition: ntv2enums.h:4233
This identifies the 4th Audio System.
Definition: ntv2enums.h:3903
SDI 7 embedded ATC LTC.
Definition: ntv2enums.h:3973
ULWord GetFirstActiveLine(const NTV2FieldID inRasterFieldID=NTV2_FIELD0) const
Definition: ntv2utils.cpp:4219
uint16_t NTV2DeviceKinds
A combination of NTV2DeviceKindFilter values.
Definition: ntv2enums.h:1404
#define NTV2_AUDIOSAMPLESIZE
SDI 8 embedded VITC 2.
Definition: ntv2enums.h:3982
static const string AJAMacDriverInfoPlistPath("/Library/Extensions/AJANTV2.kext/Contents/Info.plist")
Specifies devices that input (capture).
Definition: ntv2enums.h:1383
Specifies the Analog In 1 connector.
Definition: ntv2enums.h:1463
string NTV2HDMIProtocolToString(const NTV2HDMIProtocol inValue, const bool inCompact)
Definition: ntv2utils.cpp:6671
string NTV2BreakoutTypeToString(const NTV2BreakoutType inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6561
Specifies the PTP source on SFP 2.
Definition: ntv2enums.h:1473
#define NTV2_IS_QUAD_QUAD_FORMAT(__f__)
Definition: ntv2enums.h:821
See 8-Bit ARGB, RGBA, ABGR Formats.
Definition: ntv2enums.h:227
SDI 6 embedded VITC.
Definition: ntv2enums.h:3966
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_OFF
Definition: ntv2enums.h:355
#define NTV2_IS_VANCMODE_TALL(__v__)
Definition: ntv2enums.h:3809
See Io X3.
Definition: ntv2enums.h:43
NTV2WidgetID
Definition: ntv2enums.h:2912
New in SDK 16.0.
Definition: ntv2enums.h:2798
#define NTV2_IS_OUTPUT_CROSSPOINT(__x__)
Definition: ntv2enums.h:1736
Identifies high frame-rate 4K.
Definition: ntv2enums.h:180
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:1361
120 frames per second
Definition: ntv2enums.h:428
See 48-Bit RGB.
Definition: ntv2enums.h:241
string NTV2AudioBufferSizeToString(const NTV2AudioBufferSize inValue, const bool inForRetailDisplay)
Definition: ntv2utils.cpp:5772
Obtain audio samples from the device microphone input, if available.
Definition: ntv2enums.h:2014
NTV2VideoLimiting
These enum values identify the available SDI video output limiting modes.
Definition: ntv2enums.h:3781
string NTV2AudioFormatToString(const NTV2AudioFormat inValue, const bool inCompact)
Definition: ntv2utils.cpp:6705
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:7336
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:5313
void PackRGB10BitFor10BitDPX(RGBAlpha10BitPixel *pBuffer, const ULWord inNumPixels, const bool bigEndian=true)
bool NTV2DeviceIsExternalToHost(const NTV2DeviceID inDeviceID)
Output Black.
Definition: ntv2enums.h:1692
NTV2VANCMode
These enum values identify the available VANC modes.
Definition: ntv2enums.h:3800
NTV2TCIndexes GetTCIndexesForSDIConnector(const NTV2Channel inSDI)
Definition: ntv2utils.cpp:4973
NTV2EmbeddedAudioInput NTV2InputSourceToEmbeddedAudioInput(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2EmbeddedAudioInput value.
Definition: ntv2utils.cpp:4880
25 frames per second
Definition: ntv2enums.h:422
Doesn&#39;t specify any kind of input/output.
Definition: ntv2enums.h:1293
static std::string GetDisplayName(const uint32_t inRegNum)
string NTV2ColorCorrectionModeToString(const NTV2ColorCorrectionMode inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:7584
std::vector< NTV2OutputCrosspointID > NTV2OutputCrosspointIDs
An ordered sequence of NTV2OutputCrosspointID values.
Definition: ntv2utils.h:1066
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:447
string NTV2EmbeddedAudioInputToString(const NTV2EmbeddedAudioInput inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6716
Identifies the AES/EBU audio breakout cable that has BNC connectors.
Definition: ntv2enums.h:3110
#define NTV2_IS_VALID_AUDIO_SYSTEM(__x__)
Definition: ntv2enums.h:3917
Identifies the 3rd HDMI video input.
Definition: ntv2enums.h:1269
NTV2RegisterWriteMode
These values are used to determine when certain register writes actually take effect. See CNTV2Card::SetRegisterWriteMode or Field/Frame Interrupts.
Definition: ntv2enums.h:1682
See Corvid, Corvid 3G.
Definition: ntv2enums.h:22
string NTV2WidgetIDToString(const NTV2WidgetID inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6165
10-Bit YCbCrA
Definition: ntv2enums.h:239
Declares the NTV2FormatDescriptor class.
#define NTV2_INPUT_SOURCE_IS_ANALOG(_inpSrc_)
Definition: ntv2enums.h:1284
NTV2FrameRate GetFrameRateFamily(const NTV2FrameRate inFrameRate)
Definition: ntv2utils.cpp:5346
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:5026
string NTV2WidgetTypeToString(const NTV2WidgetType inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6304
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:6356
std::vector< NTV2FrameRates > NTV2FrameRateFamilies
Definition: ntv2utils.cpp:5315
See KONA 5.
Definition: ntv2enums.h:51
string NTV2HDMIRangeToString(const NTV2HDMIRange inValue, const bool inCompact)
Definition: ntv2utils.cpp:6682
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:7812
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:2008
bool convertHDRRegisterToFloatValues(const HDRRegValues &inRegisterValues, HDRFloatValues &outFloatValues)
Definition: ntv2utils.cpp:7693
Levels are 16 - 235 (SMPTE)
Definition: ntv2enums.h:3640
Identifies the "monitor" or "auxiliary" Field 1 ancillary data region.
Definition: ntv2enums.h:4234
NTV2FrameRate GetNTV2FrameRateFromVideoFormat(const NTV2VideoFormat videoFormat)
Definition: ntv2utils.cpp:3630
Specifies channel or FrameStore 4 (or the 4th item).
Definition: ntv2enums.h:1364
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:3979
bool convertHDRFloatToRegisterValues(const HDRFloatValues &inFloatValues, HDRRegValues &outRegisterValues)
Definition: ntv2utils.cpp:7688
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:6397
UWord NTV2DeviceGetNumVideoOutputs(const NTV2DeviceID inDeviceID)
#define NTV2_IS_VALID_FIELD(__x__)
Definition: ntv2enums.h:1850
NTV2OutputCrosspointIDs::const_iterator NTV2OutputCrosspointIDsConstIter
A convenient const iterator for NTV2OutputCrosspointIDs.
Definition: ntv2utils.h:1068
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:1365
string NTV2VideoFormatToString(const NTV2VideoFormat inFormat, const bool inUseFrameRate)
Definition: ntv2utils.cpp:6749
Identifies the first analog video input.
Definition: ntv2enums.h:1266
Private include file for all ajabase sources.
New in SDK 16.0.
Definition: ntv2enums.h:2560
See 10-Bit RGB - DPX Format.
Definition: ntv2enums.h:232
bool NTV2DeviceCanDoCustomAnc(const NTV2DeviceID inDeviceID)
This identifies the 8th Audio System.
Definition: ntv2enums.h:3907
NTV2AudioRate
Definition: ntv2enums.h:1931
#define NTV2_IS_VALID_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:727
New in SDK 16.0.
Definition: ntv2enums.h:2559
Specifies the HDMI In 4 connector.
Definition: ntv2enums.h:1477
static NTV2FrameRateFamilies sFRFamilies
Definition: ntv2utils.cpp:5318
SDI 2 embedded ATC LTC.
Definition: ntv2enums.h:3962
Output Y if set, else Output Y=0x40.
Definition: ntv2enums.h:1693
bool IsVideoFormatA(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5461
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:3717
See 24-Bit RGB.
Definition: ntv2enums.h:237
SDI 1 embedded ATC LTC.
Definition: ntv2enums.h:3961
10-Bit Raw RGB
Definition: ntv2enums.h:249
No identifiable breakout hardware appears to be attached.
Definition: ntv2enums.h:3108
#define NTV2_FBF_HAS_ALPHA(__fbf__)
Definition: ntv2enums.h:325
Progressive.
Definition: ntv2enums.h:497
std::set< NTV2DeviceID > NTV2DeviceIDSet
A set of NTV2DeviceIDs.
Definition: ntv2utils.h:1043
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:82
#define CCIR601_10BIT_CHROMAOFFSET
New in SDK 16.0.
Definition: ntv2enums.h:2566
Identifies the first field in time for an interlaced video frame, or the first and only field in a pr...
Definition: ntv2enums.h:1845
NTV2FrameGeometry GetGeometryFromFrameDimensions(const NTV2FrameSize &inFD)
Definition: ntv2utils.cpp:3957
bool NTV2DeviceCanDoCapture(const NTV2DeviceID inDeviceID)
SDI 2 embedded VITC.
Definition: ntv2enums.h:3958
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:1466
See Corvid 44 (Gen3).
Definition: ntv2enums.h:30
2048x1556, for 2Kx1556psf film format, NTV2_VANCMODE_TALL
Definition: ntv2enums.h:365
Audio clock derived from the device reference.
Definition: ntv2enums.h:1995
bool NTV2DeviceCanDoIP(const NTV2DeviceID inDeviceID)
NTV2RegisterReads FromRegNumSet(const NTV2RegNumSet &inRegNumSet)
Definition: ntv2utils.cpp:7741
Identifies the "Legal Broadcast" mode (Ymax=0x340, Cmax=0x340)
Definition: ntv2enums.h:3785
This identifies the 2nd Audio System.
Definition: ntv2enums.h:3901
SDI 5 embedded VITC.
Definition: ntv2enums.h:3965
8 audio channels
Definition: ntv2enums.h:3673
NTV2Audio4ChannelSelect
Identifies a contiguous, adjacent group of four audio channels.
Definition: ntv2enums.h:3274
NTV2ConversionMode GetConversionMode(const NTV2VideoFormat inFormat, const NTV2VideoFormat outFormat)
Definition: ntv2utils.cpp:5478
NTV2RegNumSet ToRegNumSet(const NTV2RegisterReads &inRegReads)
Definition: ntv2utils.cpp:7749
std::vector< std::string > NTV2StringList
Specifies channel or FrameStore 6 (or the 6th item).
Definition: ntv2enums.h:1366
NTV2TCIndex NTV2ChannelToTimecodeIndex(const NTV2Channel inChannel, const bool inEmbeddedLTC, const bool inIsF2)
Converts the given NTV2Channel value into the equivalent NTV2TCIndex value.
Definition: ntv2utils.cpp:4965
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:3808
string NTV2AudioChannelQuadToString(const NTV2Audio4ChannelSelect inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6446
48 frames per second
Definition: ntv2enums.h:426
NTV2AudioSource NTV2InputSourceToAudioSource(const NTV2InputSource inInputSource)
Definition: ntv2utils.cpp:4904
bool StringToSerialNum64(const string &inSerNumStr, uint64_t &outSerNum)
Definition: ntv2utils.cpp:7867
DVI protocol.
Definition: ntv2enums.h:3627
#define NTV2_IS_4K_QUADHD_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:862
Frame Mode: Register changes take effect at the next frame VBI (power-up default).
Definition: ntv2enums.h:1685
Specifies channel or FrameStore 7 (or the 7th item).
Definition: ntv2enums.h:1367
#define NTV2_INPUT_SOURCE_IS_SDI(_inpSrc_)
Definition: ntv2enums.h:1285
NTV2IOKinds GetNTV2InputSourceKind(const NTV2InputSource inSrc)
Definition: ntv2utils.cpp:5259
NTV2Crosspoint GetNTV2CrosspointChannelForIndex(const ULWord index)
Definition: ntv2utils.cpp:4739
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:80
SDI 7 embedded VITC 2.
Definition: ntv2enums.h:3981
Specifies devices that have Anc/Aux inserters/extractors.
Definition: ntv2enums.h:1396
NTV2IpError
Definition: ntv2enums.h:4320
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
string NTV2AudioChannelOctetToString(const NTV2Audio8ChannelSelect inValue, const bool inCompactDisplay)
Definition: ntv2utils.cpp:6458
See KONA 4 (UFC Mode).
Definition: ntv2enums.h:49
bool IsVideoFormatB(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5467
Identifies the "normal" Field 1 ancillary data region.
Definition: ntv2enums.h:4232
24 frames per second
Definition: ntv2enums.h:423
#define NTV2EndianSwap16(__val__)
Definition: ntv2endian.h:15
10-Bit Packed RGB
Definition: ntv2enums.h:245
8-Bit 4:2:0 2-Plane YCbCr
Definition: ntv2enums.h:255
720x576, for PAL 625i, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:368
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:6508
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:1398
Identifies the 1st SDI video input.
Definition: ntv2enums.h:1271
ULWord GetIndexForNTV2InputSource(const NTV2InputSource inValue)
Definition: ntv2utils.cpp:5277
bool IsNTV2CrosspointOutput(const NTV2Crosspoint inChannel)
Definition: ntv2utils.cpp:4858
INTERRUPT_ENUMS NTV2ChannelToOutputInterrupt(const NTV2Channel inChannel)
Converts the given NTV2Channel value into the equivalent output INTERRUPT_ENUMS value.
Definition: ntv2utils.cpp:4950
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:1385
bool Is2KFormat(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5431
std::vector< NTV2DeviceID > NTV2DeviceIDList
An ordered list of NTV2DeviceIDs.
Definition: ntv2utils.h:1036
Specifies devices that can do 4K video.
Definition: ntv2enums.h:1392
NTV2Channel NTV2InputSourceToChannel(const NTV2InputSource inInputSource)
Converts a given NTV2InputSource to its equivalent NTV2Channel value.
Definition: ntv2utils.cpp:5050
bool IsAlphaChannelFormat(const NTV2FrameBufferFormat format)
Definition: ntv2utils.cpp:5425
#define NTV2_IS_PROGRESSIVE_STANDARD(__s__)
Definition: ntv2enums.h:191
ULWord NTV2AudioBufferSizeToByteCount(const NTV2AudioBufferSize inBufferSize)
Converts the given NTV2BufferSize value into its exact byte count.
Definition: ntv2utils.cpp:5305
NTV2DeviceIDList::const_iterator NTV2DeviceIDListConstIter
A convenient const iterator for NTV2DeviceIDList.
Definition: ntv2utils.h:1038
#define NTV2_IS_VALID_NTV2FrameGeometry(__s__)
Definition: ntv2enums.h:382
Specifies the SDI In 5 connector.
Definition: ntv2enums.h:1467
NTV2EmbeddedAudioInput
This enum value determines/states which SDI video input will be used to supply audio samples to an au...
Definition: ntv2enums.h:1970
bool IsVideoFormatJ2KSupported(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5472
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:3695
#define NTV2_IS_VALID_AUDIO_CHANNEL_PAIR(__p__)
Definition: ntv2enums.h:3206
#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:7766
Declares device capability functions.
See 24-Bit BGR.
Definition: ntv2enums.h:238
SDI 1 embedded VITC.
Definition: ntv2enums.h:3957
This identifies the "tall" mode in which there are some VANC lines in the frame buffer.
Definition: ntv2enums.h:3803
HDRRegValues & setBT2020(void)
NTV2VideoFormat GetQuarterSizedVideoFormat(const NTV2VideoFormat inVideoFormat)
Definition: ntv2utils.cpp:1940
NTV2MixerKeyerMode
These enum values identify the mixer mode.
Definition: ntv2enums.h:1794
NTV2Audio8ChannelSelect
Identifies a contiguous, adjacent group of eight audio channels.
Definition: ntv2enums.h:3323
This identifies the mode in which there are no VANC lines in the frame buffer.
Definition: ntv2enums.h:3802
720x486, for NTSC 525i and 525p60, NTV2_VANCMODE_TALLER
Definition: ntv2enums.h:367
Fractional rate of 24,000 frames per 1,001 seconds.
Definition: ntv2enums.h:424
bool IsPSF(const NTV2VideoFormat format)
Definition: ntv2utils.cpp:5388
Specifies channel or FrameStore 3 (or the 3rd item).
Definition: ntv2enums.h:1363
See KONA 5.
Definition: ntv2enums.h:52
See T-TAP Pro.
Definition: ntv2enums.h:94
#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:5817
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:1312
#define NTV2_FBF_IS_RAW(__fbf__)
Definition: ntv2enums.h:333
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:3967
See KONA XM™.
Definition: ntv2enums.h:81
See 8-Bit YCbCr Format.
Definition: ntv2enums.h:225
#define NTV2_IS_4K_4096_VIDEO_FORMAT(__f__)
Definition: ntv2enums.h:835
Audio clock derived from the video input.
Definition: ntv2enums.h:1996
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:3971
string NTV2RegNumSetToString(const NTV2RegisterNumberSet &inObj)
Definition: ntv2utils.cpp:6369
virtual bool IsValid(void) const
Definition: lock.h:65
NTV2DieTempScale
Definition: ntv2enums.h:4213
#define CCIR601_10BIT_BLACK