MTDecode API Reference
MUVIDDEC Functions
Functions
Function muvidGetDecoderCaps
MUresult MUSAAPI muvidGetDecoderCaps(MUVIDDECODECAPS *pdc)
Queries decode capabilities of MTDEC-HW based on CodecType, ChromaFormat and BitDepthMinus8 parameters.
-
Application fills IN parameters CodecType, ChromaFormat and BitDepthMinus8 of MUVIDDECODECAPS structure
-
On calling muvidGetDecoderCaps, driver fills OUT parameters if the IN parameters are supported If IN parameters passed to the driver are not supported by MTDEC-HW, then all OUT params are set to 0. E.g: App fills - eCodecType = musaVideoCodec_H264; eChromaFormat = musaVideoChromaFormat_420; nBitDepthMinus8 = 0; Given IN parameters are supported, hence driver fills: bIsSupported = 1; nMinWidth = 16; nMinHeight = 16; nMaxWidth = 8192; nMaxHeight = 8192; nMaxMBCount = 262144; CodedWidth*CodedHeight/256 must be less than or equal to nMaxMBCount
Parameters:
pdc:MUVIDDECODECAPS *
Function muvidCreateDecoder
MUresult MUSAAPI muvidCreateDecoder(MUvideodecoder *phDecoder, MUVIDDECODECREATEINFO *pdci)
Create the decoder object based on pdci. A handle to the created decoder is returned
Parameters:
phDecoder:MUvideodecoder *pdci:MUVIDDECODECREATEINFO *
Function muvidDestroyDecoder
MUresult MUSAAPI muvidDestroyDecoder(MUvideodecoder hDecoder)
Destroy the decoder object
Parameters:
hDecoder:MUvideodecoder
Function muvidDecodePicture
MUresult MUSAAPI muvidDecodePicture(MUvideodecoder hDecoder, MUVIDPICPARAMS *pPicParams)
Decode a single picture (field or frame) Kicks off HW decoding
Parameters:
hDecoder:MUvideodecoderpPicParams:MUVIDPICPARAMS *
Function muvidGetDecodeStatus
MUresult MUSAAPI muvidGetDecodeStatus(MUvideodecoder hDecoder, int nPicIdx, MUVIDGETDECODESTATUS *pDecodeStatus)
Get the decode status for frame corresponding to nPicIdx
Parameters:
hDecoder:MUvideodecodernPicIdx:intpDecodeStatus:MUVIDGETDECODESTATUS *
Function muvidReconfigureDecoder
MUresult MUSAAPI muvidReconfigureDecoder(MUvideodecoder hDecoder, MUVIDRECONFIGUREDECODERINFO *pDecReconfigParams)
Used to reuse single decoder for multiple clips. Currently supports resolution change, resize params, display area params, target area params change for same codec. Must be called during MUVIDPARSERPARAMS::pfnSequenceCallback
Parameters:
hDecoder:MUvideodecoderpDecReconfigParams:MUVIDRECONFIGUREDECODERINFO *
Function muvidMapVideoFrame
MUresult MUSAAPI muvidMapVideoFrame(MUvideodecoder hDecoder, int nPicIdx, void **pDevPtr, unsigned int *pPitch, MUVIDPROCPARAMS *pVPP)
Post-process and map video frame corresponding to nPicIdx for use in musa. Returns musa device pointer and associated pitch of the video frame
Parameters:
hDecoder:MUvideodecodernPicIdx:intpDevPtr:void **pPitch:unsigned int *pVPP:MUVIDPROCPARAMS *
Function muvidUnmapVideoFrame
MUresult MUSAAPI muvidUnmapVideoFrame(MUvideodecoder hDecoder, void *DevPtr)
Unmap a previously mapped video frame
Parameters:
hDecoder:MUvideodecoderDevPtr:void *
MUVIDDEC Data Structures
Enumeration types
Enumeration type MUresult
Definition: muviddec.h (line 57)
enum MUresult {
MUSA_SUCCESS = 0,
MUSA_ERROR_INVALID_VALUE = 1,
MUSA_ERROR_OUT_OF_MEMORY = 2,
MUSA_ERROR_NOT_INITIALIZED = 3,
MUSA_ERROR_INVALID_DEVICE = 101,
MUSA_ERROR_ILLEGAL_INSTRUCTION = 715,
MUSA_ERROR_LAUNCH_FAILED = 719,
MUSA_ERROR_NOT_SUPPORTED = 801,
MUSA_ERROR_SYSTEM_NOT_READY = 802,
MUSA_ERROR_UNKNOWN = 999
}
Defines Returns codes for MTDEC.
Enumerator MUSA_SUCCESS
The API call returned with no errors.
Enumerator MUSA_ERROR_INVALID_VALUE
This indicates that one or more of the parameters passed to the API call
Enumerator MUSA_ERROR_OUT_OF_MEMORY
The API call failed because it was unable to allocate enough memory to perform the requested operation.
Enumerator MUSA_ERROR_NOT_INITIALIZED
The API call failed because the driver could not be initialized.
Enumerator MUSA_ERROR_INVALID_DEVICE
This indicates that the device ordinal supplied by the user is invalid.
Enumerator MUSA_ERROR_ILLEGAL_INSTRUCTION
The device encountered an illegal instruction
Enumerator MUSA_ERROR_LAUNCH_FAILED
An exception occurred on the device while executing a process
Enumerator MUSA_ERROR_NOT_SUPPORTED
The API call failed because the requested operation is not supported on the current system or device.
Enumerator MUSA_ERROR_SYSTEM_NOT_READY
The system is not ready to work.
Enumerator MUSA_ERROR_UNKNOWN
This indicates that an unknown internal error has occurred.
Enumeration type musaVideoCodec_enum
Definition: muviddec.h (line 84)
enum musaVideoCodec_enum {
musaVideoCodec_H264 =0,
musaVideoCodec_HEVC,
musaVideoCodec_VP9,
musaVideoCodec_AV1,
musaVideoCodec_NumCodecs
}
Enumerator musaVideoCodec_H264
H264
Enumerator musaVideoCodec_HEVC
HEVC
Enumerator musaVideoCodec_VP9
VP9
Enumerator musaVideoCodec_AV1
AV1
Enumerator musaVideoCodec_NumCodecs
Max codecs
Enumeration type musaVideoSurfaceFormat_enum
Definition: muviddec.h (line 97)
enum musaVideoSurfaceFormat_enum {
musaVideoSurfaceFormat_NV12 =0,
musaVideoSurfaceFormat_P016 =1,
musaVideoSurfaceFormat_RGBA =2,
musaVideoSurfaceFormat_BGRA =3,
musaVideoSurfaceFormat_I420 =4,
musaVideoSurfaceFormat_DEFAULT =0xFF
}
Enumerator musaVideoSurfaceFormat_NV12
Semi-Planar YUV [Y plane followed by interleaved UV plane]
Enumerator musaVideoSurfaceFormat_P016
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)
Enumerator musaVideoSurfaceFormat_RGBA
Four bytes per pixel: red, green, blue, alpha.
Enumerator musaVideoSurfaceFormat_BGRA
Four bytes per pixel: blue, green, red, alpha.
Enumerator musaVideoSurfaceFormat_I420
three-plane 8-bit YUV 4:2:0, [contain Y, U and V respectively]
Enumerator musaVideoSurfaceFormat_DEFAULT
Invalid format
Enumeration type musaVideoDeinterlaceMode_enum
Definition: muviddec.h (line 114)
enum musaVideoDeinterlaceMode_enum {
musaVideoDeinterlaceMode_Weave =0,
musaVideoDeinterlaceMode_Bob,
musaVideoDeinterlaceMode_Adaptive
}
Enumerator musaVideoDeinterlaceMode_Weave
Weave both fields (no deinterlacing)
Enumerator musaVideoDeinterlaceMode_Bob
Drop one field
Enumerator musaVideoDeinterlaceMode_Adaptive
Adaptive deinterlacing
Enumeration type musaVideoChromaFormat_enum
Definition: muviddec.h (line 125)
enum musaVideoChromaFormat_enum {
musaVideoChromaFormat_420 =1
}
Enumerator musaVideoChromaFormat_420
YUV 4:2:0
Enumeration type musaVideoCreateFlags_enum
Definition: muviddec.h (line 134)
enum musaVideoCreateFlags_enum {
musaVideoCreate_Default = 0x00,
musaVideoCreate_MUSA = 0x01
}
Enumerator musaVideoCreate_Default
Default operation mode: use dedicated video engines
Enumerator musaVideoCreate_MUSA
Use musa decoder
Enumeration type muvidDecodeStatus_enum
Definition: muviddec.h (line 145)
enum muvidDecodeStatus_enum {
muvidDecodeStatus_Invalid = 0,
muvidDecodeStatus_InProgress = 1,
muvidDecodeStatus_Success = 2,
muvidDecodeStatus_Error = 3,
muvidDecodeStatus_Error_Concealed = 4
}
Enumerator muvidDecodeStatus_Invalid
Decode status is not valid
Enumerator muvidDecodeStatus_InProgress
Decode is in progress
Enumerator muvidDecodeStatus_Success
Decode is completed without any errors
Enumerator muvidDecodeStatus_Error
Decode is completed with an error (error is not concealed)
Enumerator muvidDecodeStatus_Error_Concealed
Decode is completed with an error and error is concealed
Enumeration type _MUSAPROCFLAG
Definition: muviddec.h (line 791)
enum _MUSAPROCFLAG {
musaMapVideoFlag_ToSys = 0x0000,
musaMapVideoFlag_ToFd = 0x0001,
musaMapVideoFlag_ExportFd = 0x0002,
musaMapVideoFlag_Musa = 0x0003
}
Enumerator musaMapVideoFlag_ToSys
Export frame to system memory
Enumerator musaMapVideoFlag_ToFd
Show frame to target fd
Enumerator musaMapVideoFlag_ExportFd
Export fd of frame
Enumerator musaMapVideoFlag_Musa
musa device memory
Typedefs
Typedef MUcontext
Definition: muviddec.h (line 72)
typedef void* MUcontext
Return type: void *
Typedef MUdeviceptr
Definition: muviddec.h (line 73)
typedef void* MUdeviceptr
Return type: void *
Typedef MUvideodecoder
Definition: muviddec.h (line 76)
typedef void* MUvideodecoder
Return type: void *
Typedef MUvideoctxlock
Definition: muviddec.h (line 77)
typedef void* MUvideoctxlock
Return type: void *
Typedef musaVideoCodec
Definition: muviddec.h (line 90)
typedef enum musaVideoCodec_enum musaVideoCodec
Return type: enum musaVideoCodec_enum
Typedef musaVideoSurfaceFormat
Definition: muviddec.h (line 105)
typedef enum musaVideoSurfaceFormat_enum musaVideoSurfaceFormat
Return type: enum musaVideoSurfaceFormat_enum
Typedef musaVideoDeinterlaceMode
Definition: muviddec.h (line 118)
typedef enum musaVideoDeinterlaceMode_enum musaVideoDeinterlaceMode
Return type: enum musaVideoDeinterlaceMode_enum
Typedef musaVideoChromaFormat
Definition: muviddec.h (line 127)
typedef enum musaVideoChromaFormat_enum musaVideoChromaFormat
Return type: enum musaVideoChromaFormat_enum
Typedef musaVideoCreateFlags
Definition: muviddec.h (line 137)
typedef enum musaVideoCreateFlags_enum musaVideoCreateFlags
Return type: enum musaVideoCreateFlags_enum
Typedef muvidDecodeStatus
Definition: muviddec.h (line 152)
typedef enum muvidDecodeStatus_enum muvidDecodeStatus
Return type: enum muvidDecodeStatus_enum
Typedef MUVIDDECODECAPS
Definition: muviddec.h (line 180)
typedef struct _MUVIDDECODECAPS MUVIDDECODECAPS
Return type: struct _MUVIDDECODECAPS
Typedef MUVIDDECODECREATEINFO
Definition: muviddec.h (line 235)
typedef struct _MUVIDDECODECREATEINFO MUVIDDECODECREATEINFO
Return type: struct _MUVIDDECODECREATEINFO
Typedef MUVIDH264DPBENTRY
Definition: muviddec.h (line 251)
typedef struct _MUVIDH264DPBENTRY MUVIDH264DPBENTRY
Return type: struct _MUVIDH264DPBENTRY
Typedef MUVIDH264MVCEXT
Definition: muviddec.h (line 268)
typedef struct _MUVIDH264MVCEXT MUVIDH264MVCEXT
Return type: struct _MUVIDH264MVCEXT
Typedef MUVIDH264SVCEXT
Definition: muviddec.h (line 309)
typedef struct _MUVIDH264SVCEXT MUVIDH264SVCEXT
Return type: struct _MUVIDH264SVCEXT
Typedef MUVIDH264PICPARAMS
Definition: muviddec.h (line 371)
typedef struct _MUVIDH264PICPARAMS MUVIDH264PICPARAMS
Return type: struct _MUVIDH264PICPARAMS
Typedef MUVIDHEVCPICPARAMS
Definition: muviddec.h (line 509)
typedef struct _MUVIDHEVCPICPARAMS MUVIDHEVCPICPARAMS
Return type: struct _MUVIDHEVCPICPARAMS
Typedef MUVIDVP9PICPARAMS
Definition: muviddec.h (line 580)
typedef struct _MUVIDVP9PICPARAMS MUVIDVP9PICPARAMS
Return type: struct _MUVIDVP9PICPARAMS
Typedef MUVIDAV1PICPARAMS
Definition: muviddec.h (line 756)
typedef struct _MUVIDAV1PICPARAMS MUVIDAV1PICPARAMS
Return type: struct _MUVIDAV1PICPARAMS
Typedef MUVIDPICPARAMS
Definition: muviddec.h (line 789)
typedef struct _MUVIDPICPARAMS MUVIDPICPARAMS
Return type: struct _MUVIDPICPARAMS
Typedef MUSAPROCFLAG
Definition: muviddec.h (line 796)
typedef enum _MUSAPROCFLAG MUSAPROCFLAG
Return type: enum _MUSAPROCFLAG
Typedef MUSAVIDEOFRAMEINFO
Definition: muviddec.h (line 807)
typedef struct _MUSAVIDEOFRAMEINFO MUSAVIDEOFRAMEINFO
Return type: struct _MUSAVIDEOFRAMEINFO
Typedef MUSAMAPVIDEOTOSYSPARAMS
Definition: muviddec.h (line 814)
typedef struct _MUSAMAPVIDEOTOSYSPARAMS MUSAMAPVIDEOTOSYSPARAMS
Return type: struct _MUSAMAPVIDEOTOSYSPARAMS
Typedef MUSAMAPVIDEOTOFDPARAMS
Definition: muviddec.h (line 819)
typedef struct _MUSAMAPVIDEOTOFDPARAMS MUSAMAPVIDEOTOFDPARAMS
Return type: struct _MUSAMAPVIDEOTOFDPARAMS