35 #if !defined(__CUDA_VIDEO_H__)
36 #define __CUDA_VIDEO_H__
38 #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
39 #if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020))
40 #define __CUVID_DEVPTR64
44 #if defined(__cplusplus)
48 #if defined(__CYGWIN__)
62 typedef enum cudaVideoCodec_enum {
88 typedef enum cudaVideoSurfaceFormat_enum {
101 typedef enum cudaVideoDeinterlaceMode_enum {
114 typedef enum cudaVideoChromaFormat_enum {
126 typedef enum cudaVideoCreateFlags_enum {
138 typedef struct _CUVIDDECODECAPS
143 unsigned int reserved1[3];
146 unsigned char reserved2[3];
153 unsigned int reserved3[11];
160 typedef struct _CUVIDDECODECREATEINFO
174 tcu_ulong Reserved1[3];
202 tcu_ulong Reserved2[5];
210 typedef struct _CUVIDH264DPBENTRY
217 int FieldOrderCnt[2];
225 typedef struct _CUVIDH264MVCEXT
233 int InterViewRefsL0[16];
234 int InterViewRefsL1[16];
242 typedef struct _CUVIDH264SVCEXT
283 typedef struct _CUVIDH264PICPARAMS
314 int CurrFieldOrderCnt[2];
318 unsigned char WeightScale4x4[6][16];
319 unsigned char WeightScale8x8[2][64];
331 unsigned int Reserved[12];
346 typedef struct _CUVIDMPEG2PICPARAMS
362 unsigned char QuantMatrixIntra[64];
363 unsigned char QuantMatrixInter[64];
377 typedef struct _CUVIDMPEG4PICPARAMS
402 unsigned char QuantMatrixIntra[64];
403 unsigned char QuantMatrixInter[64];
412 typedef struct _CUVIDVC1PICPARAMS
457 typedef struct _CUVIDJPEGPICPARAMS
468 typedef struct _CUVIDHEVCPICPARAMS
502 unsigned char reserved1[14];
541 unsigned short column_width_minus1[21];
542 unsigned short row_height_minus1[21];
543 unsigned int reserved3[15];
554 int PicOrderCntVal[16];
555 unsigned char IsLongTerm[16];
556 unsigned char RefPicSetStCurrBefore[8];
557 unsigned char RefPicSetStCurrAfter[8];
558 unsigned char RefPicSetLtCurr[8];
559 unsigned char RefPicSetInterLayer0[8];
560 unsigned char RefPicSetInterLayer1[8];
561 unsigned int reserved4[12];
564 unsigned char ScalingList4x4[6][16];
565 unsigned char ScalingList8x8[6][64];
566 unsigned char ScalingList16x16[6][64];
567 unsigned char ScalingList32x32[2][64];
568 unsigned char ScalingListDCCoeff16x16[6];
569 unsigned char ScalingListDCCoeff32x32[2];
578 typedef struct _CUVIDVP8PICPARAMS
589 unsigned char frame_type : 1;
592 unsigned char update_mb_segmentation_data : 1;
593 unsigned char Reserved2Bits : 2;
597 unsigned char Reserved1[4];
598 unsigned int Reserved2[3];
606 typedef struct _CUVIDVP9PICPARAMS
618 unsigned short frameContextIdx : 2;
619 unsigned short frameType : 1;
620 unsigned short showFrame : 1;
621 unsigned short errorResilient : 1;
622 unsigned short frameParallelDecoding : 1;
623 unsigned short subSamplingX : 1;
624 unsigned short subSamplingY : 1;
625 unsigned short intraOnly : 1;
626 unsigned short allow_high_precision_mv : 1;
627 unsigned short refreshEntropyProbs : 1;
628 unsigned short reserved2Bits : 2;
632 unsigned char refFrameSignBias[4];
643 unsigned char segmentEnabled : 1;
644 unsigned char segmentMapUpdate : 1;
645 unsigned char segmentMapTemporalUpdate : 1;
646 unsigned char segmentFeatureMode : 1;
647 unsigned char reserved4Bits : 4;
650 unsigned char segmentFeatureEnable[8][4];
651 short segmentFeatureData[8][4];
652 unsigned char mb_segment_tree_probs[7];
653 unsigned char segment_pred_probs[3];
654 unsigned char reservedSegment16Bits[2];
661 unsigned int activeRefIdx[3];
664 unsigned int mbRefLfDelta[4];
665 unsigned int mbModeLfDelta[2];
668 unsigned int reserved128Bits[4];
679 typedef struct _CUVIDPICPARAMS
695 unsigned int Reserved[30];
706 unsigned int CodecReserved[1024];
716 typedef struct _CUVIDPROCPARAMS
732 unsigned int Reserved[46];
798 #if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL)
806 unsigned int *pDevPtr,
unsigned int *pPitch,
816 #if defined(_WIN64) || defined(__LP64__) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
823 typedef CUresult CUDAAPI tcuvidMapVideoFrame64(CUvideodecoder hDecoder,
int nPicIdx,
unsigned long long *pDevPtr,
830 typedef CUresult CUDAAPI tcuvidUnmapVideoFrame64(CUvideodecoder hDecoder,
unsigned long long DevPtr);
832 #if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL)
833 #define tcuvidMapVideoFrame tcuvidMapVideoFrame64
834 #define tcuvidUnmapVideoFrame tcuvidUnmapVideoFrame64
882 #if defined(__cplusplus)
886 #endif // __CUDA_VIDEO_H__
short scaled_ref_layer_bottom_offset
unsigned char loop_filter_across_tiles_enabled_flag
int ref_pic_flag
Set to 1 for I,P frames.
int PicWidthInMbs
IN: Coded frame size in macroblocks.
tcu_ulong bitDepthMinus8
IN: The value "BitDepth minus 8".
unsigned char bitDepthMinus8Luma
unsigned char deblocking_filter_override_enabled_flag
CUresult CUDAAPI tcuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx)
Use CUDA-based decoder (requires valid vidLock object for multi-threading)
int view_id
view identifier
short scaled_ref_layer_right_offset
unsigned int Reserved1
Reserved for future use (set to zero)
int num_ref_idx_l0_active_minus1
int unpaired_field
IN: Input only contains one field (2nd field is invalid)
signed char pps_tc_offset_div2
unsigned int raw_input_format
IN: Input YUV format (cudaVideoCodec_enum)
H.264 SVC picture parameters ext This structure is used in CUVIDH264PICPARAMS structure.
int num_ref_idx_l1_active_minus1
tcu_ulong ulNumOutputSurfaces
IN: Maximum number of output surfaces simultaneously mapped.
unsigned char num_tile_columns_minus1
short scaled_ref_layer_top_offset
unsigned char log2_max_pic_order_cnt_lsb_minus4
unsigned char uniform_spacing_flag
unsigned char num_ref_idx_l0_default_active_minus1
unsigned char bit_depth_chroma_minus8
unsigned char diff_cu_qp_delta_depth
unsigned char num_long_term_ref_pics_sps
int is_long_term
0=short term reference, 1=long term reference
unsigned short Reserved16Bits
unsigned char pcm_enabled_flag
cudaVideoCreateFlags
Decoder flag enums to select preferred decode path cudaVideoCreate_Default and cudaVideoCreate_Prefer...
struct _CUVIDPICPARAMS * pNextLayer
Points to the picparams for the next layer to be decoded.
unsigned char IrapPicFlag
VP8 picture parameters This structure is used in CUVIDPICPARAMS structure.
struct _CUcontextlock_st * CUvideoctxlock
unsigned char inter_view_flag
1 if used for inter-view prediction, 0 if not
This structure is used in cuvidGetDecoderCaps API.
H.264 MVC picture parameters ext This structure is used in CUVIDH264PICPARAMS structure.
int log2_max_pic_order_cnt_lsb_minus4
int FrameIdx
frame_num(short-term) or LongTermFrameIdx(long-term)
unsigned char dependent_slice_segments_enabled_flag
int field_pic_flag
IN: 0=frame picture, 1=field picture.
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream, AVFormatContext *fmt_ctx)
unsigned char chroma_phase_y_plus1
unsigned char residual_colour_transform_flag
unsigned char GoldenRefIdx
const unsigned char * pMb2SliceGroupMap
cudaVideoChromaFormat
Chroma format enums These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures JPEG...
unsigned char loop_filter_across_slices_enabled_flag
unsigned char wFrameTagFlags
unsigned char pcm_sample_bit_depth_luma_minus1
Default operation mode: use dedicated video engines.
VP9 picture parameters This structure is used in CUVIDPICPARAMS structure.
int second_chroma_qp_index_offset
cudaVideoDeinterlaceMode DeinterlaceMode
IN: cudaVideoDeinterlaceMode_XXX.
unsigned char bit_depth_luma_minus8
signed char pps_cr_qp_offset
unsigned char log2_min_luma_coding_block_size_minus3
unsigned char tcoeff_level_prediction_flag
cudaVideoCodec CodecType
IN: cudaVideoCodec_XXX.
unsigned char bit_depth_chroma_minus8
int NumBitsForShortTermRPSInSlice
unsigned char modeRefLfEnabled
cudaVideoSurfaceFormat OutputFormat
IN: cudaVideoSurfaceFormat_XXX.
unsigned char constrained_intra_pred_flag
int ForwardRefIdx
Picture index of forward reference (P/B-frames)
HEVC picture parameters This structure is used in CUVIDPICPARAMS structure.
int BackwardRefIdx
Picture index of backward reference (B-frames)
int num_views_minus1
Max number of coded views minus 1 in video : Range - 0 to 1023.
int video_object_layer_width
int delta_pic_order_always_zero_flag
tcu_ulong ulTargetWidth
IN: Post-processed output width (Should be aligned to 2)
Picture parameters for postprocessing This structure is used in cuvidMapVideoFrame API...
int PicIdx
picture index of reference frame
int intra_pic_flag
Set to 1 for I,BI frames.
unsigned char store_ref_base_pic_flag
signed char pic_init_qs_minus26
int full_pel_forward_vector
unsigned char num_inter_view_refs_l1
number of inter-view ref pics in RefPicList1
unsigned char pcm_loop_filter_disabled_flag
unsigned int first_partition_size
int constrained_intra_pred_flag
CUvideoctxlock vidLock
IN: If non-NULL, context lock used for synchronizing ownership of the cuda context.
JPEG picture parameters This structure is used in CUVIDPICPARAMS structure.
unsigned char log2_tile_columns
unsigned char num_ref_idx_l1_default_active_minus1
unsigned short nMinWidth
OUT: Min supported coded width in pixels.
unsigned char slice_group_map_type
CUresult CUDAAPI tcuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci)
unsigned char fmo_aso_enable
unsigned long long slice_group_map_addr
unsigned int frameTagSize
int bRefBaseLayer
whether to store ref base pic
This structure is used in cuvidCreateDecoder API.
H.264 DPB entry This structure is used in CUVIDH264PICPARAMS structure.
unsigned int raw_output_pitch
IN: pitch in bytes of raw YUV output (should be aligned appropriately)
unsigned char log2_parallel_merge_level_minus2
int not_existing
non-existing reference frame (corresponding PicIdx should be set to -1)
int deblocking_filter_control_present_flag
Picture parameters for decoding This structure is used in cuvidDecodePicture API IN for cuvidDecodePi...
unsigned char MVCReserved8Bits
Reserved bits.
int CurrPicIdx
IN: Output index of the current picture.
unsigned char sample_adaptive_offset_enabled_flag
unsigned char weighted_pred_flag
unsigned char pcm_sample_bit_depth_chroma_minus1
unsigned char long_term_ref_pics_present_flag
unsigned char extended_spatial_scalability_idc
unsigned char profile_idc
unsigned char transform_skip_enabled_flag
unsigned int nNumSlices
IN: Number of slices in this picture.
int FrameHeightInMbs
IN: Coded frame height in macroblocks.
unsigned short reserved16Bits
unsigned char separate_colour_plane_flag
unsigned char bIsSupported
OUT: 1 if codec supported, 0 if not supported.
int log2_max_frame_num_minus4
int resync_marker_disable
unsigned char entropy_coding_sync_enabled_flag
unsigned char loopFilterLevel
int intra_pic_flag
IN: This picture is entirely intra coded.
unsigned char bitDepthMinus8Chroma
int progressive_frame
IN: Input is progressive (deinterlace_mode will be ignored)
unsigned char scaling_list_enable_flag
int FrameHeight
Actual frame height.
tcu_ulong ulCreationFlags
IN: Decoder creation flags (cudaVideoCreateFlags_XXX)
tcu_ulong ulIntraDecodeOnly
IN: Set 1 only if video has all intra frames (default value is 0).
CUresult CUDAAPI tcuvidCtxLockDestroy(CUvideoctxlock lck)
int pic_order_present_flag
Use dedicated video engines directly.
CUresult CUDAAPI tcuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags)
int second_field
IN: Output the second field (ignored if deinterlace mode is Weave)
unsigned int mcomp_filter_type
unsigned char log2_diff_max_min_pcm_luma_coding_block_size
unsigned char num_tile_rows_minus1
unsigned int reserved_zero
Reserved (set to zero)
int ref_pic_flag
IN: This picture is a reference picture.
signed char pps_beta_offset_div2
int top_field_first
IN: Input frame is top field first (1st field is top, 2nd field is bottom)
int progressive_fcm
Progressive frame.
cudaVideoDeinterlaceMode
Deinterlacing mode enums These enums are used in CUVIDDECODECREATEINFO structure Use cudaVideoDeinter...
Go through DXVA internally if possible (requires D3D9 interop)
const unsigned int * pSliceDataOffsets
IN: nNumSlices entries, contains offset of each slice within the bitstream data buffer.
Weave both fields (no deinterlacing)
unsigned short DPBEntryValidFlag
CUresult CUDAAPI tcuvidDestroyDecoder(CUvideodecoder hDecoder)
int bottom_field_flag
IN: 0=top field, 1=bottom field (ignored if field_pic_flag=0)
unsigned char slice_header_restriction_flag
unsigned long long raw_output_dptr
IN: Output CUdeviceptr for raw YUV extensions.
unsigned int nMaxHeight
OUT: Max supported coded height in pixels.
unsigned short nMinHeight
OUT: Min supported coded height in pixels.
unsigned char num_extra_slice_header_bits
int vop_time_increment_bitcount
CUresult CUDAAPI tcuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, unsigned int *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP)
unsigned char tiles_enabled_flag
short scaled_ref_layer_left_offset
unsigned int nBitDepthMinus8
IN: The Value "BitDepth minus 8".
unsigned char log2_min_pcm_luma_coding_block_size_minus3
unsigned char qpprime_y_zero_transform_bypass_flag
CUresult CUDAAPI tcuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags)
tcu_ulong ulNumDecodeSurfaces
IN: Maximum number of internal decode surfaces.
MPEG-4 picture parameters This structure is used in CUVIDPICPARAMS structure.
unsigned char inter_layer_deblocking_filter_control_present_flag
unsigned int nMaxMBCount
OUT: Max supported macroblock count CodedWidth*CodedHeight/256 must be <= nMaxMBCount.
signed char inter_layer_slice_alpha_c0_offset_div2
int pic_height_in_luma_samples
unsigned int resetFrameContext
unsigned char slice_segment_header_extension_present_flag
int NumDeltaPocsOfRefRpsIdx
CUstream output_stream
IN: stream object used by cuvidMapVideoFrame.
unsigned char pps_deblocking_filter_disabled_flag
unsigned char Reserved8BitsA
CUresult CUDAAPI tcuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams)
unsigned char amp_enabled_flag
unsigned char sps_temporal_mvp_enabled_flag
const unsigned char * pBitstreamData
IN: Ptr to bitstream data for this picture (slice-layer)
unsigned int slice_group_change_rate_minus1
unsigned char log2_tile_rows
unsigned char loopFilterSharpness
unsigned char lists_modification_present_flag
unsigned char log2_diff_max_min_transform_block_size
unsigned char Reserved8BitsB
int video_object_layer_height
unsigned char num_inter_view_refs_l0
number of inter-view ref pics in RefPicList0
unsigned char max_transform_hierarchy_depth_inter
int entropy_coding_mode_flag
unsigned char pps_slice_chroma_qp_offsets_present_flag
int transform_8x8_mode_flag
tcu_ulong ulWidth
IN: Coded sequence width in pixels.
16 bit semiplaner format.
cudaVideoCodec eCodecType
IN: cudaVideoCodec_XXX.
unsigned char num_slice_groups_minus1
unsigned char output_flag_present_flag
signed char pps_cb_qp_offset
int concealment_motion_vectors
CUVIDMPEG2PICPARAMS mpeg2
Also used for MPEG-1.
int redundant_pic_cnt_present_flag
int used_for_reference
0=unused, 1=top_field, 2=bottom_field, 3=both_fields
int direct_8x8_inference_flag
CUresult CUDAAPI tcuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr)
unsigned char bit_depth_luma_minus8
signed char init_qp_minus26
unsigned char weighted_bipred_flag
unsigned int offsetToDctParts
unsigned char adaptive_tcoeff_level_prediction_flag
unsigned char chroma_phase_x_plus1_flag
CUresult CUDAAPI tcuvidGetDecoderCaps(CUVIDDECODECAPS *pdc)
cudaVideoChromaFormat eChromaFormat
IN: cudaVideoChromaFormat_XXX.
unsigned char transquant_bypass_enabled_flag
int pic_width_in_luma_samples
CUVIDMPEG4PICPARAMS mpeg4
cudaVideoSurfaceFormat
Video surface format enums used for output format of decoded output These enums are used in CUVIDDECO...
unsigned int reserved_flags
Reserved for future use (set to zero)
unsigned char log2_diff_max_min_luma_coding_block_size
tcu_ulong ulHeight
IN: Coded sequence height in pixels.
unsigned char cabac_init_present_flag
MPEG-2 picture parameters This structure is used in CUVIDPICPARAMS structure.
unsigned char cu_qp_delta_enabled_flag
unsigned char max_transform_hierarchy_depth_intra
cudaVideoChromaFormat ChromaFormat
IN: cudaVideoChromaFormat_XXX.
tcu_ulong ulTargetHeight
IN: Post-processed output height (Should be aligbed to 2)
VC1 picture parameters This structure is used in CUVIDPICPARAMS structure.
unsigned char GoldenRefIdx
unsigned char disable_inter_layer_deblocking_filter_idc
int second_field
IN: Second field of a complementary field pair.
unsigned char sign_data_hiding_enabled_flag
unsigned char strong_intra_smoothing_enabled_flag
cudaVideoCodec
Video codec enums These enums are used in CUVIDDECODECREATEINFO and CUVIDDECODECAPS structures...
unsigned long long raw_input_dptr
IN: Input CUdeviceptr for raw YUV extensions.
int chroma_qp_index_offset
int alternate_vertical_scan_flag
unsigned char ref_layer_chroma_phase_y_plus1
H.264 picture parameters This structure is used in CUVIDPICPARAMS structure.
int FrameWidth
Actual frame width.
unsigned int nBitstreamDataLen
IN: Number of bytes in bitstream data buffer.
int full_pel_backward_vector
unsigned char log2_min_transform_block_size_minus2
unsigned char ref_layer_chroma_phase_x_plus1_flag
unsigned char constrained_intra_resampling_flag
unsigned char num_short_term_ref_pic_sets
signed char inter_layer_slice_beta_offset_div2
unsigned int nMaxWidth
OUT: Max supported coded width in pixels.
unsigned int raw_input_pitch
IN: pitch in bytes of raw YUV input (should be aligned appropriately)