![]() |
libxcoder
5.2.0
|
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_t * | ni_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_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. More... | |
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. More... | |
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. 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] |
Public definitions for operating NETINT video processing devices for video processing.
Definition in file ni_device_api.c.
#define atobool | ( | p_str | ) | (ni_atobool(p_str, &b_error)) |
Definition at line 7180 of file ni_device_api.c.
#define atobool | ( | p_str | ) | (ni_atobool(p_str, &b_error)) |
Definition at line 7180 of file ni_device_api.c.
#define atobool | ( | p_str | ) | (ni_atobool(p_str, &b_error)) |
Definition at line 7180 of file ni_device_api.c.
#define atof | ( | p_str | ) | ni_atof(p_str, &b_error) |
Definition at line 7179 of file ni_device_api.c.
#define atof | ( | p_str | ) | ni_atof(p_str, &b_error) |
Definition at line 7179 of file ni_device_api.c.
#define atof | ( | p_str | ) | ni_atof(p_str, &b_error) |
Definition at line 7179 of file ni_device_api.c.
#define atoi | ( | p_str | ) | ni_atoi(p_str, &b_error) |
Definition at line 7178 of file ni_device_api.c.
#define atoi | ( | p_str | ) | ni_atoi(p_str, &b_error) |
Definition at line 7178 of file ni_device_api.c.
#define atoi | ( | p_str | ) | ni_atoi(p_str, &b_error) |
Definition at line 7178 of file ni_device_api.c.
#define COMPARE | ( | STR1, | |
STR2, | |||
STR3 | |||
) |
#define GBRWLPARSE | ( | OUT1, | |
OUT2, | |||
OFF, | |||
IDX | |||
) |
#define OPT2 | ( | STR1, | |
STR2 | |||
) | else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2)) |
#define OPT2 | ( | STR1, | |
STR2 | |||
) | else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2)) |
#define STRDUP | ( | value | ) | strdup(value); |
ni_retcode_t ni_ai_config_hvsplus | ( | ni_session_context_t * | p_ctx, |
ni_network_data_t * | p_network | ||
) |
configure a hvsplus filter
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
Definition at line 9651 of file ni_device_api.c.
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
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | file | Pointer to caller network binary file path |
Definition at line 9562 of file ni_device_api.c.
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.
[out] | p_frame | Pointer to caller allocated ni_frame_t |
[in] | p_network | Pointer to caller allocated ni_network_data_t |
Definition at line 9698 of file ni_device_api.c.
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.
[out] | p_packet | Pointer to a caller allocated ni_packet_t struct |
[in] | p_network | Pointer to a caller allocated ni_network_data_t struct |
Definition at line 9779 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_metrics | Pointer to network metrics |
Definition at line 11379 of file ni_device_api.c.
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.
[in] | p_upl_ctx | pointer to an uploader session context |
[in] | linesize | array of line stride |
Definition at line 9145 of file ni_device_api.c.
void ni_close_event | ( | ni_event_handle_t | event_handle | ) |
Close event and release resources (Windows only)
Definition at line 294 of file ni_device_api.c.
ni_event_handle_t ni_create_event | ( | void | ) |
Create event and return event handle if successful (Windows only)
Definition at line 266 of file ni_device_api.c.
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,
[in] | p_buffer | User provided pointer to be used for buffer |
[in] | p_packet | Pointer to a caller allocated ni_packet_t struct |
[in] | buffer_size | Buffer size |
Definition at line 3807 of file ni_device_api.c.
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.
[in] | p_pool | Buffer pool to get the memory from |
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | alloc_mem | Whether to get memory from buffer pool |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | alignment | Alignment requirement |
[in] | factor | 1 for 8 bits/pixel format, 2 for 10 bits/pixel |
[in] | is_planar | 0 if semiplanar else planar |
Definition at line 2586 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a previously allocated ni_frame_t struct |
Definition at line 3644 of file ni_device_api.c.
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.
[in] | buf | Buffer to be returned. |
[in] | p_buffer_pool | Buffer pool to return buffer to. |
Definition at line 3694 of file ni_device_api.c.
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.
[out] | param | Pointer to a user allocated ni_xcoder_params_t to initialize to default parameters |
[in] | fps_num | Frames per second |
[in] | fps_denom | FPS denomination |
[in] | bit_rate | bit rate |
[in] | width | frame width |
[in] | height | frame height |
Definition at line 4546 of file ni_device_api.c.
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.
[in] | p_params | Pointer to a user allocated ni_xcoder_params_t (used for decoder too for now ) to find and set a particular parameter |
[in] | name | String represented parameter name to search |
[in] | value | Parameter value to set |
Definition at line 4881 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_log_buffer | Reference 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_file | Indicating whether it is required to generate log files |
on failure NI_RETCODE_ERROR_MEM_ALOC NI_RETCODE_INVALID_PARAM
Definition at line 11713 of file ni_device_api.c.
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.
[in] | p_ctx | pointer to session context |
[in] | p_out_surface | pointer to output frame surface |
[in] | device_type | currently only NI_DEVICE_TYPE_AI |
Definition at line 8947 of file ni_device_api.c.
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.
[in] | p_ctx | pointer to session context |
[in] | width | width, in pixels |
[in] | height | height, in pixels |
[in] | format | pixel format |
[in] | options | options 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_width | clipping rectangle width |
[in] | rectangle_height | clipping rectangle height |
[in] | rectangle_x | horizontal position of clipping rectangle |
[in] | rectangle_y | vertical position of clipping rectangle |
[in] | rgba_color | RGBA fill colour (for padding only) |
[in] | frame_index | input hwdesc index |
[in] | device_type | only NI_DEVICE_TYPE_SCALER and NI_DEVICE_TYPE_AI (only needs p_ctx and frame_index) |
Definition at line 8880 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open |
[in] | p_cap | Pointer to a caller allocated ni_device_capability_t struct |
Definition at line 587 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open |
[in] | p_cap | Pointer to a caller allocated ni_device_capability_t struct |
[in] | device_in_ctxt | If device is in ctx |
Definition at line 647 of file ni_device_api.c.
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.
[in] | p_ctx | pointer to session context |
[in] | p_frameclone_desc | pointer to the frameclone descriptor |
Definition at line 8997 of file ni_device_api.c.
void ni_device_close | ( | ni_device_handle_t | device_handle | ) |
Close device and release resources.
[in] | device_handle | Device handle obtained by calling ni_device_open() |
Definition at line 503 of file ni_device_api.c.
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.
[in] | p_ctx | pointer to session context |
[in] | p_cfg | pointer to frame configuration |
Definition at line 9049 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open |
[in] | namespace_num | Set the namespace number with designated sriov |
[in] | sriov_index | Identify which sriov need to be set |
Definition at line 2037 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open |
[in] | mode | The requested qos mode |
Definition at line 2058 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open |
[in] | device_handle_t | Target device handle of namespace required for OP |
[in] | over_provision | The request overprovision percent |
Definition at line 2080 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
Definition at line 1621 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | hdr_data | Pointer to header data |
[in] | hdr_size | Size of header data in bytes |
Definition at line 1566 of file ni_device_api.c.
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.
[in] | p_ctx | pointer to session context |
[in] | p_cfg_in | pointer to input frame configuration |
[in] | numInCfgs | number of input frame configurations |
[in] | p_cfg_out | pointer to output frame configuration |
Definition at line 9095 of file ni_device_api.c.
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.
[in] | p_dev | Device name represented as c string. ex: "/dev/nvme0" |
[out] | p_max_io_size_out | Maximum IO Transfer size supported, could be NULL |
Definition at line 360 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[out] | p_frame | Pointer to a caller allocated hw frame |
Definition at line 10602 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[out] | p_frame | Pointer to a caller allocated hw frame |
Definition at line 10697 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | eos_received | Flag indicating if End Of Stream indicator was received |
[in] | device_type | NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or NI_DEVICE_TYPE_SCALER |
Definition at line 1379 of file ni_device_api.c.
ni_session_context_t* ni_device_session_context_alloc_init | ( | void | ) |
Allocate and initialize a new ni_session_context_t struct.
Definition at line 98 of file ni_device_api.c.
void ni_device_session_context_clear | ( | ni_session_context_t * | p_ctx | ) |
Clear already allocated session context.
[in] | p_ctx | Pointer to an already allocated ni_session_context_t |
Definition at line 249 of file ni_device_api.c.
void ni_device_session_context_free | ( | ni_session_context_t * | p_ctx | ) |
Free previously allocated session context.
[in] | p_ctx | Pointer to an already allocated ni_session_context_t struct |
Definition at line 130 of file ni_device_api.c.
ni_retcode_t ni_device_session_context_init | ( | ni_session_context_t * | p_ctx | ) |
Initialize already allocated session context to a known state.
[in] | p_ctx | Pointer to an already allocated ni_session_context_t struct |
Definition at line 156 of file ni_device_api.c.
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.
[in] | src_p_ctx | Pointer to a caller allocated source session context |
[in] | dst_p_ctx | Pointer to a caller allocated destination session context |
Definition at line 8015 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | device_type | NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER |
Definition at line 1512 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_data | Pointer 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] | hwdesc | HW descriptor to find frame in XCODER |
Definition at line 8210 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_src_data | Pointer to a caller allocated ni_session_data_io_t struct which contains a ni_frame_t data frame to send to uploader |
[out] | hwdesc | HW descriptor to find frame in XCODER |
Definition at line 8363 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | pool_size | Upload session initial allocated frames count must be > 0, |
[in] | pool | 0 use the normal pool 1 use a dedicated P2P pool |
Definition at line 8564 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | device_type | NI_DEVICE_TYPE_DECODER, NI_DEVICE_TYPE_ENCODER, or NI_DEVICE_TYPE_SCALER |
resource management context
Definition at line 710 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | device_type | NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or NI_DEVICE_TYPE_SCALER or NI_DEVICE_TYPE_AI or NI_DEVICE_TYPE_UPLOADER |
Definition at line 1920 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct [in] device_type Quadra device type |
Definition at line 8296 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | device_type | NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or |
Definition at line 1960 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | device_type | NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER or |
Definition at line 2000 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_data | Pointer 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_type | NI_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 |
Definition at line 1769 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_data | Pointer 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_type | NI_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 |
Definition at line 8043 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | width | width, in pixels |
[in] | height | height, in pixels |
[in] | device_type | NI_DEVICE_TYPE_ENCODER |
Definition at line 12913 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | width | input width |
[in] | height | input height |
[in] | bit_depth_factor | 1 for 8-bit YUV, 2 for 10-bit YUV |
[in] | device_type | device type (must be encoder) |
Definition at line 11322 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | pool_size | if 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 |
Definition at line 8612 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_data | Pointer 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_type | NI_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. |
Definition at line 1668 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | alignment | Allignment requirement |
[in] | metadata_flag | Flag indicating if space for additional metadata should be allocated |
[in] | factor | 1 for 8 bits/pixel format, 2 for 10 bits/pixel, 4 for 32 bits/pixel (RGBA) |
[in] | hw_frame_count | Number of hw descriptors stored |
[in] | is_planar | 0 if semiplanar else planar |
[in] | pix_fmt | pixel format to distinguish between planar types and/or components |
Definition at line 2321 of file ni_device_api.c.
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.
[in] | p_enc_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
on failure NI_RETCODE_ERROR_MEM_ALOC
Definition at line 11947 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | linesize | Picture line size |
[in] | alignment | Allignment requirement |
[in] | extra_len | Extra data size (incl. meta data). < 0 means not to allocate any buffer (zero-copy from existing) |
[in] | alignment_2pass_wa | set alignment to work with 2pass encode |
Definition at line 3161 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | linesize | Picture line size |
[in] | data | Picture data pointers (for each of YUV planes) |
[in] | extra_len | Extra data size (incl. meta data) |
Definition at line 2879 of file ni_device_api.c.
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.
[in] | p_enc_ctx | pointer 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) |
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_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.
[in] | p_params | Pointer to a user allocated ni_xcoder_params_t to find and set a particular parameter |
[in] | name | String represented parameter name to search |
[in] | value | Parameter value to set |
Definition at line 7197 of file ni_device_api.c.
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.
[out] | param | Pointer to a user allocated ni_xcoder_params_t to initialize to default parameters |
[in] | fps_num | Frames per second |
[in] | fps_denom | FPS denomination |
[in] | bit_rate | bit rate |
[in] | width | frame width |
[in] | height | frame height |
[in] | codec_format | codec from ni_codec_format_t |
Definition at line 4147 of file ni_device_api.c.
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.
[in] | p_params | Pointer to a user allocated ni_xcoder_params_t to find and set a particular parameter |
[in] | name | String represented parameter name to search |
[in] | value | Parameter value to set |
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.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct from encoder |
[in] | p_data | Pointer to a caller allocated ni_session_data_io_t struct which contains a ni_packet_t data packet to receive |
Definition at line 11232 of file ni_device_api.c.
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.
[in] | p_enc_ctx | pointer 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 |
on failure NI_RETCODE_INVALID_PARAM
Definition at line 11083 of file ni_device_api.c.
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.
[in] | planar | true: 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_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | linesize | Picture line size |
[in] | alignment | Allignment requirement. Only used for planar format. |
[in] | extra_len | Extra data size (incl. meta data). < 0 means not to allocate any buffer (zero-copy from existing) |
[in] | alignment_2pass_wa | set alignment to work with 2pass encode |
Definition at line 3531 of file ni_device_api.c.
ni_retcode_t ni_force_idr_frame_type | ( | ni_session_context_t * | p_ctx | ) |
Force next frame to be IDR frame during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
Definition at line 9992 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | alignment | Allignment requirement |
[in] | metadata_flag | Flag indicating if space for additional metadata should be allocated |
[in] | factor | 1 for 8 bits/pixel format, 2 for 10 bits/pixel, 4 for 32 bits/pixel (RGBA) |
[in] | hw_frame_count | Number of hw descriptors stored |
[in] | is_planar | 0 if semiplanar else planar |
Definition at line 2123 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | alignment | Allignment requirement |
[in] | pixel_format | Format for input |
Definition at line 2393 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | extra_len | Extra data size (incl. meta data) |
Definition at line 8399 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a caller allocated ni_frame_t struct |
[in] | video_width | Width of the video frame |
[in] | video_height | Height of the video frame |
[in] | linesize | Picture line size |
[in] | extra_len | Extra data size (incl. meta data). < 0 means not to allocate any buffer (zero-copy from existing) |
[in] | alignment_2pass_wa | set alignment to work with 2pass encode |
Definition at line 3397 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to caller allocated ni_frame_t |
[in] | pixel_format | a pixel format in ni_pix_fmt_t enum |
[in] | video_width | width, in pixels |
[in] | video_height | height, in pixels |
[in] | linesize | horizontal stride |
[in] | alignment | apply a 16 pixel height alignment (T408 only) |
[in] | extra_len | meta data size |
Definition at line 9252 of file ni_device_api.c.
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.
[in] | p_frame | Pointer to a previously allocated ni_frame_t struct |
Definition at line 3561 of file ni_device_api.c.
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.
[in/out] | frame a frame from which the auxiliary data should be removed | |
[in] | type | type of the auxiliary data to be removed |
Definition at line 4089 of file ni_device_api.c.
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.
[in] | frame | a frame from which the auxiliary data should be retrieved |
[in] | type | type of the auxiliary data to be retrieved |
Definition at line 4066 of file ni_device_api.c.
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.
[in/out] | frame a frame to which the auxiliary data should be added | |
[in] | type | type of the added auxiliary data |
[in] | data_size | size of the added auxiliary data |
Definition at line 4005 of file ni_device_api.c.
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.
[in/out] | frame a frame to which the auxiliary data should be added | |
[in] | type | type of the added auxiliary data |
[in] | raw_data | the raw data of the aux data |
[in] | data_size | size of the added auxiliary data |
Definition at line 4045 of file ni_device_api.c.
void ni_frame_wipe_aux_data | ( | ni_frame_t * | frame | ) |
Free and remove all auxiliary data from the frame.
[in/out] | frame a frame from which the auxiliary data should be removed |
Definition at line 4115 of file ni_device_api.c.
int32_t ni_get_dma_buf_file_descriptor | ( | const ni_frame_t * | p_frame | ) |
Get the DMA buffer file descriptor from the P2P frame.
[in] | p_frame | pointer to a P2P frame |
Definition at line 11283 of file ni_device_api.c.
bool ni_gop_params_check | ( | ni_xcoder_params_t * | p_param | ) |
Check custom gop params set.
[in] | p_param | Pointer to a caller allocated ni_xcoder_params_t struct |
on failure false
Definition at line 12749 of file ni_device_api.c.
void ni_gop_params_check_set | ( | ni_xcoder_params_t * | p_param, |
char * | value | ||
) |
Set custom gop and prepare to check if success.
[in] | p_param | Pointer to a caller allocated ni_xcoder_params_t struct |
[in] | value | Pointer to a caller allocated custom gop name |
Definition at line 12614 of file ni_device_api.c.
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.
[in] | surface | Struct containing device and frame location to clear out |
[in] | device_handle | handle to access device memory buffer is stored in |
Definition at line 8487 of file ni_device_api.c.
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.
[in] | surface | Struct containing device and frame location to clear out |
Definition at line 8517 of file ni_device_api.c.
ni_retcode_t ni_hwframe_p2p_buffer_recycle | ( | ni_frame_t * | p_frame | ) |
Recycle hw P2P frames.
[in] | p_frame | pointer to an acquired P2P hw frame |
on failure NI_RETCODE_INVALID_PARAM
Definition at line 10996 of file ni_device_api.c.
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)
[in] | pSession | Pointer to destination upload session |
[in] | dmaAddrs | Pointer to source DMA addresses |
[in] | pDstFrame | Pointer to destination P2P frame |
Definition at line 12866 of file ni_device_api.c.
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)
[in] | pSession | Pointer to source card destination |
[in] | source | Pointer to source frame to transmit |
[in] | ui64DestAddr | Destination address on target device |
[in] | ui32FrameSize | Size of frame to transfer |
Definition at line 12822 of file ni_device_api.c.
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)
[in] | pSession | Pointer to source card destination |
[in] | source | Pointer to source frame to transmit |
[in] | ui64DestAddr | Destination address on target device |
[in] | ui32FrameSize | Size of frame to transfer |
Definition at line 12791 of file ni_device_api.c.
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.
[in] | p_packet | Pointer to a caller allocated ni_packet_t struct |
[in] | packet_size | Required allocation size |
Definition at line 3713 of file ni_device_api.c.
ni_retcode_t ni_packet_buffer_free | ( | ni_packet_t * | p_packet | ) |
Free packet buffer that was previously allocated with ni_packet_buffer_alloc.
[in] | p_packet | Pointer to a previously allocated ni_packet_t struct |
Definition at line 3843 of file ni_device_api.c.
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.
[in] | p_packet | Pointer to a previously allocated ni_packet_t struct |
Definition at line 3884 of file ni_device_api.c.
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.
[in] | p_destination | Destination to where to copy to |
[in] | p_source | Source from where to copy from |
[in] | cur_size | current size |
[out] | p_leftover | Pointer to the data that was left over |
[out] | p_prev_size | Size of the data leftover ?? |
Definition at line 3936 of file ni_device_api.c.
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_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_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.
[in] | device_handle | Device handle obtained by calling ni_device_open() |
[in] | p_dev_extra_info | Pointer to device extra info |
[in] | fw_rev[] | Fw version to check if this function is supported |
Definition at line 11617 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open() |
[in] | device_info |
Definition at line 11385 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to a caller allocated ni_session_context_t struct |
[in] | p_load_query | Pointer to a caller allocated ni_load_query_t struct |
Definition at line 11447 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open() |
[in] | p_dev_temp | Pointer to device temperature |
[in] | fw_rev[] | Fw version to check if this function is supported |
Definition at line 11562 of file ni_device_api.c.
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.
[in] | device_handle | Device handle obtained by calling ni_device_open() |
[in] | p_dev_ns_vf | Pointer to a ni_device_vf_ns_id_t struct |
[in] | fw_rev[] | Fw version to check if this function is supported |
Definition at line 11509 of file ni_device_api.c.
ni_retcode_t ni_reconfig_bitrate | ( | ni_session_context_t * | p_ctx, |
int32_t | bitrate | ||
) |
Reconfigure bitrate dynamically during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | bitrate | Target bitrate to set |
Definition at line 9869 of file ni_device_api.c.
ni_retcode_t ni_reconfig_crf | ( | ni_session_context_t * | p_ctx, |
int32_t | crf | ||
) |
Reconfigure crf value dynamically during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | crf | crf value to reconfigure |
Definition at line 10301 of file ni_device_api.c.
ni_retcode_t ni_reconfig_crf2 | ( | ni_session_context_t * | p_ctx, |
float | crf | ||
) |
Reconfigure crf float point value dynamically during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | crf | crf float point value to reconfigure |
Definition at line 10358 of file ni_device_api.c.
ni_retcode_t ni_reconfig_framerate | ( | ni_session_context_t * | p_ctx, |
ni_framerate_t * | framerate | ||
) |
Reconfigure framerate dynamically during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | framerate | Target framerate to set |
Definition at line 10107 of file ni_device_api.c.
ni_retcode_t ni_reconfig_intraprd | ( | ni_session_context_t * | p_ctx, |
int32_t | intra_period | ||
) |
Reconfigure intraPeriod dynamically during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | intra_period | Target intra period to set |
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_retcode_t ni_reconfig_max_frame_size | ( | ni_session_context_t * | p_ctx, |
int32_t | max_frame_size | ||
) |
Reconfigure maxFrameSize dynamically during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | max_frame_size | maxFrameSize to set |
NOTE - maxFrameSize_Bytes value less than ((bitrate / 8) / framerate) will be rejected
Definition at line 10176 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | max_frame_size_ratio | maxFrameSizeRatio to set |
Definition at line 10468 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | ni_rc_min_max_qp | Target min&max qp to set |
Definition at line 10251 of file ni_device_api.c.
ni_retcode_t ni_reconfig_slice_arg | ( | ni_session_context_t * | p_ctx, |
int16_t | sliceArg | ||
) |
Reconfigure sliceArg dynamically during encoding.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | sliceArg | the new sliceArg value |
Definition at line 10541 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | vbvBufferSize | Target vbvBufferSize to set |
[in] | vbvMaxRate | Target vbvMaxRate to set |
Definition at line 10418 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | bitrate | Target bitrate to set |
Definition at line 9945 of file ni_device_api.c.
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
<br> |
Definition at line 3298 of file ni_device_api.c.
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
<br> |
Definition at line 3355 of file ni_device_api.c.
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
<br> |
Definition at line 3333 of file ni_device_api.c.
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.
[in] | p_ctx | pointer to caller allocated upload context [in] p_surface pointer to a caller allocated hardware frame [in] data_len scaler frame buffer data length |
on failure NI_RETCODE_FAILURE
Definition at line 11029 of file ni_device_api.c.
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.
ni_session_context_t | p_ctx - xcoder Context |
ni_scaler_params_t | * params - pointer to the scaler ni_scaler_drawbox params_t struct |
Definition at line 8701 of file ni_device_api.c.
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.
[in] | p_ctx | pointer to session context |
[in] | p_params | pointer to scaler parameters |
Definition at line 8671 of file ni_device_api.c.
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.
ni_session_context_t | p_ctx - xcoder Context |
ni_scaler_params_t | * params - pointer to the scaler ni_scaler_watermark_params_t struct |
Definition at line 8781 of file ni_device_api.c.
ni_retcode_t ni_set_demo_roi_map | ( | ni_session_context_t * | p_enc_ctx | ) |
Set up hard coded demo ROI map.
[in] | p_enc_ctx | Pointer to a caller allocated |
on failure NI_RETCODE_ERROR_MEM_ALOC
Definition at line 11751 of file ni_device_api.c.
ni_retcode_t ni_set_frame_ref_invalid | ( | ni_session_context_t * | p_ctx, |
int32_t | frame_num | ||
) |
Set frame reference invalidation.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | frame_num | frame number after which all references shall be invalidated |
Definition at line 10082 of file ni_device_api.c.
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.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | ltr | Pointer to struct specifying LTR support |
Definition at line 10026 of file ni_device_api.c.
ni_retcode_t ni_set_ltr_interval | ( | ni_session_context_t * | p_ctx, |
int32_t | ltr_interval | ||
) |
Set Long Term Reference interval.
[in] | p_ctx | Pointer to caller allocated ni_session_context_t |
[in] | ltr_interval | the new long term reference inteval value |
Definition at line 10054 of file ni_device_api.c.
int ni_strcasecmp | ( | const char * | a, |
const char * | b | ||
) |
Definition at line 12603 of file ni_device_api.c.
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.
[in] | p_upl_ctx | pointer to caller allocated upload context [in] p_frame pointer to caller allocated hardware P2P frame |
Definition at line 10763 of file ni_device_api.c.
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.
[in] | p_upl_ctx | pointer to caller allocated upload context [in] p_frame pointer to caller allocated hardware P2P frame |
Definition at line 10821 of file ni_device_api.c.
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.
[in] | p_upl_ctx | pointer to uploader context [in] width input width [in] height input height [in] linesize input linesizes (pointer to array) [in] pixel_format input pixel format |
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_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.
[in] | p_upl_ctx | pointer 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 |
Definition at line 10924 of file ni_device_api.c.
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.
[in] | p_upl_ctx | pointer 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 |
Definition at line 10869 of file ni_device_api.c.
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.
[in] | p_upl_ctx | pointer to uploader context [in] width width [in] height height [in] pixel_format pixel format [in] isP2P 0 = normal, 1 = P2P |
on failure NI_RETCODE_INVALID_PARAM
Definition at line 11171 of file ni_device_api.c.
const char* const g_xcoder_log_names[NI_XCODER_LOG_NAMES_ARRAY_LEN] |
Definition at line 71 of file ni_device_api.c.
const char* const g_xcoder_preset_names[NI_XCODER_PRESET_NAMES_ARRAY_LEN] |
Definition at line 69 of file ni_device_api.c.