19 #define AJA_FD_BEGIN NTV2FormatDescriptor ( 21 #define AJA_FD_NOTSUPPORTED NTV2FormatDescriptor () 22 #define AJA_FD_TBD NTV2FormatDescriptor () 24 #define AsConstUBytePtr(_x_) reinterpret_cast<const UByte*>(_x_) 25 #define AsUBytePtr(_x_) reinterpret_cast<UByte*>(_x_) 30 {
"YCbCr",
"",
"",
""},
31 {
"YCbCr",
"",
"",
""},
35 {
"YCbCr",
"",
"",
""},
38 {
"YCbCr",
"",
"",
""},
40 {
"Y",
"Cb",
"Cr",
""},
44 {
"YCbCrA",
"",
"",
""},
53 {
"Y",
"Cb",
"Cr",
""},
55 {
"YCbCr",
"",
"",
""},
56 {
"Y",
"Cb",
"Cr",
""},
57 {
"Y",
"Cb",
"Cr",
""},
58 {
"Y",
"CbCr",
"",
""},
59 {
"Y",
"CbCr",
"",
""},
60 {
"Y",
"CbCr",
"",
""},
669 mStandard = inStandard;
671 mVancMode = inVancMode;
680 const ULWord numActiveLines (numLines);
696 default: numLines = numActiveLines;
break;
698 firstActiveLine = numLines - numActiveLines;
707 void NTV2FormatDescriptor::FinalizePlanar (
void)
719 mLinePitch[0] = linePitch * 4;
720 mLinePitch[1] = linePitch * 4;
728 mLinePitch[0] = numPixels;
729 const ULWord lumaRasterBytes (numLines * numPixels);
730 ULWord chromaRasterBytes (lumaRasterBytes / 2);
731 if (lumaRasterBytes % 4)
732 {MakeInvalid();
break;}
733 mLinePitch[1] = mLinePitch[2] = chromaRasterBytes / numLines;
734 if (chromaRasterBytes % numLines)
743 mLinePitch[0] = numPixels *
sizeof(uint16_t);
744 const ULWord lumaRasterBytes (numLines * mLinePitch[0]);
745 ULWord chromaRasterBytes (lumaRasterBytes / 2);
746 mLinePitch[1] = mLinePitch[2] = chromaRasterBytes / numLines;
747 if (chromaRasterBytes % numLines)
752 default: MakeInvalid();
break;
775 mStandard = inStandard;
777 mVancMode = inVancMode;
786 const ULWord numActiveLines (numLines);
802 default: numLines = numActiveLines;
break;
804 firstActiveLine = numLines - numActiveLines;
824 mFrameGeometry = frameSize;
831 firstActiveLine = tall.height() - normal.
height();
832 mVancMode = inVancMode;
840 firstActiveLine = taller.height() - normal.
height();
841 mVancMode = inVancMode;
848 if (tallTaller != mFrameGeometry)
850 mFrameGeometry = tallTaller;
851 frameSize = tallTaller;
852 firstActiveLine = frameSize.
height() - inFrameSize.
height();
857 numLines = frameSize.
height();
858 numPixels = frameSize.
width();
878 case NTV2_FBF_24BIT_BGR: mLinePitch[0] = 3*numPixels; linePitch = mLinePitch[0]/4;
break;
880 case NTV2_FBF_48BIT_RGB: mLinePitch[0] = 6*numPixels; linePitch = mLinePitch[0]/4;
break;
893 default: mLinePitch[0] = 0; linePitch = 0;
break;
910 const UByte inNumLumaBits,
const UByte inNumChromaBits,
const UByte inNumAlphaBits)
911 : numLines (inNumLines),
912 numPixels (inNumPixels),
913 linePitch (inLinePitch),
914 firstActiveLine (in1stActiveLine),
921 mNumBitsLuma (inNumLumaBits),
922 mNumBitsChroma (inNumChromaBits),
923 mNumBitsAlpha (inNumAlphaBits)
925 mLinePitch[0] = inLinePitch * 4;
926 mLinePitch[1] = mLinePitch[2] = mLinePitch[3] = 0;
940 mLinePitch[0] = mLinePitch[1] = mLinePitch[2] = mLinePitch[3] = 0;
943 mNumBitsLuma = mNumBitsChroma = mNumBitsAlpha = 0;
959 static const ULWord s4K(0x00001000), s64K(0x00010000);
961 if (inPageSizeBytes != s4K)
963 pageSizeBytes = s64K;
966 if (pageSizeBytes & inPageSizeBytes)
969 }
while (pageSizeBytes > s4K);
971 if (result % pageSizeBytes)
972 result = ((result / pageSizeBytes) + 1) * pageSizeBytes;
978 if (inPlaneIndex0 >= mNumPlanes)
986 return inPlaneIndex0 ? 2 : 1;
1007 && mLinePitch[0] == inRHS.mLinePitch[0];
1013 static string emptyString;
1030 if (inByteOffset < byteOffset)
1040 if (origPlane == 0xFFFF)
1042 ULWord byteOffsetToStartOfPlane (0);
1043 UWord plane (origPlane);
1046 NTV2_ASSERT(inByteOffset >= byteOffsetToStartOfPlane);
1047 const ULWord lineOffset ((inByteOffset - byteOffsetToStartOfPlane) /
GetBytesPerRow(origPlane));
1048 return UWord(lineOffset);
1071 if (inPlaneIndex0 >= mNumPlanes)
1073 if (inFrameBuffer.
IsNULL())
1077 if (inPlaneIndex0 > 0)
1079 if (inPlaneIndex0 > 1)
1081 if (inPlaneIndex0 > 2)
1085 byteOffset += inRowIndex0 * bytesPerRow;
1086 if (byteOffset+bytesPerRow > inFrameBuffer.
GetByteCount())
1089 return inOutRowBuffer.
Set(inFrameBuffer.
GetHostAddress(byteOffset), bytesPerRow);
1096 if (inPlaneIndex0 >= mNumPlanes)
1098 if (!pInStartAddress)
1103 if (inPlaneIndex0 > 0)
1105 if (inPlaneIndex0 > 1)
1107 if (inPlaneIndex0 > 2)
1117 if (inPlaneIndex0 >= mNumPlanes)
1121 if (inPlaneIndex0 > 0)
1123 if (inPlaneIndex0 > 1)
1125 if (inPlaneIndex0 > 2)
1135 if (inPlaneIndex0 >= mNumPlanes)
1139 if (inPlaneIndex0 > 0)
1141 if (inPlaneIndex0 > 1)
1143 if (inPlaneIndex0 > 2)
1151 outFirstChangedRowNum = 0xFFFFFFFF;
1152 if (!pInStartAddress1)
1154 if (!pInStartAddress2)
1156 if (pInStartAddress1 == pInStartAddress2)
1164 for (outFirstChangedRowNum = 0; outFirstChangedRowNum <
GetFullRasterHeight(); outFirstChangedRowNum++)
1168 outFirstChangedRowNum = 0xFFFFFFFF;
1178 if (!pInBuffer1 || !pInBuffer2)
1186 if (pInBuffer1 == pInBuffer2)
1195 for (
ULWord rowOffset(0); rowOffset < maxLines; rowOffset++)
1197 outDiffs.push_back(rowOffset);
1213 oss <<
" PL" << plane <<
":";
1250 static const ULWord LineNumbersF1 [] = { 21, 26, 21, 23, 42, 211, 42, 21, 42, 42, 42, 42, 42, 42, 42, 42, 0 };
1251 static const ULWord LineNumbersF2 [] = { 584, 27, 283, 336, 43, 1201, 43, 584, 43, 43, 43, 43, 43, 43, 43, 43, 0 };
1253 static const ULWord LineNumbersF1t [] = { 5, 6, 10, 12, 10, 211, 10, 5, 10, 10, 10, 10, 10, 10, 10, 10, 0 };
1254 static const ULWord LineNumbersF2t [] = { 568, 7, 272, 325, 11, 1201, 11, 568, 11, 11, 11, 11, 11, 11, 11, 11, 0 };
1256 static const ULWord LineNumbersF1tt [] = { 4, 6, 7, 5, 8, 211, 8, 4, 8, 8, 8, 8, 8, 8, 8, 8, 0 };
1257 static const ULWord LineNumbersF2tt [] = { 567, 7, 269, 318, 9, 1201, 9, 567, 9, 9, 9, 9, 9, 9, 9, 9, 0 };
1259 static const ULWord LineNumbersF1Last[] = { 560, 745, 263, 310, 1121, 0, 1121, 0, 2201, 2201, 2201, 2201, 4361, 4361, 4361, 4361, 0 };
1260 static const ULWord LineNumbersF2Last[] = { 1123, 745, 525, 623, 1121, 0, 1121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
1265 outIsField2 =
false;
1278 outIsField2 = (inLineOffset & 1) ? !is525i : is525i;
1290 outSMPTELine = inLineOffset/divisor + smpteLine;
1297 outLineOffset = 0xFFFFFFFF;
1305 ULWord firstF1Line(0), firstF2Line(0);
1318 if (inSMPTELine < firstF1Line)
1328 outLineOffset = inSMPTELine - firstF1Line;
1329 else if (inSMPTELine >= firstF2Line)
1330 outLineOffset = (inSMPTELine - firstF2Line) * 2 + not525i;
1332 outLineOffset = (inSMPTELine - firstF1Line) * 2 + is525i;
1344 inOutStream <<
"F" << (isF2 ?
"2" :
"1") << (inForTextMode ?
"" :
" ");
1346 inOutStream <<
"L" <<
DEC0N(smpteLine,4);
1348 inOutStream <<
"L" <<
DEC(smpteLine);
1377 return inSegmentInfo;
1407 ULWord current (0xFFFFFFFF);
1408 ULWord previous (0xFFFFFFFF);
1409 ULWord first (0xFFFFFFFF);
1410 ULWord last (0xFFFFFFFF);
1415 while (iter != inObj.end())
1420 iter = inObj.begin();
1423 while (iter != inObj.end())
1426 if (previous == 0xFFFFFFFF)
1427 previous = first = last = current;
1428 else if (current == (previous + 1))
1429 last = previous = current;
1430 else if (current == previous)
1438 oss << first <<
"-" << last;
1439 pieces.push_back (oss.str ());
1441 first = last = previous = current;
1446 if (first != 0xFFFFFFFF && last != 0xFFFFFFFF)
1452 oss << first <<
"-" << last;
1453 pieces.push_back (oss.str ());
1459 if (++it != pieces.end())
#define NTV2_IS_VANCMODE_TALLER(__v__)
#define HD_YCBCRLINEPITCH_4K
#define HD_NUMCOMPONENTPIXELS_720_HDV
Identifies SMPTE HD 1080p.
bool firstFieldTop
True if the first field on the wire is the top-most field in the raster (field dominance) ...
This identifies the invalid (unspecified, uninitialized) VANC mode.
#define DEC0N(__x__, __n__)
#define NTV2_IS_2K1080_STANDARD(__s__)
NTV2FieldID
These values are used to identify fields for interlaced video. See Field/Frame Interrupts and CNTV2Ca...
NTV2FrameBufferFormat
Identifies a particular video frame buffer pixel format. See Device Frame Buffer Formats for details...
#define HD_YCBCRLINEPITCH_720_DVCPRO
10-Bit 4:2:2 2-Plane YCbCr
#define RGB48LINEPITCH_4096
enum _NTV2VideoFormat NTV2VideoFormat
Identifies a particular video format.
#define NTV2_IS_TALLER_VANC_GEOMETRY(__g__)
#define HD_NUMCOMPONENTPIXELS_1080_HDV
#define RGB24LINEPITCH_8192
#define NTV2_IS_FBF_PLANAR(__s__)
#define FD_NUMCOMPONENTPIXELS_8K
#define RGB12PLINEPITCH_625
Identifies SMPTE SD 525i.
NTV2SegmentedXferInfo & setSourceOffset(const ULWord inOffset)
Sets my source offset.
#define NTV2_IS_TALL_VANC_GEOMETRY(__g__)
ULWord GetByteCount(void) const
See Alternate 8-Bit YCbCr ('YUY2').
See 10-Bit YCbCr - DPX Format.
See 3-Plane 10-Bit YCbCr 4:2:2 ('I422_10LE' a.k.a. 'YUV-P-L10').
#define RGB24LINEPITCH_4096
#define NTV2_IS_2K_1080_VIDEO_FORMAT(__f__)
#define HD_YCBCRLINEPITCH_1080
#define RGB48LINEPITCH_525
NTV2FrameGeometry GetNormalizedFrameGeometry(const NTV2FrameGeometry inFrameGeometry)
This identifies the mode in which there are some + extra VANC lines in the frame buffer.
See 3-Plane 8-Bit YCbCr 4:2:0 ('I420' a.k.a. 'YUV-P420').
#define YCBCRLINEPITCH_SD
#define RGB48LINEPITCH_625
#define HD_NUMCOMPONENTPIXELS_QUADHD
NTV2SegmentedXferInfo & setElementLength(const ULWord inBytesPerElement)
Sets my element length.
#define HD_NUMCOMPONENTPIXELS_720
#define RGB48LINEPITCH_1080
ULWord GetLastLine(const NTV2FieldID inRasterFieldID=NTV2_FIELD0) const
Describes a segmented data transfer (copy or move) from a source memory location to a destination loc...
#define RGB24LINEPITCH_1080
#define NUMACTIVELINES_525
#define NTV2_ASSERT(_expr_)
Identifies SMPTE HD 2K1080psf.
See 3-Plane 8-Bit YCbCr 4:2:2 (Weitek 'Y42B' a.k.a. 'YUV-P8').
#define RGB24LINEPITCH_525
ULWord height(void) const
#define HD_NUMCOMPONENTPIXELS_2K
Identifies SMPTE HD 720p.
#define FD_YCBCRLINEPITCH_8K
bool Deallocate(void)
Deallocates my user-space storage (if I own it – i.e. from a prior call to Allocate).
#define HD_NUMCOMPONENTPIXELS_1080
std::string NTV2StandardToString(const NTV2Standard inValue, const bool inForRetailDisplay=false)
#define HD_YCBCRLINEPITCH_1080_HDV
8-Bit 4:2:2 2-Plane YCbCr
NTV2Standard
Identifies a particular video standard.
#define RGB24LINEPITCH_625
NTV2FrameGeometry GetVANCFrameGeometry(const NTV2FrameGeometry inFrameGeometry, const NTV2VANCMode inVancMode)
#define HD_NUMCOMPONENTPIXELS_720_DVCPRO
#define HD_NUMCOMPONENTPIXELS_1080_DVCPRO
#define RGB12PLINEPITCH_7680
#define HD_NUMCOMPONENTPIXELS_4K
#define NUMCOMPONENTPIXELS
#define HD_YCBCRLINEPITCH_1080_DVCPRO
std::vector< std::string > NTV2StringList
NTV2SegmentedXferInfo & setDestPitch(const ULWord inPitch)
Sets my destination pitch.
std::string NTV2VideoFormatToString(const NTV2VideoFormat inValue, const bool inUseFrameRate=false)
See 8-Bit ARGB, RGBA, ABGR Formats.
See 8-Bit ARGB, RGBA, ABGR Formats.
#define NTV2_IS_VALID_STANDARD(__s__)
Identifies SMPTE HD 2K1080p.
#define RGB12PLINEPITCH_720
#define RGB12PLINEPITCH_4096
See 3-Plane 10-Bit YCbCr 4:2:0 ('I420_10LE' a.k.a. 'YUV-P420-L10').
#define RGB48LINEPITCH_720
#define NTV2_IS_VANCMODE_ON(__v__)
#define FD_YCBCRLINEPITCH_UHD2
NTV2SmpteLineNumber(const NTV2Standard inStandard=NTV2_STANDARD_INVALID)
Constructs me from a given NTV2Standard.
NTV2SegmentedXferInfo & setDestOffset(const ULWord inOffset)
Sets my destination offset.
#define HD_NUMACTIVELINES_1080
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.).
Identifies SMPTE HD 1080i or 1080psf.
10-Bit 4:2:0 2-Plane YCbCr
#define RGB48LINEPITCH_8192
Identifies SMPTE SD 625i.
#define RGB48LINEPITCH_2048
#define RGB12PLINEPITCH_1080
NTV2SegmentedXferInfo & setSourcePitch(const ULWord inPitch)
Sets my source pitch.
NTV2FrameGeometry
Identifies a particular video frame geometry.
#define HD_YCBCRLINEPITCH_2K
Declares numerous NTV2 utility functions.
Describes the horizontal and vertical size dimensions of a raster, bitmap, frame or image...
bool Set(const void *pInUserPointer, const size_t inByteCount)
Sets (or resets) me from a client-supplied address and size.
#define HD_YCBCRLINEPITCH_3840
NTV2SegmentedXferInfo & setSegmentLength(const ULWord inNumElements)
Sets my segment length.
#define RGB24LINEPITCH_2048
#define RGB48LINEPITCH_7680
#define RGB48LINEPITCH_3840
#define RGB12PLINEPITCH_525
See 8-Bit ARGB, RGBA, ABGR Formats.
#define FD_NUMCOMPONENTPIXELS_UHD2
#define HD_NUMACTIVELINES_720
#define RGB24LINEPITCH_3840
#define HD_YCBCRLINEPITCH_720
#define xHEX0N(__x__, __n__)
NTV2VANCMode
These enum values identify the available VANC modes.
std::string NTV2FrameBufferFormatToString(const NTV2FrameBufferFormat inValue, const bool inForRetailDisplay=false)
#define NTV2_IS_VALID_FIELD(__x__)
NTV2SegmentedXferInfo & setSegmentCount(const ULWord inNumSegments)
Sets my segment count.
#define RGB12PLINEPITCH_8192
NTV2Standard GetNTV2StandardFromVideoFormat(const NTV2VideoFormat inVideoFormat)
See 10-Bit RGB - DPX Format.
#define NTV2_IS_VALID_VIDEO_FORMAT(__f__)
#define RGB12PLINEPITCH_3840
Identifies the first field in time for an interlaced video frame, or the first and only field in a pr...
#define NTV2_IS_VALID_FRAME_BUFFER_FORMAT(__s__)
#define HD_YCBCRLINEPITCH_720_HDV
#define NTV2_IS_VALID_VANCMODE(__v__)
void * GetHostAddress(const ULWord inByteOffset, const bool inFromEnd=false) const
8-Bit 4:2:0 2-Plane YCbCr
#define RGB24LINEPITCH_720
NTV2FrameGeometry GetGeometryFromStandard(const NTV2Standard inStandard)
#define NTV2_IS_PROGRESSIVE_STANDARD(__s__)
#define NTV2_IS_VALID_NTV2FrameGeometry(__s__)
#define HD_NUMACTIVELINES_2K
This identifies the "tall" mode in which there are some VANC lines in the frame buffer.
This identifies the mode in which there are no VANC lines in the frame buffer.
NTV2StringList::const_iterator NTV2StringListConstIter
#define RGB12PLINEPITCH_2048
#define NUMACTIVELINES_625
NTV2FrameGeometry GetNTV2FrameGeometryFromVideoFormat(const NTV2VideoFormat inVideoFormat)
#define RGB24LINEPITCH_7680