![]() |
ApraPipes 1.0
|
Base class for decoder interface. More...
#include <H264DecoderNvCodecHelper.h>
Public Member Functions | |
NvDecoder (CUcontext cuContext, int nWidth, int nHeight, bool bUseDeviceFrame, cudaVideoCodec eCodec, std::mutex *pMutex=NULL, bool bLowLatency=false, bool bDeviceFramePitched=false, const Rect *pCropRect=NULL, const Dim *pResizeDim=NULL, int maxWidth=0, int maxHeight=0) | |
This function is used to initialize the decoder session. Application must call this function to initialize the decoder, before starting to decode any frames. | |
NvDecoder () | |
~NvDecoder () | |
CUcontext | GetContext () |
This function is used to get the current CUDA context. | |
int | GetWidth () |
This function is used to get the current decode width. | |
int | GetHeight () |
This function is used to get the current decode height. | |
int | GetFrameSize () |
This function is used to get the current frame size based on pixel format. | |
int | GetDeviceFramePitch () |
This function is used to get the pitch of the device buffer holding the decoded frame. | |
int | GetBitDepth () |
This function is used to get the bit depth associated with the pixel format. | |
CUVIDEOFORMAT | GetVideoFormatInfo () |
This function is used to get information about the video stream (codec, display parameters etc) | |
std::string | GetVideoInfo () const |
This function is used to print information about the video stream. | |
bool | Decode (const uint8_t *pData, int nSize, uint8_t ***pppFrame, int *pnFrameReturned, uint32_t flags=0, int64_t **ppTimestamp=NULL, int64_t timestamp=0, CUstream stream=0) |
This function decodes a frame and returns frames that are available for display. The frames should be used or buffered before making subsequent calls to the Decode function again. | |
bool | DecodeLockFrame (const uint8_t *pData, int nSize, uint8_t ***pppFrame, int *pnFrameReturned, uint32_t flags=0, int64_t **ppTimestamp=NULL, int64_t timestamp=0, CUstream stream=0) |
This function decodes a frame and returns the locked frame buffers This makes the buffers available for use by the application without the buffers getting overwritten, even if subsequent decode calls are made. The frame buffers remain locked, until UnlockFrame() is called. | |
void | UnlockFrame (uint8_t **ppFrame, int nFrame) |
This function unlocks the frame buffer and makes the frame buffers available for write again. | |
int | setReconfigParams (const Rect *pCropRect, const Dim *pResizeDim) |
This function allow app to set decoder reconfig params. | |
Private Member Functions | |
int | HandleVideoSequence (CUVIDEOFORMAT *pVideoFormat) |
This function gets called when a sequence is ready to be decoded. The function also gets called when there is format change. | |
int | HandlePictureDecode (CUVIDPICPARAMS *pPicParams) |
This function gets called when a picture is ready to be decoded. cuvidDecodePicture is called from this function to decode the picture. | |
int | HandlePictureDisplay (CUVIDPARSERDISPINFO *pDispInfo) |
This function gets called after a picture is decoded and available for display. Frames are fetched and stored in internal buffer. | |
int | ReconfigureDecoder (CUVIDEOFORMAT *pVideoFormat) |
This function reconfigure decoder if there is a change in sequence params. | |
Static Private Member Functions | |
static int CUDAAPI | HandleVideoSequenceProc (void *pUserData, CUVIDEOFORMAT *pVideoFormat) |
Callback function to be registered for getting a callback when decoding of sequence starts. | |
static int CUDAAPI | HandlePictureDecodeProc (void *pUserData, CUVIDPICPARAMS *pPicParams) |
Callback function to be registered for getting a callback when a decoded frame is ready to be decoded. | |
static int CUDAAPI | HandlePictureDisplayProc (void *pUserData, CUVIDPARSERDISPINFO *pDispInfo) |
Callback function to be registered for getting a callback when a decoded frame is available for display. | |
Private Attributes | |
CUcontext | m_cuContext = NULL |
CUvideoctxlock | m_ctxLock |
std::mutex * | m_pMutex |
CUvideoparser | m_hParser = NULL |
CUvideodecoder | m_hDecoder = NULL |
bool | m_bUseDeviceFrame |
unsigned int | m_nWidth = 0 |
unsigned int | m_nHeight = 0 |
int | m_nSurfaceHeight = 0 |
int | m_nSurfaceWidth = 0 |
cudaVideoCodec | m_eCodec = cudaVideoCodec_NumCodecs |
cudaVideoChromaFormat | m_eChromaFormat |
int | m_nBitDepthMinus8 = 0 |
CUVIDEOFORMAT | m_videoFormat = {} |
Rect | m_displayRect = {} |
std::vector< uint8_t * > | m_vpFrame |
std::vector< uint8_t * > | m_vpFrameRet |
std::vector< int64_t > | m_vTimestamp |
int | m_nDecodedFrame = 0 |
int | m_nDecodedFrameReturned = 0 |
int | m_nDecodePicCnt = 0 |
int | m_nPicNumInDecodeOrder [32] |
bool | m_bEndDecodeDone = false |
std::mutex | m_mtxVPFrame |
int | m_nFrameAlloc = 0 |
CUstream | m_cuvidStream = 0 |
bool | m_bDeviceFramePitched = false |
size_t | m_nDeviceFramePitch = 0 |
Rect | m_cropRect = {} |
Dim | m_resizeDim = {} |
std::ostringstream | m_videoInfo |
unsigned int | m_nMaxWidth = 0 |
unsigned int | m_nMaxHeight = 0 |
bool | m_bReconfigExternal = false |
bool | m_bReconfigExtPPChange = false |
Base class for decoder interface.
NvDecoder::NvDecoder | ( | CUcontext | cuContext, |
int | nWidth, | ||
int | nHeight, | ||
bool | bUseDeviceFrame, | ||
cudaVideoCodec | eCodec, | ||
std::mutex * | pMutex = NULL, | ||
bool | bLowLatency = false, | ||
bool | bDeviceFramePitched = false, | ||
const Rect * | pCropRect = NULL, | ||
const Dim * | pResizeDim = NULL, | ||
int | maxWidth = 0, | ||
int | maxHeight = 0 ) |
This function is used to initialize the decoder session. Application must call this function to initialize the decoder, before starting to decode any frames.
|
inline |
NvDecoder::~NvDecoder | ( | ) |
bool NvDecoder::Decode | ( | const uint8_t * | pData, |
int | nSize, | ||
uint8_t *** | pppFrame, | ||
int * | pnFrameReturned, | ||
uint32_t | flags = 0, | ||
int64_t ** | ppTimestamp = NULL, | ||
int64_t | timestamp = 0, | ||
CUstream | stream = 0 ) |
This function decodes a frame and returns frames that are available for display. The frames should be used or buffered before making subsequent calls to the Decode function again.
bool NvDecoder::DecodeLockFrame | ( | const uint8_t * | pData, |
int | nSize, | ||
uint8_t *** | pppFrame, | ||
int * | pnFrameReturned, | ||
uint32_t | flags = 0, | ||
int64_t ** | ppTimestamp = NULL, | ||
int64_t | timestamp = 0, | ||
CUstream | stream = 0 ) |
This function decodes a frame and returns the locked frame buffers This makes the buffers available for use by the application without the buffers getting overwritten, even if subsequent decode calls are made. The frame buffers remain locked, until UnlockFrame() is called.
|
inline |
This function is used to get the bit depth associated with the pixel format.
|
inline |
This function is used to get the current CUDA context.
|
inline |
This function is used to get the pitch of the device buffer holding the decoded frame.
|
inline |
This function is used to get the current frame size based on pixel format.
|
inline |
This function is used to get the current decode height.
|
inline |
This function is used to get information about the video stream (codec, display parameters etc)
|
inline |
This function is used to print information about the video stream.
|
inline |
This function is used to get the current decode width.
|
private |
This function gets called when a picture is ready to be decoded. cuvidDecodePicture is called from this function to decode the picture.
|
inlinestaticprivate |
Callback function to be registered for getting a callback when a decoded frame is ready to be decoded.
|
private |
This function gets called after a picture is decoded and available for display. Frames are fetched and stored in internal buffer.
|
inlinestaticprivate |
Callback function to be registered for getting a callback when a decoded frame is available for display.
|
private |
This function gets called when a sequence is ready to be decoded. The function also gets called when there is format change.
|
inlinestaticprivate |
Callback function to be registered for getting a callback when decoding of sequence starts.
|
private |
This function reconfigure decoder if there is a change in sequence params.
This function allow app to set decoder reconfig params.
void NvDecoder::UnlockFrame | ( | uint8_t ** | ppFrame, |
int | nFrame ) |
This function unlocks the frame buffer and makes the frame buffers available for write again.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |