libxcoder  5.2.0
ni_quadra_filter_api.c File Reference

Private definitions used by ni_quadra_filter_api.c for video processing tasks. More...

#include "ni_quadra_filter_api.h"
#include "ni_defs.h"
#include "ni_rsrc_api.h"
#include "ni_util.h"
#include "ni_device_api.h"
#include "ni_av_codec.h"
#include "ni_bitstream.h"

Go to the source code of this file.

Functions

ni_fifo_buffer_tni_fifo_initialize (uint32_t number_of_buffers, uint32_t size)
 Initialize a fifo buffer. More...
 
void ni_fifo_free (ni_fifo_buffer_t *p_fifo)
 Free a fifo. More...
 
int ni_fifo_is_full (ni_fifo_buffer_t *p_fifo)
 Check if a fifo is full. More...
 
int ni_fifo_is_empty (ni_fifo_buffer_t *p_fifo)
 Check if a fifo is empty. More...
 
uint32_t ni_fifo_number_of_buffers (ni_fifo_buffer_t *p_fifo)
 Get number of buffers used in fifo. More...
 
uint8_t * ni_fifo_generic_write (ni_fifo_buffer_t *p_fifo)
 Get free buffer to write in the fifo. More...
 
uint8_t * ni_fifo_generic_read (ni_fifo_buffer_t *p_fifo)
 Get first filled buffer to read in the fifo. More...
 
int ni_fifo_return_read (ni_fifo_buffer_t *p_fifo)
 Push back the last read buffer to the fifo. More...
 
int ni_quadra_init_filters (ni_quadra_filter_t *nifilter)
 Init filter. More...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
int ni_quadra_filter_drawtext_prep_frames (void **niframe)
 prepare frames for ni_drawtext filter More...
 
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...
 
void ni_quadra_filter_close (ni_quadra_filter_t *nifilter)
 Close filter. More...
 
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...
 
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...
 
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...
 
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...
 
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...
 
uint32_t ni_quadra_ai_network_layer_size (ni_quadra_network_layer_params_t *p_param)
 
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...
 
int ni_quadra_init_internal_session (NIFramesContext *ni_ctx)
 Init filter session context only malloc session. More...
 
int ni_quadra_init_split_rsrc (NIFramesContext *ni_ctx, int w, int h)
 Init filter split context malloc session and set it default. More...
 
void ni_quadra_filter_device_close (AVNIDeviceContext *ni_hw_ctx)
 Close device. More...
 
int ni_quadra_upload_device_session_open (NIFramesContext *ni_ctx)
 Open hwupload filter. More...
 
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...
 
int ni_quadra_filter_frames_close (NIFramesContext *ni_ctx, int pool_size)
 Close filter context and frame. More...
 
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...
 
int ni_quadra_filter_device_create (AVNIDeviceContext *ni_hw_ctx, const char *device)
 Sends frame pool setup info to device. More...
 
int ni_quadra_filter_get_buffer (NIFramesContext *ni_ctx, uint8_t **dstbuf, uint8_t **dstdata, uint32_t *data_len, int width, int height, int is_planar)
 Sends frame pool setup info to device. More...
 
void ni_quadra_filter_frame_free (void *opaque, uint8_t *data)
 Free filter frame. More...
 
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...
 
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...
 
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...
 
int ni_quadra_get_device_id (void *session_ctx)
 Get session device id. More...
 
uint32_t ni_quadra_get_session_id (void *session_ctx)
 Get session device session id. More...
 
void ni_quadra_device_close (int32_t handle)
 Close device handle. More...
 
int32_t ni_quadra_get_device_handle (void *session_ctx)
 Get session device handle id. More...
 
void ni_quadra_set_device_handle (void *session_ctx, int32_t handle)
 Set session device handle. More...
 
void ni_quadra_filter_session_dl_set (void *session_ctx, bool value)
 Set download filter session context. More...
 
int ni_quadra_device_session_copy (void *src_ctx, void *dst_ctx)
 Copy filter session context. More...
 
void ni_quadra_session_timestamp_copy (void *src_ctx, void *dst_ctx)
 Copy filter session context. More...
 
int ni_quadra_get_session_status (void *session_ctx)
 Get session context status. More...
 
int ni_quadra_get_session_runstatus (void *session_ctx)
 Get session context run status. More...
 
int ni_quadra_get_session_blkiohandle (void *session_ctx)
 Get session context blk_io_handle. More...
 
uint16_t ni_quadra_get_frame_idx (void *niframe)
 Get niframui16FrameIdxe. More...
 
uint8_t * ni_quadra_get_niframe (void *niframe)
 Get niframe address. More...
 
uint8_t * ni_quadra_get_frame_buffer (void *niframe)
 Get niframe buffer address. More...
 
uint32_t ni_quadra_get_frame_buffer_size (void *niframe)
 Get niframe buffer size. More...
 
uint8_t ** ni_quadra_get_frame_data (void *niframe)
 Get niframe data address. More...
 
uint8_t * ni_quadra_get_packet_data (void *nipacket)
 Get nipacket data address. More...
 
uint32_t ni_quadra_get_packet_data_len (void *nipacket)
 Get nipacket data len. More...
 
void ni_quadra_get_frame_data_len (void *niframe, uint32_t *dst_datalen)
 Get niframe data datalen. More...
 
int ni_quadra_filter_hwframe_recycle (void *session_ctx, void *niframe)
 Recycle a frame buffer on card. More...
 
void ni_quadra_set_session_runstatus (void *session_ctx, int status)
 Set session context run status. More...
 
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...
 
int ni_quadra_hwframe_buffer_recycle (niquadraFrameSurface1_t *surface, int32_t device_handle)
 Recycle a frame buffer on card. More...
 
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...
 
int ni_quadra_get_seiset_size ()
 Recycle a frame buffer on card. More...
 
void ni_quadra_log_set_level (int level)
 Set ni_log_level. More...
 
void ni_quadra_log_set_callback (void(*log_callback)(int, const char *, va_list))
 Set ni_log() callback. More...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
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...
 
int ni_quadra_packet_buffer_free (void *p_data)
 Free packet buffer that was previously allocated with ni_packet_buffer_alloc. More...
 
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...
 
ni_quadra_device_pool_tni_quadra_rsrc_get_device_pool (void)
 Create and return the allocated ni_device_pool_t struct. More...
 
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...
 
void ni_quadra_device_session_context_clear (void *p_ctx)
 Clear already allocated session context. More...
 
int ni_quadra_frame_buffer_alloc_hwenc (void *niframe, int video_width, int video_height, int extra_len)
 
void ni_quadra_set_framerate (void *p_ctx, int num, int den)
 
int ni_quadra_get_session_packet_num (void *p_ctx)
 Get session_ctx send/recive packet number. More...
 
int ni_quadra_get_session_frame_num (void *p_ctx)
 Get session_ctx send/recieve frame number. More...
 

Detailed Description

Private definitions used by ni_quadra_filter_api.c for video processing tasks.


Definition in file ni_quadra_filter_api.c.

Function Documentation

◆ ni_fifo_free()

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()

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()

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()

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()

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()

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()

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()

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_quadra_ai_config_hvsplus()

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()

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()

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()

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_network_layer_size()

uint32_t ni_quadra_ai_network_layer_size ( ni_quadra_network_layer_params_t p_param)

Definition at line 620 of file ni_quadra_filter_api.c.

◆ ni_quadra_ai_packet_buffer_alloc()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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()

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.