mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
init
This commit is contained in:
602
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_cuda.h
vendored
Normal file
602
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_cuda.h
vendored
Normal file
@@ -0,0 +1,602 @@
|
||||
/*
|
||||
* This copyright notice applies to this header file only:
|
||||
*
|
||||
* Copyright (c) 2016
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the software, and to permit persons to whom the
|
||||
* software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#if !defined(FFNV_DYNLINK_CUDA_H) && !defined(CUDA_VERSION)
|
||||
#define FFNV_DYNLINK_CUDA_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define CUDA_VERSION 7050
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define CUDAAPI __stdcall
|
||||
#else
|
||||
#define CUDAAPI
|
||||
#endif
|
||||
|
||||
#define CU_CTX_SCHED_BLOCKING_SYNC 4
|
||||
|
||||
typedef int CUdevice;
|
||||
#if defined(__x86_64) || defined(AMD64) || defined(_M_AMD64) || defined(__LP64__) || defined(__aarch64__)
|
||||
typedef unsigned long long CUdeviceptr;
|
||||
#else
|
||||
typedef unsigned int CUdeviceptr;
|
||||
#endif
|
||||
typedef unsigned long long CUtexObject;
|
||||
|
||||
typedef struct CUarray_st *CUarray;
|
||||
typedef struct CUctx_st *CUcontext;
|
||||
typedef struct CUstream_st *CUstream;
|
||||
typedef struct CUevent_st *CUevent;
|
||||
typedef struct CUfunc_st *CUfunction;
|
||||
typedef struct CUmod_st *CUmodule;
|
||||
typedef struct CUmipmappedArray_st *CUmipmappedArray;
|
||||
typedef struct CUgraphicsResource_st *CUgraphicsResource;
|
||||
typedef struct CUextMemory_st *CUexternalMemory;
|
||||
typedef struct CUextSemaphore_st *CUexternalSemaphore;
|
||||
typedef struct CUeglStreamConnection_st *CUeglStreamConnection;
|
||||
|
||||
typedef struct CUlinkState_st *CUlinkState;
|
||||
|
||||
typedef enum cudaError_enum {
|
||||
CUDA_SUCCESS = 0,
|
||||
CUDA_ERROR_INVALID_VALUE = 1,
|
||||
CUDA_ERROR_OUT_OF_MEMORY = 2,
|
||||
CUDA_ERROR_NOT_INITIALIZED = 3,
|
||||
CUDA_ERROR_DEINITIALIZED = 4,
|
||||
CUDA_ERROR_PROFILER_DISABLED = 5,
|
||||
CUDA_ERROR_PROFILER_NOT_INITIALIZED = 6,
|
||||
CUDA_ERROR_PROFILER_ALREADY_STARTED = 7,
|
||||
CUDA_ERROR_PROFILER_ALREADY_STOPPED = 8,
|
||||
CUDA_ERROR_STUB_LIBRARY = 34,
|
||||
CUDA_ERROR_NO_DEVICE = 100,
|
||||
CUDA_ERROR_INVALID_DEVICE = 101,
|
||||
CUDA_ERROR_DEVICE_NOT_LICENSED = 102,
|
||||
CUDA_ERROR_INVALID_IMAGE = 200,
|
||||
CUDA_ERROR_INVALID_CONTEXT = 201,
|
||||
CUDA_ERROR_CONTEXT_ALREADY_CURRENT = 202,
|
||||
CUDA_ERROR_MAP_FAILED = 205,
|
||||
CUDA_ERROR_UNMAP_FAILED = 206,
|
||||
CUDA_ERROR_ARRAY_IS_MAPPED = 207,
|
||||
CUDA_ERROR_ALREADY_MAPPED = 208,
|
||||
CUDA_ERROR_NO_BINARY_FOR_GPU = 209,
|
||||
CUDA_ERROR_ALREADY_ACQUIRED = 210,
|
||||
CUDA_ERROR_NOT_MAPPED = 211,
|
||||
CUDA_ERROR_NOT_MAPPED_AS_ARRAY = 212,
|
||||
CUDA_ERROR_NOT_MAPPED_AS_POINTER = 213,
|
||||
CUDA_ERROR_ECC_UNCORRECTABLE = 214,
|
||||
CUDA_ERROR_UNSUPPORTED_LIMIT = 215,
|
||||
CUDA_ERROR_CONTEXT_ALREADY_IN_USE = 216,
|
||||
CUDA_ERROR_PEER_ACCESS_UNSUPPORTED = 217,
|
||||
CUDA_ERROR_INVALID_PTX = 218,
|
||||
CUDA_ERROR_INVALID_GRAPHICS_CONTEXT = 219,
|
||||
CUDA_ERROR_NVLINK_UNCORRECTABLE = 220,
|
||||
CUDA_ERROR_JIT_COMPILER_NOT_FOUND = 221,
|
||||
CUDA_ERROR_UNSUPPORTED_PTX_VERSION = 222,
|
||||
CUDA_ERROR_JIT_COMPILATION_DISABLED = 223,
|
||||
CUDA_ERROR_UNSUPPORTED_EXEC_AFFINITY = 224,
|
||||
CUDA_ERROR_INVALID_SOURCE = 300,
|
||||
CUDA_ERROR_FILE_NOT_FOUND = 301,
|
||||
CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND = 302,
|
||||
CUDA_ERROR_SHARED_OBJECT_INIT_FAILED = 303,
|
||||
CUDA_ERROR_OPERATING_SYSTEM = 304,
|
||||
CUDA_ERROR_INVALID_HANDLE = 400,
|
||||
CUDA_ERROR_ILLEGAL_STATE = 401,
|
||||
CUDA_ERROR_NOT_FOUND = 500,
|
||||
CUDA_ERROR_NOT_READY = 600,
|
||||
CUDA_ERROR_ILLEGAL_ADDRESS = 700,
|
||||
CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES = 701,
|
||||
CUDA_ERROR_LAUNCH_TIMEOUT = 702,
|
||||
CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING = 703,
|
||||
CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED = 704,
|
||||
CUDA_ERROR_PEER_ACCESS_NOT_ENABLED = 705,
|
||||
CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE = 708,
|
||||
CUDA_ERROR_CONTEXT_IS_DESTROYED = 709,
|
||||
CUDA_ERROR_ASSERT = 710,
|
||||
CUDA_ERROR_TOO_MANY_PEERS = 711,
|
||||
CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED = 712,
|
||||
CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED = 713,
|
||||
CUDA_ERROR_HARDWARE_STACK_ERROR = 714,
|
||||
CUDA_ERROR_ILLEGAL_INSTRUCTION = 715,
|
||||
CUDA_ERROR_MISALIGNED_ADDRESS = 716,
|
||||
CUDA_ERROR_INVALID_ADDRESS_SPACE = 717,
|
||||
CUDA_ERROR_INVALID_PC = 718,
|
||||
CUDA_ERROR_LAUNCH_FAILED = 719,
|
||||
CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE = 720,
|
||||
CUDA_ERROR_NOT_PERMITTED = 800,
|
||||
CUDA_ERROR_NOT_SUPPORTED = 801,
|
||||
CUDA_ERROR_SYSTEM_NOT_READY = 802,
|
||||
CUDA_ERROR_SYSTEM_DRIVER_MISMATCH = 803,
|
||||
CUDA_ERROR_COMPAT_NOT_SUPPORTED_ON_DEVICE = 804,
|
||||
CUDA_ERROR_MPS_CONNECTION_FAILED = 805,
|
||||
CUDA_ERROR_MPS_RPC_FAILURE = 806,
|
||||
CUDA_ERROR_MPS_SERVER_NOT_READY = 807,
|
||||
CUDA_ERROR_MPS_MAX_CLIENTS_REACHED = 808,
|
||||
CUDA_ERROR_MPS_MAX_CONNECTIONS_REACHED = 809,
|
||||
CUDA_ERROR_STREAM_CAPTURE_UNSUPPORTED = 900,
|
||||
CUDA_ERROR_STREAM_CAPTURE_INVALIDATED = 901,
|
||||
CUDA_ERROR_STREAM_CAPTURE_MERGE = 902,
|
||||
CUDA_ERROR_STREAM_CAPTURE_UNMATCHED = 903,
|
||||
CUDA_ERROR_STREAM_CAPTURE_UNJOINED = 904,
|
||||
CUDA_ERROR_STREAM_CAPTURE_ISOLATION = 905,
|
||||
CUDA_ERROR_STREAM_CAPTURE_IMPLICIT = 906,
|
||||
CUDA_ERROR_CAPTURED_EVENT = 907,
|
||||
CUDA_ERROR_STREAM_CAPTURE_WRONG_THREAD = 908,
|
||||
CUDA_ERROR_TIMEOUT = 909,
|
||||
CUDA_ERROR_GRAPH_EXEC_UPDATE_FAILURE = 910,
|
||||
CUDA_ERROR_EXTERNAL_DEVICE = 911,
|
||||
CUDA_ERROR_UNKNOWN = 999
|
||||
} CUresult;
|
||||
|
||||
/**
|
||||
* Device properties (subset)
|
||||
*/
|
||||
typedef enum CUdevice_attribute_enum {
|
||||
CU_DEVICE_ATTRIBUTE_CLOCK_RATE = 13,
|
||||
CU_DEVICE_ATTRIBUTE_TEXTURE_ALIGNMENT = 14,
|
||||
CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT = 16,
|
||||
CU_DEVICE_ATTRIBUTE_INTEGRATED = 18,
|
||||
CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY = 19,
|
||||
CU_DEVICE_ATTRIBUTE_COMPUTE_MODE = 20,
|
||||
CU_DEVICE_ATTRIBUTE_CONCURRENT_KERNELS = 31,
|
||||
CU_DEVICE_ATTRIBUTE_PCI_BUS_ID = 33,
|
||||
CU_DEVICE_ATTRIBUTE_PCI_DEVICE_ID = 34,
|
||||
CU_DEVICE_ATTRIBUTE_TCC_DRIVER = 35,
|
||||
CU_DEVICE_ATTRIBUTE_MEMORY_CLOCK_RATE = 36,
|
||||
CU_DEVICE_ATTRIBUTE_GLOBAL_MEMORY_BUS_WIDTH = 37,
|
||||
CU_DEVICE_ATTRIBUTE_ASYNC_ENGINE_COUNT = 40,
|
||||
CU_DEVICE_ATTRIBUTE_UNIFIED_ADDRESSING = 41,
|
||||
CU_DEVICE_ATTRIBUTE_PCI_DOMAIN_ID = 50,
|
||||
CU_DEVICE_ATTRIBUTE_TEXTURE_PITCH_ALIGNMENT = 51,
|
||||
CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR = 75,
|
||||
CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR = 76,
|
||||
CU_DEVICE_ATTRIBUTE_MANAGED_MEMORY = 83,
|
||||
CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD = 84,
|
||||
CU_DEVICE_ATTRIBUTE_MULTI_GPU_BOARD_GROUP_ID = 85,
|
||||
} CUdevice_attribute;
|
||||
|
||||
typedef enum CUarray_format_enum {
|
||||
CU_AD_FORMAT_UNSIGNED_INT8 = 0x01,
|
||||
CU_AD_FORMAT_UNSIGNED_INT16 = 0x02,
|
||||
CU_AD_FORMAT_UNSIGNED_INT32 = 0x03,
|
||||
CU_AD_FORMAT_SIGNED_INT8 = 0x08,
|
||||
CU_AD_FORMAT_SIGNED_INT16 = 0x09,
|
||||
CU_AD_FORMAT_SIGNED_INT32 = 0x0a,
|
||||
CU_AD_FORMAT_HALF = 0x10,
|
||||
CU_AD_FORMAT_FLOAT = 0x20
|
||||
} CUarray_format;
|
||||
|
||||
typedef enum CUmemorytype_enum {
|
||||
CU_MEMORYTYPE_HOST = 1,
|
||||
CU_MEMORYTYPE_DEVICE = 2,
|
||||
CU_MEMORYTYPE_ARRAY = 3
|
||||
} CUmemorytype;
|
||||
|
||||
typedef enum CUlimit_enum {
|
||||
CU_LIMIT_STACK_SIZE = 0,
|
||||
CU_LIMIT_PRINTF_FIFO_SIZE = 1,
|
||||
CU_LIMIT_MALLOC_HEAP_SIZE = 2,
|
||||
CU_LIMIT_DEV_RUNTIME_SYNC_DEPTH = 3,
|
||||
CU_LIMIT_DEV_RUNTIME_PENDING_LAUNCH_COUNT = 4
|
||||
} CUlimit;
|
||||
|
||||
typedef enum CUresourcetype_enum {
|
||||
CU_RESOURCE_TYPE_ARRAY = 0x00,
|
||||
CU_RESOURCE_TYPE_MIPMAPPED_ARRAY = 0x01,
|
||||
CU_RESOURCE_TYPE_LINEAR = 0x02,
|
||||
CU_RESOURCE_TYPE_PITCH2D = 0x03
|
||||
} CUresourcetype;
|
||||
|
||||
typedef enum CUaddress_mode_enum {
|
||||
CU_TR_ADDRESS_MODE_WRAP = 0,
|
||||
CU_TR_ADDRESS_MODE_CLAMP = 1,
|
||||
CU_TR_ADDRESS_MODE_MIRROR = 2,
|
||||
CU_TR_ADDRESS_MODE_BORDER = 3
|
||||
} CUaddress_mode;
|
||||
|
||||
typedef enum CUfilter_mode_enum {
|
||||
CU_TR_FILTER_MODE_POINT = 0,
|
||||
CU_TR_FILTER_MODE_LINEAR = 1
|
||||
} CUfilter_mode;
|
||||
|
||||
typedef enum CUgraphicsRegisterFlags_enum {
|
||||
CU_GRAPHICS_REGISTER_FLAGS_NONE = 0,
|
||||
CU_GRAPHICS_REGISTER_FLAGS_READ_ONLY = 1,
|
||||
CU_GRAPHICS_REGISTER_FLAGS_WRITE_DISCARD = 2,
|
||||
CU_GRAPHICS_REGISTER_FLAGS_SURFACE_LDST = 4,
|
||||
CU_GRAPHICS_REGISTER_FLAGS_TEXTURE_GATHER = 8
|
||||
} CUgraphicsRegisterFlags;
|
||||
|
||||
typedef enum CUexternalMemoryHandleType_enum {
|
||||
CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD = 1,
|
||||
CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32 = 2,
|
||||
CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
|
||||
CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP = 4,
|
||||
CU_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE = 5,
|
||||
} CUexternalMemoryHandleType;
|
||||
|
||||
typedef enum CUexternalSemaphoreHandleType_enum {
|
||||
CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD = 1,
|
||||
CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32 = 2,
|
||||
CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT = 3,
|
||||
CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE = 4,
|
||||
CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_FD = 9,
|
||||
CU_EXTERNAL_SEMAPHORE_HANDLE_TYPE_TIMELINE_SEMAPHORE_WIN32 = 10,
|
||||
} CUexternalSemaphoreHandleType;
|
||||
|
||||
typedef enum CUjit_option_enum
|
||||
{
|
||||
CU_JIT_MAX_REGISTERS = 0,
|
||||
CU_JIT_THREADS_PER_BLOCK = 1,
|
||||
CU_JIT_WALL_TIME = 2,
|
||||
CU_JIT_INFO_LOG_BUFFER = 3,
|
||||
CU_JIT_INFO_LOG_BUFFER_SIZE_BYTES = 4,
|
||||
CU_JIT_ERROR_LOG_BUFFER = 5,
|
||||
CU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES = 6,
|
||||
CU_JIT_OPTIMIZATION_LEVEL = 7,
|
||||
CU_JIT_TARGET_FROM_CUCONTEXT = 8,
|
||||
CU_JIT_TARGET = 9,
|
||||
CU_JIT_FALLBACK_STRATEGY = 10,
|
||||
CU_JIT_GENERATE_DEBUG_INFO = 11,
|
||||
CU_JIT_LOG_VERBOSE = 12,
|
||||
CU_JIT_GENERATE_LINE_INFO = 13,
|
||||
CU_JIT_CACHE_MODE = 14,
|
||||
CU_JIT_NEW_SM3X_OPT = 15,
|
||||
CU_JIT_FAST_COMPILE = 16,
|
||||
CU_JIT_GLOBAL_SYMBOL_NAMES = 17,
|
||||
CU_JIT_GLOBAL_SYMBOL_ADDRESSES = 18,
|
||||
CU_JIT_GLOBAL_SYMBOL_COUNT = 19,
|
||||
CU_JIT_NUM_OPTIONS
|
||||
} CUjit_option;
|
||||
|
||||
typedef enum CUjitInputType_enum
|
||||
{
|
||||
CU_JIT_INPUT_CUBIN = 0,
|
||||
CU_JIT_INPUT_PTX = 1,
|
||||
CU_JIT_INPUT_FATBINARY = 2,
|
||||
CU_JIT_INPUT_OBJECT = 3,
|
||||
CU_JIT_INPUT_LIBRARY = 4,
|
||||
CU_JIT_NUM_INPUT_TYPES
|
||||
} CUjitInputType;
|
||||
|
||||
typedef enum CUeglFrameType
|
||||
{
|
||||
CU_EGL_FRAME_TYPE_ARRAY = 0,
|
||||
CU_EGL_FRAME_TYPE_PITCH = 1,
|
||||
} CUeglFrameType;
|
||||
|
||||
typedef enum CUeglColorFormat
|
||||
{
|
||||
CU_EGL_COLOR_FORMAT_YUV420_PLANAR = 0x00,
|
||||
CU_EGL_COLOR_FORMAT_YUV420_SEMIPLANAR = 0x01,
|
||||
CU_EGL_COLOR_FORMAT_YVU420_SEMIPLANAR = 0x15,
|
||||
CU_EGL_COLOR_FORMAT_Y10V10U10_420_SEMIPLANAR = 0x17,
|
||||
CU_EGL_COLOR_FORMAT_Y12V12U12_420_SEMIPLANAR = 0x19,
|
||||
} CUeglColorFormat;
|
||||
|
||||
typedef enum CUd3d11DeviceList_enum
|
||||
{
|
||||
CU_D3D11_DEVICE_LIST_ALL = 1,
|
||||
CU_D3D11_DEVICE_LIST_CURRENT_FRAME = 2,
|
||||
CU_D3D11_DEVICE_LIST_NEXT_FRAME = 3,
|
||||
} CUd3d11DeviceList;
|
||||
|
||||
#ifndef CU_UUID_HAS_BEEN_DEFINED
|
||||
#define CU_UUID_HAS_BEEN_DEFINED
|
||||
typedef struct CUuuid_st {
|
||||
char bytes[16];
|
||||
} CUuuid;
|
||||
#endif
|
||||
|
||||
typedef struct CUDA_MEMCPY2D_st {
|
||||
size_t srcXInBytes;
|
||||
size_t srcY;
|
||||
CUmemorytype srcMemoryType;
|
||||
const void *srcHost;
|
||||
CUdeviceptr srcDevice;
|
||||
CUarray srcArray;
|
||||
size_t srcPitch;
|
||||
|
||||
size_t dstXInBytes;
|
||||
size_t dstY;
|
||||
CUmemorytype dstMemoryType;
|
||||
void *dstHost;
|
||||
CUdeviceptr dstDevice;
|
||||
CUarray dstArray;
|
||||
size_t dstPitch;
|
||||
|
||||
size_t WidthInBytes;
|
||||
size_t Height;
|
||||
} CUDA_MEMCPY2D;
|
||||
|
||||
typedef struct CUDA_RESOURCE_DESC_st {
|
||||
CUresourcetype resType;
|
||||
union {
|
||||
struct {
|
||||
CUarray hArray;
|
||||
} array;
|
||||
struct {
|
||||
CUmipmappedArray hMipmappedArray;
|
||||
} mipmap;
|
||||
struct {
|
||||
CUdeviceptr devPtr;
|
||||
CUarray_format format;
|
||||
unsigned int numChannels;
|
||||
size_t sizeInBytes;
|
||||
} linear;
|
||||
struct {
|
||||
CUdeviceptr devPtr;
|
||||
CUarray_format format;
|
||||
unsigned int numChannels;
|
||||
size_t width;
|
||||
size_t height;
|
||||
size_t pitchInBytes;
|
||||
} pitch2D;
|
||||
struct {
|
||||
int reserved[32];
|
||||
} reserved;
|
||||
} res;
|
||||
unsigned int flags;
|
||||
} CUDA_RESOURCE_DESC;
|
||||
|
||||
typedef struct CUDA_TEXTURE_DESC_st {
|
||||
CUaddress_mode addressMode[3];
|
||||
CUfilter_mode filterMode;
|
||||
unsigned int flags;
|
||||
unsigned int maxAnisotropy;
|
||||
CUfilter_mode mipmapFilterMode;
|
||||
float mipmapLevelBias;
|
||||
float minMipmapLevelClamp;
|
||||
float maxMipmapLevelClamp;
|
||||
float borderColor[4];
|
||||
int reserved[12];
|
||||
} CUDA_TEXTURE_DESC;
|
||||
|
||||
/* Unused type */
|
||||
typedef struct CUDA_RESOURCE_VIEW_DESC_st CUDA_RESOURCE_VIEW_DESC;
|
||||
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned int GLuint;
|
||||
/*
|
||||
* Prefix type name to avoid collisions. Clients using these types
|
||||
* will include the real headers with real definitions.
|
||||
*/
|
||||
typedef int32_t ffnv_EGLint;
|
||||
typedef void *ffnv_EGLStreamKHR;
|
||||
|
||||
typedef enum CUGLDeviceList_enum {
|
||||
CU_GL_DEVICE_LIST_ALL = 1,
|
||||
CU_GL_DEVICE_LIST_CURRENT_FRAME = 2,
|
||||
CU_GL_DEVICE_LIST_NEXT_FRAME = 3,
|
||||
} CUGLDeviceList;
|
||||
|
||||
typedef struct CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st {
|
||||
CUexternalMemoryHandleType type;
|
||||
union {
|
||||
int fd;
|
||||
struct {
|
||||
void *handle;
|
||||
const void *name;
|
||||
} win32;
|
||||
} handle;
|
||||
unsigned long long size;
|
||||
unsigned int flags;
|
||||
unsigned int reserved[16];
|
||||
} CUDA_EXTERNAL_MEMORY_HANDLE_DESC;
|
||||
|
||||
typedef struct CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st {
|
||||
unsigned long long offset;
|
||||
unsigned long long size;
|
||||
unsigned int flags;
|
||||
unsigned int reserved[16];
|
||||
} CUDA_EXTERNAL_MEMORY_BUFFER_DESC;
|
||||
|
||||
typedef struct CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st {
|
||||
CUexternalSemaphoreHandleType type;
|
||||
union {
|
||||
int fd;
|
||||
struct {
|
||||
void *handle;
|
||||
const void *name;
|
||||
} win32;
|
||||
} handle;
|
||||
unsigned int flags;
|
||||
unsigned int reserved[16];
|
||||
} CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC;
|
||||
|
||||
typedef struct CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st {
|
||||
struct {
|
||||
struct {
|
||||
unsigned long long value;
|
||||
} fence;
|
||||
unsigned int reserved[16];
|
||||
} params;
|
||||
unsigned int flags;
|
||||
unsigned int reserved[16];
|
||||
} CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS;
|
||||
|
||||
typedef CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS;
|
||||
|
||||
typedef struct CUDA_ARRAY_DESCRIPTOR_st {
|
||||
size_t Width;
|
||||
size_t Height;
|
||||
|
||||
CUarray_format Format;
|
||||
unsigned int NumChannels;
|
||||
} CUDA_ARRAY_DESCRIPTOR;
|
||||
|
||||
typedef struct CUDA_ARRAY3D_DESCRIPTOR_st {
|
||||
size_t Width;
|
||||
size_t Height;
|
||||
size_t Depth;
|
||||
|
||||
CUarray_format Format;
|
||||
unsigned int NumChannels;
|
||||
unsigned int Flags;
|
||||
} CUDA_ARRAY3D_DESCRIPTOR;
|
||||
|
||||
typedef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st {
|
||||
unsigned long long offset;
|
||||
CUDA_ARRAY3D_DESCRIPTOR arrayDesc;
|
||||
unsigned int numLevels;
|
||||
unsigned int reserved[16];
|
||||
} CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC;
|
||||
|
||||
#define CU_EGL_FRAME_MAX_PLANES 3
|
||||
typedef struct CUeglFrame_st {
|
||||
union {
|
||||
CUarray pArray[CU_EGL_FRAME_MAX_PLANES];
|
||||
void* pPitch[CU_EGL_FRAME_MAX_PLANES];
|
||||
} frame;
|
||||
unsigned int width;
|
||||
unsigned int height;
|
||||
unsigned int depth;
|
||||
unsigned int pitch;
|
||||
unsigned int planeCount;
|
||||
unsigned int numChannels;
|
||||
CUeglFrameType frameType;
|
||||
CUeglColorFormat eglColorFormat;
|
||||
CUarray_format cuFormat;
|
||||
} CUeglFrame;
|
||||
|
||||
#define CU_STREAM_DEFAULT 0
|
||||
#define CU_STREAM_NON_BLOCKING 1
|
||||
|
||||
#define CU_EVENT_DEFAULT 0
|
||||
#define CU_EVENT_BLOCKING_SYNC 1
|
||||
#define CU_EVENT_DISABLE_TIMING 2
|
||||
|
||||
#define CU_EVENT_WAIT_DEFAULT 0
|
||||
#define CU_EVENT_WAIT_EXTERNAL 1
|
||||
|
||||
#define CU_TRSF_READ_AS_INTEGER 1
|
||||
|
||||
typedef void CUDAAPI CUstreamCallback(CUstream hStream, CUresult status, void *userdata);
|
||||
|
||||
typedef CUresult CUDAAPI tcuInit(unsigned int Flags);
|
||||
typedef CUresult CUDAAPI tcuDriverGetVersion(int *driverVersion);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetCount(int *count);
|
||||
typedef CUresult CUDAAPI tcuDeviceGet(CUdevice *device, int ordinal);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetAttribute(int *pi, CUdevice_attribute attrib, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetName(char *name, int len, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetUuid(CUuuid *uuid, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetUuid_v2(CUuuid *uuid, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetLuid(char* luid, unsigned int* deviceNodeMask, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetByPCIBusId(CUdevice* dev, const char* pciBusId);
|
||||
typedef CUresult CUDAAPI tcuDeviceGetPCIBusId(char* pciBusId, int len, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDeviceComputeCapability(int *major, int *minor, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuCtxCreate_v2(CUcontext *pctx, unsigned int flags, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuCtxGetCurrent(CUcontext *pctx);
|
||||
typedef CUresult CUDAAPI tcuCtxSetLimit(CUlimit limit, size_t value);
|
||||
typedef CUresult CUDAAPI tcuCtxPushCurrent_v2(CUcontext pctx);
|
||||
typedef CUresult CUDAAPI tcuCtxPopCurrent_v2(CUcontext *pctx);
|
||||
typedef CUresult CUDAAPI tcuCtxDestroy_v2(CUcontext ctx);
|
||||
typedef CUresult CUDAAPI tcuMemAlloc_v2(CUdeviceptr *dptr, size_t bytesize);
|
||||
typedef CUresult CUDAAPI tcuMemAllocPitch_v2(CUdeviceptr *dptr, size_t *pPitch, size_t WidthInBytes, size_t Height, unsigned int ElementSizeBytes);
|
||||
typedef CUresult CUDAAPI tcuMemAllocManaged(CUdeviceptr *dptr, size_t bytesize, unsigned int flags);
|
||||
typedef CUresult CUDAAPI tcuMemsetD8Async(CUdeviceptr dstDevice, unsigned char uc, size_t N, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuMemFree_v2(CUdeviceptr dptr);
|
||||
typedef CUresult CUDAAPI tcuMemcpy(CUdeviceptr dst, CUdeviceptr src, size_t bytesize);
|
||||
typedef CUresult CUDAAPI tcuMemcpyAsync(CUdeviceptr dst, CUdeviceptr src, size_t bytesize, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuMemcpy2D_v2(const CUDA_MEMCPY2D *pcopy);
|
||||
typedef CUresult CUDAAPI tcuMemcpy2DAsync_v2(const CUDA_MEMCPY2D *pcopy, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuMemcpyHtoD_v2(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount);
|
||||
typedef CUresult CUDAAPI tcuMemcpyHtoDAsync_v2(CUdeviceptr dstDevice, const void *srcHost, size_t ByteCount, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuMemcpyDtoH_v2(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount);
|
||||
typedef CUresult CUDAAPI tcuMemcpyDtoHAsync_v2(void *dstHost, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuMemcpyDtoD_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount);
|
||||
typedef CUresult CUDAAPI tcuMemcpyDtoDAsync_v2(CUdeviceptr dstDevice, CUdeviceptr srcDevice, size_t ByteCount, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuGetErrorName(CUresult error, const char** pstr);
|
||||
typedef CUresult CUDAAPI tcuGetErrorString(CUresult error, const char** pstr);
|
||||
typedef CUresult CUDAAPI tcuCtxGetDevice(CUdevice *device);
|
||||
|
||||
typedef CUresult CUDAAPI tcuDevicePrimaryCtxRetain(CUcontext *pctx, CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDevicePrimaryCtxRelease(CUdevice dev);
|
||||
typedef CUresult CUDAAPI tcuDevicePrimaryCtxSetFlags(CUdevice dev, unsigned int flags);
|
||||
typedef CUresult CUDAAPI tcuDevicePrimaryCtxGetState(CUdevice dev, unsigned int *flags, int *active);
|
||||
typedef CUresult CUDAAPI tcuDevicePrimaryCtxReset(CUdevice dev);
|
||||
|
||||
typedef CUresult CUDAAPI tcuStreamCreate(CUstream *phStream, unsigned int flags);
|
||||
typedef CUresult CUDAAPI tcuStreamQuery(CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuStreamSynchronize(CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuStreamDestroy_v2(CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuStreamAddCallback(CUstream hStream, CUstreamCallback *callback, void *userdata, unsigned int flags);
|
||||
typedef CUresult CUDAAPI tcuStreamWaitEvent(CUstream hStream, CUevent hEvent, unsigned int flags);
|
||||
typedef CUresult CUDAAPI tcuEventCreate(CUevent *phEvent, unsigned int flags);
|
||||
typedef CUresult CUDAAPI tcuEventDestroy_v2(CUevent hEvent);
|
||||
typedef CUresult CUDAAPI tcuEventSynchronize(CUevent hEvent);
|
||||
typedef CUresult CUDAAPI tcuEventQuery(CUevent hEvent);
|
||||
typedef CUresult CUDAAPI tcuEventRecord(CUevent hEvent, CUstream hStream);
|
||||
|
||||
typedef CUresult CUDAAPI tcuLaunchKernel(CUfunction f, unsigned int gridDimX, unsigned int gridDimY, unsigned int gridDimZ, unsigned int blockDimX, unsigned int blockDimY, unsigned int blockDimZ, unsigned int sharedMemBytes, CUstream hStream, void** kernelParams, void** extra);
|
||||
typedef CUresult CUDAAPI tcuLinkCreate(unsigned int numOptions, CUjit_option* options, void** optionValues, CUlinkState* stateOut);
|
||||
typedef CUresult CUDAAPI tcuLinkAddData(CUlinkState state, CUjitInputType type, void* data, size_t size, const char* name, unsigned int numOptions, CUjit_option* options, void** optionValues);
|
||||
typedef CUresult CUDAAPI tcuLinkComplete(CUlinkState state, void** cubinOut, size_t* sizeOut);
|
||||
typedef CUresult CUDAAPI tcuLinkDestroy(CUlinkState state);
|
||||
typedef CUresult CUDAAPI tcuModuleLoadData(CUmodule* module, const void* image);
|
||||
typedef CUresult CUDAAPI tcuModuleUnload(CUmodule hmod);
|
||||
typedef CUresult CUDAAPI tcuModuleGetFunction(CUfunction* hfunc, CUmodule hmod, const char* name);
|
||||
typedef CUresult CUDAAPI tcuModuleGetGlobal(CUdeviceptr *dptr, size_t *bytes, CUmodule hmod, const char* name);
|
||||
typedef CUresult CUDAAPI tcuTexObjectCreate(CUtexObject* pTexObject, const CUDA_RESOURCE_DESC* pResDesc, const CUDA_TEXTURE_DESC* pTexDesc, const CUDA_RESOURCE_VIEW_DESC* pResViewDesc);
|
||||
typedef CUresult CUDAAPI tcuTexObjectDestroy(CUtexObject texObject);
|
||||
|
||||
typedef CUresult CUDAAPI tcuGLGetDevices_v2(unsigned int* pCudaDeviceCount, CUdevice* pCudaDevices, unsigned int cudaDeviceCount, CUGLDeviceList deviceList);
|
||||
typedef CUresult CUDAAPI tcuGraphicsGLRegisterImage(CUgraphicsResource* pCudaResource, GLuint image, GLenum target, unsigned int Flags);
|
||||
typedef CUresult CUDAAPI tcuGraphicsUnregisterResource(CUgraphicsResource resource);
|
||||
typedef CUresult CUDAAPI tcuGraphicsMapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuGraphicsUnmapResources(unsigned int count, CUgraphicsResource* resources, CUstream hStream);
|
||||
typedef CUresult CUDAAPI tcuGraphicsSubResourceGetMappedArray(CUarray* pArray, CUgraphicsResource resource, unsigned int arrayIndex, unsigned int mipLevel);
|
||||
typedef CUresult CUDAAPI tcuGraphicsResourceGetMappedPointer(CUdeviceptr *devPtrOut, size_t *sizeOut, CUgraphicsResource resource);
|
||||
typedef CUresult CUDAAPI tcuGraphicsResourceSetMapFlags_v2(CUgraphicsResource resource, unsigned int flags);
|
||||
|
||||
typedef CUresult CUDAAPI tcuImportExternalMemory(CUexternalMemory* extMem_out, const CUDA_EXTERNAL_MEMORY_HANDLE_DESC* memHandleDesc);
|
||||
typedef CUresult CUDAAPI tcuDestroyExternalMemory(CUexternalMemory extMem);
|
||||
typedef CUresult CUDAAPI tcuExternalMemoryGetMappedBuffer(CUdeviceptr* devPtr, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_BUFFER_DESC* bufferDesc);
|
||||
typedef CUresult CUDAAPI tcuExternalMemoryGetMappedMipmappedArray(CUmipmappedArray* mipmap, CUexternalMemory extMem, const CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC* mipmapDesc);
|
||||
typedef CUresult CUDAAPI tcuMipmappedArrayGetLevel(CUarray* pLevelArray, CUmipmappedArray hMipmappedArray, unsigned int level);
|
||||
typedef CUresult CUDAAPI tcuMipmappedArrayDestroy(CUmipmappedArray hMipmappedArray);
|
||||
|
||||
typedef CUresult CUDAAPI tcuImportExternalSemaphore(CUexternalSemaphore* extSem_out, const CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC* semHandleDesc);
|
||||
typedef CUresult CUDAAPI tcuDestroyExternalSemaphore(CUexternalSemaphore extSem);
|
||||
typedef CUresult CUDAAPI tcuSignalExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream);
|
||||
typedef CUresult CUDAAPI tcuWaitExternalSemaphoresAsync(const CUexternalSemaphore* extSemArray, const CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* paramsArray, unsigned int numExtSems, CUstream stream);
|
||||
|
||||
typedef CUresult CUDAAPI tcuArrayCreate(CUarray *pHandle, const CUDA_ARRAY_DESCRIPTOR* pAllocateArray);
|
||||
typedef CUresult CUDAAPI tcuArray3DCreate(CUarray *pHandle, const CUDA_ARRAY3D_DESCRIPTOR* pAllocateArray);
|
||||
typedef CUresult CUDAAPI tcuArrayDestroy(CUarray hArray);
|
||||
|
||||
typedef CUresult CUDAAPI tcuEGLStreamProducerConnect(CUeglStreamConnection* conn, ffnv_EGLStreamKHR stream, ffnv_EGLint width, ffnv_EGLint height);
|
||||
typedef CUresult CUDAAPI tcuEGLStreamProducerDisconnect(CUeglStreamConnection* conn);
|
||||
typedef CUresult CUDAAPI tcuEGLStreamConsumerDisconnect(CUeglStreamConnection* conn);
|
||||
typedef CUresult CUDAAPI tcuEGLStreamProducerPresentFrame(CUeglStreamConnection* conn, CUeglFrame eglframe, CUstream* pStream);
|
||||
typedef CUresult CUDAAPI tcuEGLStreamProducerReturnFrame(CUeglStreamConnection* conn, CUeglFrame* eglframe, CUstream* pStream);
|
||||
|
||||
typedef CUresult CUDAAPI tcuD3D11GetDevice(CUdevice *device, void *dxgiAdapter);
|
||||
typedef CUresult CUDAAPI tcuD3D11GetDevices(unsigned int *deviceCountOut, CUdevice *devices, unsigned int deviceCount, void *d3d11device, CUd3d11DeviceList listType);
|
||||
typedef CUresult CUDAAPI tcuGraphicsD3D11RegisterResource(CUgraphicsResource *cudaResourceOut, void *d3d11Resource, unsigned int flags);
|
||||
#endif
|
||||
1184
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_cuviddec.h
vendored
Normal file
1184
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_cuviddec.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
481
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_loader.h
vendored
Normal file
481
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_loader.h
vendored
Normal file
@@ -0,0 +1,481 @@
|
||||
/*
|
||||
* This copyright notice applies to this header file only:
|
||||
*
|
||||
* Copyright (c) 2016
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the software, and to permit persons to whom the
|
||||
* software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef FFNV_CUDA_DYNLINK_LOADER_H
|
||||
#define FFNV_CUDA_DYNLINK_LOADER_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "dynlink_cuda.h"
|
||||
#include "dynlink_nvcuvid.h"
|
||||
#include "nvEncodeAPI.h"
|
||||
|
||||
#if defined(_WIN32) && (!defined(FFNV_LOAD_FUNC) || !defined(FFNV_SYM_FUNC) || !defined(FFNV_LIB_HANDLE))
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
#ifndef FFNV_LIB_HANDLE
|
||||
# if defined(_WIN32)
|
||||
# define FFNV_LIB_HANDLE HMODULE
|
||||
# else
|
||||
# define FFNV_LIB_HANDLE void*
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
# define CUDA_LIBNAME "nvcuda.dll"
|
||||
# define NVCUVID_LIBNAME "nvcuvid.dll"
|
||||
# if defined(_WIN64) || defined(__CYGWIN64__)
|
||||
# define NVENC_LIBNAME "nvEncodeAPI64.dll"
|
||||
# else
|
||||
# define NVENC_LIBNAME "nvEncodeAPI.dll"
|
||||
# endif
|
||||
#else
|
||||
# define CUDA_LIBNAME "libcuda.so.1"
|
||||
# define NVCUVID_LIBNAME "libnvcuvid.so.1"
|
||||
# define NVENC_LIBNAME "libnvidia-encode.so.1"
|
||||
#endif
|
||||
|
||||
#if !defined(FFNV_LOAD_FUNC) || !defined(FFNV_SYM_FUNC)
|
||||
# ifdef _WIN32
|
||||
# define FFNV_LOAD_FUNC(path) LoadLibrary(TEXT(path))
|
||||
# define FFNV_SYM_FUNC(lib, sym) GetProcAddress((lib), (sym))
|
||||
# define FFNV_FREE_FUNC(lib) FreeLibrary(lib)
|
||||
# else
|
||||
# include <dlfcn.h>
|
||||
# define FFNV_LOAD_FUNC(path) dlopen((path), RTLD_LAZY)
|
||||
# define FFNV_SYM_FUNC(lib, sym) dlsym((lib), (sym))
|
||||
# define FFNV_FREE_FUNC(lib) dlclose(lib)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !defined(FFNV_LOG_FUNC) || !defined(FFNV_DEBUG_LOG_FUNC)
|
||||
# include <stdio.h>
|
||||
# define FFNV_LOG_FUNC(logctx, msg, ...) fprintf(stderr, (msg), __VA_ARGS__)
|
||||
# define FFNV_DEBUG_LOG_FUNC(logctx, msg, ...)
|
||||
#endif
|
||||
|
||||
#define LOAD_LIBRARY(l, path) \
|
||||
do { \
|
||||
if (!((l) = FFNV_LOAD_FUNC(path))) { \
|
||||
FFNV_LOG_FUNC(logctx, "Cannot load %s\n", path); \
|
||||
ret = -1; \
|
||||
goto error; \
|
||||
} \
|
||||
FFNV_DEBUG_LOG_FUNC(logctx, "Loaded lib: %s\n", path); \
|
||||
} while (0)
|
||||
|
||||
#define LOAD_SYMBOL(fun, tp, symbol) \
|
||||
do { \
|
||||
if (!((f->fun) = (tp*)FFNV_SYM_FUNC(f->lib, symbol))) { \
|
||||
FFNV_LOG_FUNC(logctx, "Cannot load %s\n", symbol); \
|
||||
ret = -1; \
|
||||
goto error; \
|
||||
} \
|
||||
FFNV_DEBUG_LOG_FUNC(logctx, "Loaded sym: %s\n", symbol); \
|
||||
} while (0)
|
||||
|
||||
#define LOAD_SYMBOL_OPT(fun, tp, symbol) \
|
||||
do { \
|
||||
if (!((f->fun) = (tp*)FFNV_SYM_FUNC(f->lib, symbol))) { \
|
||||
FFNV_DEBUG_LOG_FUNC(logctx, "Cannot load optional %s\n", symbol); \
|
||||
} else { \
|
||||
FFNV_DEBUG_LOG_FUNC(logctx, "Loaded sym: %s\n", symbol); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define GENERIC_LOAD_FUNC_PREAMBLE(T, n, N) \
|
||||
T *f; \
|
||||
int ret; \
|
||||
\
|
||||
n##_free_functions(functions); \
|
||||
\
|
||||
f = *functions = (T*)calloc(1, sizeof(*f)); \
|
||||
if (!f) \
|
||||
return -1; \
|
||||
\
|
||||
LOAD_LIBRARY(f->lib, N);
|
||||
|
||||
#define GENERIC_LOAD_FUNC_FINALE(n) \
|
||||
return 0; \
|
||||
error: \
|
||||
n##_free_functions(functions); \
|
||||
return ret;
|
||||
|
||||
#define GENERIC_FREE_FUNC() \
|
||||
if (!functions) \
|
||||
return; \
|
||||
if (*functions && (*functions)->lib) \
|
||||
FFNV_FREE_FUNC((*functions)->lib); \
|
||||
free(*functions); \
|
||||
*functions = NULL;
|
||||
|
||||
#ifdef FFNV_DYNLINK_CUDA_H
|
||||
typedef struct CudaFunctions {
|
||||
tcuInit *cuInit;
|
||||
tcuDriverGetVersion *cuDriverGetVersion;
|
||||
tcuDeviceGetCount *cuDeviceGetCount;
|
||||
tcuDeviceGet *cuDeviceGet;
|
||||
tcuDeviceGetAttribute *cuDeviceGetAttribute;
|
||||
tcuDeviceGetName *cuDeviceGetName;
|
||||
tcuDeviceGetUuid *cuDeviceGetUuid;
|
||||
tcuDeviceGetUuid_v2 *cuDeviceGetUuid_v2;
|
||||
tcuDeviceGetLuid *cuDeviceGetLuid;
|
||||
tcuDeviceGetByPCIBusId *cuDeviceGetByPCIBusId;
|
||||
tcuDeviceGetPCIBusId *cuDeviceGetPCIBusId;
|
||||
tcuDeviceComputeCapability *cuDeviceComputeCapability;
|
||||
tcuCtxCreate_v2 *cuCtxCreate;
|
||||
tcuCtxGetCurrent *cuCtxGetCurrent;
|
||||
tcuCtxSetLimit *cuCtxSetLimit;
|
||||
tcuCtxPushCurrent_v2 *cuCtxPushCurrent;
|
||||
tcuCtxPopCurrent_v2 *cuCtxPopCurrent;
|
||||
tcuCtxDestroy_v2 *cuCtxDestroy;
|
||||
tcuMemAlloc_v2 *cuMemAlloc;
|
||||
tcuMemAllocPitch_v2 *cuMemAllocPitch;
|
||||
tcuMemAllocManaged *cuMemAllocManaged;
|
||||
tcuMemsetD8Async *cuMemsetD8Async;
|
||||
tcuMemFree_v2 *cuMemFree;
|
||||
tcuMemcpy *cuMemcpy;
|
||||
tcuMemcpyAsync *cuMemcpyAsync;
|
||||
tcuMemcpy2D_v2 *cuMemcpy2D;
|
||||
tcuMemcpy2DAsync_v2 *cuMemcpy2DAsync;
|
||||
tcuMemcpyHtoD_v2 *cuMemcpyHtoD;
|
||||
tcuMemcpyHtoDAsync_v2 *cuMemcpyHtoDAsync;
|
||||
tcuMemcpyDtoH_v2 *cuMemcpyDtoH;
|
||||
tcuMemcpyDtoHAsync_v2 *cuMemcpyDtoHAsync;
|
||||
tcuMemcpyDtoD_v2 *cuMemcpyDtoD;
|
||||
tcuMemcpyDtoDAsync_v2 *cuMemcpyDtoDAsync;
|
||||
tcuGetErrorName *cuGetErrorName;
|
||||
tcuGetErrorString *cuGetErrorString;
|
||||
tcuCtxGetDevice *cuCtxGetDevice;
|
||||
|
||||
tcuDevicePrimaryCtxRetain *cuDevicePrimaryCtxRetain;
|
||||
tcuDevicePrimaryCtxRelease *cuDevicePrimaryCtxRelease;
|
||||
tcuDevicePrimaryCtxSetFlags *cuDevicePrimaryCtxSetFlags;
|
||||
tcuDevicePrimaryCtxGetState *cuDevicePrimaryCtxGetState;
|
||||
tcuDevicePrimaryCtxReset *cuDevicePrimaryCtxReset;
|
||||
|
||||
tcuStreamCreate *cuStreamCreate;
|
||||
tcuStreamQuery *cuStreamQuery;
|
||||
tcuStreamSynchronize *cuStreamSynchronize;
|
||||
tcuStreamDestroy_v2 *cuStreamDestroy;
|
||||
tcuStreamAddCallback *cuStreamAddCallback;
|
||||
tcuStreamWaitEvent *cuStreamWaitEvent;
|
||||
tcuEventCreate *cuEventCreate;
|
||||
tcuEventDestroy_v2 *cuEventDestroy;
|
||||
tcuEventSynchronize *cuEventSynchronize;
|
||||
tcuEventQuery *cuEventQuery;
|
||||
tcuEventRecord *cuEventRecord;
|
||||
|
||||
tcuLaunchKernel *cuLaunchKernel;
|
||||
tcuLinkCreate *cuLinkCreate;
|
||||
tcuLinkAddData *cuLinkAddData;
|
||||
tcuLinkComplete *cuLinkComplete;
|
||||
tcuLinkDestroy *cuLinkDestroy;
|
||||
tcuModuleLoadData *cuModuleLoadData;
|
||||
tcuModuleUnload *cuModuleUnload;
|
||||
tcuModuleGetFunction *cuModuleGetFunction;
|
||||
tcuModuleGetGlobal *cuModuleGetGlobal;
|
||||
tcuTexObjectCreate *cuTexObjectCreate;
|
||||
tcuTexObjectDestroy *cuTexObjectDestroy;
|
||||
|
||||
tcuGLGetDevices_v2 *cuGLGetDevices;
|
||||
tcuGraphicsGLRegisterImage *cuGraphicsGLRegisterImage;
|
||||
tcuGraphicsUnregisterResource *cuGraphicsUnregisterResource;
|
||||
tcuGraphicsMapResources *cuGraphicsMapResources;
|
||||
tcuGraphicsUnmapResources *cuGraphicsUnmapResources;
|
||||
tcuGraphicsSubResourceGetMappedArray *cuGraphicsSubResourceGetMappedArray;
|
||||
tcuGraphicsResourceGetMappedPointer *cuGraphicsResourceGetMappedPointer;
|
||||
tcuGraphicsResourceSetMapFlags_v2 *cuGraphicsResourceSetMapFlags;
|
||||
|
||||
tcuImportExternalMemory *cuImportExternalMemory;
|
||||
tcuDestroyExternalMemory *cuDestroyExternalMemory;
|
||||
tcuExternalMemoryGetMappedBuffer *cuExternalMemoryGetMappedBuffer;
|
||||
tcuExternalMemoryGetMappedMipmappedArray *cuExternalMemoryGetMappedMipmappedArray;
|
||||
tcuMipmappedArrayDestroy *cuMipmappedArrayDestroy;
|
||||
|
||||
tcuMipmappedArrayGetLevel *cuMipmappedArrayGetLevel;
|
||||
|
||||
tcuImportExternalSemaphore *cuImportExternalSemaphore;
|
||||
tcuDestroyExternalSemaphore *cuDestroyExternalSemaphore;
|
||||
tcuSignalExternalSemaphoresAsync *cuSignalExternalSemaphoresAsync;
|
||||
tcuWaitExternalSemaphoresAsync *cuWaitExternalSemaphoresAsync;
|
||||
|
||||
tcuArrayCreate *cuArrayCreate;
|
||||
tcuArray3DCreate *cuArray3DCreate;
|
||||
tcuArrayDestroy *cuArrayDestroy;
|
||||
|
||||
tcuEGLStreamProducerConnect *cuEGLStreamProducerConnect;
|
||||
tcuEGLStreamProducerDisconnect *cuEGLStreamProducerDisconnect;
|
||||
tcuEGLStreamConsumerDisconnect *cuEGLStreamConsumerDisconnect;
|
||||
tcuEGLStreamProducerPresentFrame *cuEGLStreamProducerPresentFrame;
|
||||
tcuEGLStreamProducerReturnFrame *cuEGLStreamProducerReturnFrame;
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
tcuD3D11GetDevice *cuD3D11GetDevice;
|
||||
tcuD3D11GetDevices *cuD3D11GetDevices;
|
||||
tcuGraphicsD3D11RegisterResource *cuGraphicsD3D11RegisterResource;
|
||||
#endif
|
||||
|
||||
FFNV_LIB_HANDLE lib;
|
||||
} CudaFunctions;
|
||||
#else
|
||||
typedef struct CudaFunctions CudaFunctions;
|
||||
#endif
|
||||
|
||||
typedef struct CuvidFunctions {
|
||||
tcuvidGetDecoderCaps *cuvidGetDecoderCaps;
|
||||
tcuvidCreateDecoder *cuvidCreateDecoder;
|
||||
tcuvidDestroyDecoder *cuvidDestroyDecoder;
|
||||
tcuvidDecodePicture *cuvidDecodePicture;
|
||||
tcuvidGetDecodeStatus *cuvidGetDecodeStatus;
|
||||
tcuvidReconfigureDecoder *cuvidReconfigureDecoder;
|
||||
tcuvidMapVideoFrame *cuvidMapVideoFrame;
|
||||
tcuvidUnmapVideoFrame *cuvidUnmapVideoFrame;
|
||||
tcuvidCtxLockCreate *cuvidCtxLockCreate;
|
||||
tcuvidCtxLockDestroy *cuvidCtxLockDestroy;
|
||||
tcuvidCtxLock *cuvidCtxLock;
|
||||
tcuvidCtxUnlock *cuvidCtxUnlock;
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
tcuvidCreateVideoSource *cuvidCreateVideoSource;
|
||||
tcuvidCreateVideoSourceW *cuvidCreateVideoSourceW;
|
||||
tcuvidDestroyVideoSource *cuvidDestroyVideoSource;
|
||||
tcuvidSetVideoSourceState *cuvidSetVideoSourceState;
|
||||
tcuvidGetVideoSourceState *cuvidGetVideoSourceState;
|
||||
tcuvidGetSourceVideoFormat *cuvidGetSourceVideoFormat;
|
||||
tcuvidGetSourceAudioFormat *cuvidGetSourceAudioFormat;
|
||||
#endif
|
||||
tcuvidCreateVideoParser *cuvidCreateVideoParser;
|
||||
tcuvidParseVideoData *cuvidParseVideoData;
|
||||
tcuvidDestroyVideoParser *cuvidDestroyVideoParser;
|
||||
|
||||
FFNV_LIB_HANDLE lib;
|
||||
} CuvidFunctions;
|
||||
|
||||
typedef NVENCSTATUS NVENCAPI tNvEncodeAPICreateInstance(NV_ENCODE_API_FUNCTION_LIST *functionList);
|
||||
typedef NVENCSTATUS NVENCAPI tNvEncodeAPIGetMaxSupportedVersion(uint32_t* version);
|
||||
|
||||
typedef struct NvencFunctions {
|
||||
tNvEncodeAPICreateInstance *NvEncodeAPICreateInstance;
|
||||
tNvEncodeAPIGetMaxSupportedVersion *NvEncodeAPIGetMaxSupportedVersion;
|
||||
|
||||
FFNV_LIB_HANDLE lib;
|
||||
} NvencFunctions;
|
||||
|
||||
#ifdef FFNV_DYNLINK_CUDA_H
|
||||
static inline void cuda_free_functions(CudaFunctions **functions)
|
||||
{
|
||||
GENERIC_FREE_FUNC();
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline void cuvid_free_functions(CuvidFunctions **functions)
|
||||
{
|
||||
GENERIC_FREE_FUNC();
|
||||
}
|
||||
|
||||
static inline void nvenc_free_functions(NvencFunctions **functions)
|
||||
{
|
||||
GENERIC_FREE_FUNC();
|
||||
}
|
||||
|
||||
#ifdef FFNV_DYNLINK_CUDA_H
|
||||
static inline int cuda_load_functions(CudaFunctions **functions, void *logctx)
|
||||
{
|
||||
(void)logctx;
|
||||
GENERIC_LOAD_FUNC_PREAMBLE(CudaFunctions, cuda, CUDA_LIBNAME);
|
||||
|
||||
LOAD_SYMBOL(cuInit, tcuInit, "cuInit");
|
||||
LOAD_SYMBOL(cuDriverGetVersion, tcuDriverGetVersion, "cuDriverGetVersion");
|
||||
LOAD_SYMBOL(cuDeviceGetCount, tcuDeviceGetCount, "cuDeviceGetCount");
|
||||
LOAD_SYMBOL(cuDeviceGet, tcuDeviceGet, "cuDeviceGet");
|
||||
LOAD_SYMBOL(cuDeviceGetAttribute, tcuDeviceGetAttribute, "cuDeviceGetAttribute");
|
||||
LOAD_SYMBOL(cuDeviceGetName, tcuDeviceGetName, "cuDeviceGetName");
|
||||
LOAD_SYMBOL(cuDeviceComputeCapability, tcuDeviceComputeCapability, "cuDeviceComputeCapability");
|
||||
LOAD_SYMBOL(cuCtxCreate, tcuCtxCreate_v2, "cuCtxCreate_v2");
|
||||
LOAD_SYMBOL(cuCtxGetCurrent, tcuCtxGetCurrent, "cuCtxGetCurrent");
|
||||
LOAD_SYMBOL(cuCtxSetLimit, tcuCtxSetLimit, "cuCtxSetLimit");
|
||||
LOAD_SYMBOL(cuCtxPushCurrent, tcuCtxPushCurrent_v2, "cuCtxPushCurrent_v2");
|
||||
LOAD_SYMBOL(cuCtxPopCurrent, tcuCtxPopCurrent_v2, "cuCtxPopCurrent_v2");
|
||||
LOAD_SYMBOL(cuCtxDestroy, tcuCtxDestroy_v2, "cuCtxDestroy_v2");
|
||||
LOAD_SYMBOL(cuMemAlloc, tcuMemAlloc_v2, "cuMemAlloc_v2");
|
||||
LOAD_SYMBOL(cuMemAllocPitch, tcuMemAllocPitch_v2, "cuMemAllocPitch_v2");
|
||||
LOAD_SYMBOL(cuMemAllocManaged, tcuMemAllocManaged, "cuMemAllocManaged");
|
||||
LOAD_SYMBOL(cuMemsetD8Async, tcuMemsetD8Async, "cuMemsetD8Async");
|
||||
LOAD_SYMBOL(cuMemFree, tcuMemFree_v2, "cuMemFree_v2");
|
||||
LOAD_SYMBOL(cuMemcpy, tcuMemcpy, "cuMemcpy");
|
||||
LOAD_SYMBOL(cuMemcpyAsync, tcuMemcpyAsync, "cuMemcpyAsync");
|
||||
LOAD_SYMBOL(cuMemcpy2D, tcuMemcpy2D_v2, "cuMemcpy2D_v2");
|
||||
LOAD_SYMBOL(cuMemcpy2DAsync, tcuMemcpy2DAsync_v2, "cuMemcpy2DAsync_v2");
|
||||
LOAD_SYMBOL(cuMemcpyHtoD, tcuMemcpyHtoD_v2, "cuMemcpyHtoD_v2");
|
||||
LOAD_SYMBOL(cuMemcpyHtoDAsync, tcuMemcpyHtoDAsync_v2, "cuMemcpyHtoDAsync_v2");
|
||||
LOAD_SYMBOL(cuMemcpyDtoH, tcuMemcpyDtoH_v2, "cuMemcpyDtoH_v2");
|
||||
LOAD_SYMBOL(cuMemcpyDtoHAsync, tcuMemcpyDtoHAsync_v2, "cuMemcpyDtoHAsync_v2");
|
||||
LOAD_SYMBOL(cuMemcpyDtoD, tcuMemcpyDtoD_v2, "cuMemcpyDtoD_v2");
|
||||
LOAD_SYMBOL(cuMemcpyDtoDAsync, tcuMemcpyDtoDAsync_v2, "cuMemcpyDtoDAsync_v2");
|
||||
LOAD_SYMBOL(cuGetErrorName, tcuGetErrorName, "cuGetErrorName");
|
||||
LOAD_SYMBOL(cuGetErrorString, tcuGetErrorString, "cuGetErrorString");
|
||||
LOAD_SYMBOL(cuCtxGetDevice, tcuCtxGetDevice, "cuCtxGetDevice");
|
||||
|
||||
LOAD_SYMBOL(cuDevicePrimaryCtxRetain, tcuDevicePrimaryCtxRetain, "cuDevicePrimaryCtxRetain");
|
||||
LOAD_SYMBOL(cuDevicePrimaryCtxRelease, tcuDevicePrimaryCtxRelease, "cuDevicePrimaryCtxRelease");
|
||||
LOAD_SYMBOL(cuDevicePrimaryCtxSetFlags, tcuDevicePrimaryCtxSetFlags, "cuDevicePrimaryCtxSetFlags");
|
||||
LOAD_SYMBOL(cuDevicePrimaryCtxGetState, tcuDevicePrimaryCtxGetState, "cuDevicePrimaryCtxGetState");
|
||||
LOAD_SYMBOL(cuDevicePrimaryCtxReset, tcuDevicePrimaryCtxReset, "cuDevicePrimaryCtxReset");
|
||||
|
||||
LOAD_SYMBOL(cuStreamCreate, tcuStreamCreate, "cuStreamCreate");
|
||||
LOAD_SYMBOL(cuStreamQuery, tcuStreamQuery, "cuStreamQuery");
|
||||
LOAD_SYMBOL(cuStreamSynchronize, tcuStreamSynchronize, "cuStreamSynchronize");
|
||||
LOAD_SYMBOL(cuStreamDestroy, tcuStreamDestroy_v2, "cuStreamDestroy_v2");
|
||||
LOAD_SYMBOL(cuStreamAddCallback, tcuStreamAddCallback, "cuStreamAddCallback");
|
||||
LOAD_SYMBOL(cuStreamWaitEvent, tcuStreamWaitEvent, "cuStreamWaitEvent");
|
||||
LOAD_SYMBOL(cuEventCreate, tcuEventCreate, "cuEventCreate");
|
||||
LOAD_SYMBOL(cuEventDestroy, tcuEventDestroy_v2, "cuEventDestroy_v2");
|
||||
LOAD_SYMBOL(cuEventSynchronize, tcuEventSynchronize, "cuEventSynchronize");
|
||||
LOAD_SYMBOL(cuEventQuery, tcuEventQuery, "cuEventQuery");
|
||||
LOAD_SYMBOL(cuEventRecord, tcuEventRecord, "cuEventRecord");
|
||||
|
||||
LOAD_SYMBOL(cuLaunchKernel, tcuLaunchKernel, "cuLaunchKernel");
|
||||
LOAD_SYMBOL(cuLinkCreate, tcuLinkCreate, "cuLinkCreate");
|
||||
LOAD_SYMBOL(cuLinkAddData, tcuLinkAddData, "cuLinkAddData");
|
||||
LOAD_SYMBOL(cuLinkComplete, tcuLinkComplete, "cuLinkComplete");
|
||||
LOAD_SYMBOL(cuLinkDestroy, tcuLinkDestroy, "cuLinkDestroy");
|
||||
LOAD_SYMBOL(cuModuleLoadData, tcuModuleLoadData, "cuModuleLoadData");
|
||||
LOAD_SYMBOL(cuModuleUnload, tcuModuleUnload, "cuModuleUnload");
|
||||
LOAD_SYMBOL(cuModuleGetFunction, tcuModuleGetFunction, "cuModuleGetFunction");
|
||||
LOAD_SYMBOL(cuModuleGetGlobal, tcuModuleGetGlobal, "cuModuleGetGlobal");
|
||||
LOAD_SYMBOL(cuTexObjectCreate, tcuTexObjectCreate, "cuTexObjectCreate");
|
||||
LOAD_SYMBOL(cuTexObjectDestroy, tcuTexObjectDestroy, "cuTexObjectDestroy");
|
||||
|
||||
LOAD_SYMBOL(cuGLGetDevices, tcuGLGetDevices_v2, "cuGLGetDevices_v2");
|
||||
LOAD_SYMBOL(cuGraphicsGLRegisterImage, tcuGraphicsGLRegisterImage, "cuGraphicsGLRegisterImage");
|
||||
LOAD_SYMBOL(cuGraphicsUnregisterResource, tcuGraphicsUnregisterResource, "cuGraphicsUnregisterResource");
|
||||
LOAD_SYMBOL(cuGraphicsMapResources, tcuGraphicsMapResources, "cuGraphicsMapResources");
|
||||
LOAD_SYMBOL(cuGraphicsUnmapResources, tcuGraphicsUnmapResources, "cuGraphicsUnmapResources");
|
||||
LOAD_SYMBOL(cuGraphicsSubResourceGetMappedArray, tcuGraphicsSubResourceGetMappedArray, "cuGraphicsSubResourceGetMappedArray");
|
||||
LOAD_SYMBOL(cuGraphicsResourceGetMappedPointer, tcuGraphicsResourceGetMappedPointer, "cuGraphicsResourceGetMappedPointer_v2");
|
||||
LOAD_SYMBOL(cuGraphicsResourceSetMapFlags, tcuGraphicsResourceSetMapFlags_v2, "cuGraphicsResourceSetMapFlags_v2");
|
||||
|
||||
LOAD_SYMBOL_OPT(cuDeviceGetUuid, tcuDeviceGetUuid, "cuDeviceGetUuid");
|
||||
LOAD_SYMBOL_OPT(cuDeviceGetUuid_v2, tcuDeviceGetUuid_v2, "cuDeviceGetUuid_v2");
|
||||
LOAD_SYMBOL_OPT(cuDeviceGetLuid, tcuDeviceGetLuid, "cuDeviceGetLuid");
|
||||
LOAD_SYMBOL_OPT(cuDeviceGetByPCIBusId, tcuDeviceGetByPCIBusId, "cuDeviceGetByPCIBusId");
|
||||
LOAD_SYMBOL_OPT(cuDeviceGetPCIBusId, tcuDeviceGetPCIBusId, "cuDeviceGetPCIBusId");
|
||||
LOAD_SYMBOL_OPT(cuImportExternalMemory, tcuImportExternalMemory, "cuImportExternalMemory");
|
||||
LOAD_SYMBOL_OPT(cuDestroyExternalMemory, tcuDestroyExternalMemory, "cuDestroyExternalMemory");
|
||||
LOAD_SYMBOL_OPT(cuExternalMemoryGetMappedBuffer, tcuExternalMemoryGetMappedBuffer, "cuExternalMemoryGetMappedBuffer");
|
||||
LOAD_SYMBOL_OPT(cuExternalMemoryGetMappedMipmappedArray, tcuExternalMemoryGetMappedMipmappedArray, "cuExternalMemoryGetMappedMipmappedArray");
|
||||
LOAD_SYMBOL_OPT(cuMipmappedArrayGetLevel, tcuMipmappedArrayGetLevel, "cuMipmappedArrayGetLevel");
|
||||
LOAD_SYMBOL_OPT(cuMipmappedArrayDestroy, tcuMipmappedArrayDestroy, "cuMipmappedArrayDestroy");
|
||||
|
||||
LOAD_SYMBOL_OPT(cuImportExternalSemaphore, tcuImportExternalSemaphore, "cuImportExternalSemaphore");
|
||||
LOAD_SYMBOL_OPT(cuDestroyExternalSemaphore, tcuDestroyExternalSemaphore, "cuDestroyExternalSemaphore");
|
||||
LOAD_SYMBOL_OPT(cuSignalExternalSemaphoresAsync, tcuSignalExternalSemaphoresAsync, "cuSignalExternalSemaphoresAsync");
|
||||
LOAD_SYMBOL_OPT(cuWaitExternalSemaphoresAsync, tcuWaitExternalSemaphoresAsync, "cuWaitExternalSemaphoresAsync");
|
||||
|
||||
LOAD_SYMBOL(cuArrayCreate, tcuArrayCreate, "cuArrayCreate_v2");
|
||||
LOAD_SYMBOL(cuArray3DCreate, tcuArray3DCreate, "cuArray3DCreate_v2");
|
||||
LOAD_SYMBOL(cuArrayDestroy, tcuArrayDestroy, "cuArrayDestroy");
|
||||
|
||||
LOAD_SYMBOL_OPT(cuEGLStreamProducerConnect, tcuEGLStreamProducerConnect, "cuEGLStreamProducerConnect");
|
||||
LOAD_SYMBOL_OPT(cuEGLStreamProducerDisconnect, tcuEGLStreamProducerDisconnect, "cuEGLStreamProducerDisconnect");
|
||||
LOAD_SYMBOL_OPT(cuEGLStreamConsumerDisconnect, tcuEGLStreamConsumerDisconnect, "cuEGLStreamConsumerDisconnect");
|
||||
LOAD_SYMBOL_OPT(cuEGLStreamProducerPresentFrame, tcuEGLStreamProducerPresentFrame, "cuEGLStreamProducerPresentFrame");
|
||||
LOAD_SYMBOL_OPT(cuEGLStreamProducerReturnFrame, tcuEGLStreamProducerReturnFrame, "cuEGLStreamProducerReturnFrame");
|
||||
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
LOAD_SYMBOL(cuD3D11GetDevice, tcuD3D11GetDevice, "cuD3D11GetDevice");
|
||||
LOAD_SYMBOL(cuD3D11GetDevices, tcuD3D11GetDevices, "cuD3D11GetDevices");
|
||||
LOAD_SYMBOL(cuGraphicsD3D11RegisterResource, tcuGraphicsD3D11RegisterResource, "cuGraphicsD3D11RegisterResource");
|
||||
#endif
|
||||
|
||||
GENERIC_LOAD_FUNC_FINALE(cuda);
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline int cuvid_load_functions(CuvidFunctions **functions, void *logctx)
|
||||
{
|
||||
(void)logctx;
|
||||
GENERIC_LOAD_FUNC_PREAMBLE(CuvidFunctions, cuvid, NVCUVID_LIBNAME);
|
||||
|
||||
LOAD_SYMBOL_OPT(cuvidGetDecoderCaps, tcuvidGetDecoderCaps, "cuvidGetDecoderCaps");
|
||||
LOAD_SYMBOL(cuvidCreateDecoder, tcuvidCreateDecoder, "cuvidCreateDecoder");
|
||||
LOAD_SYMBOL(cuvidDestroyDecoder, tcuvidDestroyDecoder, "cuvidDestroyDecoder");
|
||||
LOAD_SYMBOL(cuvidDecodePicture, tcuvidDecodePicture, "cuvidDecodePicture");
|
||||
LOAD_SYMBOL(cuvidGetDecodeStatus, tcuvidGetDecodeStatus, "cuvidGetDecodeStatus");
|
||||
LOAD_SYMBOL(cuvidReconfigureDecoder, tcuvidReconfigureDecoder, "cuvidReconfigureDecoder");
|
||||
#ifdef __CUVID_DEVPTR64
|
||||
LOAD_SYMBOL(cuvidMapVideoFrame, tcuvidMapVideoFrame, "cuvidMapVideoFrame64");
|
||||
LOAD_SYMBOL(cuvidUnmapVideoFrame, tcuvidUnmapVideoFrame, "cuvidUnmapVideoFrame64");
|
||||
#else
|
||||
LOAD_SYMBOL(cuvidMapVideoFrame, tcuvidMapVideoFrame, "cuvidMapVideoFrame");
|
||||
LOAD_SYMBOL(cuvidUnmapVideoFrame, tcuvidUnmapVideoFrame, "cuvidUnmapVideoFrame");
|
||||
#endif
|
||||
LOAD_SYMBOL(cuvidCtxLockCreate, tcuvidCtxLockCreate, "cuvidCtxLockCreate");
|
||||
LOAD_SYMBOL(cuvidCtxLockDestroy, tcuvidCtxLockDestroy, "cuvidCtxLockDestroy");
|
||||
LOAD_SYMBOL(cuvidCtxLock, tcuvidCtxLock, "cuvidCtxLock");
|
||||
LOAD_SYMBOL(cuvidCtxUnlock, tcuvidCtxUnlock, "cuvidCtxUnlock");
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
LOAD_SYMBOL(cuvidCreateVideoSource, tcuvidCreateVideoSource, "cuvidCreateVideoSource");
|
||||
LOAD_SYMBOL(cuvidCreateVideoSourceW, tcuvidCreateVideoSourceW, "cuvidCreateVideoSourceW");
|
||||
LOAD_SYMBOL(cuvidDestroyVideoSource, tcuvidDestroyVideoSource, "cuvidDestroyVideoSource");
|
||||
LOAD_SYMBOL(cuvidSetVideoSourceState, tcuvidSetVideoSourceState, "cuvidSetVideoSourceState");
|
||||
LOAD_SYMBOL(cuvidGetVideoSourceState, tcuvidGetVideoSourceState, "cuvidGetVideoSourceState");
|
||||
LOAD_SYMBOL(cuvidGetSourceVideoFormat, tcuvidGetSourceVideoFormat, "cuvidGetSourceVideoFormat");
|
||||
LOAD_SYMBOL(cuvidGetSourceAudioFormat, tcuvidGetSourceAudioFormat, "cuvidGetSourceAudioFormat");
|
||||
#endif
|
||||
LOAD_SYMBOL(cuvidCreateVideoParser, tcuvidCreateVideoParser, "cuvidCreateVideoParser");
|
||||
LOAD_SYMBOL(cuvidParseVideoData, tcuvidParseVideoData, "cuvidParseVideoData");
|
||||
LOAD_SYMBOL(cuvidDestroyVideoParser, tcuvidDestroyVideoParser, "cuvidDestroyVideoParser");
|
||||
|
||||
GENERIC_LOAD_FUNC_FINALE(cuvid);
|
||||
}
|
||||
|
||||
static inline int nvenc_load_functions(NvencFunctions **functions, void *logctx)
|
||||
{
|
||||
(void)logctx;
|
||||
GENERIC_LOAD_FUNC_PREAMBLE(NvencFunctions, nvenc, NVENC_LIBNAME);
|
||||
|
||||
LOAD_SYMBOL(NvEncodeAPICreateInstance, tNvEncodeAPICreateInstance, "NvEncodeAPICreateInstance");
|
||||
LOAD_SYMBOL(NvEncodeAPIGetMaxSupportedVersion, tNvEncodeAPIGetMaxSupportedVersion, "NvEncodeAPIGetMaxSupportedVersion");
|
||||
|
||||
GENERIC_LOAD_FUNC_FINALE(nvenc);
|
||||
}
|
||||
|
||||
#undef GENERIC_LOAD_FUNC_PREAMBLE
|
||||
#undef LOAD_LIBRARY
|
||||
#undef LOAD_SYMBOL
|
||||
#undef GENERIC_LOAD_FUNC_FINALE
|
||||
#undef GENERIC_FREE_FUNC
|
||||
#undef CUDA_LIBNAME
|
||||
#undef NVCUVID_LIBNAME
|
||||
#undef NVENC_LIBNAME
|
||||
|
||||
#endif
|
||||
|
||||
499
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_nvcuvid.h
vendored
Normal file
499
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/dynlink_nvcuvid.h
vendored
Normal file
@@ -0,0 +1,499 @@
|
||||
/*
|
||||
* This copyright notice applies to this header file only:
|
||||
*
|
||||
* Copyright (c) 2010-2023 NVIDIA Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person
|
||||
* obtaining a copy of this software and associated documentation
|
||||
* files (the "Software"), to deal in the Software without
|
||||
* restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the software, and to permit persons to whom the
|
||||
* software is furnished to do so, subject to the following
|
||||
* conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
* OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/********************************************************************************************************************/
|
||||
//! \file nvcuvid.h
|
||||
//! NVDECODE API provides video decoding interface to NVIDIA GPU devices.
|
||||
//! \date 2015-2022
|
||||
//! This file contains the interface constants, structure definitions and function prototypes.
|
||||
/********************************************************************************************************************/
|
||||
|
||||
#if !defined(__NVCUVID_H__)
|
||||
#define __NVCUVID_H__
|
||||
|
||||
#include "dynlink_cuviddec.h"
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define MAX_CLOCK_TS 3
|
||||
|
||||
/***********************************************/
|
||||
//!
|
||||
//! High-level helper APIs for video sources
|
||||
//!
|
||||
/***********************************************/
|
||||
|
||||
typedef void *CUvideosource;
|
||||
typedef void *CUvideoparser;
|
||||
typedef long long CUvideotimestamp;
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
//! \enum cudaVideoState
|
||||
//! Video source state enums
|
||||
//! Used in cuvidSetVideoSourceState and cuvidGetVideoSourceState APIs
|
||||
/************************************************************************/
|
||||
typedef enum {
|
||||
cudaVideoState_Error = -1, /**< Error state (invalid source) */
|
||||
cudaVideoState_Stopped = 0, /**< Source is stopped (or reached end-of-stream) */
|
||||
cudaVideoState_Started = 1 /**< Source is running and delivering data */
|
||||
} cudaVideoState;
|
||||
|
||||
/************************************************************************/
|
||||
//! \enum cudaAudioCodec
|
||||
//! Audio compression enums
|
||||
//! Used in CUAUDIOFORMAT structure
|
||||
/************************************************************************/
|
||||
typedef enum {
|
||||
cudaAudioCodec_MPEG1=0, /**< MPEG-1 Audio */
|
||||
cudaAudioCodec_MPEG2, /**< MPEG-2 Audio */
|
||||
cudaAudioCodec_MP3, /**< MPEG-1 Layer III Audio */
|
||||
cudaAudioCodec_AC3, /**< Dolby Digital (AC3) Audio */
|
||||
cudaAudioCodec_LPCM, /**< PCM Audio */
|
||||
cudaAudioCodec_AAC, /**< AAC Audio */
|
||||
} cudaAudioCodec;
|
||||
|
||||
/************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct HEVCTIMECODESET
|
||||
//! Used to store Time code extracted from Time code SEI in HEVC codec
|
||||
/************************************************************************/
|
||||
typedef struct _HEVCTIMECODESET
|
||||
{
|
||||
unsigned int time_offset_value;
|
||||
unsigned short n_frames;
|
||||
unsigned char clock_timestamp_flag;
|
||||
unsigned char units_field_based_flag;
|
||||
unsigned char counting_type;
|
||||
unsigned char full_timestamp_flag;
|
||||
unsigned char discontinuity_flag;
|
||||
unsigned char cnt_dropped_flag;
|
||||
unsigned char seconds_value;
|
||||
unsigned char minutes_value;
|
||||
unsigned char hours_value;
|
||||
unsigned char seconds_flag;
|
||||
unsigned char minutes_flag;
|
||||
unsigned char hours_flag;
|
||||
unsigned char time_offset_length;
|
||||
unsigned char reserved;
|
||||
} HEVCTIMECODESET;
|
||||
|
||||
/************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct HEVCSEITIMECODE
|
||||
//! Used to extract Time code SEI in HEVC codec
|
||||
/************************************************************************/
|
||||
typedef struct _HEVCSEITIMECODE
|
||||
{
|
||||
HEVCTIMECODESET time_code_set[MAX_CLOCK_TS];
|
||||
unsigned char num_clock_ts;
|
||||
} HEVCSEITIMECODE;
|
||||
|
||||
/**********************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUSEIMESSAGE;
|
||||
//! Used in CUVIDSEIMESSAGEINFO structure
|
||||
/**********************************************************************************/
|
||||
typedef struct _CUSEIMESSAGE
|
||||
{
|
||||
unsigned char sei_message_type; /**< OUT: SEI Message Type */
|
||||
unsigned char reserved[3];
|
||||
unsigned int sei_message_size; /**< OUT: SEI Message Size */
|
||||
} CUSEIMESSAGE;
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDEOFORMAT
|
||||
//! Video format
|
||||
//! Used in cuvidGetSourceVideoFormat API
|
||||
/************************************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
cudaVideoCodec codec; /**< OUT: Compression format */
|
||||
/**
|
||||
* OUT: frame rate = numerator / denominator (for example: 30000/1001)
|
||||
*/
|
||||
struct {
|
||||
/**< OUT: frame rate numerator (0 = unspecified or variable frame rate) */
|
||||
unsigned int numerator;
|
||||
/**< OUT: frame rate denominator (0 = unspecified or variable frame rate) */
|
||||
unsigned int denominator;
|
||||
} frame_rate;
|
||||
unsigned char progressive_sequence; /**< OUT: 0=interlaced, 1=progressive */
|
||||
unsigned char bit_depth_luma_minus8; /**< OUT: high bit depth luma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */
|
||||
unsigned char bit_depth_chroma_minus8; /**< OUT: high bit depth chroma. E.g, 2 for 10-bitdepth, 4 for 12-bitdepth */
|
||||
unsigned char min_num_decode_surfaces; /**< OUT: Minimum number of decode surfaces to be allocated for correct
|
||||
decoding. The client can send this value in ulNumDecodeSurfaces
|
||||
(in CUVIDDECODECREATEINFO structure).
|
||||
This guarantees correct functionality and optimal video memory
|
||||
usage but not necessarily the best performance, which depends on
|
||||
the design of the overall application. The optimal number of
|
||||
decode surfaces (in terms of performance and memory utilization)
|
||||
should be decided by experimentation for each application, but it
|
||||
cannot go below min_num_decode_surfaces.
|
||||
If this value is used for ulNumDecodeSurfaces then it must be
|
||||
returned to parser during sequence callback. */
|
||||
unsigned int coded_width; /**< OUT: coded frame width in pixels */
|
||||
unsigned int coded_height; /**< OUT: coded frame height in pixels */
|
||||
/**
|
||||
* area of the frame that should be displayed
|
||||
* typical example:
|
||||
* coded_width = 1920, coded_height = 1088
|
||||
* display_area = { 0,0,1920,1080 }
|
||||
*/
|
||||
struct {
|
||||
int left; /**< OUT: left position of display rect */
|
||||
int top; /**< OUT: top position of display rect */
|
||||
int right; /**< OUT: right position of display rect */
|
||||
int bottom; /**< OUT: bottom position of display rect */
|
||||
} display_area;
|
||||
cudaVideoChromaFormat chroma_format; /**< OUT: Chroma format */
|
||||
unsigned int bitrate; /**< OUT: video bitrate (bps, 0=unknown) */
|
||||
/**
|
||||
* OUT: Display Aspect Ratio = x:y (4:3, 16:9, etc)
|
||||
*/
|
||||
struct {
|
||||
int x;
|
||||
int y;
|
||||
} display_aspect_ratio;
|
||||
/**
|
||||
* Video Signal Description
|
||||
* Refer section E.2.1 (VUI parameters semantics) of H264 spec file
|
||||
*/
|
||||
struct {
|
||||
unsigned char video_format : 3; /**< OUT: 0-Component, 1-PAL, 2-NTSC, 3-SECAM, 4-MAC, 5-Unspecified */
|
||||
unsigned char video_full_range_flag : 1; /**< OUT: indicates the black level and luma and chroma range */
|
||||
unsigned char reserved_zero_bits : 4; /**< Reserved bits */
|
||||
unsigned char color_primaries; /**< OUT: chromaticity coordinates of source primaries */
|
||||
unsigned char transfer_characteristics; /**< OUT: opto-electronic transfer characteristic of the source picture */
|
||||
unsigned char matrix_coefficients; /**< OUT: used in deriving luma and chroma signals from RGB primaries */
|
||||
} video_signal_description;
|
||||
unsigned int seqhdr_data_length; /**< OUT: Additional bytes following (CUVIDEOFORMATEX) */
|
||||
} CUVIDEOFORMAT;
|
||||
|
||||
/****************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDOPERATINGPOINTINFO
|
||||
//! Operating point information of scalable bitstream
|
||||
/****************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
cudaVideoCodec codec;
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
unsigned char operating_points_cnt;
|
||||
unsigned char reserved24_bits[3];
|
||||
unsigned short operating_points_idc[32];
|
||||
} av1;
|
||||
unsigned char CodecReserved[1024];
|
||||
};
|
||||
} CUVIDOPERATINGPOINTINFO;
|
||||
|
||||
/**********************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDSEIMESSAGEINFO
|
||||
//! Used in cuvidParseVideoData API with PFNVIDSEIMSGCALLBACK pfnGetSEIMsg
|
||||
/**********************************************************************************/
|
||||
typedef struct _CUVIDSEIMESSAGEINFO
|
||||
{
|
||||
void *pSEIData; /**< OUT: SEI Message Data */
|
||||
CUSEIMESSAGE *pSEIMessage; /**< OUT: SEI Message Info */
|
||||
unsigned int sei_message_count; /**< OUT: SEI Message Count */
|
||||
unsigned int picIdx; /**< OUT: SEI Message Pic Index */
|
||||
} CUVIDSEIMESSAGEINFO;
|
||||
|
||||
/****************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDAV1SEQHDR
|
||||
//! AV1 specific sequence header information
|
||||
/****************************************************************/
|
||||
typedef struct {
|
||||
unsigned int max_width;
|
||||
unsigned int max_height;
|
||||
unsigned char reserved[1016];
|
||||
} CUVIDAV1SEQHDR;
|
||||
|
||||
/****************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDEOFORMATEX
|
||||
//! Video format including raw sequence header information
|
||||
//! Used in cuvidGetSourceVideoFormat API
|
||||
/****************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
CUVIDEOFORMAT format; /**< OUT: CUVIDEOFORMAT structure */
|
||||
union {
|
||||
CUVIDAV1SEQHDR av1;
|
||||
unsigned char raw_seqhdr_data[1024]; /**< OUT: Sequence header data */
|
||||
};
|
||||
} CUVIDEOFORMATEX;
|
||||
|
||||
/****************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUAUDIOFORMAT
|
||||
//! Audio formats
|
||||
//! Used in cuvidGetSourceAudioFormat API
|
||||
/****************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
cudaAudioCodec codec; /**< OUT: Compression format */
|
||||
unsigned int channels; /**< OUT: number of audio channels */
|
||||
unsigned int samplespersec; /**< OUT: sampling frequency */
|
||||
unsigned int bitrate; /**< OUT: For uncompressed, can also be used to determine bits per sample */
|
||||
unsigned int reserved1; /**< Reserved for future use */
|
||||
unsigned int reserved2; /**< Reserved for future use */
|
||||
} CUAUDIOFORMAT;
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
//! \enum CUvideopacketflags
|
||||
//! Data packet flags
|
||||
//! Used in CUVIDSOURCEDATAPACKET structure
|
||||
/***************************************************************/
|
||||
typedef enum {
|
||||
CUVID_PKT_ENDOFSTREAM = 0x01, /**< Set when this is the last packet for this stream */
|
||||
CUVID_PKT_TIMESTAMP = 0x02, /**< Timestamp is valid */
|
||||
CUVID_PKT_DISCONTINUITY = 0x04, /**< Set when a discontinuity has to be signalled */
|
||||
CUVID_PKT_ENDOFPICTURE = 0x08, /**< Set when the packet contains exactly one frame or one field */
|
||||
CUVID_PKT_NOTIFY_EOS = 0x10, /**< If this flag is set along with CUVID_PKT_ENDOFSTREAM, an additional (dummy)
|
||||
display callback will be invoked with null value of CUVIDPARSERDISPINFO which
|
||||
should be interpreted as end of the stream. */
|
||||
} CUvideopacketflags;
|
||||
|
||||
/*****************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDSOURCEDATAPACKET
|
||||
//! Data Packet
|
||||
//! Used in cuvidParseVideoData API
|
||||
//! IN for cuvidParseVideoData
|
||||
/*****************************************************************************/
|
||||
typedef struct _CUVIDSOURCEDATAPACKET
|
||||
{
|
||||
tcu_ulong flags; /**< IN: Combination of CUVID_PKT_XXX flags */
|
||||
tcu_ulong payload_size; /**< IN: number of bytes in the payload (may be zero if EOS flag is set) */
|
||||
const unsigned char *payload; /**< IN: Pointer to packet payload data (may be NULL if EOS flag is set) */
|
||||
CUvideotimestamp timestamp; /**< IN: Presentation time stamp (10MHz clock), only valid if
|
||||
CUVID_PKT_TIMESTAMP flag is set */
|
||||
} CUVIDSOURCEDATAPACKET;
|
||||
|
||||
// Callback for packet delivery
|
||||
typedef int (CUDAAPI *PFNVIDSOURCECALLBACK)(void *, CUVIDSOURCEDATAPACKET *);
|
||||
|
||||
/**************************************************************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDSOURCEPARAMS
|
||||
//! Describes parameters needed in cuvidCreateVideoSource API
|
||||
//! NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported
|
||||
//! containers. It's recommended to clients to use their own or third party demuxer if audio support is needed.
|
||||
/**************************************************************************************************************************/
|
||||
typedef struct _CUVIDSOURCEPARAMS
|
||||
{
|
||||
unsigned int ulClockRate; /**< IN: Time stamp units in Hz (0=default=10000000Hz) */
|
||||
unsigned int bAnnexb : 1; /**< IN: AV1 annexB stream */
|
||||
unsigned int uReserved : 31; /**< Reserved for future use - set to zero */
|
||||
unsigned int uReserved1[6]; /**< Reserved for future use - set to zero */
|
||||
void *pUserData; /**< IN: User private data passed in to the data handlers */
|
||||
PFNVIDSOURCECALLBACK pfnVideoDataHandler; /**< IN: Called to deliver video packets */
|
||||
PFNVIDSOURCECALLBACK pfnAudioDataHandler; /**< IN: Called to deliver audio packets. */
|
||||
void *pvReserved2[8]; /**< Reserved for future use - set to NULL */
|
||||
} CUVIDSOURCEPARAMS;
|
||||
|
||||
|
||||
/**********************************************/
|
||||
//! \ingroup ENUMS
|
||||
//! \enum CUvideosourceformat_flags
|
||||
//! CUvideosourceformat_flags
|
||||
//! Used in cuvidGetSourceVideoFormat API
|
||||
/**********************************************/
|
||||
typedef enum {
|
||||
CUVID_FMT_EXTFORMATINFO = 0x100 /**< Return extended format structure (CUVIDEOFORMATEX) */
|
||||
} CUvideosourceformat_flags;
|
||||
|
||||
#if !defined(__APPLE__)
|
||||
/***************************************************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams)
|
||||
//! Create CUvideosource object. CUvideosource spawns demultiplexer thread that provides two callbacks:
|
||||
//! pfnVideoDataHandler() and pfnAudioDataHandler()
|
||||
//! NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported
|
||||
//! containers. It's recommended to clients to use their own or third party demuxer if audio support is needed.
|
||||
/***************************************************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams);
|
||||
|
||||
/***************************************************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams)
|
||||
//! Create video source
|
||||
/***************************************************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidCreateVideoSourceW(CUvideosource *pObj, const wchar_t *pwszFileName, CUVIDSOURCEPARAMS *pParams);
|
||||
|
||||
/********************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidDestroyVideoSource(CUvideosource obj)
|
||||
//! Destroy video source
|
||||
/********************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidDestroyVideoSource(CUvideosource obj);
|
||||
|
||||
/******************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state)
|
||||
//! Set video source state to:
|
||||
//! cudaVideoState_Started - to signal the source to run and deliver data
|
||||
//! cudaVideoState_Stopped - to stop the source from delivering the data
|
||||
//! cudaVideoState_Error - invalid source
|
||||
/******************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidSetVideoSourceState(CUvideosource obj, cudaVideoState state);
|
||||
|
||||
/******************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn cudaVideoState CUDAAPI cuvidGetVideoSourceState(CUvideosource obj)
|
||||
//! Get video source state
|
||||
//! Returns:
|
||||
//! cudaVideoState_Started - if Source is running and delivering data
|
||||
//! cudaVideoState_Stopped - if Source is stopped or reached end-of-stream
|
||||
//! cudaVideoState_Error - if Source is in error state
|
||||
/******************************************************************************************/
|
||||
typedef cudaVideoState CUDAAPI tcuvidGetVideoSourceState(CUvideosource obj);
|
||||
|
||||
/******************************************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags)
|
||||
//! Gets video source format in pvidfmt, flags is set to combination of CUvideosourceformat_flags as per requirement
|
||||
/******************************************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidGetSourceVideoFormat(CUvideosource obj, CUVIDEOFORMAT *pvidfmt, unsigned int flags);
|
||||
|
||||
/**************************************************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags)
|
||||
//! Get audio source format
|
||||
//! NVDECODE API is intended for HW accelerated video decoding so CUvideosource doesn't have audio demuxer for all supported
|
||||
//! containers. It's recommended to clients to use their own or third party demuxer if audio support is needed.
|
||||
/**************************************************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidGetSourceAudioFormat(CUvideosource obj, CUAUDIOFORMAT *paudfmt, unsigned int flags);
|
||||
|
||||
#endif
|
||||
/**********************************************************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDPARSERDISPINFO
|
||||
//! Used in cuvidParseVideoData API with PFNVIDDISPLAYCALLBACK pfnDisplayPicture
|
||||
/**********************************************************************************/
|
||||
typedef struct _CUVIDPARSERDISPINFO
|
||||
{
|
||||
int picture_index; /**< OUT: Index of the current picture */
|
||||
int progressive_frame; /**< OUT: 1 if progressive frame; 0 otherwise */
|
||||
int top_field_first; /**< OUT: 1 if top field is displayed first; 0 otherwise */
|
||||
int repeat_first_field; /**< OUT: Number of additional fields (1=ivtc, 2=frame doubling, 4=frame tripling,
|
||||
-1=unpaired field) */
|
||||
CUvideotimestamp timestamp; /**< OUT: Presentation time stamp */
|
||||
} CUVIDPARSERDISPINFO;
|
||||
|
||||
/***********************************************************************************************************************/
|
||||
//! Parser callbacks
|
||||
//! The parser will call these synchronously from within cuvidParseVideoData(), whenever there is sequence change or a picture
|
||||
//! is ready to be decoded and/or displayed. First argument in functions is "void *pUserData" member of structure CUVIDSOURCEPARAMS
|
||||
//! Return values from these callbacks are interpreted as below. If the callbacks return failure, it will be propagated by
|
||||
//! cuvidParseVideoData() to the application.
|
||||
//! Parser picks default operating point as 0 and outputAllLayers flag as 0 if PFNVIDOPPOINTCALLBACK is not set or return value is
|
||||
//! -1 or invalid operating point.
|
||||
//! PFNVIDSEQUENCECALLBACK : 0: fail, 1: succeeded, > 1: override dpb size of parser (set by CUVIDPARSERPARAMS::ulMaxNumDecodeSurfaces
|
||||
//! while creating parser)
|
||||
//! PFNVIDDECODECALLBACK : 0: fail, >=1: succeeded
|
||||
//! PFNVIDDISPLAYCALLBACK : 0: fail, >=1: succeeded
|
||||
//! PFNVIDOPPOINTCALLBACK : <0: fail, >=0: succeeded (bit 0-9: OperatingPoint, bit 10-10: outputAllLayers, bit 11-30: reserved)
|
||||
//! PFNVIDSEIMSGCALLBACK : 0: fail, >=1: succeeded
|
||||
/***********************************************************************************************************************/
|
||||
typedef int (CUDAAPI *PFNVIDSEQUENCECALLBACK)(void *, CUVIDEOFORMAT *);
|
||||
typedef int (CUDAAPI *PFNVIDDECODECALLBACK)(void *, CUVIDPICPARAMS *);
|
||||
typedef int (CUDAAPI *PFNVIDDISPLAYCALLBACK)(void *, CUVIDPARSERDISPINFO *);
|
||||
typedef int (CUDAAPI *PFNVIDOPPOINTCALLBACK)(void *, CUVIDOPERATINGPOINTINFO*);
|
||||
typedef int (CUDAAPI *PFNVIDSEIMSGCALLBACK) (void *, CUVIDSEIMESSAGEINFO *);
|
||||
|
||||
/**************************************/
|
||||
//! \ingroup STRUCTS
|
||||
//! \struct CUVIDPARSERPARAMS
|
||||
//! Used in cuvidCreateVideoParser API
|
||||
/**************************************/
|
||||
typedef struct _CUVIDPARSERPARAMS
|
||||
{
|
||||
cudaVideoCodec CodecType; /**< IN: cudaVideoCodec_XXX */
|
||||
unsigned int ulMaxNumDecodeSurfaces; /**< IN: Max # of decode surfaces (parser will cycle through these) */
|
||||
unsigned int ulClockRate; /**< IN: Timestamp units in Hz (0=default=10000000Hz) */
|
||||
unsigned int ulErrorThreshold; /**< IN: % Error threshold (0-100) for calling pfnDecodePicture (100=always
|
||||
IN: call pfnDecodePicture even if picture bitstream is fully corrupted) */
|
||||
unsigned int ulMaxDisplayDelay; /**< IN: Max display queue delay (improves pipelining of decode with display)
|
||||
0=no delay (recommended values: 2..4) */
|
||||
unsigned int bAnnexb : 1; /**< IN: AV1 annexB stream */
|
||||
unsigned int uReserved : 31; /**< Reserved for future use - set to zero */
|
||||
unsigned int uReserved1[4]; /**< IN: Reserved for future use - set to 0 */
|
||||
void *pUserData; /**< IN: User data for callbacks */
|
||||
PFNVIDSEQUENCECALLBACK pfnSequenceCallback; /**< IN: Called before decoding frames and/or whenever there is a fmt change */
|
||||
PFNVIDDECODECALLBACK pfnDecodePicture; /**< IN: Called when a picture is ready to be decoded (decode order) */
|
||||
PFNVIDDISPLAYCALLBACK pfnDisplayPicture; /**< IN: Called whenever a picture is ready to be displayed (display order) */
|
||||
PFNVIDOPPOINTCALLBACK pfnGetOperatingPoint; /**< IN: Called from AV1 sequence header to get operating point of a AV1
|
||||
scalable bitstream */
|
||||
PFNVIDSEIMSGCALLBACK pfnGetSEIMsg; /**< IN: Called when all SEI messages are parsed for particular frame */
|
||||
void *pvReserved2[5]; /**< Reserved for future use - set to NULL */
|
||||
CUVIDEOFORMATEX *pExtVideoInfo; /**< IN: [Optional] sequence header data from system layer */
|
||||
} CUVIDPARSERPARAMS;
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams)
|
||||
//! Create video parser object and initialize
|
||||
/************************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidCreateVideoParser(CUvideoparser *pObj, CUVIDPARSERPARAMS *pParams);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket)
|
||||
//! Parse the video data from source data packet in pPacket
|
||||
//! Extracts parameter sets like SPS, PPS, bitstream etc. from pPacket and
|
||||
//! calls back pfnDecodePicture with CUVIDPICPARAMS data for kicking of HW decoding
|
||||
//! calls back pfnSequenceCallback with CUVIDEOFORMAT data for initial sequence header or when
|
||||
//! the decoder encounters a video format change
|
||||
//! calls back pfnDisplayPicture with CUVIDPARSERDISPINFO data to display a video frame
|
||||
/************************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidParseVideoData(CUvideoparser obj, CUVIDSOURCEDATAPACKET *pPacket);
|
||||
|
||||
/************************************************************************************************/
|
||||
//! \ingroup FUNCTS
|
||||
//! \fn CUresult CUDAAPI cuvidDestroyVideoParser(CUvideoparser obj)
|
||||
//! Destroy the video parser
|
||||
/************************************************************************************************/
|
||||
typedef CUresult CUDAAPI tcuvidDestroyVideoParser(CUvideoparser obj);
|
||||
|
||||
/**********************************************************************************************/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif // __NVCUVID_H__
|
||||
4451
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/nvEncodeAPI.h
vendored
Normal file
4451
libs/hwcodec/externals/nv-codec-headers_n12.1.14.0/include/ffnvcodec/nvEncodeAPI.h
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user