35 #if !defined(__CUDA_VIDEO_H__)
36 #define __CUDA_VIDEO_H__
38 #ifndef __cuda_cuda_h__
40 #endif // __cuda_cuda_h__
42 #if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
43 #if (CUDA_VERSION >= 3020) && (!defined(CUDA_FORCE_API_VERSION) || (CUDA_FORCE_API_VERSION >= 3020))
44 #define __CUVID_DEVPTR64
48 #if defined(__cplusplus)
64 typedef enum cudaVideoCodec_enum {
89 typedef enum cudaVideoSurfaceFormat_enum {
97 typedef enum cudaVideoDeinterlaceMode_enum {
107 typedef enum cudaVideoChromaFormat_enum {
118 typedef enum cudaVideoCreateFlags_enum {
129 typedef struct _CUVIDDECODECREATEINFO
138 unsigned long Reserved1[4];
165 unsigned long Reserved2[5];
172 typedef struct _CUVIDH264DPBENTRY
179 int FieldOrderCnt[2];
186 typedef struct _CUVIDH264MVCEXT
194 int InterViewRefsL0[16];
195 int InterViewRefsL1[16];
202 typedef struct _CUVIDH264SVCEXT
243 typedef struct _CUVIDH264PICPARAMS
274 int CurrFieldOrderCnt[2];
278 unsigned char WeightScale4x4[6][16];
279 unsigned char WeightScale8x8[2][64];
291 unsigned int Reserved[12];
305 typedef struct _CUVIDMPEG2PICPARAMS
321 unsigned char QuantMatrixIntra[64];
322 unsigned char QuantMatrixInter[64];
340 typedef struct _CUVIDMPEG4PICPARAMS
365 unsigned char QuantMatrixIntra[64];
366 unsigned char QuantMatrixInter[64];
374 typedef struct _CUVIDVC1PICPARAMS
418 typedef struct _CUVIDJPEGPICPARAMS
428 typedef struct _CUVIDHEVCPICPARAMS
462 unsigned char reserved1[14];
501 unsigned short column_width_minus1[21];
502 unsigned short row_height_minus1[21];
503 unsigned int reserved3[15];
514 int PicOrderCntVal[16];
515 unsigned char IsLongTerm[16];
516 unsigned char RefPicSetStCurrBefore[8];
517 unsigned char RefPicSetStCurrAfter[8];
518 unsigned char RefPicSetLtCurr[8];
519 unsigned char RefPicSetInterLayer0[8];
520 unsigned char RefPicSetInterLayer1[8];
521 unsigned int reserved4[12];
524 unsigned char ScalingList4x4[6][16];
525 unsigned char ScalingList8x8[6][64];
526 unsigned char ScalingList16x16[6][64];
527 unsigned char ScalingList32x32[2][64];
528 unsigned char ScalingListDCCoeff16x16[6];
529 unsigned char ScalingListDCCoeff32x32[2];
537 typedef struct _CUVIDVP8PICPARAMS
548 unsigned char frame_type : 1;
551 unsigned char update_mb_segmentation_data : 1;
552 unsigned char Reserved2Bits : 2;
556 unsigned char Reserved1[4];
557 unsigned int Reserved2[3];
564 typedef struct _CUVIDVP9PICPARAMS
576 unsigned short frameContextIdx : 2;
577 unsigned short frameType : 1;
578 unsigned short showFrame : 1;
579 unsigned short errorResilient : 1;
580 unsigned short frameParallelDecoding : 1;
581 unsigned short subSamplingX : 1;
582 unsigned short subSamplingY : 1;
583 unsigned short intraOnly : 1;
584 unsigned short allow_high_precision_mv : 1;
585 unsigned short refreshEntropyProbs : 1;
586 unsigned short reserved2Bits : 2;
590 unsigned char refFrameSignBias[4];
601 unsigned char segmentEnabled : 1;
602 unsigned char segmentMapUpdate : 1;
603 unsigned char segmentMapTemporalUpdate : 1;
604 unsigned char segmentFeatureMode : 1;
605 unsigned char reserved4Bits : 4;
608 unsigned char segmentFeatureEnable[8][4];
609 short segmentFeatureData[8][4];
610 unsigned char mb_segment_tree_probs[7];
611 unsigned char segment_pred_probs[3];
612 unsigned char reservedSegment16Bits[2];
619 unsigned int activeRefIdx[3];
622 unsigned int mbRefLfDelta[4];
623 unsigned int mbModeLfDelta[2];
626 unsigned int reserved128Bits[4];
635 typedef struct _CUVIDPICPARAMS
650 unsigned int Reserved[30];
661 unsigned int CodecReserved[1024];
670 typedef struct _CUVIDPROCPARAMS
684 unsigned int Reserved[48];
733 #if !defined(__CUVID_DEVPTR64) || defined(__CUVID_INTERNAL)
739 unsigned int *pDevPtr,
unsigned int *pPitch,
749 #if defined(WIN64) || defined(_WIN64) || defined(__x86_64) || defined(AMD64) || defined(_M_AMD64)
754 CUresult CUDAAPI cuvidMapVideoFrame64(CUvideodecoder hDecoder,
int nPicIdx,
unsigned long long *pDevPtr,
761 CUresult CUDAAPI cuvidUnmapVideoFrame64(CUvideodecoder hDecoder,
unsigned long long DevPtr);
763 #if defined(__CUVID_DEVPTR64) && !defined(__CUVID_INTERNAL)
764 #define cuvidMapVideoFrame cuvidMapVideoFrame64
765 #define cuvidUnmapVideoFrame cuvidUnmapVideoFrame64
810 #if defined(__cplusplus)
816 CUvideoctxlock m_ctx;
818 CCtxAutoLock(CUvideoctxlock
ctx);
826 #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
Coded Frame Size.
unsigned char bitDepthMinus8Luma
unsigned char deblocking_filter_override_enabled_flag
short scaled_ref_layer_right_offset
int num_ref_idx_l0_active_minus1
int unpaired_field
Input only contains one field (2nd field is invalid)
signed char pps_tc_offset_div2
unsigned int raw_input_format
Reserved for future use (set to zero)
int num_ref_idx_l1_active_minus1
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
struct _CUVIDPICPARAMS * pNextLayer
Points to the picparams for the next layer to be decoded.
CUresult CUDAAPI cuvidMapVideoFrame(CUvideodecoder hDecoder, int nPicIdx, unsigned int *pDevPtr, unsigned int *pPitch, CUVIDPROCPARAMS *pVPP)
Post-process and map a video frame for use in cuda.
unsigned char IrapPicFlag
unsigned char inter_view_flag
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
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
Use dedicated video engines directly.
const unsigned char * pMb2SliceGroupMap
unsigned char loop_filter_across_slices_enabled_flag
unsigned char wFrameTagFlags
unsigned char pcm_sample_bit_depth_luma_minus1
int second_chroma_qp_index_offset
cudaVideoDeinterlaceMode DeinterlaceMode
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
cudaVideoCodec_XXX
unsigned char bit_depth_chroma_minus8
int NumBitsForShortTermRPSInSlice
unsigned char modeRefLfEnabled
cudaVideoSurfaceFormat OutputFormat
cudaVideoSurfaceFormat_XXX
unsigned char constrained_intra_pred_flag
int ForwardRefIdx
Picture index of forward reference (P/B-frames)
int BackwardRefIdx
Picture index of backward reference (B-frames)
int video_object_layer_width
int delta_pic_order_always_zero_flag
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
unsigned long ulCreationFlags
Decoder creation flags (cudaVideoCreateFlags_XXX)
int full_pel_forward_vector
unsigned char num_inter_view_refs_l1
unsigned char pcm_loop_filter_disabled_flag
unsigned int first_partition_size
int constrained_intra_pred_flag
CUvideoctxlock vidLock
If non-NULL, context lock used for synchronizing ownership of the cuda context.
CUresult CUDAAPI cuvidDecodePicture(CUvideodecoder hDecoder, CUVIDPICPARAMS *pPicParams)
Decode a single picture (field or frame)
unsigned char log2_tile_columns
unsigned char num_ref_idx_l1_default_active_minus1
CUresult CUDAAPI cuvidCreateDecoder(CUvideodecoder *phDecoder, CUVIDDECODECREATEINFO *pdci)
In order to minimize decode latencies, there should be always at least 2 pictures in the decode queue...
unsigned char slice_group_map_type
CUresult CUDAAPI cuvidCtxUnlock(CUvideoctxlock lck, unsigned int reserved_flags)
unsigned char fmo_aso_enable
unsigned long long slice_group_map_addr
unsigned int frameTagSize
int bRefBaseLayer
whether to store ref base pic
unsigned int raw_output_pitch
Reserved for future use (set to zero)
unsigned char log2_parallel_merge_level_minus2
Weave both fields (no deinterlacing)
int not_existing
non-existing reference frame (corresponding PicIdx should be set to -1)
int deblocking_filter_control_present_flag
unsigned char MVCReserved8Bits
int CurrPicIdx
Output index of the current picture.
unsigned char sample_adaptive_offset_enabled_flag
unsigned char weighted_pred_flag
unsigned long ulNumDecodeSurfaces
Maximum number of internal decode surfaces.
unsigned char pcm_sample_bit_depth_chroma_minus1
Use a CUDA-based decoder if faster than dedicated engines (requires a valid vidLock object for multi-...
unsigned long ulNumOutputSurfaces
Maximum number of output surfaces simultaneously mapped.
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
Number of slices in this picture.
int FrameHeightInMbs
Coded Frame Height.
unsigned short reserved16Bits
unsigned char separate_colour_plane_flag
int log2_max_frame_num_minus4
int resync_marker_disable
unsigned char entropy_coding_sync_enabled_flag
unsigned char loopFilterLevel
int intra_pic_flag
This picture is entirely intra coded.
unsigned char bitDepthMinus8Chroma
int progressive_frame
Input is progressive (deinterlace_mode will be ignored)
struct _CUcontextlock_st * CUvideoctxlock
unsigned long ulTargetHeight
Post-processed Output Height (Should be aligbed to 2)
unsigned char scaling_list_enable_flag
int FrameHeight
Actual frame height.
int pic_order_present_flag
int second_field
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
Default operation mode: use dedicated video engines.
unsigned char num_tile_rows_minus1
unsigned int reserved_zero
Reserved (set to zero)
int ref_pic_flag
This picture is a reference picture.
signed char pps_beta_offset_div2
int top_field_first
Input frame is top field first (1st field is top, 2nd field is bottom)
int progressive_fcm
Progressive frame.
const unsigned int * pSliceDataOffsets
nNumSlices entries, contains offset of each slice within the bitstream data buffer ...
unsigned short DPBEntryValidFlag
int bottom_field_flag
0=top field, 1=bottom field (ignored if field_pic_flag=0)
unsigned char slice_header_restriction_flag
unsigned long long raw_output_dptr
Reserved for future use (set to zero)
unsigned char num_extra_slice_header_bits
int vop_time_increment_bitcount
unsigned char tiles_enabled_flag
short scaled_ref_layer_left_offset
unsigned char log2_min_pcm_luma_coding_block_size_minus3
unsigned char qpprime_y_zero_transform_bypass_flag
CUresult CUDAAPI cuvidDestroyDecoder(CUvideodecoder hDecoder)
Destroy the decoder object.
unsigned char inter_layer_deblocking_filter_control_present_flag
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
unsigned char pps_deblocking_filter_disabled_flag
unsigned char Reserved8BitsA
unsigned char amp_enabled_flag
unsigned char sps_temporal_mvp_enabled_flag
const unsigned char * pBitstreamData
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
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
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
unsigned char bit_depth_luma_minus8
CUresult CUDAAPI cuvidCtxLockDestroy(CUvideoctxlock lck)
signed char init_qp_minus26
unsigned char weighted_bipred_flag
unsigned int offsetToDctParts
unsigned char adaptive_tcoeff_level_prediction_flag
NV12 (currently the only supported output format)
unsigned char chroma_phase_x_plus1_flag
unsigned long bitDepthMinus8
Go through DXVA internally if possible (requires D3D9 interop)
unsigned long ulHeight
Coded Sequence Height.
unsigned char transquant_bypass_enabled_flag
int pic_width_in_luma_samples
CUVIDMPEG4PICPARAMS mpeg4
unsigned long ulWidth
Coded Sequence Width.
unsigned int reserved_flags
Reserved for future use (set to zero)
unsigned char log2_diff_max_min_luma_coding_block_size
CUresult CUDAAPI cuvidUnmapVideoFrame(CUvideodecoder hDecoder, unsigned int DevPtr)
Unmap a previously mapped video frame.
CUresult CUDAAPI cuvidCtxLockCreate(CUvideoctxlock *pLock, CUcontext ctx)
Context-locking: to facilitate multi-threaded implementations, the following 4 functions provide a si...
unsigned char cabac_init_present_flag
unsigned char cu_qp_delta_enabled_flag
unsigned char max_transform_hierarchy_depth_intra
cudaVideoChromaFormat ChromaFormat
cudaVideoChromaFormat_XXX (only 4:2:0 is currently supported)
unsigned long ulTargetWidth
Post-processed Output Width (Should be aligned to 2)
unsigned char GoldenRefIdx
unsigned char disable_inter_layer_deblocking_filter_idc
int second_field
Second field of a complementary field pair.
unsigned char sign_data_hiding_enabled_flag
unsigned char strong_intra_smoothing_enabled_flag
CUresult CUDAAPI cuvidCtxLock(CUvideoctxlock lck, unsigned int reserved_flags)
unsigned long long raw_input_dptr
Input CUdeviceptr for raw YUV extensions.
int chroma_qp_index_offset
int alternate_vertical_scan_flag
unsigned char ref_layer_chroma_phase_y_plus1
int FrameWidth
Actual frame width.
unsigned int nBitstreamDataLen
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 raw_input_pitch
pitch in bytes of raw YUV input (should be aligned appropriately)