Rr/roc video decode class (#20)

* WIP: class implementation

* add more definitions

* rocvideodecode implementation

* formatting fixes

* address review comments

[ROCm/rocdecode commit: d0e6743872]
This commit is contained in:
Rajy Rawther
2023-10-23 09:16:45 -07:00
committed by GitHub
parent 9b158f2b07
commit db6dbf7076
18 changed files with 1144 additions and 44 deletions
+9 -9
View File
@@ -108,7 +108,7 @@ typedef enum rocDecVideoSurfaceFormat_enum {
rocDecVideoSurfaceFormat_NV12=0, /**< Semi-Planar YUV [Y plane followed by interleaved UV plane] */
rocDecVideoSurfaceFormat_P016=1, /**< 16 bit Semi-Planar YUV [Y plane followed by interleaved UV plane].
Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
rocDecVideoSurfaceFormat_YUV444=2, /**< Planar YUV [Y plane followed by U and V planes] */
rocDecVideoSurfaceFormat_YUV444=2, /**< Planar YUV [Y plane followed by U and V planes] */
rocDecVideoSurfaceFormat_YUV444_16Bit=3, /**< 16 bit Planar YUV [Y plane followed by U and V planes].
Can be used for 10 bit(6LSB bits 0), 12 bit (4LSB bits 0) */
} rocDecVideoSurfaceFormat;
@@ -125,6 +125,7 @@ typedef enum rocDecVideoChromaFormat_enum {
rocDecVideoChromaFormat_444 /**< YUV 4:4:4 */
} rocDecVideoChromaFormat;
/*************************************************************************/
//! \enum rocDecDecodeStatus
//! Decode status enums
@@ -178,14 +179,14 @@ typedef struct _RocdecDecoderCreateInfo {
uint32_t ulMaxWidth; /**< IN: Coded sequence max width in pixels used with reconfigure Decoder */
uint32_t ulMaxHeight; /**< IN: Coded sequence max height in pixels used with reconfigure Decoder */
/**
* IN: area of the frame that should be copied
* IN: area of the frame that should be displayed
*/
struct {
int16_t left;
int16_t top;
int16_t right;
int16_t bottom;
} roi_area;
} display_area;
rocDecVideoSurfaceFormat OutputFormat; /**< IN: rocDecVideoSurfaceFormat_XXX */
uint32_t ulTargetWidth; /**< IN: Post-processed output width (Should be aligned to 2) */
@@ -203,7 +204,6 @@ typedef struct _RocdecDecoderCreateInfo {
int16_t bottom;
} target_rect;
uint32_t enableHistogram; /**< IN: enable histogram output, if supported */
uint32_t Reserved2[4]; /**< Reserved for future use - set to zero */
} RocdecDecoderCreateInfo;
@@ -668,7 +668,7 @@ typedef struct _RocdecProcParams
uint64_t raw_output_dptr; /**< IN: Output HIP device mem ptr for raw YUV extensions */
uint32_t raw_output_pitch; /**< IN: pitch in bytes of raw YUV output (should be aligned appropriately) */
uint32_t raw_output_format; /**< IN: Output YUV format (rocDecVideoCodec_enum) */
hipStream_t output_hstream; /**< IN: stream object used by rocDecMapVideoFrame */
hipStream_t output_hipstream; /**< IN: stream object used by rocDecMapVideoFrame */
uint32_t Reserved[16]; /**< Reserved for future use (set to zero) */
} RocdecProcParams;
@@ -714,10 +714,10 @@ extern rocDecStatus ROCDECAPI rocDecDestroyDecoder(rocDecDecoderHandle hDecoder)
//! \fn rocDecStatus ROCDECAPI rocdecGetDecoderCaps(RocdecDecodeCaps *pdc)
//! Queries decode capabilities of AMD's VCN decoder based on CodecType, ChromaFormat and BitDepthMinus8 parameters.
//! 1. Application fills IN parameters CodecType, ChromaFormat and BitDepthMinus8 of RocdecDecodeCaps structure
//! 2. On calling rocdecGetDecoderCaps, driver fills OUT parameters if the IN parameters are supported
//! 2. On calling rocdecGetDecoderCaps, driver fills OUT parameters (for GPU device) if the IN parameters are supported
//! If IN parameters passed to the driver are not supported by AMD-VCN-HW, then all OUT params are set to 0.
/**********************************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecGetDecoderCaps(rocDecDecoderHandle hDecoder, RocdecDecodeCaps *pdc);
extern rocDecStatus ROCDECAPI rocDecGetDecoderCaps(RocdecDecodeCaps *pdc);
/*****************************************************************************************************/
//! \fn rocDecStatus ROCDECAPI rocDecDecodeFrame(rocDecDecoderHandle hDecoder, RocdecPicParams *pPicParams)
@@ -746,10 +746,10 @@ extern rocDecStatus ROCDECAPI rocDecReconfigureDecoder(rocDecDecoderHandle hDeco
//! uint32_t *pDevMemPtr, uint32_t *pHorizontalPitch,
//! RocdecProcParams *pVidPostprocParams);
//! Post-process and map video frame corresponding to nPicIdx for use in HIP. Returns HIP device pointer and associated
//! pitch(horizontal stride) of the video frame. Returns device memory pointers for each plane (Y, U and V) seperately
//! pitch(horizontal stride) of the video frame. Returns device memory pointers and pitch for each plane (Y, U and V) seperately
/************************************************************************************************************************/
extern rocDecStatus ROCDECAPI rocDecMapVideoFrame(rocDecDecoderHandle hDecoder, int nPicIdx,
void *pDevMemPtr[3], uint32_t *pHorizontalPitch[3],
void *pDevMemPtr[3], uint32_t (&pHorizontalPitch)[3],
RocdecProcParams *pVidPostprocParams);
/*****************************************************************************************************/
+17 -2
View File
@@ -132,6 +132,21 @@ typedef struct {
uint8_t raw_seqhdr_data[1024]; /**< OUT: Sequence header data */
} RocdecVideoFormatEx;
/***************************************************************/
//! \enum RocdecVideoPacketFlags
//! Data packet flags
//! Used in RocdecSourceDataPacket structure
/***************************************************************/
typedef enum {
ROCDEC_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */
ROCDEC_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */
ROCDEC_PKT_DISCONTINUITY = 0x04, /**< Set when a discontinuity has to be signalled */
ROCDEC_PKT_ENDOFPICTURE = 0x08, /**< Set when the packet contains exactly one frame or one field */
ROCDEC_PKT_NOTIFY_EOS = 0x10, /**< If this flag is set along with ROCDEC_PKT_ENDOFSTREAM, an additional (dummy)
display callback will be invoked with null value of ROCDECPARSERDISPINFO which
should be interpreted as end of the stream. */
} RocdecVideoPacketFlags;
/*****************************************************************************/
//! \ingroup STRUCTS
//! \struct RocdecSourceDataPacket
@@ -140,11 +155,11 @@ typedef struct {
//! IN for rocDecParseVideoData
/*****************************************************************************/
typedef struct _RocdecSourceDataPacket {
uint32_t flags; /**< IN: Combination of CUVID_PKT_XXX flags */
uint32_t flags; /**< IN: Combination of ROCDEC_PKT_XXX flags */
uint32_t payload_size; /**< IN: number of bytes in the payload (may be zero if EOS flag is set) */
const uint8_t *payload; /**< IN: Pointer to packet payload data (may be NULL if EOS flag is set) */
RocdecTimeStamp pts; /**< IN: Presentation time stamp (10MHz clock), only valid if
CUVID_PKT_TIMESTAMP flag is set */
ROCDEC_PKT_TIMESTAMP flag is set */
} RocdecSourceDataPacket;