libxcoder  5.2.0
ni_device_api.c File Reference

Public definitions for operating NETINT video processing devices for video processing. More...

#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "inttypes.h"
#include "ni_device_api.h"
#include "ni_device_api_priv.h"
#include "ni_nvme.h"
#include "ni_util.h"
#include "ni_rsrc_api.h"
#include "ni_rsrc_priv.h"
#include "ni_lat_meas.h"
#include "ni_p2p_ioctl.h"

Go to the source code of this file.

Macros

#define atoi(p_str)   ni_atoi(p_str, &b_error)
 
#define atof(p_str)   ni_atof(p_str, &b_error)
 
#define atobool(p_str)   (ni_atobool(p_str, &b_error))
 
#define OPT(STR)   else if (!strcasecmp(name, STR))
 
#define OPT2(STR1, STR2)   else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))
 
#define atoi(p_str)   ni_atoi(p_str, &b_error)
 
#define atof(p_str)   ni_atof(p_str, &b_error)
 
#define atobool(p_str)   (ni_atobool(p_str, &b_error))
 
#define OPT(STR)   else if (!strcasecmp(name, STR))
 
#define OPT2(STR1, STR2)   else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))
 
#define COMPARE(STR1, STR2, STR3)
 
#define STRDUP(value)   strdup(value);
 
#define GBRWLPARSE(OUT1, OUT2, OFF, IDX)
 
#define atoi(p_str)   ni_atoi(p_str, &b_error)
 
#define atof(p_str)   ni_atof(p_str, &b_error)
 
#define atobool(p_str)   (ni_atobool(p_str, &b_error))
 
#define OPT(STR)   else if (!strcasecmp(name, STR))
 

Functions

ni_session_context_tni_device_session_context_alloc_init (void)
 Allocate and initialize a new ni_session_context_t struct. More...
 
void ni_device_session_context_free (ni_session_context_t *p_ctx)
 Free previously allocated session context. More...
 
ni_retcode_t ni_device_session_context_init (ni_session_context_t *p_ctx)
 Initialize already allocated session context to a known state. More...
 
void ni_device_session_context_clear (ni_session_context_t *p_ctx)
 Clear already allocated session context. More...
 
ni_event_handle_t ni_create_event (void)
 Create event and return event handle if successful (Windows only) More...
 
void ni_close_event (ni_event_handle_t event_handle)
 Close event and release resources (Windows only) More...
 
ni_device_handle_t ni_device_open (const char *p_dev, uint32_t *p_max_io_size_out)
 Open device and return device device_handle if successful. More...
 
void ni_device_close (ni_device_handle_t device_handle)
 Close device and release resources. More...
 
NI_DEPRECATED ni_retcode_t ni_device_capability_query (ni_device_handle_t device_handle, ni_device_capability_t *p_cap)
 Query device and return device capability structure This function had been replaced by ni_device_capability_query2 This function can't be callback in multi thread. More...
 
ni_retcode_t ni_device_capability_query2 (ni_device_handle_t device_handle, ni_device_capability_t *p_cap, bool device_in_ctxt)
 Query device and return device capability structure This function had replaced ni_device_capability_query This function can be callback with multi thread. More...
 
ni_retcode_t ni_device_session_open (ni_session_context_t *p_ctx, ni_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...
 
ni_retcode_t ni_device_session_close (ni_session_context_t *p_ctx, int eos_recieved, ni_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...
 
ni_retcode_t ni_device_session_flush (ni_session_context_t *p_ctx, ni_device_type_t device_type)
 Send a flush command to the device If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to decoder If device_type is NI_DEVICE_TYPE_ENCODER sends EOS command to encoder. More...
 
ni_retcode_t ni_device_dec_session_save_hdrs (ni_session_context_t *p_ctx, uint8_t *hdr_data, uint8_t hdr_size)
 Save a stream's headers in a decoder session that can be used later for continuous decoding from the same source. More...
 
ni_retcode_t ni_device_dec_session_flush (ni_session_context_t *p_ctx)
 Flush a decoder session to get ready to continue decoding. Note: this is different from ni_device_session_flush in that it closes the current decode session and opens a new one for continuous decoding. More...
 
int ni_device_session_write (ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_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_device_session_read (ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t 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...
 
ni_retcode_t ni_device_session_query (ni_session_context_t *p_ctx, ni_device_type_t device_type)
 Query session data from the device - If device_type is valid, will query session data from specified device type. More...
 
ni_retcode_t ni_device_session_query_detail (ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_t *detail_data)
 Query detail session data from the device - If device_type is valid, will query session data from specified device type. More...
 
ni_retcode_t ni_device_session_query_detail_v1 (ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_v1_t *detail_data)
 Query detail session data from the device - If device_type is valid, will query session data from specified device type. More...
 
ni_retcode_t ni_device_config_namespace_num (ni_device_handle_t device_handle, uint32_t namespace_num, uint32_t sriov_index)
 Send namespace num and SRIOv index to the device with specified logic block address. More...
 
ni_retcode_t ni_device_config_qos (ni_device_handle_t device_handle, uint32_t mode)
 Send qos mode to the device with specified logic block address. More...
 
ni_retcode_t ni_device_config_qos_op (ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t over_provision)
 Send qos over provisioning mode to target namespace with specified logic block address. More...
 
ni_retcode_t ni_frame_buffer_alloc (ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar)
 Allocate preliminary memory for the frame buffer based on provided parameters. Applicable to YUV420 Planar pixel (8 or 10 bit/pixel) format or 32-bit RGBA. More...
 
ni_retcode_t ni_enc_frame_buffer_alloc (ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar, ni_pix_fmt_t pix_fmt)
 Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min. resoulution considerations for encoder. More...
 
ni_retcode_t ni_frame_buffer_alloc_dl (ni_frame_t *p_frame, int video_width, int video_height, int pixel_format)
 Allocate preliminary memory for the frame buffer based on provided parameters. More...
 
ni_retcode_t ni_decoder_frame_buffer_alloc (ni_buf_pool_t *p_pool, ni_frame_t *p_frame, int alloc_mem, int video_width, int video_height, int alignment, int factor, int is_planar)
 Allocate memory for decoder frame buffer based on provided parameters; the memory is retrieved from a buffer pool and will be returned to the same buffer pool by ni_decoder_frame_buffer_free. Note: all attributes of ni_frame_t will be set up except for memory and buffer, which rely on the pool being allocated; the pool will be allocated only after the frame resolution is known. More...
 
ni_retcode_t ni_encoder_frame_zerocopy_check (ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params, int width, int height, const int linesize[], bool set_linesize)
 Check if incoming frame is encoder zero copy compatible or not. More...
 
ni_retcode_t ni_encoder_frame_zerocopy_buffer_alloc (ni_frame_t *p_frame, int video_width, int video_height, const int linesize[], const uint8_t *data[], int extra_len)
 Allocate memory for encoder zero copy (metadata, etc.) for encoding based on given parameters, taking into account pic linesize and extra data. Applicable to YUV planr / semi-planar 8 or 10 bit and RGBA pixel formats. More...
 
ni_retcode_t ni_uploader_frame_zerocopy_check (ni_session_context_t *p_upl_ctx, int width, int height, const int linesize[], int pixel_format)
 Check if incoming frame is hwupload zero copy compatible or not. More...
 
ni_retcode_t ni_encoder_frame_buffer_alloc (ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
 Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic line size and extra data. Applicable to YUV420p AVFrame only. 8 or 10 bit/pixel. Cb/Cr size matches that of Y. More...
 
ni_retcode_t ni_scaler_dest_frame_alloc (ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params, niFrameSurface1_t *p_surface)
 allocate device destination frame from scaler hwframe pool More...
 
ni_retcode_t ni_scaler_input_frame_alloc (ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params, niFrameSurface1_t *p_src_surface)
 allocate device input frame by hw descriptor. This call won't actually allocate a frame but sends the incoming hardware frame index to the scaler manager More...
 
ni_retcode_t ni_scaler_frame_pool_alloc (ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params)
 init output pool of scaler frames More...
 
ni_retcode_t ni_frame_buffer_alloc_nv (ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int extra_len, bool alignment_2pass_wa)
 Allocate memory for the frame buffer based on provided parameters taking into account pic line size and extra data. Applicable to nv12 AVFrame only. Cb/Cr size matches that of Y. More...
 
ni_retcode_t ni_encoder_sw_frame_buffer_alloc (bool planar, ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
 This API is a wrapper for ni_encoder_frame_buffer_alloc(), used for planar pixel formats, and ni_frame_buffer_alloc_nv(), used for semi-planar pixel formats. This API is meant to combine the functionality for both individual format APIs. Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic line size and extra data. Applicable to YUV420p(8 or 10 bit/pixel) or nv12 AVFrame. Cb/Cr size matches that of Y. More...
 
ni_retcode_t ni_frame_buffer_free (ni_frame_t *p_frame)
 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_retcode_t ni_decoder_frame_buffer_free (ni_frame_t *p_frame)
 Free decoder frame buffer that was previously allocated with ni_decoder_frame_buffer_alloc, returning memory to a buffer pool. More...
 
void ni_decoder_frame_buffer_pool_return_buf (ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool)
 Return a memory buffer to memory buffer pool. More...
 
ni_retcode_t ni_packet_buffer_alloc (ni_packet_t *p_packet, int packet_size)
 Allocate memory for the packet buffer based on provided packet size. More...
 
ni_retcode_t ni_custom_packet_buffer_alloc (void *p_buffer, ni_packet_t *p_packet, int buffer_size)
 Allocate packet buffer using a user provided pointer, the memory is expected to have already been allocated. More...
 
ni_retcode_t ni_packet_buffer_free (ni_packet_t *p_packet)
 Free packet buffer that was previously allocated with ni_packet_buffer_alloc. More...
 
ni_retcode_t ni_packet_buffer_free_av1 (ni_packet_t *p_packet)
 Free packet buffer that was previously allocated with ni_packet_buffer_alloc for AV1 packets merge. More...
 
int ni_packet_copy (void *p_destination, const void *const p_source, int cur_size, void *p_leftover, int *p_prev_size)
 Copy video packet accounting for alignment. More...
 
ni_aux_data_tni_frame_new_aux_data (ni_frame_t *frame, ni_aux_data_type_t type, int data_size)
 Add a new auxiliary data to a frame. More...
 
ni_aux_data_tni_frame_new_aux_data_from_raw_data (ni_frame_t *frame, ni_aux_data_type_t type, const uint8_t *raw_data, int data_size)
 Add a new auxiliary data to a frame and copy in the raw data. More...
 
ni_aux_data_tni_frame_get_aux_data (const ni_frame_t *frame, ni_aux_data_type_t type)
 Retrieve from the frame auxiliary data of a given type if exists. More...
 
void ni_frame_free_aux_data (ni_frame_t *frame, ni_aux_data_type_t type)
 If auxiliary data of the given type exists in the frame, free it and remove it from the frame. More...
 
void ni_frame_wipe_aux_data (ni_frame_t *frame)
 Free and remove all auxiliary data from the frame. More...
 
ni_retcode_t ni_encoder_init_default_params (ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height, ni_codec_format_t codec_format)
 Initialize default encoder parameters. More...
 
ni_retcode_t ni_decoder_init_default_params (ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height)
 Initialize default decoder parameters. More...
 
ni_retcode_t ni_parse_reconf_file (const char *reconf_file, int hash_map[][NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE])
 
ni_retcode_t ni_parse_customize_qpoffset_file (const char *customize_file, int8_t qp_map[][NI_CUSTOMIZE_ROI_QP_NUM])
 
ni_retcode_t ni_decoder_params_set_value (ni_xcoder_params_t *p_params, const char *name, char *value)
 Set value referenced by name in decoder parameters structure. More...
 
ni_retcode_t ni_encoder_params_set_value (ni_xcoder_params_t *p_params, const char *name, const char *value)
 Set value referenced by name in encoder parameters structure. More...
 
ni_retcode_t ni_encoder_gop_params_set_value (ni_xcoder_params_t *p_params, const char *name, const char *value)
 Set GOP parameter value referenced by name in encoder parameters structure. More...
 
ni_retcode_t ni_device_session_copy (ni_session_context_t *src_p_ctx, ni_session_context_t *dst_p_ctx)
 Copy existing decoding session params for hw frame usage. More...
 
int ni_device_session_read_hwdesc (ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t 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_device_session_hwdl (ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, niFrameSurface1_t *hwdesc)
 Reads YUV data from hw descriptor stored location on device. More...
 
ni_retcode_t ni_device_session_query_buffer_avail (ni_session_context_t *p_ctx, ni_device_type_t device_type)
 Query the session if a buffer is available. More...
 
int ni_device_session_hwup (ni_session_context_t *p_ctx, ni_session_data_io_t *p_src_data, niFrameSurface1_t *hwdesc)
 Sends raw YUV input to uploader instance and retrieves a HW descriptor to represent it. More...
 
ni_retcode_t ni_frame_buffer_alloc_hwenc (ni_frame_t *p_frame, 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...
 
ni_retcode_t ni_hwframe_buffer_recycle (niFrameSurface1_t *surface, int32_t device_handle)
 Recycle a frame buffer on card. More...
 
ni_retcode_t ni_hwframe_buffer_recycle2 (niFrameSurface1_t *surface)
 Recycle a frame buffer on card, only hwframe descriptor is needed. More...
 
int ni_device_session_init_framepool (ni_session_context_t *p_ctx, uint32_t pool_size, uint32_t pool)
 Sends frame pool setup info to device. More...
 
ni_retcode_t ni_device_session_update_framepool (ni_session_context_t *p_ctx, uint32_t pool_size)
 Sends frame pool change info to device. More...
 
ni_retcode_t ni_scaler_set_params (ni_session_context_t *p_ctx, ni_scaler_params_t *p_params)
 Set parameters on the device for the 2D engine. More...
 
ni_retcode_t ni_scaler_set_drawbox_params (ni_session_context_t *p_ctx, ni_scaler_drawbox_params_t *p_params)
 Send a p_config command to configure scaling drawbox parameters. More...
 
ni_retcode_t ni_scaler_set_watermark_params (ni_session_context_t *p_ctx, ni_scaler_watermark_params_t *p_params)
 Send a p_config command to configure scaling watermark parameters. More...
 
ni_retcode_t ni_device_alloc_frame (ni_session_context_t *p_ctx, 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, ni_device_type_t device_type)
 Allocate a frame on the device for 2D engine or AI engine to work on based on provided parameters. More...
 
ni_retcode_t ni_device_alloc_dst_frame (ni_session_context_t *p_ctx, niFrameSurface1_t *p_out_surface, ni_device_type_t device_type)
 Allocate a frame on the device and return the frame index. More...
 
ni_retcode_t ni_device_clone_hwframe (ni_session_context_t *p_ctx, ni_frameclone_desc_t *p_frameclone_desc)
 Copy the data of src hwframe to dst hwframe. More...
 
ni_retcode_t ni_device_config_frame (ni_session_context_t *p_ctx, ni_frame_config_t *p_cfg)
 Configure the 2D engine to work based on provided parameters. More...
 
ni_retcode_t ni_device_multi_config_frame (ni_session_context_t *p_ctx, ni_frame_config_t p_cfg_in[], int numInCfgs, ni_frame_config_t *p_cfg_out)
 Configure the 2D engine to work based on provided parameters. More...
 
int ni_calculate_total_frame_size (const ni_session_context_t *p_upl_ctx, const int linesize[])
 Calculate the total size of a frame based on the upload context attributes and includes rounding up to the page size. More...
 
ni_retcode_t ni_frame_buffer_alloc_pixfmt (ni_frame_t *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...
 
ni_retcode_t ni_ai_config_network_binary (ni_session_context_t *p_ctx, ni_network_data_t *p_network, const char *file)
 configure a network context based with the network binary More...
 
ni_retcode_t ni_ai_config_hvsplus (ni_session_context_t *p_ctx, ni_network_data_t *p_network)
 configure a hvsplus filter More...
 
ni_retcode_t ni_ai_frame_buffer_alloc (ni_frame_t *p_frame, ni_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...
 
ni_retcode_t ni_ai_packet_buffer_alloc (ni_packet_t *p_packet, ni_network_data_t *p_network)
 Allocate output layers memory for the packet buffer based on provided network. More...
 
ni_retcode_t ni_reconfig_bitrate (ni_session_context_t *p_ctx, int32_t bitrate)
 Reconfigure bitrate dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_intraprd (ni_session_context_t *p_ctx, int32_t intra_period)
 Reconfigure intraPeriod dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_vui (ni_session_context_t *p_ctx, ni_vui_hrd_t *vui)
 Reconfigure VUI HRD dynamically during encoding. More...
 
ni_retcode_t ni_force_idr_frame_type (ni_session_context_t *p_ctx)
 Force next frame to be IDR frame during encoding. More...
 
ni_retcode_t ni_set_ltr (ni_session_context_t *p_ctx, ni_long_term_ref_t *ltr)
 Set a frame's support of Long Term Reference frame during encoding. More...
 
ni_retcode_t ni_set_ltr_interval (ni_session_context_t *p_ctx, int32_t ltr_interval)
 Set Long Term Reference interval. More...
 
ni_retcode_t ni_set_frame_ref_invalid (ni_session_context_t *p_ctx, int32_t frame_num)
 Set frame reference invalidation. More...
 
ni_retcode_t ni_reconfig_framerate (ni_session_context_t *p_ctx, ni_framerate_t *framerate)
 Reconfigure framerate dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_max_frame_size (ni_session_context_t *p_ctx, int32_t max_frame_size)
 Reconfigure maxFrameSize dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_min_max_qp (ni_session_context_t *p_ctx, ni_rc_min_max_qp *p_min_max_qp)
 Reconfigure min&max qp dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_crf (ni_session_context_t *p_ctx, int32_t crf)
 Reconfigure crf value dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_crf2 (ni_session_context_t *p_ctx, float crf)
 Reconfigure crf float point value dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_vbv_value (ni_session_context_t *p_ctx, int32_t vbvMaxRate, int32_t vbvBufferSize)
 Reconfigure vbv buffer size and vbv max rate dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_max_frame_size_ratio (ni_session_context_t *p_ctx, int32_t max_frame_size_ratio)
 Reconfigure maxFrameSizeRatio dynamically during encoding. More...
 
ni_retcode_t ni_reconfig_slice_arg (ni_session_context_t *p_ctx, int16_t sliceArg)
 Reconfigure sliceArg dynamically during encoding. More...
 
int ni_device_session_acquire (ni_session_context_t *p_ctx, ni_frame_t *p_frame)
 Acquire a P2P frame buffer from the hwupload session. More...
 
int ni_device_session_acquire_for_read (ni_session_context_t *p_ctx, ni_frame_t *p_frame)
 Acquire a P2P frame buffer from the hwupload session for P2P read. More...
 
ni_retcode_t ni_uploader_frame_buffer_lock (ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
 Lock a hardware P2P frame prior to encoding. More...
 
ni_retcode_t ni_uploader_frame_buffer_unlock (ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
 Unlock a hardware P2P frame after encoding. More...
 
ni_retcode_t ni_uploader_p2p_test_send (ni_session_context_t *p_upl_ctx, uint8_t *p_data, uint32_t len, ni_frame_t *p_hwframe)
 Special P2P test API function. Copies YUV data from the software frame to the hardware P2P frame on the Quadra device. More...
 
ni_retcode_t ni_uploader_p2p_test_load (ni_session_context_t *p_upl_ctx, uint8_t *p_data, uint32_t len, ni_frame_t *p_hwframe)
 Special P2P test API function. Copies video data from the software frame to the hardware P2P frame on the Quadra device. Does not need the Netint kernel driver but requires root privilege. More...
 
ni_retcode_t ni_hwframe_p2p_buffer_recycle (ni_frame_t *p_frame)
 Recycle hw P2P frames. More...
 
ni_retcode_t ni_scaler_p2p_frame_acquire (ni_session_context_t *p_ctx, niFrameSurface1_t *p_surface, int data_len)
 Acquire the scaler P2P DMA buffer for read/write. More...
 
ni_retcode_t ni_encoder_set_input_frame_format (ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params, int width, int height, int bit_depth, int src_endian, int planar)
 Set the incoming frame format for the encoder. More...
 
ni_retcode_t ni_uploader_set_frame_format (ni_session_context_t *p_upl_ctx, int width, int height, ni_pix_fmt_t pixel_format, int isP2P)
 Set the outgoing frame format for the uploader. More...
 
int ni_encoder_session_read_stream_header (ni_session_context_t *p_ctx, ni_session_data_io_t *p_data)
 Read encoder stream header from the device. More...
 
int32_t ni_get_dma_buf_file_descriptor (const ni_frame_t *p_frame)
 Get the DMA buffer file descriptor from the P2P frame. More...
 
ni_retcode_t ni_device_session_sequence_change (ni_session_context_t *p_ctx, int width, int height, int bit_depth_factor, ni_device_type_t device_type)
 Send sequence change information to device. More...
 
ni_retcode_t ni_ai_session_read_metrics (ni_session_context_t *p_ctx, ni_network_perf_metrics_t *p_metrics)
 Fetch perf metrics of inferences from device. More...
 
ni_retcode_t ni_query_fl_fw_versions (ni_device_handle_t device_handle, ni_device_info_t *p_dev_info)
 Query firmware loader and firmware versions from the device. More...
 
ni_retcode_t ni_query_nvme_status (ni_session_context_t *p_ctx, ni_load_query_t *p_load_query)
 Query NVMe load from the device. More...
 
ni_retcode_t ni_query_vf_ns_id (ni_device_handle_t device_handle, ni_device_vf_ns_id_t *p_dev_ns_vf, uint8_t fw_rev[])
 Query VF and NS id from device. More...
 
ni_retcode_t ni_query_temperature (ni_device_handle_t device_handle, ni_device_temp_t *p_dev_temp, uint8_t fw_rev[])
 Query CompositeTemp from device. More...
 
ni_retcode_t ni_query_extra_info (ni_device_handle_t device_handle, ni_device_extra_info_t *p_dev_extra_info, uint8_t fw_rev[])
 Query CompositeTemp from device. More...
 
ni_retcode_t ni_device_alloc_and_get_firmware_logs (ni_session_context_t *p_ctx, void **p_log_buffer, bool gen_log_file)
 Allocate log buffer if needed and retrieve firmware logs from device. More...
 
ni_retcode_t ni_set_demo_roi_map (ni_session_context_t *p_enc_ctx)
 Set up hard coded demo ROI map. More...
 
ni_retcode_t ni_enc_prep_reconf_demo_data (ni_session_context_t *p_enc_ctx, ni_frame_t *p_frame)
 Convert various reconfig and demo modes (stored in encoder configuration) to aux data and store them in frame. More...
 
int ni_strcasecmp (const char *a, const char *b)
 
void ni_gop_params_check_set (ni_xcoder_params_t *p_param, char *value)
 Set custom gop and prepare to check if success. More...
 
bool ni_gop_params_check (ni_xcoder_params_t *p_param)
 Check custom gop params set. More...
 
NI_DEPRECATED ni_retcode_t ni_p2p_xfer (ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
 Initiate P2P transfer (P2P write) (deprecated) More...
 
ni_retcode_t ni_p2p_send (ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
 Initiate P2P transfer (P2P write) More...
 
ni_retcode_t ni_p2p_recv (ni_session_context_t *pSession, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame)
 Initiate a P2P transfer (P2P read) More...
 
ni_retcode_t ni_device_session_restart (ni_session_context_t *p_ctx, int video_width, int video_height, ni_device_type_t device_type)
 Send a restart command after flush command Only support Encoder now. More...
 

Variables

const char *const g_xcoder_preset_names [NI_XCODER_PRESET_NAMES_ARRAY_LEN]
 
const char *const g_xcoder_log_names [NI_XCODER_LOG_NAMES_ARRAY_LEN]
 

Detailed Description

Public definitions for operating NETINT video processing devices for video processing.


Definition in file ni_device_api.c.

Macro Definition Documentation

◆ atobool [1/3]

#define atobool (   p_str)    (ni_atobool(p_str, &b_error))

Definition at line 7180 of file ni_device_api.c.

◆ atobool [2/3]

#define atobool (   p_str)    (ni_atobool(p_str, &b_error))

Definition at line 7180 of file ni_device_api.c.

◆ atobool [3/3]

#define atobool (   p_str)    (ni_atobool(p_str, &b_error))

Definition at line 7180 of file ni_device_api.c.

◆ atof [1/3]

#define atof (   p_str)    ni_atof(p_str, &b_error)

Definition at line 7179 of file ni_device_api.c.

◆ atof [2/3]

#define atof (   p_str)    ni_atof(p_str, &b_error)

Definition at line 7179 of file ni_device_api.c.

◆ atof [3/3]

#define atof (   p_str)    ni_atof(p_str, &b_error)

Definition at line 7179 of file ni_device_api.c.

◆ atoi [1/3]

#define atoi (   p_str)    ni_atoi(p_str, &b_error)

Definition at line 7178 of file ni_device_api.c.

◆ atoi [2/3]

#define atoi (   p_str)    ni_atoi(p_str, &b_error)

Definition at line 7178 of file ni_device_api.c.

◆ atoi [3/3]

#define atoi (   p_str)    ni_atoi(p_str, &b_error)

Definition at line 7178 of file ni_device_api.c.

◆ COMPARE

#define COMPARE (   STR1,
  STR2,
  STR3 
)
Value:
if ((atoi(STR1) > (STR2)) || (atoi(STR1) < (STR3))) \
{ \
}

◆ GBRWLPARSE

#define GBRWLPARSE (   OUT1,
  OUT2,
  OFF,
  IDX 
)

◆ OPT [1/3]

#define OPT (   STR)    else if (!strcasecmp(name, STR))

◆ OPT [2/3]

#define OPT (   STR)    else if (!strcasecmp(name, STR))

◆ OPT [3/3]

#define OPT (   STR)    else if (!strcasecmp(name, STR))

◆ OPT2 [1/2]

#define OPT2 (   STR1,
  STR2 
)    else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))

◆ OPT2 [2/2]

#define OPT2 (   STR1,
  STR2 
)    else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))

◆ STRDUP

#define STRDUP (   value)    strdup(value);

Function Documentation

◆ ni_ai_config_hvsplus()

ni_retcode_t ni_ai_config_hvsplus ( ni_session_context_t p_ctx,
ni_network_data_t p_network 
)

configure a hvsplus filter


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
Returns
NI_RETCODE_SUCCESS NI_RETCODE_FAILURE

Definition at line 9651 of file ni_device_api.c.

◆ ni_ai_config_network_binary()

ni_retcode_t ni_ai_config_network_binary ( ni_session_context_t p_ctx,
ni_network_data_t p_network,
const char *  file 
)

configure a network context based with the network binary


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_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 9562 of file ni_device_api.c.

◆ ni_ai_frame_buffer_alloc()

ni_retcode_t ni_ai_frame_buffer_alloc ( ni_frame_t p_frame,
ni_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 caller allocated ni_frame_t
[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 9698 of file ni_device_api.c.

◆ ni_ai_packet_buffer_alloc()

ni_retcode_t ni_ai_packet_buffer_alloc ( ni_packet_t p_packet,
ni_network_data_t p_network 
)

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


Parameters
[out]p_packetPointer to a caller allocated ni_packet_t struct
[in]p_networkPointer to a caller allocated ni_network_data_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 9779 of file ni_device_api.c.

◆ ni_ai_session_read_metrics()

ni_retcode_t ni_ai_session_read_metrics ( ni_session_context_t p_ctx,
ni_network_perf_metrics_t p_metrics 
)

Fetch perf metrics of inferences from device.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_metricsPointer to network metrics
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 11379 of file ni_device_api.c.

◆ ni_calculate_total_frame_size()

int ni_calculate_total_frame_size ( const ni_session_context_t p_upl_ctx,
const int  linesize[] 
)

Calculate the total size of a frame based on the upload context attributes and includes rounding up to the page size.


Parameters
[in]p_upl_ctxpointer to an uploader session context
[in]linesizearray of line stride
Returns
size NI_RETCODE_INVALID_PARAM

Definition at line 9145 of file ni_device_api.c.

◆ ni_close_event()

void ni_close_event ( ni_event_handle_t  event_handle)

Close event and release resources (Windows only)


Returns
NONE

Definition at line 294 of file ni_device_api.c.

◆ ni_create_event()

ni_event_handle_t ni_create_event ( void  )

Create event and return event handle if successful (Windows only)


Returns
On success returns a event handle On failure returns NI_INVALID_EVENT_HANDLE

Definition at line 266 of file ni_device_api.c.

◆ ni_custom_packet_buffer_alloc()

ni_retcode_t ni_custom_packet_buffer_alloc ( void *  p_buffer,
ni_packet_t p_packet,
int  buffer_size 
)

Allocate packet buffer using a user provided pointer, the memory is expected to have already been allocated.


For ideal performance memory should be 4k aligned. If it is not 4K aligned then a temporary 4k aligned memory will be used to copy data to and from when writing and reading. This will negatively impact performance.

This API will overwrite p_packet->buffer_size, p_packet->p_buffer and p_packet->p_data fields in p_packet.

This API will not free any memory associated with p_packet->p_buffer and p_packet->p_data fields in p_packet. Common use case could be,

  1. Allocate memory to pointer
  2. Call ni_custom_packet_buffer_alloc() with allocated pointer.
  3. Use p_packet as required.
  4. Call ni_packet_buffer_free() to free up the memory.
Parameters
[in]p_bufferUser provided pointer to be used for buffer
[in]p_packetPointer to a caller allocated ni_packet_t struct
[in]buffer_sizeBuffer size
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 3807 of file ni_device_api.c.

◆ ni_decoder_frame_buffer_alloc()

ni_retcode_t ni_decoder_frame_buffer_alloc ( ni_buf_pool_t p_pool,
ni_frame_t p_frame,
int  alloc_mem,
int  video_width,
int  video_height,
int  alignment,
int  factor,
int  is_planar 
)

Allocate memory for decoder frame buffer based on provided parameters; the memory is retrieved from a buffer pool and will be returned to the same buffer pool by ni_decoder_frame_buffer_free. Note: all attributes of ni_frame_t will be set up except for memory and buffer, which rely on the pool being allocated; the pool will be allocated only after the frame resolution is known.


Parameters
[in]p_poolBuffer pool to get the memory from
[in]p_framePointer to a caller allocated ni_frame_t struct
[in]alloc_memWhether to get memory from buffer pool
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]alignmentAlignment requirement
[in]factor1 for 8 bits/pixel format, 2 for 10 bits/pixel
[in]is_planar0 if semiplanar else planar
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 2586 of file ni_device_api.c.

◆ ni_decoder_frame_buffer_free()

ni_retcode_t ni_decoder_frame_buffer_free ( ni_frame_t p_frame)

Free decoder frame buffer that was previously allocated with ni_decoder_frame_buffer_alloc, returning memory to a buffer pool.


Parameters
[in]p_framePointer to a previously allocated ni_frame_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 3644 of file ni_device_api.c.

◆ ni_decoder_frame_buffer_pool_return_buf()

void ni_decoder_frame_buffer_pool_return_buf ( ni_buf_t buf,
ni_buf_pool_t p_buffer_pool 
)

Return a memory buffer to memory buffer pool.

Return a memory buffer to memory buffer pool, for a decoder frame.


Parameters
[in]bufBuffer to be returned.
[in]p_buffer_poolBuffer pool to return buffer to.
Returns
None

Definition at line 3694 of file ni_device_api.c.

◆ ni_decoder_init_default_params()

ni_retcode_t ni_decoder_init_default_params ( ni_xcoder_params_t p_param,
int  fps_num,
int  fps_denom,
long  bit_rate,
int  width,
int  height 
)

Initialize default decoder parameters.


Parameters
[out]paramPointer to a user allocated ni_xcoder_params_t to initialize to default parameters
[in]fps_numFrames per second
[in]fps_denomFPS denomination
[in]bit_ratebit rate
[in]widthframe width
[in]heightframe height
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 4546 of file ni_device_api.c.

◆ ni_decoder_params_set_value()

ni_retcode_t ni_decoder_params_set_value ( ni_xcoder_params_t p_params,
const char *  name,
char *  value 
)

Set value referenced by name in decoder parameters structure.


Parameters
[in]p_paramsPointer to a user allocated ni_xcoder_params_t (used for decoder too for now ) to find and set a particular parameter
[in]nameString represented parameter name to search
[in]valueParameter value to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 4881 of file ni_device_api.c.

◆ ni_device_alloc_and_get_firmware_logs()

ni_retcode_t ni_device_alloc_and_get_firmware_logs ( ni_session_context_t p_ctx,
void **  p_log_buffer,
bool  gen_log_file 
)

Allocate log buffer if needed and retrieve firmware logs from device.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_log_bufferReference to pointer to a log buffer If log buffer pointer is NULL, this function will allocate log buffer NOTE caller is responsible for freeing log buffer after calling this function
[in]gen_log_fileIndicating whether it is required to generate log files
Returns
on success NI_RETCODE_SUCCESS

on failure NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_INVALID_PARAM

Definition at line 11713 of file ni_device_api.c.

◆ ni_device_alloc_dst_frame()

ni_retcode_t ni_device_alloc_dst_frame ( ni_session_context_t p_ctx,
niFrameSurface1_t p_out_surface,
ni_device_type_t  device_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 8947 of file ni_device_api.c.

◆ ni_device_alloc_frame()

ni_retcode_t ni_device_alloc_frame ( ni_session_context_t p_ctx,
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,
ni_device_type_t  device_type 
)

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


Parameters
[in]p_ctxpointer to session context
[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_INVALID_PARAM NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_MEM_ALOC

Definition at line 8880 of file ni_device_api.c.

◆ ni_device_capability_query()

NI_DEPRECATED ni_retcode_t ni_device_capability_query ( ni_device_handle_t  device_handle,
ni_device_capability_t p_cap 
)

Query device and return device capability structure This function had been replaced by ni_device_capability_query2 This function can't be callback in multi thread.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open
[in]p_capPointer to a caller allocated ni_device_capability_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 587 of file ni_device_api.c.

◆ ni_device_capability_query2()

ni_retcode_t ni_device_capability_query2 ( ni_device_handle_t  device_handle,
ni_device_capability_t p_cap,
bool  device_in_ctxt 
)

Query device and return device capability structure This function had replaced ni_device_capability_query This function can be callback with multi thread.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open
[in]p_capPointer to a caller allocated ni_device_capability_t struct
[in]device_in_ctxtIf device is in ctx
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 647 of file ni_device_api.c.

◆ ni_device_clone_hwframe()

ni_retcode_t ni_device_clone_hwframe ( ni_session_context_t p_ctx,
ni_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 8997 of file ni_device_api.c.

◆ ni_device_close()

void ni_device_close ( ni_device_handle_t  device_handle)

Close device and release resources.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open()
Returns
NONE

Definition at line 503 of file ni_device_api.c.

◆ ni_device_config_frame()

ni_retcode_t ni_device_config_frame ( ni_session_context_t p_ctx,
ni_frame_config_t p_cfg 
)

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

Config a frame on the device for 2D engined to work on based on provided parameters.


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

Definition at line 9049 of file ni_device_api.c.

◆ ni_device_config_namespace_num()

ni_retcode_t ni_device_config_namespace_num ( ni_device_handle_t  device_handle,
uint32_t  namespace_num,
uint32_t  sriov_index 
)

Send namespace num and SRIOv index to the device with specified logic block address.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open
[in]namespace_numSet the namespace number with designated sriov
[in]sriov_indexIdentify which sriov need to be set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 2037 of file ni_device_api.c.

◆ ni_device_config_qos()

ni_retcode_t ni_device_config_qos ( ni_device_handle_t  device_handle,
uint32_t  mode 
)

Send qos mode to the device with specified logic block address.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open
[in]modeThe requested qos mode
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 2058 of file ni_device_api.c.

◆ ni_device_config_qos_op()

ni_retcode_t ni_device_config_qos_op ( ni_device_handle_t  device_handle,
ni_device_handle_t  device_handle_t,
uint32_t  over_provision 
)

Send qos over provisioning mode to target namespace with specified logic block address.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open
[in]device_handle_tTarget device handle of namespace required for OP
[in]over_provisionThe request overprovision percent
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 2080 of file ni_device_api.c.

◆ ni_device_dec_session_flush()

ni_retcode_t ni_device_dec_session_flush ( ni_session_context_t p_ctx)

Flush a decoder session to get ready to continue decoding. Note: this is different from ni_device_session_flush in that it closes the current decode session and opens a new one for continuous decoding.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
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 1621 of file ni_device_api.c.

◆ ni_device_dec_session_save_hdrs()

ni_retcode_t ni_device_dec_session_save_hdrs ( ni_session_context_t p_ctx,
uint8_t *  hdr_data,
uint8_t  hdr_size 
)

Save a stream's headers in a decoder session that can be used later for continuous decoding from the same source.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]hdr_dataPointer to header data
[in]hdr_sizeSize of header data in bytes
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 1566 of file ni_device_api.c.

◆ ni_device_multi_config_frame()

ni_retcode_t ni_device_multi_config_frame ( ni_session_context_t p_ctx,
ni_frame_config_t  p_cfg_in[],
int  numInCfgs,
ni_frame_config_t p_cfg_out 
)

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

Config multiple frame on the device for 2D engined to work on based on provided parameters.


Parameters
[in]p_ctxpointer to session context
[in]p_cfg_inpointer to input frame configuration
[in]numInCfgsnumber of input frame configurations
[in]p_cfg_outpointer to output frame configuration
Returns
NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_MEM_ALOC

Definition at line 9095 of file ni_device_api.c.

◆ ni_device_open()

ni_device_handle_t ni_device_open ( const char *  p_dev,
uint32_t *  p_max_io_size_out 
)

Open device and return device device_handle if successful.


Parameters
[in]p_devDevice name represented as c string. ex: "/dev/nvme0"
[out]p_max_io_size_outMaximum IO Transfer size supported, could be NULL
Returns
On success returns a device device_handle On failure returns NI_INVALID_DEVICE_HANDLE

Definition at line 360 of file ni_device_api.c.

◆ ni_device_session_acquire()

int ni_device_session_acquire ( ni_session_context_t p_ctx,
ni_frame_t p_frame 
)

Acquire a P2P frame buffer from the hwupload session.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[out]p_framePointer to a caller allocated hw frame
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 10602 of file ni_device_api.c.

◆ ni_device_session_acquire_for_read()

int ni_device_session_acquire_for_read ( ni_session_context_t p_ctx,
ni_frame_t p_frame 
)

Acquire a P2P frame buffer from the hwupload session for P2P read.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[out]p_framePointer to a caller allocated hw frame
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 10697 of file ni_device_api.c.

◆ ni_device_session_close()

ni_retcode_t ni_device_session_close ( ni_session_context_t p_ctx,
int  eos_recieved,
ni_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 1379 of file ni_device_api.c.

◆ ni_device_session_context_alloc_init()

ni_session_context_t* ni_device_session_context_alloc_init ( void  )

Allocate and initialize a new ni_session_context_t struct.


Returns
On success returns a valid pointer to newly allocated context On failure returns NULL

Definition at line 98 of file ni_device_api.c.

◆ ni_device_session_context_clear()

void ni_device_session_context_clear ( ni_session_context_t p_ctx)

Clear already allocated session context.


Parameters
[in]p_ctxPointer to an already allocated ni_session_context_t

Definition at line 249 of file ni_device_api.c.

◆ ni_device_session_context_free()

void ni_device_session_context_free ( ni_session_context_t p_ctx)

Free previously allocated session context.


Parameters
[in]p_ctxPointer to an already allocated ni_session_context_t struct

Definition at line 130 of file ni_device_api.c.

◆ ni_device_session_context_init()

ni_retcode_t ni_device_session_context_init ( ni_session_context_t p_ctx)

Initialize already allocated session context to a known state.


Parameters
[in]p_ctxPointer to an already allocated ni_session_context_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_FAILURE

Definition at line 156 of file ni_device_api.c.

◆ ni_device_session_copy()

ni_retcode_t ni_device_session_copy ( ni_session_context_t src_p_ctx,
ni_session_context_t dst_p_ctx 
)

Copy existing decoding session params for hw frame usage.


Parameters
[in]src_p_ctxPointer to a caller allocated source session context
[in]dst_p_ctxPointer to a caller allocated destination session context
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 8015 of file ni_device_api.c.

◆ ni_device_session_flush()

ni_retcode_t ni_device_session_flush ( ni_session_context_t p_ctx,
ni_device_type_t  device_type 
)

Send a flush command to the device If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to decoder If device_type is NI_DEVICE_TYPE_ENCODER sends EOS command to encoder.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
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 1512 of file ni_device_api.c.

◆ ni_device_session_hwdl()

int ni_device_session_hwdl ( ni_session_context_t p_ctx,
ni_session_data_io_t p_data,
niFrameSurface1_t hwdesc 
)

Reads YUV data from hw descriptor stored location on device.

Read YUV data from hw descriptor stored location on device.


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]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 8210 of file ni_device_api.c.

◆ ni_device_session_hwup()

int ni_device_session_hwup ( ni_session_context_t p_ctx,
ni_session_data_io_t p_src_data,
niFrameSurface1_t hwdesc 
)

Sends raw YUV input to uploader instance and retrieves a HW descriptor to represent it.

Send raw YUV input to uploader instance and retrieve a HW descriptor to represent it.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_src_dataPointer to a caller allocated ni_session_data_io_t struct which contains a ni_frame_t data frame to send to uploader
[out]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 8363 of file ni_device_api.c.

◆ ni_device_session_init_framepool()

int ni_device_session_init_framepool ( ni_session_context_t p_ctx,
uint32_t  pool_size,
uint32_t  pool 
)

Sends frame pool setup info to device.

Send frame pool setup info to device.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[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_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_MEM_ALOC

Definition at line 8564 of file ni_device_api.c.

◆ ni_device_session_open()

ni_retcode_t ni_device_session_open ( ni_session_context_t p_ctx,
ni_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

resource management context

Definition at line 710 of file ni_device_api.c.

◆ ni_device_session_query()

ni_retcode_t ni_device_session_query ( ni_session_context_t p_ctx,
ni_device_type_t  device_type 
)

Query session data from the device - If device_type is valid, will query session data from specified device type.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or NI_DEVICE_TYPE_SCALER or NI_DEVICE_TYPE_AI or NI_DEVICE_TYPE_UPLOADER
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 1920 of file ni_device_api.c.

◆ ni_device_session_query_buffer_avail()

ni_retcode_t ni_device_session_query_buffer_avail ( ni_session_context_t p_ctx,
ni_device_type_t  device_type 
)

Query the session if a buffer is available.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct [in] device_type Quadra device type
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 8296 of file ni_device_api.c.

◆ ni_device_session_query_detail()

ni_retcode_t ni_device_session_query_detail ( ni_session_context_t p_ctx,
ni_device_type_t  device_type,
ni_instance_mgr_detail_status_t detail_data 
)

Query detail session data from the device - If device_type is valid, will query session data from specified device type.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or
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 1960 of file ni_device_api.c.

◆ ni_device_session_query_detail_v1()

ni_retcode_t ni_device_session_query_detail_v1 ( ni_session_context_t p_ctx,
ni_device_type_t  device_type,
ni_instance_mgr_detail_status_v1_t detail_data 
)

Query detail session data from the device - If device_type is valid, will query session data from specified device type.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or
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 2000 of file ni_device_api.c.

◆ ni_device_session_read()

int ni_device_session_read ( ni_session_context_t p_ctx,
ni_session_data_io_t p_data,
ni_device_type_t  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]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, 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 1769 of file ni_device_api.c.

◆ ni_device_session_read_hwdesc()

int ni_device_session_read_hwdesc ( ni_session_context_t p_ctx,
ni_session_data_io_t p_data,
ni_device_type_t  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]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_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_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION

Definition at line 8043 of file ni_device_api.c.

◆ ni_device_session_restart()

ni_retcode_t ni_device_session_restart ( ni_session_context_t p_ctx,
int  video_width,
int  video_height,
ni_device_type_t  device_type 
)

Send a restart command after flush command Only support Encoder now.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]widthwidth, in pixels
[in]heightheight, in pixels
[in]device_typeNI_DEVICE_TYPE_ENCODER
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 12913 of file ni_device_api.c.

◆ ni_device_session_sequence_change()

ni_retcode_t ni_device_session_sequence_change ( ni_session_context_t p_ctx,
int  width,
int  height,
int  bit_depth_factor,
ni_device_type_t  device_type 
)

Send sequence change information to device.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]widthinput width
[in]heightinput height
[in]bit_depth_factor1 for 8-bit YUV, 2 for 10-bit YUV
[in]device_typedevice type (must be encoder)
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 NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION

Definition at line 11322 of file ni_device_api.c.

◆ ni_device_session_update_framepool()

ni_retcode_t ni_device_session_update_framepool ( ni_session_context_t p_ctx,
uint32_t  pool_size 
)

Sends frame pool change info to device.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]pool_sizeif pool_size = 0, free allocated device memory buffers if pool_size > 0, expand device frame buffer pool of current instance with pool_size more frame buffers
Returns
On success Return code On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION

Definition at line 8612 of file ni_device_api.c.

◆ ni_device_session_write()

int ni_device_session_write ( ni_session_context_t p_ctx,
ni_session_data_io_t p_data,
ni_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.

Send 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 1668 of file ni_device_api.c.

◆ ni_enc_frame_buffer_alloc()

ni_retcode_t ni_enc_frame_buffer_alloc ( ni_frame_t p_frame,
int  video_width,
int  video_height,
int  alignment,
int  metadata_flag,
int  factor,
int  hw_frame_count,
int  is_planar,
ni_pix_fmt_t  pix_fmt 
)

Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min. resoulution considerations for encoder.


Parameters
[in]p_framePointer to a caller allocated ni_frame_t struct
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]alignmentAllignment requirement
[in]metadata_flagFlag indicating if space for additional metadata should be allocated
[in]factor1 for 8 bits/pixel format, 2 for 10 bits/pixel, 4 for 32 bits/pixel (RGBA)
[in]hw_frame_countNumber of hw descriptors stored
[in]is_planar0 if semiplanar else planar
[in]pix_fmtpixel format to distinguish between planar types and/or components
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 2321 of file ni_device_api.c.

◆ ni_enc_prep_reconf_demo_data()

ni_retcode_t ni_enc_prep_reconf_demo_data ( ni_session_context_t p_enc_ctx,
ni_frame_t p_frame 
)

Convert various reconfig and demo modes (stored in encoder configuration) to aux data and store them in frame.


Parameters
[in]p_enc_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_framePointer to a caller allocated ni_frame_t struct
Returns
on success NI_RETCODE_SUCCESS

on failure NI_RETCODE_ERROR_MEM_ALOC

Definition at line 11947 of file ni_device_api.c.

◆ ni_encoder_frame_buffer_alloc()

ni_retcode_t ni_encoder_frame_buffer_alloc ( ni_frame_t p_frame,
int  video_width,
int  video_height,
int  linesize[],
int  alignment,
int  extra_len,
bool  alignment_2pass_wa 
)

Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic line size and extra data. Applicable to YUV420p AVFrame only. 8 or 10 bit/pixel. Cb/Cr size matches that of Y.


Parameters
[in]p_framePointer to a caller allocated ni_frame_t struct
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]linesizePicture line size
[in]alignmentAllignment requirement
[in]extra_lenExtra data size (incl. meta data). < 0 means not to allocate any buffer (zero-copy from existing)
[in]alignment_2pass_waset alignment to work with 2pass encode
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 3161 of file ni_device_api.c.

◆ ni_encoder_frame_zerocopy_buffer_alloc()

ni_retcode_t ni_encoder_frame_zerocopy_buffer_alloc ( ni_frame_t p_frame,
int  video_width,
int  video_height,
const int  linesize[],
const uint8_t *  data[],
int  extra_len 
)

Allocate memory for encoder zero copy (metadata, etc.) for encoding based on given parameters, taking into account pic linesize and extra data. Applicable to YUV planr / semi-planar 8 or 10 bit and RGBA pixel formats.


Parameters
[in]p_framePointer to a caller allocated ni_frame_t struct
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]linesizePicture line size
[in]dataPicture data pointers (for each of YUV planes)
[in]extra_lenExtra data size (incl. meta data)
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 2879 of file ni_device_api.c.

◆ ni_encoder_frame_zerocopy_check()

ni_retcode_t ni_encoder_frame_zerocopy_check ( ni_session_context_t p_enc_ctx,
ni_xcoder_params_t p_enc_params,
int  width,
int  height,
const int  linesize[],
bool  set_linesize 
)

Check if incoming frame is encoder zero copy compatible or not.


Parameters
[in]p_enc_ctxpointer to encoder context [in] p_enc_params pointer to encoder parameters [in] width input width [in] height input height [in] linesize input linesizes (pointer to array) [in] set_linesize setup linesizes 0 means not setup linesizes, 1 means setup linesizes (before encoder open)
Returns
on success and can do zero copy NI_RETCODE_SUCCESS

cannot do zero copy NI_RETCODE_ERROR_UNSUPPORTED_FEATURE NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_INVALID_PARAM

Definition at line 2733 of file ni_device_api.c.

◆ ni_encoder_gop_params_set_value()

ni_retcode_t ni_encoder_gop_params_set_value ( ni_xcoder_params_t p_params,
const char *  name,
const char *  value 
)

Set GOP parameter value referenced by name in encoder parameters structure.


Parameters
[in]p_paramsPointer to a user allocated ni_xcoder_params_t to find and set a particular parameter
[in]nameString represented parameter name to search
[in]valueParameter value to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 7197 of file ni_device_api.c.

◆ ni_encoder_init_default_params()

ni_retcode_t ni_encoder_init_default_params ( ni_xcoder_params_t p_param,
int  fps_num,
int  fps_denom,
long  bit_rate,
int  width,
int  height,
ni_codec_format_t  codec_format 
)

Initialize default encoder parameters.


Parameters
[out]paramPointer to a user allocated ni_xcoder_params_t to initialize to default parameters
[in]fps_numFrames per second
[in]fps_denomFPS denomination
[in]bit_ratebit rate
[in]widthframe width
[in]heightframe height
[in]codec_formatcodec from ni_codec_format_t
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 4147 of file ni_device_api.c.

◆ ni_encoder_params_set_value()

ni_retcode_t ni_encoder_params_set_value ( ni_xcoder_params_t p_params,
const char *  name,
const char *  value 
)

Set value referenced by name in encoder parameters structure.


Parameters
[in]p_paramsPointer to a user allocated ni_xcoder_params_t to find and set a particular parameter
[in]nameString represented parameter name to search
[in]valueParameter value to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

allow "5.1" or "51", both converted to integer 51

if level-idc specifies an obviously wrong value in either float or int, throw error consistently. Stronger level checking will be done in encoder_open()

Definition at line 5635 of file ni_device_api.c.

◆ ni_encoder_session_read_stream_header()

int ni_encoder_session_read_stream_header ( ni_session_context_t p_ctx,
ni_session_data_io_t p_data 
)

Read encoder stream header from the device.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct from encoder
[in]p_dataPointer to a caller allocated ni_session_data_io_t struct which contains a ni_packet_t data packet to receive
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 11232 of file ni_device_api.c.

◆ ni_encoder_set_input_frame_format()

ni_retcode_t ni_encoder_set_input_frame_format ( ni_session_context_t p_enc_ctx,
ni_xcoder_params_t p_enc_params,
int  width,
int  height,
int  bit_depth,
int  src_endian,
int  planar 
)

Set the incoming frame format for the encoder.


Parameters
[in]p_enc_ctxpointer to encoder context [in] p_enc_params pointer to encoder parameters [in] width input width [in] height input height [in] bit_depth 8 for 8-bit YUV, 10 for 10-bit YUV [in] src_endian NI_FRAME_LITTLE_ENDIAN or NI_FRAME_BIG_ENDIAN [in] planar 0 for semi-planar YUV, 1 for planar YUV
Returns
on success NI_RETCODE_SUCCESS

on failure NI_RETCODE_INVALID_PARAM

Definition at line 11083 of file ni_device_api.c.

◆ ni_encoder_sw_frame_buffer_alloc()

ni_retcode_t ni_encoder_sw_frame_buffer_alloc ( bool  planar,
ni_frame_t p_frame,
int  video_width,
int  video_height,
int  linesize[],
int  alignment,
int  extra_len,
bool  alignment_2pass_wa 
)

This API is a wrapper for ni_encoder_frame_buffer_alloc(), used for planar pixel formats, and ni_frame_buffer_alloc_nv(), used for semi-planar pixel formats. This API is meant to combine the functionality for both individual format APIs. Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic line size and extra data. Applicable to YUV420p(8 or 10 bit/pixel) or nv12 AVFrame. Cb/Cr size matches that of Y.

This API is a wrapper for ni_encoder_frame_buffer_alloc(), used for planar pixel formats, and ni_frame_buffer_alloc_nv(), used for semi-planar pixel formats. This API is meant to combine the functionality for both formats. Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic line size and extra data. Applicable to YUV420p(8 or 10 bit/pixel) or nv12 AVFrame. Cb/Cr size matches that of Y.


Parameters
[in]planartrue: if planar: pixel_format == (NI_PIX_FMT_YUV420P || NI_PIX_FMT_YUV420P10LE ||NI_PIX_FMT_RGBA). false: semi-planar: pixel_format == (NI_PIX_FMT_NV12 || NI_PIX_FMT_P010LE).
[in]p_framePointer to a caller allocated ni_frame_t struct
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]linesizePicture line size
[in]alignmentAllignment requirement. Only used for planar format.
[in]extra_lenExtra data size (incl. meta data). < 0 means not to allocate any buffer (zero-copy from existing)
[in]alignment_2pass_waset alignment to work with 2pass encode
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 3531 of file ni_device_api.c.

◆ ni_force_idr_frame_type()

ni_retcode_t ni_force_idr_frame_type ( ni_session_context_t p_ctx)

Force next frame to be IDR frame during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
Returns
On success NI_RETCODE_SUCCESS

Definition at line 9992 of file ni_device_api.c.

◆ ni_frame_buffer_alloc()

ni_retcode_t ni_frame_buffer_alloc ( ni_frame_t p_frame,
int  video_width,
int  video_height,
int  alignment,
int  metadata_flag,
int  factor,
int  hw_frame_count,
int  is_planar 
)

Allocate preliminary memory for the frame buffer based on provided parameters. Applicable to YUV420 Planar pixel (8 or 10 bit/pixel) format or 32-bit RGBA.


Parameters
[in]p_framePointer to a caller allocated ni_frame_t struct
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]alignmentAllignment requirement
[in]metadata_flagFlag indicating if space for additional metadata should be allocated
[in]factor1 for 8 bits/pixel format, 2 for 10 bits/pixel, 4 for 32 bits/pixel (RGBA)
[in]hw_frame_countNumber of hw descriptors stored
[in]is_planar0 if semiplanar else planar
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 2123 of file ni_device_api.c.

◆ ni_frame_buffer_alloc_dl()

ni_retcode_t ni_frame_buffer_alloc_dl ( ni_frame_t p_frame,
int  video_width,
int  video_height,
int  pixel_format 
)

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


Parameters
[in]p_framePointer to a caller allocated ni_frame_t struct
[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 2393 of file ni_device_api.c.

◆ ni_frame_buffer_alloc_hwenc()

ni_retcode_t ni_frame_buffer_alloc_hwenc ( ni_frame_t p_frame,
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]p_framePointer to a caller allocated ni_frame_t struct
[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_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 8399 of file ni_device_api.c.

◆ ni_frame_buffer_alloc_nv()

ni_retcode_t ni_frame_buffer_alloc_nv ( ni_frame_t p_frame,
int  video_width,
int  video_height,
int  linesize[],
int  extra_len,
bool  alignment_2pass_wa 
)

Allocate memory for the frame buffer based on provided parameters taking into account pic line size and extra data. Applicable to nv12 AVFrame only. Cb/Cr size matches that of Y.


Parameters
[in]p_framePointer to a caller allocated ni_frame_t struct
[in]video_widthWidth of the video frame
[in]video_heightHeight of the video frame
[in]linesizePicture line size
[in]extra_lenExtra data size (incl. meta data). < 0 means not to allocate any buffer (zero-copy from existing)
[in]alignment_2pass_waset alignment to work with 2pass encode
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 3397 of file ni_device_api.c.

◆ ni_frame_buffer_alloc_pixfmt()

ni_retcode_t ni_frame_buffer_alloc_pixfmt ( ni_frame_t 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 ni_frame_t
[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 9252 of file ni_device_api.c.

◆ ni_frame_buffer_free()

ni_retcode_t ni_frame_buffer_free ( ni_frame_t p_frame)

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_framePointer to a previously allocated ni_frame_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 3561 of file ni_device_api.c.

◆ ni_frame_free_aux_data()

void ni_frame_free_aux_data ( ni_frame_t frame,
ni_aux_data_type_t  type 
)

If auxiliary data of the given type exists in the frame, free it and remove it from the frame.


Parameters
[in/out]frame a frame from which the auxiliary data should be removed
[in]typetype of the auxiliary data to be removed
Returns
None

Definition at line 4089 of file ni_device_api.c.

◆ ni_frame_get_aux_data()

ni_aux_data_t* ni_frame_get_aux_data ( const ni_frame_t frame,
ni_aux_data_type_t  type 
)

Retrieve from the frame auxiliary data of a given type if exists.


Parameters
[in]framea frame from which the auxiliary data should be retrieved
[in]typetype of the auxiliary data to be retrieved
Returns
a pointer to the aux data of a given type on success, NULL otherwise

Definition at line 4066 of file ni_device_api.c.

◆ ni_frame_new_aux_data()

ni_aux_data_t* ni_frame_new_aux_data ( ni_frame_t frame,
ni_aux_data_type_t  type,
int  data_size 
)

Add a new auxiliary data to a frame.


Parameters
[in/out]frame a frame to which the auxiliary data should be added
[in]typetype of the added auxiliary data
[in]data_sizesize of the added auxiliary data
Returns
a pointer to the newly added aux data on success, NULL otherwise

Definition at line 4005 of file ni_device_api.c.

◆ ni_frame_new_aux_data_from_raw_data()

ni_aux_data_t* ni_frame_new_aux_data_from_raw_data ( ni_frame_t frame,
ni_aux_data_type_t  type,
const uint8_t *  raw_data,
int  data_size 
)

Add a new auxiliary data to a frame and copy in the raw data.


Parameters
[in/out]frame a frame to which the auxiliary data should be added
[in]typetype of the added auxiliary data
[in]raw_datathe raw data of the aux data
[in]data_sizesize of the added auxiliary data
Returns
a pointer to the newly added aux data on success, NULL otherwise

Definition at line 4045 of file ni_device_api.c.

◆ ni_frame_wipe_aux_data()

void ni_frame_wipe_aux_data ( ni_frame_t frame)

Free and remove all auxiliary data from the frame.


Parameters
[in/out]frame a frame from which the auxiliary data should be removed
Returns
None

Definition at line 4115 of file ni_device_api.c.

◆ ni_get_dma_buf_file_descriptor()

int32_t ni_get_dma_buf_file_descriptor ( const ni_frame_t p_frame)

Get the DMA buffer file descriptor from the P2P frame.


Parameters
[in]p_framepointer to a P2P frame
Returns
On success DMA buffer file descriptor On failure NI_RETCODE_INVALID_PARAM

Definition at line 11283 of file ni_device_api.c.

◆ ni_gop_params_check()

bool ni_gop_params_check ( ni_xcoder_params_t p_param)

Check custom gop params set.


Parameters
[in]p_paramPointer to a caller allocated ni_xcoder_params_t struct
Returns
on success true

on failure false

Definition at line 12749 of file ni_device_api.c.

◆ ni_gop_params_check_set()

void ni_gop_params_check_set ( ni_xcoder_params_t p_param,
char *  value 
)

Set custom gop and prepare to check if success.


Parameters
[in]p_paramPointer to a caller allocated ni_xcoder_params_t struct
[in]valuePointer to a caller allocated custom gop name
Returns
none

Definition at line 12614 of file ni_device_api.c.

◆ ni_hwframe_buffer_recycle()

ni_retcode_t ni_hwframe_buffer_recycle ( niFrameSurface1_t surface,
int32_t  device_handle 
)

Recycle a frame buffer on card.

Recycle a hwframe 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 8487 of file ni_device_api.c.

◆ ni_hwframe_buffer_recycle2()

ni_retcode_t ni_hwframe_buffer_recycle2 ( niFrameSurface1_t surface)

Recycle a frame buffer on card, only hwframe descriptor is needed.

Recycle a hwframe buffer on card.


Parameters
[in]surfaceStruct containing device and frame location to clear out
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 8517 of file ni_device_api.c.

◆ ni_hwframe_p2p_buffer_recycle()

ni_retcode_t ni_hwframe_p2p_buffer_recycle ( ni_frame_t p_frame)

Recycle hw P2P frames.


Parameters
[in]p_framepointer to an acquired P2P hw frame
Returns
on success NI_RETCODE_SUCCESS

on failure NI_RETCODE_INVALID_PARAM

Definition at line 10996 of file ni_device_api.c.

◆ ni_p2p_recv()

ni_retcode_t ni_p2p_recv ( ni_session_context_t pSession,
const ni_p2p_sgl_t dmaAddrs,
ni_frame_t pDstFrame 
)

Initiate a P2P transfer (P2P read)


Parameters
[in]pSessionPointer to destination upload session
[in]dmaAddrsPointer to source DMA addresses
[in]pDstFramePointer to destination P2P frame
Returns
on success NI_RETCODE_SUCCESS on failure NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 12866 of file ni_device_api.c.

◆ ni_p2p_send()

ni_retcode_t ni_p2p_send ( ni_session_context_t pSession,
niFrameSurface1_t source,
uint64_t  ui64DestAddr,
uint32_t  ui32FrameSize 
)

Initiate P2P transfer (P2P write)

Initiate P2P transfer to another device (P2P write)


Parameters
[in]pSessionPointer to source card destination
[in]sourcePointer to source frame to transmit
[in]ui64DestAddrDestination address on target device
[in]ui32FrameSizeSize of frame to transfer
Returns
on success NI_RETCODE_SUCCESS on failure NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_ERROR_NVME_CMD_FAILED

Definition at line 12822 of file ni_device_api.c.

◆ ni_p2p_xfer()

NI_DEPRECATED ni_retcode_t ni_p2p_xfer ( ni_session_context_t pSession,
niFrameSurface1_t source,
uint64_t  ui64DestAddr,
uint32_t  ui32FrameSize 
)

Initiate P2P transfer (P2P write) (deprecated)


Parameters
[in]pSessionPointer to source card destination
[in]sourcePointer to source frame to transmit
[in]ui64DestAddrDestination address on target device
[in]ui32FrameSizeSize of frame to transfer
Returns
always returns NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION

Definition at line 12791 of file ni_device_api.c.

◆ ni_packet_buffer_alloc()

ni_retcode_t ni_packet_buffer_alloc ( ni_packet_t p_packet,
int  packet_size 
)

Allocate memory for the packet buffer based on provided packet size.


Parameters
[in]p_packetPointer to a caller allocated ni_packet_t struct
[in]packet_sizeRequired allocation size
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_MEM_ALOC

Definition at line 3713 of file ni_device_api.c.

◆ ni_packet_buffer_free()

ni_retcode_t ni_packet_buffer_free ( ni_packet_t p_packet)

Free packet buffer that was previously allocated with ni_packet_buffer_alloc.


Parameters
[in]p_packetPointer to a previously allocated ni_packet_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 3843 of file ni_device_api.c.

◆ ni_packet_buffer_free_av1()

ni_retcode_t ni_packet_buffer_free_av1 ( ni_packet_t p_packet)

Free packet buffer that was previously allocated with ni_packet_buffer_alloc for AV1 packets merge.


Parameters
[in]p_packetPointer to a previously allocated ni_packet_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 3884 of file ni_device_api.c.

◆ ni_packet_copy()

int ni_packet_copy ( void *  p_destination,
const void *const  p_source,
int  cur_size,
void *  p_leftover,
int *  p_prev_size 
)

Copy video packet accounting for alignment.


Parameters
[in]p_destinationDestination to where to copy to
[in]p_sourceSource from where to copy from
[in]cur_sizecurrent size
[out]p_leftoverPointer to the data that was left over
[out]p_prev_sizeSize of the data leftover ??
Returns
On success Total number of bytes that were copied On failure NI_RETCODE_FAILURE

Definition at line 3936 of file ni_device_api.c.

◆ ni_parse_customize_qpoffset_file()

ni_retcode_t ni_parse_customize_qpoffset_file ( const char *  customize_file,
int8_t  qp_map[][NI_CUSTOMIZE_ROI_QP_NUM] 
)

Definition at line 4768 of file ni_device_api.c.

◆ ni_parse_reconf_file()

ni_retcode_t ni_parse_reconf_file ( const char *  reconf_file,
int  hash_map[][NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE] 
)

Definition at line 4664 of file ni_device_api.c.

◆ ni_query_extra_info()

ni_retcode_t ni_query_extra_info ( ni_device_handle_t  device_handle,
ni_device_extra_info_t p_dev_extra_info,
uint8_t  fw_rev[] 
)

Query CompositeTemp from device.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open()
[in]p_dev_extra_infoPointer to device extra info
[in]fw_rev[]Fw version to check if this function is supported
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_MEM_ALOC

Definition at line 11617 of file ni_device_api.c.

◆ ni_query_fl_fw_versions()

ni_retcode_t ni_query_fl_fw_versions ( ni_device_handle_t  device_handle,
ni_device_info_t p_dev_info 
)

Query firmware loader and firmware versions from the device.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open()
[in]device_info
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_MEM_ALOC

Definition at line 11385 of file ni_device_api.c.

◆ ni_query_nvme_status()

ni_retcode_t ni_query_nvme_status ( ni_session_context_t p_ctx,
ni_load_query_t p_load_query 
)

Query NVMe load from the device.


Parameters
[in]p_ctxPointer to a caller allocated ni_session_context_t struct
[in]p_load_queryPointer to a caller allocated ni_load_query_t struct
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_MEM_ALOC

Definition at line 11447 of file ni_device_api.c.

◆ ni_query_temperature()

ni_retcode_t ni_query_temperature ( ni_device_handle_t  device_handle,
ni_device_temp_t p_dev_temp,
uint8_t  fw_rev[] 
)

Query CompositeTemp from device.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open()
[in]p_dev_tempPointer to device temperature
[in]fw_rev[]Fw version to check if this function is supported
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_MEM_ALOC

Definition at line 11562 of file ni_device_api.c.

◆ ni_query_vf_ns_id()

ni_retcode_t ni_query_vf_ns_id ( ni_device_handle_t  device_handle,
ni_device_vf_ns_id_t p_dev_ns_vf,
uint8_t  fw_rev[] 
)

Query VF and NS id from device.


Parameters
[in]device_handleDevice handle obtained by calling ni_device_open()
[in]p_dev_ns_vfPointer to a ni_device_vf_ns_id_t struct
[in]fw_rev[]Fw version to check if this function is supported
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_ERROR_MEM_ALOC

Definition at line 11509 of file ni_device_api.c.

◆ ni_reconfig_bitrate()

ni_retcode_t ni_reconfig_bitrate ( ni_session_context_t p_ctx,
int32_t  bitrate 
)

Reconfigure bitrate dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]bitrateTarget bitrate to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 9869 of file ni_device_api.c.

◆ ni_reconfig_crf()

ni_retcode_t ni_reconfig_crf ( ni_session_context_t p_ctx,
int32_t  crf 
)

Reconfigure crf value dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]crfcrf value to reconfigure
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10301 of file ni_device_api.c.

◆ ni_reconfig_crf2()

ni_retcode_t ni_reconfig_crf2 ( ni_session_context_t p_ctx,
float  crf 
)

Reconfigure crf float point value dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]crfcrf float point value to reconfigure
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10358 of file ni_device_api.c.

◆ ni_reconfig_framerate()

ni_retcode_t ni_reconfig_framerate ( ni_session_context_t p_ctx,
ni_framerate_t framerate 
)

Reconfigure framerate dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]framerateTarget framerate to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10107 of file ni_device_api.c.

◆ ni_reconfig_intraprd()

ni_retcode_t ni_reconfig_intraprd ( ni_session_context_t p_ctx,
int32_t  intra_period 
)

Reconfigure intraPeriod dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]intra_periodTarget intra period to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

NOTE - the frame upon which intra period is reconfigured is encoded as IDR frame NOTE - reconfigure intra period is not allowed if intraRefreshMode is enabled or if gopPresetIdx is 1

Definition at line 9909 of file ni_device_api.c.

◆ ni_reconfig_max_frame_size()

ni_retcode_t ni_reconfig_max_frame_size ( ni_session_context_t p_ctx,
int32_t  max_frame_size 
)

Reconfigure maxFrameSize dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]max_frame_sizemaxFrameSize to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

NOTE - maxFrameSize_Bytes value less than ((bitrate / 8) / framerate) will be rejected

Definition at line 10176 of file ni_device_api.c.

◆ ni_reconfig_max_frame_size_ratio()

ni_retcode_t ni_reconfig_max_frame_size_ratio ( ni_session_context_t p_ctx,
int32_t  max_frame_size_ratio 
)

Reconfigure maxFrameSizeRatio dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]max_frame_size_ratiomaxFrameSizeRatio to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10468 of file ni_device_api.c.

◆ ni_reconfig_min_max_qp()

ni_retcode_t ni_reconfig_min_max_qp ( ni_session_context_t p_ctx,
ni_rc_min_max_qp p_min_max_qp 
)

Reconfigure min&max qp dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]ni_rc_min_max_qpTarget min&max qp to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10251 of file ni_device_api.c.

◆ ni_reconfig_slice_arg()

ni_retcode_t ni_reconfig_slice_arg ( ni_session_context_t p_ctx,
int16_t  sliceArg 
)

Reconfigure sliceArg dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]sliceArgthe new sliceArg value
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10541 of file ni_device_api.c.

◆ ni_reconfig_vbv_value()

ni_retcode_t ni_reconfig_vbv_value ( ni_session_context_t p_ctx,
int32_t  vbvMaxRate,
int32_t  vbvBufferSize 
)

Reconfigure vbv buffer size and vbv max rate dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]vbvBufferSizeTarget vbvBufferSize to set
[in]vbvMaxRateTarget vbvMaxRate to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10418 of file ni_device_api.c.

◆ ni_reconfig_vui()

ni_retcode_t ni_reconfig_vui ( ni_session_context_t p_ctx,
ni_vui_hrd_t vui 
)

Reconfigure VUI HRD dynamically during encoding.

Reconfigure VUI dynamically during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]bitrateTarget bitrate to set
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 9945 of file ni_device_api.c.

◆ ni_scaler_dest_frame_alloc()

ni_retcode_t ni_scaler_dest_frame_alloc ( ni_session_context_t p_ctx,
ni_scaler_input_params_t  scaler_params,
niFrameSurface1_t p_surface 
)

allocate device destination frame from scaler hwframe pool


Parameters
<br>
Returns
0 if successful, < 0 otherwise

Definition at line 3298 of file ni_device_api.c.

◆ ni_scaler_frame_pool_alloc()

ni_retcode_t ni_scaler_frame_pool_alloc ( ni_session_context_t p_ctx,
ni_scaler_input_params_t  scaler_params 
)

init output pool of scaler frames


Parameters
<br>
Returns
0 if successful, < 0 otherwise

Definition at line 3355 of file ni_device_api.c.

◆ ni_scaler_input_frame_alloc()

ni_retcode_t ni_scaler_input_frame_alloc ( ni_session_context_t p_ctx,
ni_scaler_input_params_t  scaler_params,
niFrameSurface1_t p_src_surface 
)

allocate device input frame by hw descriptor. This call won't actually allocate a frame but sends the incoming hardware frame index to the scaler manager


Parameters
<br>
Returns
0 if successful, < 0 otherwise

Definition at line 3333 of file ni_device_api.c.

◆ ni_scaler_p2p_frame_acquire()

ni_retcode_t ni_scaler_p2p_frame_acquire ( ni_session_context_t p_ctx,
niFrameSurface1_t p_surface,
int  data_len 
)

Acquire the scaler P2P DMA buffer for read/write.


Parameters
[in]p_ctxpointer to caller allocated upload context [in] p_surface pointer to a caller allocated hardware frame [in] data_len scaler frame buffer data length
Returns
on success NI_RETCODE_SUCCESS

on failure NI_RETCODE_FAILURE

Definition at line 11029 of file ni_device_api.c.

◆ ni_scaler_set_drawbox_params()

ni_retcode_t ni_scaler_set_drawbox_params ( ni_session_context_t p_ctx,
ni_scaler_drawbox_params_t p_params 
)

Send a p_config command to configure scaling drawbox parameters.


Parameters
ni_session_context_tp_ctx - xcoder Context
ni_scaler_params_t* params - pointer to the scaler ni_scaler_drawbox params_t struct
Returns
- NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION, NI_RETCODE_ERROR_NVME_CMD_FAILED on failure

Definition at line 8701 of file ni_device_api.c.

◆ ni_scaler_set_params()

ni_retcode_t ni_scaler_set_params ( ni_session_context_t p_ctx,
ni_scaler_params_t p_params 
)

Set parameters on the device for the 2D engine.


Parameters
[in]p_ctxpointer to session context
[in]p_paramspointer to scaler parameters
Returns
NI_RETCODE_INVALID_PARAM NI_RETCODE_ERROR_INVALID_SESSION NI_RETCODE_ERROR_NVME_CMD_FAILED NI_RETCODE_ERROR_MEM_ALOC

Definition at line 8671 of file ni_device_api.c.

◆ ni_scaler_set_watermark_params()

ni_retcode_t ni_scaler_set_watermark_params ( ni_session_context_t p_ctx,
ni_scaler_watermark_params_t p_params 
)

Send a p_config command to configure scaling watermark parameters.


Parameters
ni_session_context_tp_ctx - xcoder Context
ni_scaler_params_t* params - pointer to the scaler ni_scaler_watermark_params_t struct
Returns
- NI_RETCODE_SUCCESS on success, NI_RETCODE_ERROR_INVALID_SESSION, NI_RETCODE_ERROR_NVME_CMD_FAILED on failure

Definition at line 8781 of file ni_device_api.c.

◆ ni_set_demo_roi_map()

ni_retcode_t ni_set_demo_roi_map ( ni_session_context_t p_enc_ctx)

Set up hard coded demo ROI map.


Parameters
[in]p_enc_ctxPointer to a caller allocated
Returns
on success NI_RETCODE_SUCCESS

on failure NI_RETCODE_ERROR_MEM_ALOC

Definition at line 11751 of file ni_device_api.c.

◆ ni_set_frame_ref_invalid()

ni_retcode_t ni_set_frame_ref_invalid ( ni_session_context_t p_ctx,
int32_t  frame_num 
)

Set frame reference invalidation.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]frame_numframe number after which all references shall be invalidated
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10082 of file ni_device_api.c.

◆ ni_set_ltr()

ni_retcode_t ni_set_ltr ( ni_session_context_t p_ctx,
ni_long_term_ref_t ltr 
)

Set a frame's support of Long Term Reference frame during encoding.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]ltrPointer to struct specifying LTR support
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10026 of file ni_device_api.c.

◆ ni_set_ltr_interval()

ni_retcode_t ni_set_ltr_interval ( ni_session_context_t p_ctx,
int32_t  ltr_interval 
)

Set Long Term Reference interval.


Parameters
[in]p_ctxPointer to caller allocated ni_session_context_t
[in]ltr_intervalthe new long term reference inteval value
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_INVALID_PARAM

Definition at line 10054 of file ni_device_api.c.

◆ ni_strcasecmp()

int ni_strcasecmp ( const char *  a,
const char *  b 
)

Definition at line 12603 of file ni_device_api.c.

◆ ni_uploader_frame_buffer_lock()

ni_retcode_t ni_uploader_frame_buffer_lock ( ni_session_context_t p_upl_ctx,
ni_frame_t p_frame 
)

Lock a hardware P2P frame prior to encoding.


Parameters
[in]p_upl_ctxpointer to caller allocated upload context [in] p_frame pointer to caller allocated hardware P2P frame
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 10763 of file ni_device_api.c.

◆ ni_uploader_frame_buffer_unlock()

ni_retcode_t ni_uploader_frame_buffer_unlock ( ni_session_context_t p_upl_ctx,
ni_frame_t p_frame 
)

Unlock a hardware P2P frame after encoding.


Parameters
[in]p_upl_ctxpointer to caller allocated upload context [in] p_frame pointer to caller allocated hardware P2P frame
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 10821 of file ni_device_api.c.

◆ ni_uploader_frame_zerocopy_check()

ni_retcode_t ni_uploader_frame_zerocopy_check ( ni_session_context_t p_upl_ctx,
int  width,
int  height,
const int  linesize[],
int  pixel_format 
)

Check if incoming frame is hwupload zero copy compatible or not.


Parameters
[in]p_upl_ctxpointer to uploader context [in] width input width [in] height input height [in] linesize input linesizes (pointer to array) [in] pixel_format input pixel format
Returns
on success and can do zero copy NI_RETCODE_SUCCESS

cannot do zero copy NI_RETCODE_ERROR_UNSUPPORTED_FEATURE NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION NI_RETCODE_INVALID_PARAM

Definition at line 3028 of file ni_device_api.c.

◆ ni_uploader_p2p_test_load()

ni_retcode_t ni_uploader_p2p_test_load ( ni_session_context_t p_upl_ctx,
uint8_t *  p_data,
uint32_t  len,
ni_frame_t p_hwframe 
)

Special P2P test API function. Copies video data from the software frame to the hardware P2P frame on the Quadra device. Does not need the Netint kernel driver but requires root privilege.


Parameters
[in]p_upl_ctxpointer to caller allocated uploader session context [in] p_swframe pointer to a caller allocated software frame [in] p_hwframe pointer to a caller allocated hardware frame
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 10924 of file ni_device_api.c.

◆ ni_uploader_p2p_test_send()

ni_retcode_t ni_uploader_p2p_test_send ( ni_session_context_t p_upl_ctx,
uint8_t *  p_data,
uint32_t  len,
ni_frame_t p_hwframe 
)

Special P2P test API function. Copies YUV data from the software frame to the hardware P2P frame on the Quadra device.

Special P2P test API call. Copies YUV data from the software frame to the hardware P2P frame on the Quadra device.


Parameters
[in]p_upl_ctxpointer to caller allocated uploader session context [in] p_swframe pointer to a caller allocated software frame [in] p_hwframe pointer to a caller allocated hardware frame
Returns
On success NI_RETCODE_SUCCESS On failure NI_RETCODE_FAILURE NI_RETCODE_INVALID_PARAM

Definition at line 10869 of file ni_device_api.c.

◆ ni_uploader_set_frame_format()

ni_retcode_t ni_uploader_set_frame_format ( ni_session_context_t p_upl_ctx,
int  width,
int  height,
ni_pix_fmt_t  pixel_format,
int  isP2P 
)

Set the outgoing frame format for the uploader.

Set the frame format for the uploader.


Parameters
[in]p_upl_ctxpointer to uploader context [in] width width [in] height height [in] pixel_format pixel format [in] isP2P 0 = normal, 1 = P2P
Returns
on success NI_RETCODE_SUCCESS

on failure NI_RETCODE_INVALID_PARAM

Definition at line 11171 of file ni_device_api.c.

Variable Documentation

◆ g_xcoder_log_names

◆ g_xcoder_preset_names

const char* const g_xcoder_preset_names[NI_XCODER_PRESET_NAMES_ARRAY_LEN]
Initial value:

Definition at line 69 of file ni_device_api.c.

NI_XCODER_PRESET_NAME_CUSTOM
#define NI_XCODER_PRESET_NAME_CUSTOM
Definition: ni_device_api.h:2880
NI_XCODER_LOG_NAME_WARN
#define NI_XCODER_LOG_NAME_WARN
Definition: ni_device_api.h:2884
NI_XCODER_LOG_NAME_FULL
#define NI_XCODER_LOG_NAME_FULL
Definition: ni_device_api.h:2887
NI_XCODER_LOG_NAME_NONE
#define NI_XCODER_LOG_NAME_NONE
Definition: ni_device_api.h:2882
NI_XCODER_LOG_NAME_INFO
#define NI_XCODER_LOG_NAME_INFO
Definition: ni_device_api.h:2885
NI_XCODER_PRESET_NAME_DEFAULT
#define NI_XCODER_PRESET_NAME_DEFAULT
Definition: ni_device_api.h:2879
NI_XCODER_LOG_NAME_ERROR
#define NI_XCODER_LOG_NAME_ERROR
Definition: ni_device_api.h:2883
atoi
#define atoi(p_str)
Definition: ni_device_api.c:7178
NI_XCODER_LOG_NAME_DEBUG
#define NI_XCODER_LOG_NAME_DEBUG
Definition: ni_device_api.h:2886
NI_RETCODE_PARAM_ERROR_OOR
@ NI_RETCODE_PARAM_ERROR_OOR
Definition: ni_defs.h:493