25 #ifndef _NVBUF_UTILS_H_
26 #define _NVBUF_UTILS_H_
34 #include <EGL/eglext.h>
40 #define MAX_NUM_PLANES 4
45 #define MAX_COMPOSITE_FRAME 16
538 int NvBuffer2Raw (
int dmabuf_fd,
unsigned int plane,
unsigned int out_width,
unsigned int out_height,
unsigned char *ptr);
550 int Raw2NvBuffer (
unsigned char *ptr,
unsigned int plane,
unsigned int in_width,
unsigned int in_height,
int dmabuf_fd);
uint32_t layout[MAX_NUM_PLANES]
layout type of each planes of hardware buffer.
uint32_t num_planes
number of planes of hardware buffer.
int ExtractFdFromNvBuffer(void *nvbuf, int *dmabuf_fd)
Extracts the dmabuf_fd from the hardware buffer.
NvBufferColorFormat pixel_format
video format type of hardware buffer.
BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
uint32_t left
rectangle left.
NvBufferRect src_comp_rect[MAX_COMPOSITE_FRAME]
source rectangle coordinates of input buffers for composition.
BT.601 colorspace - YUV 4:2:2 planar.
BT.601 colorspace - YUV444 multi-planar.
tag for H264/H265/VP9 Video Decoder.
transform flag to set flip method.
float g
background color value for g.
uint32_t psize[MAX_NUM_PLANES]
size of each vodeo planes of hardware buffer.
transform flag to set filter type.
int NvReleaseFd(int dmabuf_fd)
Releases the dmabuf_fd buffer.
flag to set for composition.
transform flag to crop source rectangle.
Video flip rotate 270 degree clockwise.
Video flip with respect to Y-axis.
LegacyRGBA colorspace - BGRA-8-8-8-8 planar.
uint32_t input_buf_count
number of the input buffers to be composited.
tag for Video Transform/Composite.
int32_t memsize
size of the memory.
Video flip inverse transpode.
NvBufferRect dst_comp_rect[MAX_COMPOSITE_FRAME]
destination rectangle coordinates of input buffers for composition.
int32_t width
width of the buffer.
Video flip rotate 180 degree clockwise.
Holds composition background r,g,b colors.
int NvBufferMemUnMap(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
Unmaps the mapped virtual address of the plane.
BT.601 colorspace - YUV ER 4:2:2 planar.
BT.601 colorspace - Y/CbCr 4:2:0 multi-planar.
struct _NvBufferCreateParams NvBufferCreateParams
Holds the input parameters for hardware buffer creation.
BT.601 colorspace - Y/CrCb 4:2:0 10-bit multi-planar.
transform filter bilinear.
LegacyRGBA colorspace - XRGB-8-8-8-8 planar.
LegacyRGBA colorspace - ARGB-8-8-8-8 planar.
buffer payload with HW memory handle for specific memory size.
Holds parameters for a hardware buffer.
uint32_t nv_buffer_size
size of hardware buffer.
int NvBuffer2Raw(int dmabuf_fd, unsigned int plane, unsigned int out_width, unsigned int out_height, unsigned char *ptr)
Copies the NvBuffer plane contents to a raw buffer plane.
transform filter nearest.
uint32_t composite_flag
flag to indicate which of the composition/blending parameters are valid.
uint32_t height
rectangle height.
int Raw2NvBuffer(unsigned char *ptr, unsigned int plane, unsigned int in_width, unsigned int in_height, int dmabuf_fd)
Copies raw buffer plane contents to an NvBuffer plane.
NvBufferTransform_Flag
Defines flags to indicate for valid transform.
int NvBufferMemSyncForCpu(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
Syncs the HW memory cache for the CPU.
NvBufferComposite_Flag
Defines flags that specify valid composition/blending operations.
int NvBufferMemMap(int dmabuf_fd, unsigned int plane, NvBufferMemFlags memflag, void **pVirtAddr)
Gets the memory-mapped virtual address of the plane.
BT.709 colorspace - Y/CbCr 4:2:0 multi-planar.
BT.601 colorspace - YUV 4:2:2 planar.
uint32_t width
rectangle width.
BT.601 colorspace - YUV ER 4:2:2 planar.
NvBufferTag
Defines tags to associate, while allocation of NvBuffer.
NvBufferSession NvBufferSessionCreate(void)
Creates a new NvBufferSession for parallel scheduling of buffer transformations and compositions...
float b
background color value for b.
#define MAX_NUM_PLANES
Defines the maximum number of planes for video frame.
BT.601 colorspace - YVU420 ER multi-planar.
NvBufferColorFormat colorFormat
colorformat of the buffer.
BT.601 colorspace - YUV420 multi-planar.
struct _NvBufferCompositeParams NvBufferCompositeParams
Holds parameters related to compositing/blending.
NvBufferCompositeBackground composite_bgcolor
background color values for composition.
float dst_comp_rect_alpha[MAX_COMPOSITE_FRAME]
alpha values of input buffers for the blending.
NvBufferPayloadType payloadType
payload type of the buffer.
uint32_t height[MAX_NUM_PLANES]
height of each planes of hardware buffer.
tag for Jpeg Encoder/Decoder.
struct _NvBufferParams NvBufferParams
Holds parameters for a hardware buffer.
int NvBufferMemSyncForDevice(int dmabuf_fd, unsigned int plane, void **pVirtAddr)
Syncs the HW memory cache sync for the device.
uint32_t width[MAX_NUM_PLANES]
width of each planes of hardware buffer.
uint32_t pitch[MAX_NUM_PLANES]
pitch of each planes of hardware buffer.
int NvBufferCreate(int *dmabuf_fd, int width, int height, NvBufferLayout layout, NvBufferColorFormat colorFormat)
Allocates a HW buffer (deprecated).
EGLImageKHR NvEGLImageFromFd(EGLDisplay display, int dmabuf_fd)
Creates an EGLImage instance from dmabuf-fd.
BT.601 colorspace - YUV420 ER multi-planar.
uint32_t dmabuf_fd
dmabuf_fd of hardware buffer.
BT.601 colorspace - YUV ER 4:2:2 planar.
BT.709 colorspace - YUV420 ER multi-planar.
uint32_t offset[MAX_NUM_PLANES]
memory offset values of each video planes of hardware buffer.
buffer payload with HW memory handle for set of planes.
BT.601 colorspace - YUV420 multi-planar.
uint32_t top
rectangle top.
int32_t memsize
size of the memory.
int NvBufferTransform(int src_dmabuf_fd, int dst_dmabuf_fd, NvBufferTransformParams *transform_params)
Transforms one DMA buffer to another DMA buffer.
int NvBufferGetSize(void)
This method can be used to get HW Buffer struct size.
Video flip with respect to X-axis.
BT.709 colorspace - Y/CbCr ER 4:2:0 multi-planar.
void * nv_buffer
pointer to hardware buffer memory.
void NvBufferSessionDestroy(NvBufferSession session)
Destroys an exisiting NvBufferSession.
Holds the input parameters for hardware buffer creation.
int NvBufferGetParams(int dmabuf_fd, NvBufferParams *params)
Gets buffer parameters.
NvBufferPayloadType
Defines Payload types for NvBuffer.
int NvBufferComposite(int *src_dmabuf_fds, int dst_dmabuf_fd, NvBufferCompositeParams *composite_params)
Composites multiple input DMA buffers to one output DMA buffer.
int32_t height
height of the buffer.
BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
NvBufferTransform_Filter
Defines transform video filter types.
BT.601 colorspace - Y/CbCr ER 4:2:0 multi-planar.
BT.601 colorspace - Y/CbCr 4:2:0 10-bit multi-planar.
BT.601 colorspace - Y/CbCr 4:2:0 12-bit multi-planar.
BT.601 colorspace - Y/CrCb 4:2:0 12-bit multi-planar.
BT.709 colorspace - YUV420 multi-planar.
NvBufferLayout layout
layout of the buffer.
NvBufferTag nvbuf_tag
tag to associate with the buffer.
float r
background color value for r.
BT.601 colorspace - YUV 4:2:2 planar.
struct _NvBufferTransformParams NvBufferTransformParams
Holds parameters for buffer transform functions.
transform flag to crop destination rectangle.
Optical flow SAD calculation Buffer format.
NvBufferPayloadType payloadType
payload type of the buffer.
BT.2020 colorspace - Y/CbCr 4:2:0 multi-planar.
NvBufferTransform_Flip
Defines video flip methods.
BT.601 colorspace - YUV 4:2:2 planar.
NvBufferLayout
Defines Layout formats for NvBuffer video planes.
tag for H264/H265 Video Encoder.
int NvBufferDestroy(int dmabuf_fd)
Destroys a HW buffer.
int NvBufferCreateEx(int *dmabuf_fd, NvBufferCreateParams *input_params)
Allocates a HW buffer.
Holds coordinates for a rectangle.
NvBufferColorFormat
Defines color formats for NvBuffer.
Holds parameters related to compositing/blending.
Video flip rotate 90 degree clockwise.
struct _NvBufferSession * NvBufferSession
Holds an opaque NvBuffer session type required for parallel buffer tranformations and compositions...
BT.2020 colorspace - YUV420 multi-planar.
BT.601 colorspace - YUV ER 4:2:2 planar.
int NvDestroyEGLImage(EGLDisplay display, EGLImageKHR eglImage)
Destroys an EGLImage object.
NvBufferSession session
NvBufferSession to be used for composition.
flag to set for blending.
NvBufferMemFlags
Defines memory access flags for NvBuffer.
#define MAX_COMPOSITE_FRAME
Defines the maximum number of input video frames that can be used for composition.