28 #ifndef NVBUFSURFACE_H_
29 #define NVBUFSURFACE_H_
46 #define STRUCTURE_PADDING 4
49 #define NVBUF_MAX_PLANES 4
55 #define NVBUFSURFACE_CHROMA_SUBSAMPLING_HORIZ_DEFAULT 0
56 #define NVBUFSURFACE_CHROMA_SUBSAMPLING_VERT_DEFAULT 1
58 #define NVBUFSURFACE_CHROMA_SUBSAMPLING_PARAMS_DEFAULT \
60 NVBUFSURFACE_CHROMA_SUBSAMPLING_HORIZ_DEFAULT, \
61 NVBUFSURFACE_CHROMA_SUBSAMPLING_VERT_DEFAULT \
617 int NvBufSurface2Raw (
NvBufSurface *Surf,
unsigned int index,
unsigned int plane,
unsigned int outwidth,
unsigned int outheight,
unsigned char *ptr);
635 int Raw2NvBufSurface (
unsigned char *ptr,
unsigned int index,
unsigned int plane,
unsigned int inwidth,
unsigned int inheight,
NvBufSurface *Surf);
Specifies BT.601 colorspace - YUV444 multi-planar.
Specifies CUDA Device memory type.
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
int32_t startofvaliddata
offset in bytes from the start of the buffer to the first valid byte.
void * _reserved[STRUCTURE_PADDING]
struct NvBufSurfaceCreateParams NvBufSurfaceCreateParams
Holds parameters required to allocate an NvBufSurface.
Specifies color format for packed 2 signed shorts.
uint32_t secondfieldoffset[NVBUF_MAX_PLANES]
offset of the second field for interlaced buffer.
uint64_t flags[NVBUF_MAX_PLANES]
flags associated with planes
uint32_t size
Holds the amount of memory to be allocated.
Specifies Non-linear RGB BT.709 colorspace - RGBA-10-10-10-2 planar.
NvBufSurfaceLayout layout
Holds BL or PL.
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
Specifies BT.2020 colorspace - Y/CbCr 12 bit 4:4:4 multi-planar.
uint8_t chromaLocHoriz
location settings
void * _reserved[STRUCTURE_PADDING]
Specifies BT.601 colorspace - YVU420 ER multi-planar.
#define NVBUF_MAX_PLANES
Defines the maximum number of planes.
uint32_t pitch[NVBUF_MAX_PLANES]
Holds the pitches of planes in bytes.
NvBufSurfaceTag memtag
components tag to be used for memory allocation
int NvBufSurfaceUnMapEglImage(NvBufSurface *surf, int index)
Destroys the previously created EGLImage object(s).
int NvBufSurfaceDestroy(NvBufSurface *surf)
Free the batched buffers previously allocated through NvBufSurfaceCreate.
Specifies BT.601 colorspace - YUV422 multi-planar.
void * dataPtr
Holds a pointer to allocated memory.
NvBufSurfaceColorFormat colorFormat
Holds the color format of the buffer.
Specifies BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
struct NvBufSurfaceMappedAddr NvBufSurfaceMappedAddr
Hold the pointers of mapped buffer.
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
Specifies block linear layout.
int NvBufSurfaceSyncForDevice(NvBufSurface *surf, int index, int plane)
Syncs the hardware memory cache for the device.
Specifies NVRM Surface Array type.
uint32_t num_planes
Holds the number of planes.
Specifies Non-linear RGB BT.2020 colorspace - BGRA-10-10-10-2 planar.
Specifies an invalid color format.
Specifies BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
void * _reserved[STRUCTURE_PADDING-1]
uint32_t bytesPerPix[NVBUF_MAX_PLANES]
Holds the number of bytes occupied by a pixel in each plane.
Specifies RGB-8-8-8 single plane.
Specifies RGBA-8-8-8-8 single plane.
Specifies BT.2020 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
Specifies RGB- unsigned 8 bit multiplanar plane.
Hold the information of single buffer in the batch.
NvBufSurfaceCreateParams params
Hold legacy NvBufSurface creation parameters.
NvBufSurfaceDisplayScanFormat scanformat[NVBUF_MAX_PLANES]
display scan format - progressive/interlaced.
Specifies NvBufSurface mapping type "write.".
int NvBufSurfaceAllocate(NvBufSurface **surf, uint32_t batchSize, NvBufSurfaceAllocateParams *paramsext)
Allocate batch of buffers.
Specifies ABGR-8-8-8-8 single plane.
struct NvBufSurfaceChromaSubsamplingParams NvBufSurfaceChromaSubsamplingParams
Holds Chroma Subsampling parameters for NvBufSurface allocation.
struct NvBufSurfacePlaneParams NvBufSurfacePlaneParams
Holds plane wise parameters of a buffer.
Specifies NvBufSurface mapping type "read.".
bool isContiguous
Holds a "contiguous memory" flag.
Specifies BGR-8-8-8 single plane.
Specifies BT.2020 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
Specifies BT.601 colorspace - YUV 4:2:2 planar.
Specifies BT.709 colorspace - Y/CbCr ER 4:2:0 multi-planar.
Specifies BT.601 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
void * addr[NVBUF_MAX_PLANES]
Holds planewise pointers to a CPU mapped buffer.
NvBufSurfaceMappedAddr mappedAddr
Holds pointers to mapped buffers.
struct NvBufSurfaceAllocateParams NvBufSurfaceAllocateParams
Hold extended parameters required to allocate NvBufSurface.
Specifies BGRA-8-8-8-8 single plane.
Specifies CUDA Host memory type.
Specifies BT.601_ER colorspace - Y/CbCr 4:2:2 multi-planar.
tag for H264/H265 Video Encoder.
Specifies BT.709 colorspace - Y/CbCr 4:4:4 multi-planar.
Specifies RGBx-8-8-8-8 single plane.
Specifies BT.601 colorspace - Y/CrCb 4:4:4 10-bit multi-planar.
void * _reserved[STRUCTURE_PADDING]
uint32_t numFilled
Holds the number valid and filled buffers.
Specifies BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
Specifies memory allocated by malloc().
int NvBufSurfaceFromFd(int dmabuf_fd, void **buffer)
Gets the NvBufSurface from the DMABUF FD.
int NvBufSurfaceCopy(NvBufSurface *srcSurf, NvBufSurface *dstSurf)
Copies the content of source batched buffer(s) to destination batched buffer(s).
Specifies BT.2020 colorspace - YUV420 multi-planar.
Specifies BT.2020 colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.
uint32_t pitch
Holds the pitch of the buffer.
uint32_t psize[NVBUF_MAX_PLANES]
Holds the sizes of planes in bytes.
Specifies BT.601 colorspace - Y/CrCb 4:2:0 12-bit multi-planar.
NvBufSurfaceParams * surfaceList
Holds a pointer to an array of batched buffers.
uint32_t batchSize
Holds the batch size.
Specifies Optical flow SAD calculation Buffer format.
struct NvBufSurfaceParamsEx NvBufSurfaceParamsEx
Hold the information(extended) of single buffer in the batch.
Holds plane wise parameters(extended) of a buffer.
Specifies BT.601 colorspace - YUV420 multi-planar.
int NvBufSurfaceSyncForCpu(NvBufSurface *surf, int index, int plane)
Syncs the HW memory cache for the CPU.
Holds parameters required to allocate an NvBufSurface.
Hold extended parameters required to allocate NvBufSurface.
Specifies BGR- unsigned 8 bit multiplanar plane.
tag for H264/H265/VP9 Video Decoder.
Specifies CUDA Unified memory type.
int NvBufSurface2Raw(NvBufSurface *Surf, unsigned int index, unsigned int plane, unsigned int outwidth, unsigned int outheight, unsigned char *ptr)
Copies the NvBufSurface plane memory content to a raw buffer plane for a specific batched buffer...
Specifies BT.601 colorspace - YUV420 ER multi-planar.
Specifies 8 bit GRAY scale - single plane.
Specifies BT.709 ER colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.
NvBufSurfaceMemType memType
Holds type of memory for buffers in the batch.
tag for Video Transform/Composite/Blend.
struct NvBufSurface NvBufSurface
Holds information about batched buffers.
bool is_protected
get buffer vpr information.
#define STRUCTURE_PADDING
Defines the default padding length for reserved fields of structures.
Holds Chroma Subsampling parameters for NvBufSurface allocation.
NvBufSurfacePlaneParams planeParams
Holds planewise information (width, height, pitch, offset, etc.).
Holds plane wise parameters of a buffer.
uint32_t width
Holds the width of the buffer.
Specifies BT.601 colorspace - YUV 4:2:2 planar.
uint32_t height
Holds the height of the buffer.
Specifies BT.601 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
Hold the information(extended) of single buffer in the batch.
uint64_t bufferDesc
Holds a DMABUF FD.
uint32_t height
Holds the height of the buffer.
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
NvBufSurfaceChromaSubsamplingParams chromaSubsampling
Chroma Subsampling parameters.
Specifies BT.709_ER colorspace - Y/CbCr 4:2:2 multi-planar.
Specifies ARGB-8-8-8-8 single plane.
Holds information about batched buffers.
void * _reserved[STRUCTURE_PADDING *NVBUF_MAX_PLANES]
NvBufSurfaceTag
Defines tags that identify the components requesting a memory allocation.
uint32_t offset[NVBUF_MAX_PLANES]
Holds the offsets of planes in bytes.
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Specifies BT.709 colorspace - Y/CbCr 4:2:0 multi-planar.
uint32_t width[NVBUF_MAX_PLANES]
Holds the widths of planes.
Specifies the default memory type, i.e.
NvBufSurfacePlaneParamsEx planeParamsex
plane wise extended info
uint32_t gpuId
Holds the GPU ID.
Specifies BT.601 colorspace - YUV ER 4:2:2 planar.
int NvBufSurfaceUnMap(NvBufSurface *surf, int index, int plane)
Unmaps previously mapped buffer(s).
uint32_t gpuId
Holds a GPU ID.
struct NvBufSurfaceParams NvBufSurfaceParams
Hold the information of single buffer in the batch.
Specifies BGRx-8-8-8-8 single plane.
Specifies BT.601 colorspace - Y/CbCr 4:2:2 10-bit semi-planar.
int Raw2NvBufSurface(unsigned char *ptr, unsigned int index, unsigned int plane, unsigned int inwidth, unsigned int inheight, NvBufSurface *Surf)
Copies the raw buffer plane memory content to the NvBufSurface plane memory of a specific batched buf...
Specifies BT.709 colorspace - YUV420 multi-planar.
Specifies BT.601 colorspace - YUV420 multi-planar.
NvBufSurfaceMemType memType
Holds the type of memory to be allocated.
NvBufSurfaceParamsEx * paramex
pointers of extended parameters of single buffer in the batch.
int32_t sizeofvaliddatainbytes
size of the valid data from the first to the last valid byte.
Specifies NVRM Handle type.
uint32_t height[NVBUF_MAX_PLANES]
Holds the heights of planes.
Specifies BT.709_ER colorspace - Y/CbCr 4:4:4 multi-planar.
Specifies BT.601 colorspace - YUV 4:2:2 planar.
int NvBufSurfaceCreate(NvBufSurface **surf, uint32_t batchSize, NvBufSurfaceCreateParams *params)
Allocates a batch of buffers.
Specifies Non-linear RGB BT.2020 colorspace - RGBA-10-10-10-2 planar.
Specifies BT.601 colorspace - YUV 4:2:2 planar.
struct NvBufSurfacePlaneParamsEx NvBufSurfacePlaneParamsEx
Holds plane wise parameters(extended) of a buffer.
void * _reserved[STRUCTURE_PADDING]
NvBufSurfaceLayout
Specifies layout formats for NvBufSurface video planes.
Specifies BT.709 colorspace - Y/CbCr ER 4:2:0 10-bit multi-planar.
Specifies BT.709 colorspace - Y/CbCr 10 bit 4:4:4 multi-planar.
uint32_t width
Holds the width of the buffer.
NvBufSurfaceLayout layout
Holds the surface layout.
bool isContiguous
Holds an "is contiguous" flag.
Specifies BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
Specifies xBGR-8-8-8-8 single plane.
Specifies RGB-32bit Floating point multiplanar plane.
Specifies NvBufSurface mapping type "read/write.".
NvBufSurfaceMemMapFlags
Defines mapping types of NvBufSurface.
void * eglImage
Holds a pointer to a mapped EGLImage.
Specifies BT.601 colorspace - Y/CbCr 4:4:4 multi-planar.
Specifies BT.709 colorspace - YUV420 ER multi-planar.
Specifies BT.601 colorspace - Y/CbCr ER 4:2:0 10-bit multi-planar.
Specifies BT.2020 colorspace - Y/CbCr 4:2:0 multi-planar.
NvBufSurfaceColorFormat colorFormat
Holds the color format of the buffer.
Specifies BT.601 colorspace - 10 bit YUV 4:2:2 interleaved.
NvBufSurfaceDisplayScanFormat displayscanformat
Display scan format.
int NvBufSurfaceMap(NvBufSurface *surf, int index, int plane, NvBufSurfaceMemMapFlags type)
Maps hardware batched buffers to the HOST or CPU address space.
uint32_t blockheightlog2[NVBUF_MAX_PLANES]
block height of the planes for blockLinear layout buffer.
Specifies Non-linear RGB BT.709 colorspace - BGRA-10-10-10-2 planar.
Specifies BT.709 colorspace - Y/CbCr 4:2:2 multi-planar.
Specifies BT.601 colorspace - Y/CrCb 4:2:0 10-bit multi-planar.
Specifies BGR-32bit Floating point multiplanar plane.
Specifies xRGB-8-8-8-8 single plane.
Specifies BT.601 colorspace - Y/CbCr 4:2:2 multi-planar.
Hold the pointers of mapped buffer.
uint32_t dataSize
Holds the amount of allocated memory.
uint32_t physicaladdress[NVBUF_MAX_PLANES]
physical address of allocated planes.
Specifies BT.709 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
int NvBufSurfaceMapEglImage(NvBufSurface *surf, int index)
Creates an EGLImage from the memory of one or more NvBufSurface buffers.
NvBufSurfaceDisplayScanFormat
Defines display scan formats for NvBufSurface video planes.
NvBufSurfaceChromaSubsamplingParams chromaSubsampling
chroma subsampling parameters.
void * _reserved[STRUCTURE_PADDING *NVBUF_MAX_PLANES]
Specifies BT.601 colorspace - 10 bit YUV ER 4:2:2 interleaved.
tag for Jpeg Encoder/Decoder.
int NvBufSurfaceMemSet(NvBufSurface *surf, int index, int plane, uint8_t value)
Fills each byte of the buffer(s) in an NvBufSurface with a provided value.
Specifies BT.601_ER colorspace - Y/CbCr 4:4:4 multi-planar.