libxcoder  5.2.0
ni_quadra_filter_api.h File Reference

NETINT filters API header file. More...

#include <assert.h>
#include <ctype.h>
#include <inttypes.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "ni_macro_defs_quadra.h"

Go to the source code of this file.

Data Structures

struct  _ni_fifo_buffer_t
 
struct  _ni_quadra_frame_config
 
struct  _ni_quadra_network_layer_params_t
 
struct  _ni_quadra_network_layer_info
 
struct  _ni_quadra_network_layer_offset
 
struct  _ni_quadra_network_data
 
struct  _ni_quadra_frameclone_desc
 
struct  _ni_quadra_filter_t
 
struct  _ni_quadra_split_context_t
 
struct  _niquadraFrameSurface1
 
struct  NIFramesContext
 
struct  AVNIDeviceContext
 
struct  _ni_quadra_scaler_drawbox_params_t
 
struct  _ni_quadra_scaler_watermark_params_t
 
struct  _ni_quadra_scaler_multi_drawbox_params_t
 
struct  _ni_quadra_scaler_multi_watermark_params_t
 
struct  _ni_quadra_card_info
 
struct  _ni_quadra_hw_device_info
 
struct  _ni_quadra_hw_device_info_encoder_param
 
struct  _ni_quadra_hw_device_info_decoder_param
 
struct  _ni_quadra_hw_device_info_scaler_param
 
struct  _ni_quadra_hw_device_info_ai_param
 
struct  _ni_quadra_hw_device_info_threshold_param
 
struct  _ni_quadra_hw_device_info_coder_param
 
struct  _ni_quadra_device_queue
 
struct  _ni_quadra_device_pool
 

Macros

#define LIB_API
 
#define NI_QUADRA_BEST_MODEL_LOAD_STR   "bestmodelload"
 
#define NI_QUADRA_BEST_REAL_LOAD_STR   "bestload"
 
#define NI_QUADRA_MAX_KEEP_ALIVE_TIMEOUT   100
 
#define NI_QUADRA_MIN_KEEP_ALIVE_TIMEOUT   1
 
#define NI_QUADRA_DEFAULT_KEEP_ALIVE_TIMEOUT   3
 
#define MAX_QUADRA_NUM_FRAMEPOOL_HWAVFRAME   128
 
#define NI_QUADRA_MAX_NUM_DATA_POINTERS   4
 
#define NI_QUADRA_MAX_NUM_AUX_DATA_PER_FRAME   16
 
#define NI_QUADRA_MAX_NUM_OF_DECODER_OUTPUTS   3
 
#define NI_QUADRA_MAX_PPU_PARAM_EXPR_CHAR   20
 
#define NI_QUADRA_MAX_FIFO_CAPACITY   120
 
#define NI_QUADRA_NOPTS_VALUE   ((int64_t)UINT64_C(0x8000000000000000))
 
#define NI_QUADRA_MAX_WIDTH   8192
 
#define NI_QUADRA_MIN_WIDTH   144
 
#define NI_QUADRA_MAX_HEIGHT   8192
 
#define NI_QUADRA_MIN_HEIGHT   128
 
#define NIALIGN(x, a)   (((x) + (a)-1) & ~((a)-1))
 
#define NIMAX(a, b)   ((a) > (b) ? (a) : (b))
 
#define NIMIN(a, b)   ((a) > (b) ? (b) : (a))
 
#define NI_QUADRA_SCALER_FLAG_IO   0x0001 /* 0 = source frame, 1 = destination frame */
 
#define NI_QUADRA_SCALER_FLAG_PC   0x0002 /* 0 = single allocation, 1 = create pool */
 
#define NI_QUADRA_SCALER_FLAG_PA   0x0004 /* 0 = straight alpha, 1 = premultiplied alpha */
 
#define NI_QUADRA_SCALER_FLAG_P2   0x0008 /* 0 = normal allocation, 1 = P2P allocation */
 
#define NI_QUADRA_SCALER_FLAG_FCE   0x0010 /* 0 = no fill color, 1 = fill color enabled */
 
#define NI_QUADRA_SCALER_FLAG_CS   0x0020 /* 0 = BT.709, 1 = BT.2020 */
 
#define NI_QUADRA_SCALER_FLAG_CMP   0x0800 /* 0 = no compress, 1 = compress*/
 
#define NI_QUADRA_AI_FLAG_IO   0x0001 /* 0 = source frame, 1 = destination frame */
 
#define NI_QUADRA_AI_FLAG_PC   0x0002 /* 0 = single allocation, 1 = create pool */
 
#define NI_QUADRA_MAX_RESOLUTION_WIDTH   8192
 
#define NI_QUADRA_MAX_RESOLUTION_HEIGHT   8192
 
#define NI_QUADRA_MIN_RESOLUTION_WIDTH_SCALER   32
 
#define NI_QUADRA_MIN_RESOLUTION_HEIGHT_SCALER   32
 
#define NI_QUADRA_MAX_SUPPORT_DRAWBOX_NUM   5
 
#define NI_QUADRA_MAX_SUPPORT_WATERMARK_NUM   6
 
#define NI_QUADRA_MAX_DEVICE_CNT   128
 

Typedefs

typedef __gnuc_va_list va_list
 
typedef struct _ni_fifo_buffer_t ni_fifo_buffer_t
 
typedef enum _ni_quadra_pixel_planar_format ni_quadra_pixel_planar_format
 
typedef enum _ni_quadra_scaler_opcode ni_quadra_scaler_opcode_t
 
typedef enum _ni_quadra_codec_format ni_quadra_codec_format_t
 
typedef struct _ni_quadra_frame_config ni_quadra_frame_config_t
 
typedef struct _ni_quadra_network_layer_params_t ni_quadra_network_layer_params_t
 
typedef struct _ni_quadra_network_layer_info ni_quadra_network_layer_info_t
 
typedef struct _ni_quadra_network_layer_offset ni_quadra_network_layer_offset_t
 
typedef struct _ni_quadra_network_data ni_quadra_network_data_t
 
typedef struct _ni_quadra_frameclone_desc ni_quadra_frameclone_desc_t
 
typedef enum ni_quadra_codec_hw_actions ni_quadra_codec_hw_actions_t
 This is an enumeration for hw actions. More...
 
typedef struct _ni_quadra_filter_t ni_quadra_filter_t
 
typedef struct _ni_quadra_split_context_t ni_quadra_split_context_t
 
typedef struct _niquadraFrameSurface1 niquadraFrameSurface1_t
 
typedef struct NIFramesContext NIFramesContext
 
typedef struct AVNIDeviceContext AVNIDeviceContext
 
typedef struct _ni_quadra_scaler_drawbox_params_t ni_quadra_scaler_drawbox_params_t
 
typedef struct _ni_quadra_scaler_watermark_params_t ni_quadra_scaler_watermark_params_t
 
typedef struct _ni_quadra_scaler_multi_drawbox_params_t ni_quadra_scaler_multi_drawbox_params_t
 
typedef struct _ni_quadra_scaler_multi_watermark_params_t ni_quadra_scaler_multi_watermark_params_t
 
typedef struct _ni_quadra_card_info ni_quadra_card_info_t
 
typedef struct _ni_quadra_hw_device_info ni_quadra_hw_device_info_t
 
typedef struct _ni_quadra_hw_device_info_encoder_param ni_quadra_hw_device_info_encoder_param_t
 
typedef struct _ni_quadra_hw_device_info_decoder_param ni_quadra_hw_device_info_decoder_param_t
 
typedef struct _ni_quadra_hw_device_info_scaler_param ni_quadra_hw_device_info_scaler_param_t
 
typedef struct _ni_quadra_hw_device_info_ai_param ni_quadra_hw_device_info_ai_param_t
 
typedef struct _ni_quadra_hw_device_info_threshold_param ni_quadra_hw_device_info_threshold_param_t
 
typedef struct _ni_quadra_hw_device_info_coder_param ni_quadra_hw_device_info_coder_param_t
 
typedef struct _ni_quadra_device_queue ni_quadra_device_queue_t
 
typedef struct _ni_quadra_device_pool ni_quadra_device_pool_t
 

Enumerations

enum  ni_quadra_log_level_t {
  NI_QUADRA_LOG_INVALID = -1, NI_QUADRA_LOG_NONE = 0, NI_QUADRA_LOG_FATAL = 1, NI_QUADRA_LOG_ERROR = 2,
  NI_QUADRA_LOG_INFO = 3, NI_QUADRA_LOG_DEBUG = 4, NI_QUADRA_LOG_TRACE = 5
}
 
enum  _ni_quadra_pixel_planar_format { NI_QUADRA_PIXEL_PLANAR_FORMAT_SEMIPLANAR = 0, NI_QUADRA_PIXEL_PLANAR_FORMAT_PLANAR = 1, NI_QUADRA_PIXEL_PLANAR_FORMAT_TILED4X4 = 2, NI_QUADRA_PIXEL_PLANAR_MAX }
 
enum  _ni_quadra_scaler_opcode {
  NI_QUADRA_SCALER_OPCODE_SCALE = 0, NI_QUADRA_SCALER_OPCODE_CROP = 1, NI_QUADRA_SCALER_OPCODE_FLIP = 1, NI_QUADRA_SCALER_OPCODE_PAD = 2,
  NI_QUADRA_SCALER_OPCODE_OVERLAY = 3, NI_QUADRA_SCALER_OPCODE_STACK = 4, NI_QUADRA_SCALER_OPCODE_ROTATE = 5, NI_QUADRA_SCALER_OPCODE_DRAWBOX = 6,
  NI_QUADRA_SCALER_OPCODE_IPOVLY = 7, NI_QUADRA_SCALER_OPCODE_WATERMARK = 8, NI_QUADRA_SCALER_OPCODE_DELOGO = 9, NI_QUADRA_SCALER_OPCODE_MERGE = 10
}
 
enum  _ni_quadra_codec_format {
  NI_QUADRA_CODEC_FORMAT_H264 = 0, NI_QUADRA_CODEC_FORMAT_H265 = 1, NI_QUADRA_CODEC_FORMAT_VP9 = 2, NI_QUADRA_CODEC_FORMAT_JPEG = 3,
  NI_QUADRA_CODEC_FORMAT_AV1 = 4
}
 
enum  ni_quadra_retcode_t {
  NI_QUADRA_RET_SUCCESS = 0, NI_QUADRA_SEQ_CHANGE_DRAINING = -1024, NI_QUADRA_ERROR_VPU_RECOVERY = -1023, NI_QUADRA_ERROR_INVALID_SESSION = -1022,
  NI_QUADRA_EAGAIN = -1021, NI_QUADRA_ERROR = -1020, NI_QUADRA_PARAM_WARNING_DEPRECATED = -1019
}
 
enum  ni_quadra_device_type_t {
  NI_QUADRA_DEVICE_TYPE_MIN = -1, NI_QUADRA_DEVICE_TYPE_DECODER = 0, NI_QUADRA_DEVICE_TYPE_ENCODER = 1, NI_QUADRA_DEVICE_TYPE_SCALER = 2,
  NI_QUADRA_DEVICE_TYPE_AI = 3, NI_QUADRA_DEVICE_TYPE_XCODER_MAX = 4, NI_QUADRA_DEVICE_TYPE_UPLOAD, NI_QUADRA_DEVICE_TYPE_MAX = 5
}
 
enum  ni_quadra_pix_fmt_t {
  NI_QUADRA_PIX_FMT_YUV420P = 0, NI_QUADRA_PIX_FMT_YUV420P10LE = 1, NI_QUADRA_PIX_FMT_NV12 = 2, NI_QUADRA_PIX_FMT_P010LE = 3,
  NI_QUADRA_PIX_FMT_RGBA = 4, NI_QUADRA_PIX_FMT_BGRA = 5, NI_QUADRA_PIX_FMT_ARGB = 6, NI_QUADRA_PIX_FMT_ABGR = 7,
  NI_QUADRA_PIX_FMT_BGR0 = 8, NI_QUADRA_PIX_FMT_BGRP = 9, NI_QUADRA_PIX_FMT_NV16 = 10, NI_QUADRA_PIX_FMT_YUYV422 = 11,
  NI_QUADRA_PIX_FMT_UYVY422 = 12, NI_QUADRA_PIX_FMT_8_TILED4X4 = 13, NI_QUADRA_PIX_FMT_10_TILED4X4 = 14, NI_QUADRA_PIX_FMT_NONE = 15,
  NI_QUADRA_PIX_FMT_YUV420P10BE = 16, NI_QUADRA_PIX_FMT_YUVJ420P = 17
}
 
enum  ni_quadra_codec_hw_actions {
  NI_QUADRA_CODEC_HW_NONE = 0, NI_QUADRA_CODEC_HW_ENABLE = (1 << 0), NI_QUADRA_CODEC_HW_DOWNLOAD = (1 << 1), NI_QUADRA_CODEC_HW_UPLOAD = (1 << 2),
  NI_QUADRA_CODEC_HW_RSVD = (1 << 3), NI_QUADRA_CODEC_HW_PAYLOAD_OFFSET = 4
}
 This is an enumeration for hw actions. More...
 

Functions

LIB_API int ni_quadra_init_filters (ni_quadra_filter_t *nifilter)
 Init filter. More...
 
LIB_API int ni_quadra_build_frame_pool (ni_quadra_filter_t *nifilter, int width, int height, int out_format, int pool_size)
 Alloc frame pool for filter. More...
 
LIB_API int ni_quadra_filter_frame_buffer_alloc_hwenc (ni_quadra_filter_t *nifilter, int video_width, int video_height, int extra_len)
 Allocate memory for the hwDescriptor buffer based on provided parameters taking into account pic size and extra data. More...
 
LIB_API int ni_quadra_filter_device_alloc_frame (ni_quadra_filter_t *nifilter, int width, int height, int format, int options, int rectangle_width, int rectangle_height, int rectangle_x, int rectangle_y, int rgba_color, int frame_index, int type)
 Allocate a frame on the device for 2D engine or AI engine to work on based on provided parameters. More...
 
LIB_API int ni_quadra_filter_device_alloc_dst_frame (ni_quadra_filter_t *nifilter, niquadraFrameSurface1_t *p_hwdesc, int type)
 Allocate a frame on the device and return the frame index. More...
 
LIB_API int ni_quadra_filter_device_clone_hwframe (ni_quadra_filter_t *nifilter, ni_quadra_frameclone_desc_t *p_frameclone_desc)
 Copy the data of src hwframe to dst hwframe. More...
 
LIB_API int ni_quadra_device_session_read_hwdesc (void *p_ctx, void *p_data, int device_type)
 Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from decoder If device_type is NI_DEVICE_TYPE_SCALER reads data hwdesc from scaler. More...
 
LIB_API int ni_quadra_device_session_read (void *p_ctx, void *p_data, int device_type)
 Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data packet from decoder If device_type is NI_DEVICE_TYPE_ENCODER reads data frame from encoder If device_type is NI_DEVICE_TYPE_AI reads data frame from AI engine. More...
 
LIB_API int ni_quadra_scaler_set_drawbox_params (ni_quadra_filter_t *nifilter, ni_quadra_scaler_drawbox_params_t *p_params)
 Send a p_config command to configure scaling drawbox parameters. More...
 
LIB_API int ni_quadra_scaler_set_watermark_params (ni_quadra_filter_t *nifilter, ni_quadra_scaler_watermark_params_t *p_params)
 Send a p_config command to configure watermark parameters. More...
 
LIB_API int ni_quadra_filter_get_output_data (ni_quadra_filter_t *nifilter, uint8_t *data, int width, int height)
 Get data from device. More...
 
uint8_t * ni_quadra_filter_get_data3 (void *p_frame)
 Get niframe data3 from device. More...
 
LIB_API int ni_quadra_filter_drawtext_prep_frames (void **niframe)
 prepare frames for ni_drawtext filter More...
 
LIB_API int ni_quadra_filter_frame_buffer_alloc_dl (void *niframe, int video_width, int video_height, int pixel_format)
 Allocate preliminary memory for the frame buffer based on provided parameters. More...
 
LIB_API void ni_quadra_filter_close (ni_quadra_filter_t *nifilter)
 Close filter. More...
 
LIB_API int ni_quadra_ai_config_network_binary (ni_quadra_filter_t *nifilter, ni_quadra_network_data_t *p_network, const char *file)
 configure a network context based with the network binary More...
 
LIB_API int ni_quadra_ai_config_hvsplus (ni_quadra_filter_t *nifilter, ni_quadra_network_data_t *p_network, int nb_width, int nb_height, int level, int format)
 configure a hvsplus context based with the network binary More...
 
LIB_API int ni_quadra_ai_frame_buffer_alloc (void *p_frame, ni_quadra_network_data_t *p_network)
 Allocate input layers memory for AI frame buffer based on provided parameters taking into account width, height, format defined by network. More...
 
LIB_API int ni_quadra_ai_packet_buffer_alloc (void *p_pkt, ni_quadra_network_data_t *p_network)
 Allocate output layers memory for the packet buffer based on provided network. More...
 
LIB_API uint32_t ni_quadra_ai_network_layer_dims (ni_quadra_network_layer_params_t *p_param)
 Get dims from ni_quadra_network_layer_params_t. More...
 
LIB_API int ni_quadra_network_layer_convert_output (void *p_data, float *dst, uint32_t num, ni_quadra_network_data_t *p_network, uint32_t layer)
 Convert data from nipacket to dst data. More...
 
int ni_quadra_frame_buffer_alloc_pixfmt (void *p_frame, int pixel_format, int video_width, int video_height, int linesize[], int alignment, int extra_len)
 Allocate memory for the frame buffer based on provided parameters taking into account the pixel format, width, height, stride, alignment, and extra data. More...
 
int ni_quadra_device_session_hwdl (void *p_ctx, void *p_data, niquadraFrameSurface1_t *hwdesc)
 Reads YUV data from hw descriptor stored location on device. More...
 
LIB_API int ni_quadra_init_internal_session (NIFramesContext *ni_ctx)
 Init filter session context only malloc session. More...
 
LIB_API int ni_quadra_init_split_rsrc (NIFramesContext *ni_ctx, int w, int h)
 Init filter split context malloc session and set it default. More...
 
LIB_API int ni_quadra_filter_frames_init (NIFramesContext *ni_ctx, int *width, int *height, int ni_fmat, int keep_alive_time)
 Init filter frame context and set value to session context. More...
 
LIB_API int ni_quadra_filter_frames_close (NIFramesContext *ni_ctx, int pool_size)
 Close filter context and frame. More...
 
LIB_API void ni_quadra_filter_device_close (AVNIDeviceContext *ni_hw_ctx)
 Close device. More...
 
LIB_API int ni_quadra_upload_device_session_open (NIFramesContext *ni_ctx)
 Open hwupload filter. More...
 
LIB_API int ni_quadra_filter_device_session_init_framepool (NIFramesContext *ni_ctx, uint32_t pool_size, uint32_t pool)
 Sends frame pool setup info to device. More...
 
LIB_API int ni_quadra_filter_device_create (AVNIDeviceContext *ni_hw_ctx, const char *device)
 Sends frame pool setup info to device. More...
 
LIB_API int ni_quadra_filter_get_buffer (NIFramesContext *ni_ctx, uint8_t **dstbuf, uint8_t **dstdata, uint32_t *buf_size, int width, int height, int is_planar)
 Sends frame pool setup info to device. More...
 
LIB_API void ni_quadra_filter_frame_free (void *opaque, uint8_t *data)
 Free filter frame. More...
 
LIB_API int ni_quadra_filter_hwup_frame (NIFramesContext *ni_ctx, niquadraFrameSurface1_t *dst_surf, int width, int height, int ni_fmat, int nb_planes, const int *linesize, uint8_t **src_data)
 Upload frame. More...
 
LIB_API int ni_quadra_filter_hwdl_frame (NIFramesContext *ni_ctx, niquadraFrameSurface1_t *src_surf, int width, int height, int ni_fmat, int nb_planes, const int *linesize, uint8_t **dst_data)
 Download frame. More...
 
LIB_API void ni_quadra_split_ctx_set (NIFramesContext *ni_ctx, niquadraFrameSurface1_t *ni_surf, niquadraFrameSurface1_t *ni_surf_1, niquadraFrameSurface1_t *ni_surf_2, int num_extra_outputs)
 Split context set. More...
 
LIB_API int ni_quadra_get_device_id (void *session_ctx)
 Get session device id. More...
 
LIB_API uint32_t ni_quadra_get_session_id (void *session_ctx)
 Get session device session id. More...
 
LIB_API void ni_quadra_device_close (int32_t handle)
 Close device handle. More...
 
LIB_API int32_t ni_quadra_get_device_handle (void *session_ctx)
 Get session device handle id. More...
 
LIB_API void ni_quadra_set_device_handle (void *session_ctx, int32_t handle)
 Set session device handle. More...
 
LIB_API void ni_quadra_filter_session_dl_set (void *session_ctx, bool value)
 Set download filter session context. More...
 
LIB_API int ni_quadra_device_session_copy (void *src_ctx, void *dst_ctx)
 Copy filter session context. More...
 
LIB_API void ni_quadra_session_timestamp_copy (void *src_ctx, void *dst_ctx)
 Copy filter session context. More...
 
LIB_API int ni_quadra_get_session_runstatus (void *session_ctx)
 Get session context run status. More...
 
LIB_API void ni_quadra_set_session_runstatus (void *session_ctx, int status)
 Set session context run status. More...
 
LIB_API int ni_quadra_get_session_status (void *session_ctx)
 Get session context status. More...
 
LIB_API int ni_quadra_get_session_blkiohandle (void *session_ctx)
 Get session context blk_io_handle. More...
 
LIB_API uint16_t ni_quadra_get_frame_idx (void *niframe)
 Get niframui16FrameIdxe. More...
 
LIB_API uint8_t * ni_quadra_get_niframe (void *niframe)
 Get niframe address. More...
 
LIB_API uint8_t * ni_quadra_get_frame_buffer (void *niframe)
 Get niframe buffer address. More...
 
LIB_API uint32_t ni_quadra_get_frame_buffer_size (void *niframe)
 Get niframe buffer size. More...
 
LIB_API uint8_t ** ni_quadra_get_frame_data (void *niframe)
 Get niframe data address. More...
 
LIB_API uint8_t * ni_quadra_get_packet_data (void *nipacket)
 Get nipacket data address. More...
 
LIB_API uint32_t ni_quadra_get_packet_data_len (void *nipacket)
 Get nipacket data len. More...
 
LIB_API void ni_quadra_get_frame_data_len (void *niframe, uint32_t *dst_datalen)
 Get niframe data datalen. More...
 
LIB_API int ni_quadra_filter_hwframe_recycle (void *session_ctx, void *niframe)
 Recycle a frame buffer on card. More...
 
LIB_API int ni_quadra_filter_device_config_frame (void *p_ctx, ni_quadra_frame_config_t *p_cfg)
 Configure the 2D engine to work based on provided parameters. More...
 
LIB_API int ni_quadra_hwframe_buffer_recycle (niquadraFrameSurface1_t *surface, int32_t device_handle)
 Recycle a frame buffer on card. More...
 
LIB_API void ni_quadra_get_hw_yuv420p_dim (int width, int height, int factor, int is_semiplanar, int plane_stride[4], int plane_height[4])
 Get dimension information of Netint HW YUV420p frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_encoder_frame_buffer_alloc for buffer allocation. More...
 
LIB_API int ni_quadra_get_seiset_size ()
 Recycle a frame buffer on card. More...
 
LIB_API ni_fifo_buffer_tni_fifo_initialize (uint32_t number_of_buffers, uint32_t size)
 Initialize a fifo buffer. More...
 
LIB_API void ni_fifo_free (ni_fifo_buffer_t *p_fifo)
 Free a fifo. More...
 
LIB_API int ni_fifo_is_full (ni_fifo_buffer_t *p_fifo)
 Check if a fifo is full. More...
 
LIB_API int ni_fifo_is_empty (ni_fifo_buffer_t *p_fifo)
 Check if a fifo is empty. More...
 
LIB_API uint32_t ni_fifo_number_of_buffers (ni_fifo_buffer_t *p_fifo)
 Get number of buffers used in fifo. More...
 
LIB_API uint8_t * ni_fifo_generic_write (ni_fifo_buffer_t *p_fifo)
 Get free buffer to write in the fifo. More...
 
LIB_API uint8_t * ni_fifo_generic_read (ni_fifo_buffer_t *p_fifo)
 Get first filled buffer to read in the fifo. More...
 
LIB_API int ni_fifo_return_read (ni_fifo_buffer_t *p_fifo)
 Push back the last read buffer to the fifo. More...
 
const LIB_API uint8_t * ni_find_start_code (const uint8_t *p, const uint8_t *end, uint32_t *state)
 Find the next start code. More...
 
LIB_API void ni_quadra_log_set_level (int level)
 Set ni_log_level. More...
 
LIB_API void ni_quadra_log_set_callback (void(*log_callback)(int, const char *, va_list))
 Set ni_log() callback. More...
 
LIB_API ni_quadra_log_level_t ni_quadra_ff_to_ni_log_level (int fflog_level)
 Convert ffmpeg log level integer to appropriate ni_quadra_log_level_t. More...
 
LIB_API ni_quadra_hw_device_info_coder_param_tni_quadra_create_hw_device_info_coder_param (int mode)
 Create a pointer to hw_device_info_coder_param_t instance. This instance will be created and set to default vaule by param mode.You may change the resolution, fps, bit_8_10 and other vaule you want to set. More...
 
LIB_API void ni_quadra_destory_hw_device_info_coder_param (ni_quadra_hw_device_info_coder_param_t *p_quadra_hw_device_info_coder_param)
 Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param. More...
 
LIB_API ni_quadra_hw_device_info_tni_quadra_hw_device_info_alloc (int device_type_num, int avaliable_card_num)
 Create a pointer to ni_hw_device_info_quadra_t instance . More...
 
LIB_API void ni_quadra_hw_device_info_free (ni_quadra_hw_device_info_t *p_hw_device_info)
 Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param. More...
 
LIB_API int ni_quadra_check_hw_info (ni_quadra_hw_device_info_t **pointer_to_p_hw_device_info, int task_mode, ni_quadra_hw_device_info_threshold_param_t *hw_info_threshold_param, int preferential_device_type, ni_quadra_hw_device_info_coder_param_t *coder_param, int hw_mode, int consider_mem)
 check hw info, return the appropriate card number to use depends on the load&task_num&used resource More...
 
LIB_API int ni_quadra_rsrc_get_device_by_block_name (const char *blk_name, ni_quadra_device_type_t device_type)
 Get GUID of the device by block device name and type. More...
 
LIB_API int ni_quadra_device_session_open (void *p_ctx, ni_quadra_device_type_t device_type)
 Open a new device session depending on the device_type parameter If device_type is NI_DEVICE_TYPE_DECODER opens decoding session If device_type is NI_DEVICE_TYPE_ENCODER opens encoding session If device_type is NI_DEVICE_TYPE_SCALER opens scaling session. More...
 
LIB_API int ni_quadra_device_session_write (void *p_ctx, void *p_data, ni_quadra_device_type_t device_type)
 Sends data to the device If device_type is NI_DEVICE_TYPE_DECODER sends data packet to decoder If device_type is NI_DEVICE_TYPE_ENCODER sends data frame to encoder If device_type is NI_DEVICE_TYPE_AI sends data frame to ai engine. More...
 
LIB_API int ni_quadra_packet_buffer_free (void *p_data)
 Free packet buffer that was previously allocated with ni_packet_buffer_alloc. More...
 
LIB_API int ni_quadra_frame_buffer_free (void *p_data)
 Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame_buffer_alloc or ni_frame_buffer_alloc_nv. More...
 
LIB_API ni_quadra_device_pool_tni_quadra_rsrc_get_device_pool (void)
 Create and return the allocated ni_device_pool_t struct. More...
 
LIB_API int ni_quadra_device_session_close (void *p_ctx, int eos_recieved, ni_quadra_device_type_t device_type)
 Close device session that was previously opened by calling ni_device_session_open() If device_type is NI_DEVICE_TYPE_DECODER closes decoding session If device_type is NI_DEVICE_TYPE_ENCODER closes encoding session If device_type is NI_DEVICE_TYPE_SCALER closes scaling session. More...
 
LIB_API void ni_quadra_device_session_context_clear (void *p_ctx)
 Clear already allocated session context. More...
 
LIB_API int ni_quadra_frame_buffer_alloc_hwenc (void *niframe, int video_width, int video_height, int extra_len)
 
LIB_API void ni_quadra_set_framerate (void *p_ctx, int num, int den)
 
LIB_API int ni_quadra_get_session_packet_num (void *session_ctx)
 Get session_ctx send/recive packet number. More...
 
LIB_API int ni_quadra_get_session_frame_num (void *session_ctx)
 Get session_ctx send/recieve frame number. More...
 

Detailed Description

NETINT filters API header file.


Definition in file ni_quadra_filter_api.h.

Macro Definition Documentation

◆ LIB_API

#define LIB_API

Definition at line 39 of file ni_quadra_filter_api.h.

◆ MAX_QUADRA_NUM_FRAMEPOOL_HWAVFRAME

#define MAX_QUADRA_NUM_FRAMEPOOL_HWAVFRAME   128

Definition at line 82 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_AI_FLAG_IO

#define NI_QUADRA_AI_FLAG_IO   0x0001 /* 0 = source frame, 1 = destination frame */

Definition at line 131 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_AI_FLAG_PC

#define NI_QUADRA_AI_FLAG_PC   0x0002 /* 0 = single allocation, 1 = create pool */

Definition at line 132 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_BEST_MODEL_LOAD_STR

#define NI_QUADRA_BEST_MODEL_LOAD_STR   "bestmodelload"

Definition at line 72 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_BEST_REAL_LOAD_STR

#define NI_QUADRA_BEST_REAL_LOAD_STR   "bestload"

Definition at line 73 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_DEFAULT_KEEP_ALIVE_TIMEOUT

#define NI_QUADRA_DEFAULT_KEEP_ALIVE_TIMEOUT   3

Definition at line 79 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_DEVICE_CNT

#define NI_QUADRA_MAX_DEVICE_CNT   128

Definition at line 146 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_FIFO_CAPACITY

#define NI_QUADRA_MAX_FIFO_CAPACITY   120

Definition at line 98 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_HEIGHT

#define NI_QUADRA_MAX_HEIGHT   8192

Definition at line 108 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_KEEP_ALIVE_TIMEOUT

#define NI_QUADRA_MAX_KEEP_ALIVE_TIMEOUT   100

Definition at line 77 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_NUM_AUX_DATA_PER_FRAME

#define NI_QUADRA_MAX_NUM_AUX_DATA_PER_FRAME   16

Definition at line 89 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_NUM_DATA_POINTERS

#define NI_QUADRA_MAX_NUM_DATA_POINTERS   4

Definition at line 86 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_NUM_OF_DECODER_OUTPUTS

#define NI_QUADRA_MAX_NUM_OF_DECODER_OUTPUTS   3

Definition at line 92 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_PPU_PARAM_EXPR_CHAR

#define NI_QUADRA_MAX_PPU_PARAM_EXPR_CHAR   20

Definition at line 95 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_RESOLUTION_HEIGHT

#define NI_QUADRA_MAX_RESOLUTION_HEIGHT   8192

Definition at line 137 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_RESOLUTION_WIDTH

#define NI_QUADRA_MAX_RESOLUTION_WIDTH   8192

Definition at line 136 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_SUPPORT_DRAWBOX_NUM

#define NI_QUADRA_MAX_SUPPORT_DRAWBOX_NUM   5

Definition at line 143 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_SUPPORT_WATERMARK_NUM

#define NI_QUADRA_MAX_SUPPORT_WATERMARK_NUM   6

Definition at line 144 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MAX_WIDTH

#define NI_QUADRA_MAX_WIDTH   8192

Definition at line 106 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MIN_HEIGHT

#define NI_QUADRA_MIN_HEIGHT   128

Definition at line 109 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MIN_KEEP_ALIVE_TIMEOUT

#define NI_QUADRA_MIN_KEEP_ALIVE_TIMEOUT   1

Definition at line 78 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MIN_RESOLUTION_HEIGHT_SCALER

#define NI_QUADRA_MIN_RESOLUTION_HEIGHT_SCALER   32

Definition at line 140 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MIN_RESOLUTION_WIDTH_SCALER

#define NI_QUADRA_MIN_RESOLUTION_WIDTH_SCALER   32

Definition at line 139 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_MIN_WIDTH

#define NI_QUADRA_MIN_WIDTH   144

Definition at line 107 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_NOPTS_VALUE

#define NI_QUADRA_NOPTS_VALUE   ((int64_t)UINT64_C(0x8000000000000000))

Definition at line 101 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_SCALER_FLAG_CMP

#define NI_QUADRA_SCALER_FLAG_CMP   0x0800 /* 0 = no compress, 1 = compress*/

Definition at line 128 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_SCALER_FLAG_CS

#define NI_QUADRA_SCALER_FLAG_CS   0x0020 /* 0 = BT.709, 1 = BT.2020 */

Definition at line 126 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_SCALER_FLAG_FCE

#define NI_QUADRA_SCALER_FLAG_FCE   0x0010 /* 0 = no fill color, 1 = fill color enabled */

Definition at line 124 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_SCALER_FLAG_IO

#define NI_QUADRA_SCALER_FLAG_IO   0x0001 /* 0 = source frame, 1 = destination frame */

Definition at line 116 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_SCALER_FLAG_P2

#define NI_QUADRA_SCALER_FLAG_P2   0x0008 /* 0 = normal allocation, 1 = P2P allocation */

Definition at line 122 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_SCALER_FLAG_PA

#define NI_QUADRA_SCALER_FLAG_PA   0x0004 /* 0 = straight alpha, 1 = premultiplied alpha */

Definition at line 120 of file ni_quadra_filter_api.h.

◆ NI_QUADRA_SCALER_FLAG_PC

#define NI_QUADRA_SCALER_FLAG_PC   0x0002 /* 0 = single allocation, 1 = create pool */

Definition at line 118 of file ni_quadra_filter_api.h.

◆ NIALIGN

#define NIALIGN (   x,
 
)    (((x) + (a)-1) & ~((a)-1))

Definition at line 111 of file ni_quadra_filter_api.h.

◆ NIMAX

#define NIMAX (   a,
 
)    ((a) > (b) ? (a) : (b))

Definition at line 112 of file ni_quadra_filter_api.h.

◆ NIMIN

#define NIMIN (   a,
 
)    ((a) > (b) ? (b) : (a))

Definition at line 113 of file ni_quadra_filter_api.h.

Typedef Documentation

◆ AVNIDeviceContext

This struct is allocated as AVHWDeviceContext.hwctx

◆ ni_fifo_buffer_t

◆ ni_quadra_card_info_t

◆ ni_quadra_codec_format_t

◆ ni_quadra_codec_hw_actions_t

This is an enumeration for hw actions.

◆ ni_quadra_device_pool_t

◆ ni_quadra_device_queue_t

◆ ni_quadra_filter_t

◆ ni_quadra_frame_config_t

◆ ni_quadra_frameclone_desc_t

◆ ni_quadra_hw_device_info_ai_param_t

◆ ni_quadra_hw_device_info_coder_param_t

◆ ni_quadra_hw_device_info_decoder_param_t

◆ ni_quadra_hw_device_info_encoder_param_t

◆ ni_quadra_hw_device_info_scaler_param_t

◆ ni_quadra_hw_device_info_t

◆ ni_quadra_hw_device_info_threshold_param_t

◆ ni_quadra_network_data_t

◆ ni_quadra_network_layer_info_t

◆ ni_quadra_network_layer_offset_t

◆ ni_quadra_network_layer_params_t

◆ ni_quadra_pixel_planar_format

◆ ni_quadra_scaler_drawbox_params_t

◆ ni_quadra_scaler_multi_drawbox_params_t

◆ ni_quadra_scaler_multi_watermark_params_t

◆ ni_quadra_scaler_opcode_t

◆ ni_quadra_scaler_watermark_params_t

◆ ni_quadra_split_context_t

◆ NIFramesContext

◆ niquadraFrameSurface1_t

◆ va_list

typedef __gnuc_va_list va_list

Definition at line 69 of file ni_quadra_filter_api.h.

Enumeration Type Documentation

◆ _ni_quadra_codec_format

Enumerator
NI_QUADRA_CODEC_FORMAT_H264 
NI_QUADRA_CODEC_FORMAT_H265 
NI_QUADRA_CODEC_FORMAT_VP9 
NI_QUADRA_CODEC_FORMAT_JPEG 
NI_QUADRA_CODEC_FORMAT_AV1 

Definition at line 196 of file ni_quadra_filter_api.h.

◆ _ni_quadra_pixel_planar_format

Enumerator
NI_QUADRA_PIXEL_PLANAR_FORMAT_SEMIPLANAR 
NI_QUADRA_PIXEL_PLANAR_FORMAT_PLANAR 
NI_QUADRA_PIXEL_PLANAR_FORMAT_TILED4X4 
NI_QUADRA_PIXEL_PLANAR_MAX 

Definition at line 171 of file ni_quadra_filter_api.h.

◆ _ni_quadra_scaler_opcode

Enumerator
NI_QUADRA_SCALER_OPCODE_SCALE 
NI_QUADRA_SCALER_OPCODE_CROP 
NI_QUADRA_SCALER_OPCODE_FLIP 
NI_QUADRA_SCALER_OPCODE_PAD 
NI_QUADRA_SCALER_OPCODE_OVERLAY 
NI_QUADRA_SCALER_OPCODE_STACK 
NI_QUADRA_SCALER_OPCODE_ROTATE 
NI_QUADRA_SCALER_OPCODE_DRAWBOX 
NI_QUADRA_SCALER_OPCODE_IPOVLY 
NI_QUADRA_SCALER_OPCODE_WATERMARK 
NI_QUADRA_SCALER_OPCODE_DELOGO 
NI_QUADRA_SCALER_OPCODE_MERGE 

Definition at line 179 of file ni_quadra_filter_api.h.

◆ ni_quadra_codec_hw_actions

This is an enumeration for hw actions.

Enumerator
NI_QUADRA_CODEC_HW_NONE 
NI_QUADRA_CODEC_HW_ENABLE 
NI_QUADRA_CODEC_HW_DOWNLOAD 
NI_QUADRA_CODEC_HW_UPLOAD 
NI_QUADRA_CODEC_HW_RSVD 
NI_QUADRA_CODEC_HW_PAYLOAD_OFFSET 

Definition at line 336 of file ni_quadra_filter_api.h.

◆ ni_quadra_device_type_t

Enumerator
NI_QUADRA_DEVICE_TYPE_MIN 
NI_QUADRA_DEVICE_TYPE_DECODER 
NI_QUADRA_DEVICE_TYPE_ENCODER 
NI_QUADRA_DEVICE_TYPE_SCALER 
NI_QUADRA_DEVICE_TYPE_AI 
NI_QUADRA_DEVICE_TYPE_XCODER_MAX 
NI_QUADRA_DEVICE_TYPE_UPLOAD 
NI_QUADRA_DEVICE_TYPE_MAX 

Definition at line 217 of file ni_quadra_filter_api.h.

◆ ni_quadra_log_level_t

Enumerator
NI_QUADRA_LOG_INVALID 
NI_QUADRA_LOG_NONE 
NI_QUADRA_LOG_FATAL 
NI_QUADRA_LOG_ERROR 
NI_QUADRA_LOG_INFO 
NI_QUADRA_LOG_DEBUG 
NI_QUADRA_LOG_TRACE 

Definition at line 159 of file ni_quadra_filter_api.h.

◆ ni_quadra_pix_fmt_t

Enumerator
NI_QUADRA_PIX_FMT_YUV420P 
NI_QUADRA_PIX_FMT_YUV420P10LE 
NI_QUADRA_PIX_FMT_NV12 
NI_QUADRA_PIX_FMT_P010LE 
NI_QUADRA_PIX_FMT_RGBA 
NI_QUADRA_PIX_FMT_BGRA 
NI_QUADRA_PIX_FMT_ARGB 
NI_QUADRA_PIX_FMT_ABGR 
NI_QUADRA_PIX_FMT_BGR0 
NI_QUADRA_PIX_FMT_BGRP 
NI_QUADRA_PIX_FMT_NV16 
NI_QUADRA_PIX_FMT_YUYV422 
NI_QUADRA_PIX_FMT_UYVY422 
NI_QUADRA_PIX_FMT_8_TILED4X4 
NI_QUADRA_PIX_FMT_10_TILED4X4 
NI_QUADRA_PIX_FMT_NONE 
NI_QUADRA_PIX_FMT_YUV420P10BE 
NI_QUADRA_PIX_FMT_YUVJ420P 

Definition at line 235 of file ni_quadra_filter_api.h.

◆ ni_quadra_retcode_t

Enumerator
NI_QUADRA_RET_SUCCESS 
NI_QUADRA_SEQ_CHANGE_DRAINING 
NI_QUADRA_ERROR_VPU_RECOVERY 
NI_QUADRA_ERROR_INVALID_SESSION 
NI_QUADRA_EAGAIN 
NI_QUADRA_ERROR 
NI_QUADRA_PARAM_WARNING_DEPRECATED 

Definition at line 205 of file ni_quadra_filter_api.h.

Function Documentation

◆ ni_fifo_free()

LIB_API void ni_fifo_free ( ni_fifo_buffer_t p_fifo)

Free a fifo.


Parameters
[in]p_fifoThe pointer of ni_fifo_buffer_t
Returns

Definition at line 85 of file ni_quadra_filter_api.c.

◆ ni_fifo_generic_read()

LIB_API uint8_t* ni_fifo_generic_read ( ni_fifo_buffer_t p_fifo)

Get first filled buffer to read in the fifo.


Parameters
[in]p_fifoThe pointer of ni_fifo_buffer_t
Returns
On success return the pointer of filled buffer in fifo, On failure return NULL

Definition at line 178 of file ni_quadra_filter_api.c.

◆ ni_fifo_generic_write()

LIB_API uint8_t* ni_fifo_generic_write ( ni_fifo_buffer_t p_fifo)

Get free buffer to write in the fifo.


Parameters
[in]p_fifoThe pointer of ni_fifo_buffer_t
Returns
On success return the pointer of free buffer, On failure return NULL

Definition at line 148 of file ni_quadra_filter_api.c.

◆ ni_fifo_initialize()

LIB_API ni_fifo_buffer_t* ni_fifo_initialize ( uint32_t  number_of_buffers,
uint32_t  size 
)

Initialize a fifo buffer.


Parameters
[in]number_of_buffersTotal number of buffers in this fifo
[in]sizeThe size of every buffer
Returns
On success return fifo pointer, On failure return NULL

Definition at line 44 of file ni_quadra_filter_api.c.

◆ ni_fifo_is_empty()

LIB_API int ni_fifo_is_empty ( ni_fifo_buffer_t p_fifo)

Check if a fifo is empty.


Parameters
[in]p_fifoThe pointer of ni_fifo_buffer_t
Returns
1 is empty; 0 is not empty

Definition at line 123 of file ni_quadra_filter_api.c.

◆ ni_fifo_is_full()

LIB_API int ni_fifo_is_full ( ni_fifo_buffer_t p_fifo)

Check if a fifo is full.


Parameters
[in]p_fifoThe pointer of ni_fifo_buffer_t
Returns
1 is full; 0 is not full

Definition at line 111 of file ni_quadra_filter_api.c.

◆ ni_fifo_number_of_buffers()

LIB_API uint32_t ni_fifo_number_of_buffers ( ni_fifo_buffer_t p_fifo)

Get number of buffers used in fifo.


Parameters
[in]p_fifoThe pointer of ni_fifo_buffer_t
Returns
fifo's number_of_buffers_used

Definition at line 135 of file ni_quadra_filter_api.c.

◆ ni_fifo_return_read()

LIB_API int ni_fifo_return_read ( ni_fifo_buffer_t p_fifo)

Push back the last read buffer to the fifo.


Parameters
[in]p_fifoThe pointer of ni_fifo_buffer_t
Returns
On success return 0, On failure return -1

Definition at line 207 of file ni_quadra_filter_api.c.

◆ ni_find_start_code()

const LIB_API uint8_t* ni_find_start_code ( const uint8_t *  p,
const uint8_t *  end,
uint32_t *  state 
)

Find the next start code.


Parameters
[in]ppointer to buffer start address.
[in]endpointer to buffer end address.
[state]state pointer to nalu type address
Returns
search end address

Definition at line 2897 of file ni_av_codec.c.

◆ ni_quadra_ai_config_hvsplus()

LIB_API int ni_quadra_ai_config_hvsplus ( ni_quadra_filter_t nifilter,
ni_quadra_network_data_t p_network,
int  nb_width,
int  nb_height,
int  level,
int  format 
)

configure a hvsplus context based with the network binary


Parameters
[in]nifilterPointer to ni_quadra_filter_t
[in]p_networkPointer to caller allocated ni_quadra_network_data_t
[in]nb_widthWidth for network binary
[in]nb_heightHeight for network binary
[in]levelHvsplus level
[in]formatPixel format
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_FAILURE

Definition at line 583 of file ni_quadra_filter_api.c.

◆ ni_quadra_ai_config_network_binary()

LIB_API int ni_quadra_ai_config_network_binary ( ni_quadra_filter_t nifilter,
ni_quadra_network_data_t p_network,
const char *  file 
)

configure a network context based with the network binary


Parameters
[in]nifilterPointer to ni_quadra_filter_t
[in]p_networkPointer to caller allocated ni_quadra_network_data_t
[in]filePointer to caller network binary file path
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_FAILURE

Definition at line 575 of file ni_quadra_filter_api.c.

◆ ni_quadra_ai_frame_buffer_alloc()

LIB_API int ni_quadra_ai_frame_buffer_alloc ( void *  p_frame,
ni_quadra_network_data_t p_network 
)

Allocate input layers memory for AI frame buffer based on provided parameters taking into account width, height, format defined by network.


Parameters
[out]p_framePointer to void *
[in]p_networkPointer to caller allocated ni_network_data_t
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 600 of file ni_quadra_filter_api.c.

◆ ni_quadra_ai_network_layer_dims()

LIB_API uint32_t ni_quadra_ai_network_layer_dims ( ni_quadra_network_layer_params_t p_param)

Get dims from ni_quadra_network_layer_params_t.


Parameters
[out]p_paramPointer to ni_quadra_network_layer_params_t
Returns
uint32_t

Definition at line 615 of file ni_quadra_filter_api.c.

◆ ni_quadra_ai_packet_buffer_alloc()

LIB_API int ni_quadra_ai_packet_buffer_alloc ( void *  p_pkt,
ni_quadra_network_data_t p_network 
)

Allocate output layers memory for the packet buffer based on provided network.


Parameters
[out]p_pktPointer to void *
[in]p_networkPointer to a caller allocated ni_quadra_network_data_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 607 of file ni_quadra_filter_api.c.

◆ ni_quadra_build_frame_pool()

LIB_API int ni_quadra_build_frame_pool ( ni_quadra_filter_t nifilter,
int  width,
int  height,
int  out_format,
int  pool_size 
)

Alloc frame pool for filter.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
[in]widthframe width
[in]heightframe height
[in]out_formatframe format
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 381 of file ni_quadra_filter_api.c.

◆ ni_quadra_check_hw_info()

LIB_API int ni_quadra_check_hw_info ( ni_quadra_hw_device_info_t **  pointer_to_p_hw_device_info,
int  task_mode,
ni_quadra_hw_device_info_threshold_param_t hw_info_threshold_param,
int  preferential_device_type,
ni_quadra_hw_device_info_coder_param_t coder_param,
int  hw_mode,
int  consider_mem 
)

check hw info, return the appropriate card number to use depends on the load&task_num&used resource


Parameters
[out]pointer_to_p_hw_device_info: pointer to user-supplied ni_hw_device_info_quadra_t (allocated by ni_hw_device_info_alloc). May be a ponter to NULL ,in which case a ni_hw_device_info_quadra_coder_param_t is allocated by this function and written to pointer_to_p_hw_device_info. record the device info, including available card num and which card to select, and each card's informaton, such as, the load, task num, device type
[in]task_modeaffect the scheduling strategy, 1 - both the load_num and task_num should consider, usually applied to live scenes 0 - only consider the task_num, don not care the load_num
[in]hw_info_threshold_param: an array of threshold including device type task threshold and load threshold in hw_mode fill the arry with both encoder and decoder threshold or fill the arry with preferential device type threshold when don not in hw_mode load threshold in range[0:100] task num threshold in range [0:32]
[in]preferential_device_type: which device type is preferential 0:decode 1:encode . This need to set to encoder/decoder even if in sw_mode to check whether coder_param is wrong.
[in]coder_param: encoder and decoder information that helps to choose card .This coder_param can be created and set to default value by function hw_device_info_coder_param_t * create_hw_device_info_coder_param(). You may change the resolution fps bit_8_10 or other vaule you want to use
[in]hw_mode:Set1 then this function will choose encoder and decoder in just one card . When no card meets the conditions ,NO card will be choosed. You can try to use set hw_mode 0 to use sw_mode to do encoder/decoder in different card when hw_mode reports an error In hw_mode set both encoder_param and decoder_param in coder_param. Set 0 then just consider sw_mode to choose which card to do encode/decode, In sw_mode set one param in coder_param the other one will be set to NULL.
[in]consider_mem: set 1 this function will consider memory usage extra set 0 this function will not consider memory usage
Returns
0-error 1-success

Definition at line 1870 of file ni_quadra_filter_api.c.

◆ ni_quadra_create_hw_device_info_coder_param()

LIB_API ni_quadra_hw_device_info_coder_param_t* ni_quadra_create_hw_device_info_coder_param ( int  mode)

Create a pointer to hw_device_info_coder_param_t instance. This instance will be created and set to default vaule by param mode.You may change the resolution, fps, bit_8_10 and other vaule you want to set.


Parameters
[in]mode:0:createinstance with decoder_param ,encoder_param, scaler_param and ai_param will be set to NULL 1:create instance with encoder_param ,decoder_param, scaler_param and ai_param will be set to NULL 2:create instance with scaler_param ,decoder_param, encoder_param and ai_param will be set to NULL 3:create instance with ai_param ,decoder_param, encoder_param and scaler_param will be set to NULL >= 4:create instance with decoder_param encoder_param, scaler_param and ai_param for ni_check_hw_info() hw_mode
Returns
NULL-error,pointer to an instance when success

Definition at line 1850 of file ni_quadra_filter_api.c.

◆ ni_quadra_destory_hw_device_info_coder_param()

LIB_API void ni_quadra_destory_hw_device_info_coder_param ( ni_quadra_hw_device_info_coder_param_t p_quadra_hw_device_info_coder_param)

Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param.


Parameters
[in]p_hw_device_info_coder_param:pointerto a hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param

Definition at line 1855 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_close()

LIB_API void ni_quadra_device_close ( int32_t  handle)

Close device handle.


Parameters
[in]handleHandle to close

Definition at line 1662 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_close()

LIB_API int ni_quadra_device_session_close ( void *  p_ctx,
int  eos_recieved,
ni_quadra_device_type_t  device_type 
)

Close device session that was previously opened by calling ni_device_session_open() If device_type is NI_DEVICE_TYPE_DECODER closes decoding session If device_type is NI_DEVICE_TYPE_ENCODER closes encoding session If device_type is NI_DEVICE_TYPE_SCALER closes scaling session.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]eos_receivedFlag indicating if End Of Stream indicator was received
[in]device_typeNI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or NI_DEVICE_TYPE_SCALER
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 2020 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_context_clear()

LIB_API void ni_quadra_device_session_context_clear ( void *  p_ctx)

Clear already allocated session context.


Parameters
[in]p_ctxPointer to an already allocated ni_session_context_t

Definition at line 2035 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_copy()

LIB_API int ni_quadra_device_session_copy ( void *  src_ctx,
void *  dst_ctx 
)

Copy filter session context.


Parameters
[in/out]src_ctx Pointer to void*
[in/out]dst_ctx Pointer to void*
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 1685 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_hwdl()

int ni_quadra_device_session_hwdl ( void *  p_ctx,
void *  p_data,
niquadraFrameSurface1_t hwdesc 
)

Reads YUV data from hw descriptor stored location on device.


Parameters
[in]p_ctxPointer to a caller allocated
[in]p_dataPointer to a caller allocated ni_session_data_io_t struct which contains either a ni_frame_t data frame or ni_packet_t data packet to send
[in]hwdescHW descriptor to find frame in XCODER
Returns
On success Total number of bytes read On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 646 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_open()

LIB_API int ni_quadra_device_session_open ( void *  p_ctx,
ni_quadra_device_type_t  device_type 
)

Open a new device session depending on the device_type parameter If device_type is NI_DEVICE_TYPE_DECODER opens decoding session If device_type is NI_DEVICE_TYPE_ENCODER opens encoding session If device_type is NI_DEVICE_TYPE_SCALER opens scaling session.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]device_typeNI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or NI_DEVICE_TYPE_SCALER
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 1912 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_read()

LIB_API int ni_quadra_device_session_read ( void *  p_ctx,
void *  p_data,
int  device_type 
)

Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data packet from decoder If device_type is NI_DEVICE_TYPE_ENCODER reads data frame from encoder If device_type is NI_DEVICE_TYPE_AI reads data frame from AI engine.


Parameters
[in/out]p_ctx Pointer to void * ni_session_context_t struct
[in/out]p_data Pointer to void * ni_session_data_io_t struct
[in]device_typeNI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or NI_DEVICE_TYPE_SCALER If NI_DEVICE_TYPE_DECODER is specified, data that was read will be placed into ni_frame_t struct inside the p_data pointer If NI_DEVICE_TYPE_ENCODER is specified, data that was read will be placed into ni_packet_t struct inside the p_data pointer If NI_DEVICE_TYPE_AI is specified, data that was read will be placed into ni_frame_t struct inside the p_data pointer
Returns
On success Total number of bytes read On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 455 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_read_hwdesc()

LIB_API int ni_quadra_device_session_read_hwdesc ( void *  p_ctx,
void *  p_data,
int  device_type 
)

Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from decoder If device_type is NI_DEVICE_TYPE_SCALER reads data hwdesc from scaler.


Parameters
[in/out]p_ctx Pointer to void * ni_session_context_t struct
[in/out]p_data Pointer to void * ni_session_data_io_t struct
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER If NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_SCALER is specified, hw descriptor info will be stored in p_data ni_frame
Returns
On success Total number of bytes read On failure NI_RETCODE_FAILURE NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 447 of file ni_quadra_filter_api.c.

◆ ni_quadra_device_session_write()

LIB_API int ni_quadra_device_session_write ( void *  p_ctx,
void *  p_data,
ni_quadra_device_type_t  device_type 
)

Sends data to the device If device_type is NI_DEVICE_TYPE_DECODER sends data packet to decoder If device_type is NI_DEVICE_TYPE_ENCODER sends data frame to encoder If device_type is NI_DEVICE_TYPE_AI sends data frame to ai engine.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_dataPointer to a caller allocated ni_session_data_io_t struct which contains either a ni_frame_t data frame or ni_packet_t data packet to send
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or NI_DEVICE_TYPE_AI If NI_DEVICE_TYPE_DECODER is specified, it is expected that the ni_packet_t struct inside the p_data pointer contains data to send. If NI_DEVICE_TYPE_ENCODER or NI_DEVICE_TYPE_AI is specified, it is expected that the ni_frame_t struct inside the p_data pointer contains data to send.
Returns
On success Total number of bytes written On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 1948 of file ni_quadra_filter_api.c.

◆ ni_quadra_ff_to_ni_log_level()

LIB_API ni_quadra_log_level_t ni_quadra_ff_to_ni_log_level ( int  fflog_level)

Convert ffmpeg log level integer to appropriate ni_quadra_log_level_t.


Parameters
fflog_levelinteger representation of FFmpeg log level
Returns
ni_quadra_log_level

Definition at line 1845 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_close()

LIB_API void ni_quadra_filter_close ( ni_quadra_filter_t nifilter)

Close filter.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
Returns
none

Definition at line 529 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_device_alloc_dst_frame()

LIB_API int ni_quadra_filter_device_alloc_dst_frame ( ni_quadra_filter_t nifilter,
niquadraFrameSurface1_t p_hwdesc,
int  type 
)

Allocate a frame on the device and return the frame index.


Parameters
[in]p_ctxpointer to session context
[in]p_out_surfacepointer to output frame surface
[in]device_typecurrently only NI_DEVICE_TYPE_AI
Returns
NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_MEM_ALOC

Definition at line 428 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_device_alloc_frame()

LIB_API int ni_quadra_filter_device_alloc_frame ( ni_quadra_filter_t nifilter,
int  width,
int  height,
int  format,
int  options,
int  rectangle_width,
int  rectangle_height,
int  rectangle_x,
int  rectangle_y,
int  rgba_color,
int  frame_index,
int  type 
)

Allocate a frame on the device for 2D engine or AI engine to work on based on provided parameters.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
[in]widthwidth, in pixels
[in]heightheight, in pixels
[in]formatpixel format
[in]optionsoptions bitmap flags, bit 0 (NI_SCALER_FLAG_IO) is 0=input frame or 1=output frame. Bit 1 (NI_SCALER_FLAG_PC) is 0=single allocation, 1=create pool. Bit 2 (NI_SCALER_FLAG_PA) is 0=straight alpha, 1=premultiplied alpha
[in]rectangle_widthclipping rectangle width
[in]rectangle_heightclipping rectangle height
[in]rectangle_xhorizontal position of clipping rectangle
[in]rectangle_yvertical position of clipping rectangle
[in]rgba_colorRGBA fill colour (for padding only)
[in]frame_indexinput hwdesc index
[in]device_typeonly NI_DEVICE_TYPE_SCALER and NI_DEVICE_TYPE_AI (only needs p_ctx and frame_index)
Returns
NI_RETCODE_FAILURE NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_MEM_ALOC

Definition at line 415 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_device_clone_hwframe()

LIB_API int ni_quadra_filter_device_clone_hwframe ( ni_quadra_filter_t nifilter,
ni_quadra_frameclone_desc_t p_frameclone_desc 
)

Copy the data of src hwframe to dst hwframe.


Parameters
[in]p_ctxpointer to session context
[in]p_frameclone_descpointer to the frameclone descriptor
Returns
NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_MEM_ALOC

Definition at line 438 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_device_close()

LIB_API void ni_quadra_filter_device_close ( AVNIDeviceContext ni_hw_ctx)

Close device.


Parameters
[in/out]ni_hw_ctx Pointer AVNIDeviceContext
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 720 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_device_config_frame()

LIB_API int ni_quadra_filter_device_config_frame ( void *  p_ctx,
ni_quadra_frame_config_t p_cfg 
)

Configure the 2D engine to work based on provided parameters.


Parameters
[in]p_ctxpointer to session context
[in]p_cfgpointer to ni_quadra_frame_config_t
Returns
NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_MEM_ALOC

Definition at line 1782 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_device_create()

LIB_API int ni_quadra_filter_device_create ( AVNIDeviceContext ni_hw_ctx,
const char *  device 
)

Sends frame pool setup info to device.


Parameters
[in]ni_hw_ctxPointer to AVNIDeviceContext
[in]devicestring device name
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 958 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_device_session_init_framepool()

LIB_API int ni_quadra_filter_device_session_init_framepool ( NIFramesContext ni_ctx,
uint32_t  pool_size,
uint32_t  pool 
)

Sends frame pool setup info to device.


Parameters
[in]ni_ctxPointer to NIFramesContext
[in]pool_sizeUpload session initial allocated frames count must be > 0,
[in]pool0 use the normal pool 1 use a dedicated P2P pool
Returns
On success Return code On failure NI_RETCODE_FAILURE NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_MEM_ALOC

Definition at line 747 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_drawtext_prep_frames()

LIB_API int ni_quadra_filter_drawtext_prep_frames ( void **  niframe)

prepare frames for ni_drawtext filter


Parameters
[in/out]niframe Pointer void
Returns
0

Definition at line 501 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_frame_buffer_alloc_dl()

LIB_API int ni_quadra_filter_frame_buffer_alloc_dl ( void *  niframe,
int  video_width,
int  video_height,
int  pixel_format 
)

Allocate preliminary memory for the frame buffer based on provided parameters.


Parameters
[in]niframePointer void
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]alignmentAllignment requirement
[in]pixel_formatFormat for input
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 520 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_frame_buffer_alloc_hwenc()

LIB_API int ni_quadra_filter_frame_buffer_alloc_hwenc ( ni_quadra_filter_t nifilter,
int  video_width,
int  video_height,
int  extra_len 
)

Allocate memory for the hwDescriptor buffer based on provided parameters taking into account pic size and extra data.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]extra_lenExtra data size (incl. meta data)
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_ERROR_MEM_ALOC

Definition at line 406 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_frame_free()

LIB_API void ni_quadra_filter_frame_free ( void *  opaque,
uint8_t *  data 
)

Free filter frame.


Parameters
[in]opaquePointer to void*
[in]dataPointer to void*
Returns
none

Definition at line 1052 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_frames_close()

LIB_API int ni_quadra_filter_frames_close ( NIFramesContext ni_ctx,
int  pool_size 
)

Close filter context and frame.


Parameters
[in/out]ni_ctx Pointer NIFramesContext
[in]pool_sizeavctx width
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 755 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_frames_init()

LIB_API int ni_quadra_filter_frames_init ( NIFramesContext ni_ctx,
int *  width,
int *  height,
int  ni_fmat,
int  keep_alive_time 
)

Init filter frame context and set value to session context.


Parameters
[in/out]ni_ctx Pointer NIFramesContext
[in]widthavctx width
[in]heightavctx height
[in]ni_fmatavctx format
[in]keep_alive_timekeep_alive_time
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 809 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_get_buffer()

LIB_API int ni_quadra_filter_get_buffer ( NIFramesContext ni_ctx,
uint8_t **  dstbuf,
uint8_t **  dstdata,
uint32_t *  buf_size,
int  width,
int  height,
int  is_planar 
)

Sends frame pool setup info to device.


Parameters
[in/out]ni_ctx Pointer to NIFramesContext
[in]dstbufPointer dst buf
[in]dstdataPointer dst data
[in]buf_sizePointer dst buf_size
[in]widthframe width
[in]heightframe height
[in]is_planarframe format is nv12
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_ERROR_MEM_ALOC

Definition at line 1025 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_get_data3()

uint8_t* ni_quadra_filter_get_data3 ( void *  p_frame)

Get niframe data3 from device.


Parameters
[in/out]p_frame Pointer void
Returns
Pointer to uint8_t

Definition at line 495 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_get_output_data()

LIB_API int ni_quadra_filter_get_output_data ( ni_quadra_filter_t nifilter,
uint8_t *  data,
int  width,
int  height 
)

Get data from device.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
[in]dataframe data
[in]widthframe width
[in]heightframe height
Returns
0

Definition at line 477 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_hwdl_frame()

LIB_API int ni_quadra_filter_hwdl_frame ( NIFramesContext ni_ctx,
niquadraFrameSurface1_t src_surf,
int  width,
int  height,
int  ni_fmat,
int  nb_planes,
const int *  linesize,
uint8_t **  dst_data 
)

Download frame.


Parameters
[in/out]ni_ctx Pointer to NIFramesContext
[in]src_surfPointer to niquadraFrameSurface1_t
[in]widthframe width
[in]heightframe height
[in]ni_fmatframe format
[in]nb_planesframe plane
[in]linesizeframe linesize
[in]dst_datapointer dst data
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 1588 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_hwframe_recycle()

LIB_API int ni_quadra_filter_hwframe_recycle ( void *  session_ctx,
void *  niframe 
)

Recycle a frame buffer on card.


Parameters
[in]session_ctxPointer to void*
[in]niframePointer to void*
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 1766 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_hwup_frame()

LIB_API int ni_quadra_filter_hwup_frame ( NIFramesContext ni_ctx,
niquadraFrameSurface1_t dst_surf,
int  width,
int  height,
int  ni_fmat,
int  nb_planes,
const int *  linesize,
uint8_t **  src_data 
)

Upload frame.


Parameters
[in/out]ni_ctx Pointer to NIFramesContext
[in]dst_surfPointer to niquadraFrameSurface1_t
[in]widthframe width
[in]heightframe height
[in]ni_fmatframe format
[in]nb_planesframe plane
[in]linesizeframe linesize
[in]src_datapointer src data
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 1416 of file ni_quadra_filter_api.c.

◆ ni_quadra_filter_session_dl_set()

LIB_API void ni_quadra_filter_session_dl_set ( void *  session_ctx,
bool  value 
)

Set download filter session context.


Parameters
[in/out]session_ctx Pointer to void*
[in]valueBool need to set value
Returns
none

Definition at line 1679 of file ni_quadra_filter_api.c.

◆ ni_quadra_frame_buffer_alloc_hwenc()

LIB_API int ni_quadra_frame_buffer_alloc_hwenc ( void *  niframe,
int  video_width,
int  video_height,
int  extra_len 
)

Definition at line 2041 of file ni_quadra_filter_api.c.

◆ ni_quadra_frame_buffer_alloc_pixfmt()

int ni_quadra_frame_buffer_alloc_pixfmt ( void *  p_frame,
int  pixel_format,
int  video_width,
int  video_height,
int  linesize[],
int  alignment,
int  extra_len 
)

Allocate memory for the frame buffer based on provided parameters taking into account the pixel format, width, height, stride, alignment, and extra data.


Parameters
[in]p_framePointer to caller allocated void
[in]pixel_formata pixel format in ni_pix_fmt_t enum
[in]video_widthwidth, in pixels
[in]video_heightheight, in pixels
[in]linesizehorizontal stride
[in]alignmentapply a 16 pixel height alignment (T408 only)
[in]extra_lenmeta data size
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 635 of file ni_quadra_filter_api.c.

◆ ni_quadra_frame_buffer_free()

LIB_API int ni_quadra_frame_buffer_free ( void *  p_data)

Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame_buffer_alloc or ni_frame_buffer_alloc_nv.


Parameters
[in]p_dataPointer to void * ni_session_data_io_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 1982 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_device_handle()

LIB_API int32_t ni_quadra_get_device_handle ( void *  session_ctx)

Get session device handle id.


Parameters
[in/out]session_ctx Pointer to void*
Returns
session handle id

Definition at line 1667 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_device_id()

LIB_API int ni_quadra_get_device_id ( void *  session_ctx)

Get session device id.


Parameters
[in/out]session_ctx Pointer to void*
Returns
hw id

Definition at line 1650 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_frame_buffer()

LIB_API uint8_t* ni_quadra_get_frame_buffer ( void *  niframe)

Get niframe buffer address.


Parameters
[in/out]niframe Pointer to void*
Returns
point frame p_buffer

Definition at line 1726 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_frame_buffer_size()

LIB_API uint32_t ni_quadra_get_frame_buffer_size ( void *  niframe)

Get niframe buffer size.


Parameters
[in/out]niframe Pointer to void*
Returns
niframe buffer size

Definition at line 1732 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_frame_data()

LIB_API uint8_t** ni_quadra_get_frame_data ( void *  niframe)

Get niframe data address.


Parameters
[in/out]niframe Pointer to void*
Returns
niframe data address

Definition at line 1738 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_frame_data_len()

LIB_API void ni_quadra_get_frame_data_len ( void *  niframe,
uint32_t *  dst_datalen 
)

Get niframe data datalen.


Parameters
[in/out]niframe Pointer to void*
[in]dst_datalenPointer to int*
Returns
void

Definition at line 1756 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_frame_idx()

LIB_API uint16_t ni_quadra_get_frame_idx ( void *  niframe)

Get niframui16FrameIdxe.


Parameters
[in/out]niframe Pointer to void*
Returns
frame ui16FrameIdx

Definition at line 1713 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_hw_yuv420p_dim()

LIB_API void ni_quadra_get_hw_yuv420p_dim ( int  width,
int  height,
int  factor,
int  is_semiplanar,
int  plane_stride[4],
int  plane_height[4] 
)

Get dimension information of Netint HW YUV420p frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_encoder_frame_buffer_alloc for buffer allocation.


Parameters
[in]widthsource YUV frame width
[in]heightsource YUV frame height
[in]factor1 for 8 bit, 2 for 10 bit
[in]is_semiplanar1 for semiplanar frame, 0 otherwise
[out]plane_stridesize (in bytes) of each plane width
[out]plane_heightsize of each plane height
Returns
Y/Cb/Cr stride and height info

Definition at line 1795 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_niframe()

LIB_API uint8_t* ni_quadra_get_niframe ( void *  niframe)

Get niframe address.


Parameters
[in/out]niframe Pointer to void*
Returns
point niframe

Definition at line 1720 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_packet_data()

LIB_API uint8_t* ni_quadra_get_packet_data ( void *  nipacket)

Get nipacket data address.


Parameters
[in/out]nipacket Pointer to void*
Returns
nipacket data address

Definition at line 1744 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_packet_data_len()

LIB_API uint32_t ni_quadra_get_packet_data_len ( void *  nipacket)

Get nipacket data len.


Parameters
[in/out]nipacket Pointer to void*
Returns
nipacket data len

Definition at line 1750 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_seiset_size()

LIB_API int ni_quadra_get_seiset_size ( )

Recycle a frame buffer on card.


Parameters
[in]surfaceStruct containing device and frame location to clear out
[in]device_handlehandle to access device memory buffer is stored in
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 1829 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_session_blkiohandle()

LIB_API int ni_quadra_get_session_blkiohandle ( void *  session_ctx)

Get session context blk_io_handle.


Parameters
[in/out]session_ctx Pointer to void*
Returns
session context blk_io_handle

Definition at line 1707 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_session_frame_num()

LIB_API int ni_quadra_get_session_frame_num ( void *  session_ctx)

Get session_ctx send/recieve frame number.


Parameters
[in]p_ctxPointer to an already allocated ni_session_context_t

Definition at line 2064 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_session_id()

LIB_API uint32_t ni_quadra_get_session_id ( void *  session_ctx)

Get session device session id.


Parameters
[in/out]session_ctx Pointer to void*
Returns
session id

Definition at line 1656 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_session_packet_num()

LIB_API int ni_quadra_get_session_packet_num ( void *  session_ctx)

Get session_ctx send/recive packet number.


Parameters
[in]p_ctxPointer to an already allocated ni_session_context_t

Definition at line 2058 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_session_runstatus()

LIB_API int ni_quadra_get_session_runstatus ( void *  session_ctx)

Get session context run status.


Parameters
[in/out]session_ctx Pointer to void*
Returns
session context run status

Definition at line 1702 of file ni_quadra_filter_api.c.

◆ ni_quadra_get_session_status()

LIB_API int ni_quadra_get_session_status ( void *  session_ctx)

Get session context status.


Parameters
[in/out]session_ctx Pointer to void*
Returns
session context status

Definition at line 1697 of file ni_quadra_filter_api.c.

◆ ni_quadra_hw_device_info_alloc()

LIB_API ni_quadra_hw_device_info_t* ni_quadra_hw_device_info_alloc ( int  device_type_num,
int  avaliable_card_num 
)

Create a pointer to ni_hw_device_info_quadra_t instance .


Parameters
[in]device_type_num:numberof device type to be allocated in this function
[in]avaliable_card_num:numberof avaliable card per device to be allocated in this function
Returns
NULL-error,pointer to an instance when success

Definition at line 1860 of file ni_quadra_filter_api.c.

◆ ni_quadra_hw_device_info_free()

LIB_API void ni_quadra_hw_device_info_free ( ni_quadra_hw_device_info_t p_hw_device_info)

Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param.


Parameters
[in]p_hw_device_info:pointerto a ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param

Definition at line 1865 of file ni_quadra_filter_api.c.

◆ ni_quadra_hwframe_buffer_recycle()

LIB_API int ni_quadra_hwframe_buffer_recycle ( niquadraFrameSurface1_t surface,
int32_t  device_handle 
)

Recycle a frame buffer on card.


Parameters
[in]surfaceStruct containing device and frame location to clear out
[in]device_handlehandle to access device memory buffer is stored in
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 1789 of file ni_quadra_filter_api.c.

◆ ni_quadra_init_filters()

LIB_API int ni_quadra_init_filters ( ni_quadra_filter_t nifilter)

Init filter.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 228 of file ni_quadra_filter_api.c.

◆ ni_quadra_init_internal_session()

LIB_API int ni_quadra_init_internal_session ( NIFramesContext ni_ctx)

Init filter session context only malloc session.


Parameters
[in/out]ni_ctx Pointer NIFramesContext
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 654 of file ni_quadra_filter_api.c.

◆ ni_quadra_init_split_rsrc()

LIB_API int ni_quadra_init_split_rsrc ( NIFramesContext ni_ctx,
int  w,
int  h 
)

Init filter split context malloc session and set it default.


Parameters
[in/out]ni_ctx Pointer NIFramesContext
[in]wavctx width
[in]havctx height
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 705 of file ni_quadra_filter_api.c.

◆ ni_quadra_log_set_callback()

LIB_API void ni_quadra_log_set_callback ( void(*)(int, const char *, va_list log_callback)

Set ni_log() callback.


Parameters
[in]callback
Returns

Definition at line 1839 of file ni_quadra_filter_api.c.

◆ ni_quadra_log_set_level()

LIB_API void ni_quadra_log_set_level ( int  level)

Set ni_log_level.


Parameters
levellog level
Returns

Definition at line 1834 of file ni_quadra_filter_api.c.

◆ ni_quadra_network_layer_convert_output()

LIB_API int ni_quadra_network_layer_convert_output ( void *  p_data,
float *  dst,
uint32_t  num,
ni_quadra_network_data_t p_network,
uint32_t  layer 
)

Convert data from nipacket to dst data.


Parameters
[in/out]p_data Pointer to void * ni_session_data_io_t struct
[in]dstPointer to float
[in]numoutput_number
[in]p_networkPointer to ni_quadra_network_data_t
[in]layerint value
Returns
uint32_t

Definition at line 625 of file ni_quadra_filter_api.c.

◆ ni_quadra_packet_buffer_free()

LIB_API int ni_quadra_packet_buffer_free ( void *  p_data)

Free packet buffer that was previously allocated with ni_packet_buffer_alloc.


Parameters
[in]p_dataPointer to void * ni_session_data_io_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 1965 of file ni_quadra_filter_api.c.

◆ ni_quadra_rsrc_get_device_by_block_name()

LIB_API int ni_quadra_rsrc_get_device_by_block_name ( const char *  blk_name,
ni_quadra_device_type_t  device_type 
)

Get GUID of the device by block device name and type.


Parameters
[in]blk_namedevice's block name
[in]typedevice type
Returns
device GUID (>= 0) if found, NI_RETCODE_FAILURE (-1) otherwise

Definition at line 1888 of file ni_quadra_filter_api.c.

◆ ni_quadra_rsrc_get_device_pool()

LIB_API ni_quadra_device_pool_t* ni_quadra_rsrc_get_device_pool ( void  )

Create and return the allocated ni_device_pool_t struct.


Parameters
None
Returns
Pointer to ni_device_pool_t struct on success, or NULL on failure

Definition at line 1995 of file ni_quadra_filter_api.c.

◆ ni_quadra_scaler_set_drawbox_params()

LIB_API int ni_quadra_scaler_set_drawbox_params ( ni_quadra_filter_t nifilter,
ni_quadra_scaler_drawbox_params_t p_params 
)

Send a p_config command to configure scaling drawbox parameters.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
[in]p_paramsPointer ni_quadra_scaler_drawbox_params_t
Returns
- NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION, NI_RETCODE_ERROR_NVME_CMD_FAILED on failure

Definition at line 463 of file ni_quadra_filter_api.c.

◆ ni_quadra_scaler_set_watermark_params()

LIB_API int ni_quadra_scaler_set_watermark_params ( ni_quadra_filter_t nifilter,
ni_quadra_scaler_watermark_params_t p_params 
)

Send a p_config command to configure watermark parameters.


Parameters
[in/out]nifilter Pointer ni_quadra_filter_t
[in]p_paramsPointer ni_quadra_scaler_watermark_params_t
Returns
- NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION, NI_RETCODE_ERROR_NVME_CMD_FAILED on failure

Definition at line 470 of file ni_quadra_filter_api.c.

◆ ni_quadra_session_timestamp_copy()

LIB_API void ni_quadra_session_timestamp_copy ( void *  src_ctx,
void *  dst_ctx 
)

Copy filter session context.


Parameters
[in/out]src_ctx Pointer to void*
[in/out]dst_ctx Pointer to void*
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 1690 of file ni_quadra_filter_api.c.

◆ ni_quadra_set_device_handle()

LIB_API void ni_quadra_set_device_handle ( void *  session_ctx,
int32_t  handle 
)

Set session device handle.


Parameters
[in]session_ctxPointer to void*
[in]handleHandle to set

Definition at line 1673 of file ni_quadra_filter_api.c.

◆ ni_quadra_set_framerate()

LIB_API void ni_quadra_set_framerate ( void *  p_ctx,
int  num,
int  den 
)

Definition at line 2050 of file ni_quadra_filter_api.c.

◆ ni_quadra_set_session_runstatus()

LIB_API void ni_quadra_set_session_runstatus ( void *  session_ctx,
int  status 
)

Set session context run status.


Parameters
[in/out]session_ctx Pointer to void*
Returns
none

Definition at line 1776 of file ni_quadra_filter_api.c.

◆ ni_quadra_split_ctx_set()

LIB_API void ni_quadra_split_ctx_set ( NIFramesContext ni_ctx,
niquadraFrameSurface1_t ni_surf,
niquadraFrameSurface1_t ni_surf_1,
niquadraFrameSurface1_t ni_surf_2,
int  num_extra_outputs 
)

Split context set.


Parameters
[in/out]ni_ctx Pointer to NIFramesContext
[in]ni_surfPointer to niquadraFrameSurface1_t
[in]ni_surf1Pointer to niquadraFrameSurface1_t
[in]ni_surf2Pointer to niquadraFrameSurface1_t
[in]num_extra_outputssplit outputs number
Returns
none

Definition at line 1628 of file ni_quadra_filter_api.c.

◆ ni_quadra_upload_device_session_open()

LIB_API int ni_quadra_upload_device_session_open ( NIFramesContext ni_ctx)

Open hwupload filter.


Parameters
[in/out]ni_ctx Pointer NIFramesContext
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE

Definition at line 742 of file ni_quadra_filter_api.c.