AJA NTV2 SDK  18.0.0.2122
NTV2 SDK 18.0.0.2122
CNTV2SMPTEAncData Class Reference

#include <ntv2smpteancdata.h>

Static Public Member Functions

static UWord AddEvenParity (UByte dataByte)
 
static bool UnpackLine_8BitYUVtoUWordSequence (const void *pInYUV8Line, UWordSequence &out16BitYUVLine, const ULWord inNumPixels)
 Converts a single line of NTV2_FBF_8BIT_YCBCR data from the given source buffer into an ordered sequence of UWords that contain the resulting 10-bit even-parity data. More...
 
static bool FindAnc (const UWord inAncDID, const UWord inAncSDID, const NTV2Buffer &inFrameBuffer, const NTV2FormatDescriptor &inFormatDesc, const NTV2_SMPTEAncChannelSelect inAncChannel, UWordSequence &outWords, bool &outHasParityErrors, const UWord inLineIncrement, UWord &inOutLineStart, UWord &inOutPixelStart)
 Searches for ancillary data in a given host frame buffer. More...
 
static bool FindAnc (const UWord inAncDID, const UWord inAncSDID, const ULWord *pInFrameBuffer, const NTV2_SMPTEAncChannelSelect inAncChannel, const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, UWord *pOutBuff, ULWord &outWordCount, const ULWord inWordCountMax, bool &outHasParityErrors, const UWord inLineIncrement, UWord &inOutLineStart, UWord &inOutPixelStart)
 Searches for ancillary data in a given host frame buffer. More...
 
static bool FindAnc (const UWord inAncDID, const UWord inAncSDID, const ULWord *pInFrameBuffer, const NTV2_SMPTEAncChannelSelect inAncChannel, const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, UWord *pOutBuff, ULWord &outWordCount, const ULWord inWordCountMax, bool &outHasParityErrors)
 Searches for ancillary data in a given host frame buffer. More...
 
static bool FindAnc (const UWord inAncDID, const UWord inAncSDID, const ULWord *pInFrameBuffer, const NTV2_SMPTEAncChannelSelect inAncChannel, const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat, UWord *pOutBuff, ULWord &outWordCount, const ULWord inWordCountMax)
 Searches for ancillary data in a given host frame buffer. More...
 
static bool MakeAncHeader (NTV2_SMPTEAncHeaderPtr pHdr, UByte ancDID, UByte ancSDID, UByte ancDC)
 
static bool SetAncHeaderDataCount (NTV2_SMPTEAncHeaderPtr pHdr, UByte ancDC)
 
static bool SetAncFooterChecksum (NTV2_SMPTEAncFooterPtr pFtr, UWord checksum)
 
static bool CalculateAncChecksum (NTV2_SMPTEAncHeaderPtr pHdr, UByte dataCount=0)
 
static bool ExtractCompressedAnc (const void *pFrameBuffer, void *pAncBuff, ULWord ancBufMax, ULWord &inOutFoundSize, NTV2VideoFormat videoFormat, NTV2FrameBufferFormat fbFormat)
 
static bool EmbedCompressedAnc (const void *pAncBuff, void *pFrameBuffer, const ULWord ancBufSize, const NTV2VideoFormat videoFormat, const NTV2FrameBufferFormat fbFormat)
 
static bool InsertAnc (const UWord *pInAncBuff, const size_t inAncWordCount, const ULWord inLineOffset, const ULWord inWordOffset, ULWord *pFrameBuffer, const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat)
 Inserts ancillary data at a given line and channel offset into the given host frame buffer. More...
 
static bool InsertAncAtSmpteLine (const UWord *pInAncBuff, const ULWord inAncWordCount, const ULWord inSMPTELineNum, const ULWord inWordOffset, ULWord *pFrameBuffer, const NTV2VideoFormat inVideoFormat, const NTV2FrameBufferFormat inFBFormat)
 Inserts ancillary data at a given line and channel offset into the given host frame buffer. More...
 
static bool FirstVancLineAndChannel (const NTV2FormatDescriptor &inFD, const NTV2SmpteLineNumber &inLN, NTV2_SMPTEAncChannelSelect &inOutChannel, ULWord &inOutSMPTELine, ULWord &outLineOffset)
 
static bool NextVancLineAndChannel (const NTV2FormatDescriptor &inFD, const NTV2SmpteLineNumber &inLN, NTV2_SMPTEAncChannelSelect &inOutChannel, ULWord &inOutSMPTELine, ULWord &outLineOffset)
 
static ULWord GetVancLineOffset (const NTV2FormatDescriptor &inFormatDesc, const NTV2SmpteLineNumber &inSmpteLineNumbers, const ULWord inSmpteLine)
 
static bool CompressAncPacket (const UWord *packetBuffer, UByte *targetBuffer, ULWord maxTargetSize, ULWord &outCompPacketSize, NTV2_SMPTEAncChannelSelect chan, UWord smpteLine)
 
static void DecompressAncPacket (const UByte *pInCompBuffer, UWord *pOutUnpackedBuffer, ULWord &outCompPacketSize, bool &outIsValidLoc, NTV2_SMPTEAncChannelSelect &outChan, ULWord &outSmpteLine)
 
static bool FindCompressedAnc (UByte ancDID, UByte ancSDID, const UByte *pSrcAncBuf, const ULWord srcAncSize, UByteConstPtr &outBuffPtr, ULWord &outBufSize)
 
static bool GetAncPacketsFromVANCLine (const UWordSequence &inYUV16Line, const NTV2_SMPTEAncChannelSelect inChanSelect, UWordVANCPacketList &outRawPackets, UWordSequence &outWordOffsets)
 Extracts whatever VANC packets are found inside the given 16-bit YUV line buffer. More...
 
static ULWord GetCaptionAncLineNumber (const NTV2VideoFormat inVideoFormat, const bool inIsField1=true)
 Answers with the SMPTE raster line number into which NTSC caption CDPs should be inserted. More...
 

Detailed Description

Definition at line 99 of file ntv2smpteancdata.h.

Member Function Documentation

◆ AddEvenParity()

static UWord CNTV2SMPTEAncData::AddEvenParity ( UByte  dataByte)
static

◆ CalculateAncChecksum()

static bool CNTV2SMPTEAncData::CalculateAncChecksum ( NTV2_SMPTEAncHeaderPtr  pHdr,
UByte  dataCount = 0 
)
static

◆ CompressAncPacket()

static bool CNTV2SMPTEAncData::CompressAncPacket ( const UWord *  packetBuffer,
UByte *  targetBuffer,
ULWord  maxTargetSize,
ULWord &  outCompPacketSize,
NTV2_SMPTEAncChannelSelect  chan,
UWord  smpteLine 
)
static

◆ DecompressAncPacket()

static void CNTV2SMPTEAncData::DecompressAncPacket ( const UByte *  pInCompBuffer,
UWord *  pOutUnpackedBuffer,
ULWord &  outCompPacketSize,
bool &  outIsValidLoc,
NTV2_SMPTEAncChannelSelect &  outChan,
ULWord &  outSmpteLine 
)
static

◆ EmbedCompressedAnc()

static bool CNTV2SMPTEAncData::EmbedCompressedAnc ( const void *  pAncBuff,
void *  pFrameBuffer,
const ULWord  ancBufSize,
const NTV2VideoFormat  videoFormat,
const NTV2FrameBufferFormat  fbFormat 
)
static

◆ ExtractCompressedAnc()

static bool CNTV2SMPTEAncData::ExtractCompressedAnc ( const void *  pFrameBuffer,
void *  pAncBuff,
ULWord  ancBufMax,
ULWord &  inOutFoundSize,
NTV2VideoFormat  videoFormat,
NTV2FrameBufferFormat  fbFormat 
)
static

◆ FindAnc() [1/4]

static bool CNTV2SMPTEAncData::FindAnc ( const UWord  inAncDID,
const UWord  inAncSDID,
const NTV2Buffer &  inFrameBuffer,
const NTV2FormatDescriptor &  inFormatDesc,
const NTV2_SMPTEAncChannelSelect  inAncChannel,
UWordSequence &  outWords,
bool &  outHasParityErrors,
const UWord  inLineIncrement,
UWord &  inOutLineStart,
UWord &  inOutPixelStart 
)
static

Searches for ancillary data in a given host frame buffer.

Parameters
[in]inAncDIDSpecifies the Ancillary data ID to look for in the frame buffer. (The proper parity will automatically be added to 8-bit DID values.)
[in]inAncSDIDSpecifies the Ancillary SDID to look for in the frame buffer. (The proper parity will automatically be added to 8-bit SDID values.)
[in]inFrameBufferSpecifies the host frame buffer to be searched.
[in]inFormatDescDescribes the video/pixel format of the host frame buffer.
[in]inAncChannelSpecifies the ancillary data channel to search, whether luma (Y), chroma (C), or both.
[out]outWordsReceives the 10-bit packet data (including parity), replacing its previous contents.
[out]outHasParityErrorsReceives "true" if any parity errors are found, or "false" if none found.
[in]inLineIncrementSpecifies the line increment to use. Use 1 to scan every VANC line in the buffer.
inOutLineStartUpon entry, specifies the zero-based starting line offset at which to start the search. Upon return, contains the ending line offset where the search ended.
inOutPixelStartUpon entry, specifies the initial zero-based pixel offset from which to start the search. Upon exit, contains the ending zero-based pixel offset where the data search ended. Ignored if inOutLineStart is non-zero.
Note
The specified starting pixel number is used only when searching the first line. If the desired Anc data is not found in the first line, subsequent line searching will commence with the first pixel.
To find the next matching ancillary data packet, the caller must increment the returned line and/or pixel offsets; otherwise, this function will keep returning the same values.
Returns
True if successful; otherwise false.

◆ FindAnc() [2/4]

static bool CNTV2SMPTEAncData::FindAnc ( const UWord  inAncDID,
const UWord  inAncSDID,
const ULWord *  pInFrameBuffer,
const NTV2_SMPTEAncChannelSelect  inAncChannel,
const NTV2VideoFormat  inVideoFormat,
const NTV2FrameBufferFormat  inFBFormat,
UWord *  pOutBuff,
ULWord &  outWordCount,
const ULWord  inWordCountMax,
bool &  outHasParityErrors,
const UWord  inLineIncrement,
UWord &  inOutLineStart,
UWord &  inOutPixelStart 
)
static

Searches for ancillary data in a given host frame buffer.

Parameters
[in]inAncDIDSpecifies the Ancillary data ID to look for in the frame buffer. (The proper parity will automatically be added to 8-bit DID values.)
[in]inAncSDIDSpecifies the Ancillary SDID to look for in the frame buffer. (The proper parity will automatically be added to 8-bit SDID values.)
[in]pInFrameBufferSpecifies a valid, non-NULL starting address of the host frame buffer to be searched.
[in]inAncChannelSpecifies the ancillary data channel to search, whether in the luma (Y), the chroma (C), or both.
[in]inVideoFormatSpecifies the video format of the host frame buffer.
[in]inFBFormatSpecifies the pixel format of the host frame buffer. Must be NTV2_FBF_8BIT_YCBCR or NTV2_FBF_10BIT_YCBCR.
[out]pOutBuffSpecifies a valid, non-NULL address of the output buffer that is to receive the packet data. This will be 10-bit data, and will include parity.
[out]outWordCountSpecifies the number of ancillary data words written into the output buffer.
[in]inWordCountMaxSpecifies the capacity, in UWords, of the output buffer.
[out]outHasParityErrorsSpecifies a boolean variable that is to receive "true" if any parity errors are found, or "false" if none are found.
[in]inLineIncrementSpecifies the line increment to use. Use 1 to scan every line in the buffer.
inOutLineStartUpon entry, specifies the zero-based starting line number at which to start the search. Upon return, contains the ending line number where the search ended.
inOutPixelStartUpon entry, specifies the initial zero-based pixel number from which to start the search. Upon exit, contains the ending zero-based pixel number where the data search ended. Ignored if inOutLineStart is non-zero.
Note
The specified starting pixel number is used only when searching the first line. If the desired Anc data is not found in the first line, subsequent line searching will commence with the first pixel.
To find the next matching ancillary data, the caller must increment the returned line and/or pixel start values. Otherwise, this function will keep returning the same values.
Returns
True if successful; otherwise false.

◆ FindAnc() [3/4]

static bool CNTV2SMPTEAncData::FindAnc ( const UWord  inAncDID,
const UWord  inAncSDID,
const ULWord *  pInFrameBuffer,
const NTV2_SMPTEAncChannelSelect  inAncChannel,
const NTV2VideoFormat  inVideoFormat,
const NTV2FrameBufferFormat  inFBFormat,
UWord *  pOutBuff,
ULWord &  outWordCount,
const ULWord  inWordCountMax,
bool &  outHasParityErrors 
)
static

Searches for ancillary data in a given host frame buffer.

Parameters
[in]inAncDIDSpecifies the Ancillary data ID to look for in the frame buffer. The proper parity will automatically be added to 8-bit DID values.
[in]inAncSDIDSpecifies the Ancillary SDID to look for in the frame buffer. The proper parity will automatically be added to 8-bit SDID values.
[in]pInFrameBufferSpecifies a valid, non-NULL starting address of the host frame buffer to be searched.
[in]inAncChannelSpecifies the ancillary data channel.
[in]inVideoFormatSpecifies the video format of the host frame buffer.
[in]inFBFormatSpecifies the pixel format of the host frame buffer.
[out]pOutBuffSpecifies a valid, non-NULL address of the output buffer.
[out]outWordCountSpecifies the number of ancillary data words written into the output buffer.
[in]inWordCountMaxSpecifies the capacity, in UWords, of the output buffer.
[out]outHasParityErrorsSpecifies a boolean variable that is to receive true if any parity errors are found, or false if none are found.
Returns
True if successful; otherwise false.
Note
In this release, only 8-bit YCbCr and 10-bit YCbCr frame buffer formats are allowed.

◆ FindAnc() [4/4]

static bool CNTV2SMPTEAncData::FindAnc ( const UWord  inAncDID,
const UWord  inAncSDID,
const ULWord *  pInFrameBuffer,
const NTV2_SMPTEAncChannelSelect  inAncChannel,
const NTV2VideoFormat  inVideoFormat,
const NTV2FrameBufferFormat  inFBFormat,
UWord *  pOutBuff,
ULWord &  outWordCount,
const ULWord  inWordCountMax 
)
static

Searches for ancillary data in a given host frame buffer.

Parameters
[in]inAncDIDSpecifies the Ancillary data ID to look for in the frame buffer. The proper parity will automatically be added to 8-bit DID values.
[in]inAncSDIDSpecifies the Ancillary SDID to look for in the frame buffer. The proper parity will automatically be added to 8-bit SDID values.
[in]pInFrameBufferSpecifies a valid, non-NULL starting address of the host frame buffer to be searched.
[in]inAncChannelSpecifies the ancillary data channel.
[in]inVideoFormatSpecifies the video format of the host frame buffer.
[in]inFBFormatSpecifies the pixel format of the host frame buffer.
[out]pOutBuffSpecifies a valid, non-NULL address of the output buffer.
[out]outWordCountSpecifies the number of ancillary data words written into the output buffer.
[in]inWordCountMaxSpecifies the capacity, in UWords, of the output buffer.
Returns
True if successful; otherwise false.

◆ FindCompressedAnc()

static bool CNTV2SMPTEAncData::FindCompressedAnc ( UByte  ancDID,
UByte  ancSDID,
const UByte *  pSrcAncBuf,
const ULWord  srcAncSize,
UByteConstPtr &  outBuffPtr,
ULWord &  outBufSize 
)
static

◆ FirstVancLineAndChannel()

static bool CNTV2SMPTEAncData::FirstVancLineAndChannel ( const NTV2FormatDescriptor &  inFD,
const NTV2SmpteLineNumber &  inLN,
NTV2_SMPTEAncChannelSelect &  inOutChannel,
ULWord &  inOutSMPTELine,
ULWord &  outLineOffset 
)
static

◆ GetAncPacketsFromVANCLine()

static bool CNTV2SMPTEAncData::GetAncPacketsFromVANCLine ( const UWordSequence &  inYUV16Line,
const NTV2_SMPTEAncChannelSelect  inChanSelect,
UWordVANCPacketList &  outRawPackets,
UWordSequence &  outWordOffsets 
)
static

Extracts whatever VANC packets are found inside the given 16-bit YUV line buffer.

Parameters
[in]inYUV16LineSpecifies the UWord sequence containing the 10-bit YUV VANC line data components. (Use UnpackLine_10BitYUVtoUWordSequence to convert a VANC line from an NTV2_FBF_10BIT_YCBCR frame buffer into this format. Use CNTV2SMPTEAncData::UnpackLine_8BitYUVtoUWordSequence) to convert a VANC line from an NTV2_FBF_8BIT_YCBCR frame buffer into this format.)
[in]inChanSelectSpecifies the ancillary data channel to search, whether in the luma (kNTV2SMPTEAncChannel_Y) or chroma (kNTV2SMPTEAncChannel_C). Use kNTV2SMPTEAncChannel_Both for SD video.
[out]outRawPacketsReceives the UWordVancPacketList, which will have one UWordSequence per extracted packet. Each UWordSequence in the returned list will start with the 0x000/0x3FF/0x3FF/DID/SDID/DC sequence, followed by each 10-bit packet data word, and ending with the checksum word.
[out]outWordOffsetsReceives the horizontal word offsets into the line, one for each packet found. This should have the same number of elements as "outRawPackets". These offsets can also be used to discern which channel each packet originated in (Y or C).
Returns
True if successful; false if failed.
Note
This function will not finish parsing the line once a parity, checksum, or overrun error is discovered in the line.

◆ GetCaptionAncLineNumber()

static ULWord CNTV2SMPTEAncData::GetCaptionAncLineNumber ( const NTV2VideoFormat  inVideoFormat,
const bool  inIsField1 = true 
)
static

Answers with the SMPTE raster line number into which NTSC caption CDPs should be inserted.

Parameters
[in]inVideoFormatSpecifies the video format.
[in]inIsField1Specify true for Field 1; otherwise false for Field 2.
Returns
The SMPTE raster line number; or zero upon failure.

◆ GetVancLineOffset()

static ULWord CNTV2SMPTEAncData::GetVancLineOffset ( const NTV2FormatDescriptor &  inFormatDesc,
const NTV2SmpteLineNumber &  inSmpteLineNumbers,
const ULWord  inSmpteLine 
)
static

◆ InsertAnc()

static bool CNTV2SMPTEAncData::InsertAnc ( const UWord *  pInAncBuff,
const size_t  inAncWordCount,
const ULWord  inLineOffset,
const ULWord  inWordOffset,
ULWord *  pFrameBuffer,
const NTV2VideoFormat  inVideoFormat,
const NTV2FrameBufferFormat  inFBFormat 
)
static

Inserts ancillary data at a given line and channel offset into the given host frame buffer.

Parameters
[in]pInAncBuffSpecifies a valid, non-NULL starting address of the buffer that contains the ancillary data to be inserted into the host frame buffer.
[in]inAncWordCountSpecifies the number of two-byte words of ancillary data in the pAncBuff to be inserted into the host frame buffer.
[in]inLineOffsetSpecifies the line offset into the host frame buffer into which the ancillary data will be inserted.
[in]inWordOffsetSpecifies the word offset in the host frame buffer into which the ancillary data will be inserted. This effectively determines the anc channel in which to embed the data (e.g., 1 uses the Y/luma channel).
[in]pFrameBufferSpecifies a valid, non-NULL starting address of the host frame buffer that is to have the ancillary data inserted into it.
[in]inVideoFormatSpecifies the video format.
[in]inFBFormatSpecifies the pixel format of the host frame buffer.
Returns
True if successful; otherwise false.
Bug:
This function doesn't work for SD video formats, since SD packets use both luma and chroma channels.

◆ InsertAncAtSmpteLine()

static bool CNTV2SMPTEAncData::InsertAncAtSmpteLine ( const UWord *  pInAncBuff,
const ULWord  inAncWordCount,
const ULWord  inSMPTELineNum,
const ULWord  inWordOffset,
ULWord *  pFrameBuffer,
const NTV2VideoFormat  inVideoFormat,
const NTV2FrameBufferFormat  inFBFormat 
)
static

Inserts ancillary data at a given line and channel offset into the given host frame buffer.

Parameters
[in]pInAncBuffSpecifies a valid, non-NULL starting address of the buffer that contains the ancillary data to be inserted into the host frame buffer.
[in]inAncWordCountSpecifies the number of two-byte words of ancillary data in the pAncBuff to be inserted into the host frame buffer.
[in]inSMPTELineNumSpecifies the SMPTE line number into which the ancillary data will be inserted in the host frame buffer.
[in]inWordOffsetSpecifies the word offset in the host frame buffer into which the ancillary data will be inserted. This effectively determines the anc channel in which to embed the data (e.g., 1 uses the Y/luma channel).
[in]pFrameBufferSpecifies a valid, non-NULL starting address of the host frame buffer that is to have the ancillary data inserted into it.
[in]inVideoFormatSpecifies the video format.
[in]inFBFormatSpecifies the pixel format of the host frame buffer.
Returns
True if successful; otherwise false.
Bug:
This function doesn't work for SD video formats, since SD packets use both luma and chroma channels.

◆ MakeAncHeader()

static bool CNTV2SMPTEAncData::MakeAncHeader ( NTV2_SMPTEAncHeaderPtr  pHdr,
UByte  ancDID,
UByte  ancSDID,
UByte  ancDC 
)
static

◆ NextVancLineAndChannel()

static bool CNTV2SMPTEAncData::NextVancLineAndChannel ( const NTV2FormatDescriptor &  inFD,
const NTV2SmpteLineNumber &  inLN,
NTV2_SMPTEAncChannelSelect &  inOutChannel,
ULWord &  inOutSMPTELine,
ULWord &  outLineOffset 
)
static

◆ SetAncFooterChecksum()

static bool CNTV2SMPTEAncData::SetAncFooterChecksum ( NTV2_SMPTEAncFooterPtr  pFtr,
UWord  checksum 
)
static

◆ SetAncHeaderDataCount()

static bool CNTV2SMPTEAncData::SetAncHeaderDataCount ( NTV2_SMPTEAncHeaderPtr  pHdr,
UByte  ancDC 
)
static

◆ UnpackLine_8BitYUVtoUWordSequence()

static bool CNTV2SMPTEAncData::UnpackLine_8BitYUVtoUWordSequence ( const void *  pInYUV8Line,
UWordSequence &  out16BitYUVLine,
const ULWord  inNumPixels 
)
static

Converts a single line of NTV2_FBF_8BIT_YCBCR data from the given source buffer into an ordered sequence of UWords that contain the resulting 10-bit even-parity data.

Parameters
[in]pInYUV8LineA valid, non-NULL pointer to the start of the VANC line in an NTV2_FBF_8BIT_YCBCR video buffer.
[out]out16BitYUVLineReceives the converted 10-bit-per-component values as an ordered sequence of UWord values, which will include even parity and valid checksums.
[in]inNumPixelsSpecifies the width of the line to be converted, in pixels.
Returns
True if successful; otherwise false.
Note
If SMPTE ancillary data is detected in the video, this routine "intelligently" stretches it by copying the 8-bits to the LS 8-bits of the 10-bit output, recalculating parity and checksums as needed. (This emulates what NTV2 device firmware does during playout of NTV2_FBF_8BIT_YCBCR frame buffers with NTV2_VANCDATA_8BITSHIFT_ENABLE.)

The documentation for this class was generated from the following file: