libxcoder  5.2.0
ni_util.h File Reference

Utility definitions. More...

#include "ni_device_api.h"
#include "ni_log.h"
#include "ni_defs.h"

Go to the source code of this file.

Macros

#define NI_INVALID_POWER   0xFFFFFFFF
 
#define TPS25940_IMON_OS   0.8f
 
#define TPS25940_GAIN_IMON   52.0f
 
#define TPS25940_R_IMON   5.6f
 
#define TPS25946_GAIN_IMON   182.0f
 
#define TPS25946_GAIN_IMON_T1M   105.5f
 
#define TPS25946_R_IMON_T2A   1000.0f
 
#define TPS25946_R_IMON_T1U_UA   1130.0f
 
#define TPS25946_R_IMON_T1S   562.0f
 
#define TPS25946_R_IMON_T1M   750.0f
 
#define MAX15162AAWE_C_IRATIO   4000.0f
 
#define MAX15162AAWE_R_IMON   1500.0f
 
#define MAX17613B_R_ISET_TOTAL   1510.0f /* Voltage Divider at ADC */
 
#define MAX17613B_R_ISET_R2   1000.0f
 
#define MAX17613B_C_IRATIO   3000.0f
 
#define MCU_FSR_ADC   4096.0f
 
#define MCU_REF_VOLTAGE   2500.0f
 
#define NIALIGN(x, a)   (((x) + (a)-1) & ~((a)-1))
 
#define COMPILE_ASSERT(condition)   ((void)sizeof(char[1 - 2 * !(condition)]))
 
#define XCODER_MAX_NUM_TS_TABLE   32
 
#define XCODER_FRAME_OFFSET_DIFF_THRES   100
 
#define XCODER_MAX_ENC_PACKETS_PER_READ   16
 
#define XCODER_MAX_NUM_QUEUE_ENTRIES   6000
 
#define XCODER_MAX_NUM_TEMPORAL_LAYER   7
 
#define BUFFER_POOL_SZ_PER_CONTEXT   300
 
#define XCODER_MIN_ENC_PIC_WIDTH   144
 
#define XCODER_MIN_ENC_PIC_HEIGHT   128
 
#define XCODER_MAX_ENC_PIC_WIDTH   8192
 
#define XCODER_MAX_ENC_PIC_HEIGHT   8192
 
#define NI_DEC_FRAME_BUF_POOL_SIZE_INIT   20
 
#define NI_DEC_FRAME_BUF_POOL_SIZE_EXPAND   20
 
#define ni_aligned_free(p_memptr)
 
#define ni_memfree(p_memptr)
 

Functions

ni_buf_tni_buf_pool_get_buffer (ni_buf_pool_t *p_buffer_pool)
 
void ni_buf_pool_return_buffer (ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool)
 
ni_buf_tni_buf_pool_allocate_buffer (ni_buf_pool_t *p_buffer_pool, int buffer_size)
 
int32_t ni_dec_fme_buffer_pool_initialize (ni_session_context_t *p_ctx, int32_t number_of_buffers, int width, int height, int height_align, int factor)
 
void ni_dec_fme_buffer_pool_free (ni_buf_pool_t *p_buffer_pool)
 
void ni_buffer_pool_free (ni_queue_buffer_pool_t *p_buffer_pool)
 
ni_retcode_t ni_find_blk_name (const char *p_dev, char *p_out_buf, int out_buf_len)
 Find NVMe name space block from device name If none is found, assume nvme multi-pathing is disabled and return /dev/nvmeXn1. More...
 
ni_retcode_t ni_check_dev_name (const char *p_dev)
 check dev name More...
 
ni_retcode_t ni_timestamp_init (ni_session_context_t *p_ctx, ni_timestamp_table_t **pp_table, const char *name)
 Initialize timestamp handling. More...
 
ni_retcode_t ni_timestamp_done (ni_timestamp_table_t *p_table, ni_queue_buffer_pool_t *p_buffer_pool)
 Clean up timestamp handling. More...
 
ni_retcode_t ni_timestamp_register (ni_queue_buffer_pool_t *p_buffer_pool, ni_timestamp_table_t *p_table, int64_t timestamp, uint64_t data_info)
 Register timestamp in timestamp/frameoffset table. More...
 
ni_retcode_t ni_timestamp_get (ni_timestamp_table_t *p_table, uint64_t frame_info, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_queue_buffer_pool_t *p_buffer_pool)
 Retrieve timestamp from table based on frameoffset info. More...
 
ni_retcode_t ni_timestamp_get_v2 (ni_timestamp_table_t *p_table, uint64_t frame_offset, int64_t *p_timestamp, int32_t threshold, ni_queue_buffer_pool_t *p_buffer_pool)
 Retrieve timestamp from table based on frameoffset info. More...
 
ni_retcode_t ni_timestamp_get_with_threshold (ni_timestamp_table_t *p_table, uint64_t frame_info, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_queue_buffer_pool_t *p_buffer_pool)
 
void ni_timestamp_scan_cleanup (ni_timestamp_table_t *pts_list, ni_timestamp_table_t *dts_list, ni_queue_buffer_pool_t *p_buffer_pool)
 
ni_retcode_t ni_queue_init (ni_session_context_t *p_ctx, ni_queue_t *p_queue, const char *name)
 Initialize xcoder queue. More...
 
ni_retcode_t ni_queue_push (ni_queue_buffer_pool_t *p_buffer_pool, ni_queue_t *p_queue, uint64_t frame_offset, int64_t timestamp)
 Push into xcoder queue. More...
 
ni_retcode_t ni_queue_pop (ni_queue_t *p_queue, uint64_t frame_offset, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_queue_buffer_pool_t *p_buffer_pool)
 Pop from the xcoder queue. More...
 
ni_retcode_t ni_queue_pop_threshold (ni_queue_t *p_queue, uint64_t frame_offset, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_queue_buffer_pool_t *p_buffer_pool)
 
ni_retcode_t ni_queue_free (ni_queue_t *p_queue, ni_queue_buffer_pool_t *p_buffer_pool)
 Free xcoder queue. More...
 
ni_retcode_t ni_queue_print (ni_queue_t *p_queue)
 Print xcoder queue info. More...
 
int32_t ni_atobool (const char *p_str, bool *b_error)
 Convert string to boolean. More...
 
int32_t ni_atoi (const char *p_str, bool *b_error)
 Convert string to integer. More...
 
double ni_atof (const char *p_str, bool *b_error)
 Convert string to floating. More...
 
int32_t ni_parse_name (const char *arg, const char *const *names, bool *b_error)
 Parse name. More...
 
uint32_t ni_decode_power_measurement (uint32_t power_value, const uint8_t *serial_number)
 decode the raw current obtained and determine power More...
 
ni_retcode_t ni_quadra_card_identify_precheck (const char *p_dev)
 precheck a device can be read by ni_device_capability_query() INFO OR ERROR logs will not be printed in this function More...
 
LIB_API void ni_get_hw_yuv420p_dim (int width, int height, int bit_depth_factor, int is_semiplanar, int plane_stride[NI_MAX_NUM_DATA_POINTERS], int plane_height[NI_MAX_NUM_DATA_POINTERS])
 Get dimension information of Netint HW YUV420p frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_encoder_frame_buffer_alloc for buffer allocation. More...
 
LIB_API void ni_get_frame_dim (int width, int height, ni_pix_fmt_t pix_fmt, int plane_stride[NI_MAX_NUM_DATA_POINTERS], int plane_height[NI_MAX_NUM_DATA_POINTERS])
 Get dimension information of frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_encoder_frame_buffer_alloc for buffer allocation. The returned stride and height info will take alignment requirements into account. More...
 
LIB_API void ni_get_min_frame_dim (int width, int height, ni_pix_fmt_t pix_fmt, int plane_stride[NI_MAX_NUM_DATA_POINTERS], int plane_height[NI_MAX_NUM_DATA_POINTERS])
 Get dimension information of frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_encoder_frame_buffer_alloc for buffer allocation. The returned stride and height info will take into account both min resolution and alignment requirements. More...
 
LIB_API void ni_copy_hw_yuv420p (uint8_t *p_dst[NI_MAX_NUM_DATA_POINTERS], uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS], int width, int height, int bit_depth_factor, int is_semiplanar, int conf_win_right, int dst_stride[NI_MAX_NUM_DATA_POINTERS], int dst_height[NI_MAX_NUM_DATA_POINTERS], int src_stride[NI_MAX_NUM_DATA_POINTERS], int src_height[NI_MAX_NUM_DATA_POINTERS])
 Copy YUV data to Netint HW YUV420p frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc. More...
 
LIB_API void ni_copy_frame_data (uint8_t *p_dst[NI_MAX_NUM_DATA_POINTERS], uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS], int frame_width, int frame_height, int factor, ni_pix_fmt_t pix_fmt, int conf_win_right, int dst_stride[NI_MAX_NUM_DATA_POINTERS], int dst_height[NI_MAX_NUM_DATA_POINTERS], int src_stride[NI_MAX_NUM_DATA_POINTERS], int src_height[NI_MAX_NUM_DATA_POINTERS])
 Copy RGBA or YUV data to Netint HW frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc. More...
 
LIB_API void ni_copy_yuv_444p_to_420p (uint8_t *p_dst0[NI_MAX_NUM_DATA_POINTERS], uint8_t *p_dst1[NI_MAX_NUM_DATA_POINTERS], uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS], int width, int height, int factor, int mode)
 Copy yuv444p data to yuv420p frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc. More...
 
LIB_API int ni_insert_emulation_prevent_bytes (uint8_t *buf, int size)
 Insert emulation prevention byte(s) as needed into the data buffer. More...
 
LIB_API int ni_remove_emulation_prevent_bytes (uint8_t *buf, int size)
 Remove emulation prevention byte(s) as needed from the data buffer. More...
 
LIB_API int32_t ni_gettimeofday (struct timeval *p_tp, void *p_tzp)
 Get time for logs with microsecond timestamps. More...
 
LIB_API int ni_posix_memalign (void **memptr, size_t alignment, size_t size)
 Allocate aligned memory. More...
 
uint32_t ni_round_up (uint32_t number_to_round, uint32_t multiple)
 
LIB_API uint64_t ni_gettime_ns (void)
 
LIB_API void ni_usleep (int64_t usec)
 
LIB_API char * ni_strtok (char *s, const char *delim, char **saveptr)
 
LIB_API ni_retcode_t ni_network_layer_convert_output (float *dst, uint32_t num, ni_packet_t *p_packet, ni_network_data_t *p_network, uint32_t layer)
 
LIB_API uint32_t ni_ai_network_layer_size (ni_network_layer_params_t *p_param)
 
LIB_API uint32_t ni_ai_network_layer_dims (ni_network_layer_params_t *p_param)
 
LIB_API ni_retcode_t ni_network_layer_convert_tensor (uint8_t *dst, uint32_t dst_len, const char *tensor_file, ni_network_layer_params_t *p_param)
 
LIB_API ni_retcode_t ni_network_convert_tensor_to_data (uint8_t *dst, uint32_t dst_len, float *src, uint32_t src_len, ni_network_layer_params_t *p_param)
 
LIB_API ni_retcode_t ni_network_convert_data_to_tensor (float *dst, uint32_t dst_len, uint8_t *src, uint32_t src_len, ni_network_layer_params_t *p_param)
 
LIB_API void ni_calculate_sha256 (const uint8_t aui8Data[], size_t ui32DataLength, uint8_t aui8Hash[])
 
LIB_API void ni_copy_hw_descriptors (uint8_t *p_dst[NI_MAX_NUM_DATA_POINTERS], uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS])
 Copy Descriptor data to Netint HW descriptor frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc. Only necessary when metadata size in source is insufficient. More...
 
LIB_API char * ni_get_libxcoder_api_ver (void)
 Get libxcoder API version. More...
 
LIB_API NI_DEPRECATED char * ni_get_compat_fw_api_ver (void)
 Get FW API version libxcoder is compatible with. More...
 
LIB_API void ni_fmt_fw_api_ver_str (const char ver_str[], char fmt_str[])
 Get formatted FW API version string from unformatted FW API version string. More...
 
LIB_API int ni_cmp_fw_api_ver (const char ver1[], const char ver2[])
 Compare two 3 character strings containing a FW API version. Handle comparision when FW API version format length changed from 2 to 3. More...
 
LIB_API char * ni_get_libxcoder_release_ver (void)
 Get libxcoder SW release version. More...
 
LIB_API int ni_pthread_mutex_init (ni_pthread_mutex_t *mutex)
 initialize a mutex More...
 
LIB_API int ni_pthread_mutex_destroy (ni_pthread_mutex_t *mutex)
 destory a mutex More...
 
LIB_API int ni_pthread_mutex_lock (ni_pthread_mutex_t *mutex)
 thread mutex lock More...
 
LIB_API int ni_pthread_mutex_unlock (ni_pthread_mutex_t *mutex)
 thread mutex unlock More...
 
LIB_API int ni_pthread_create (ni_pthread_t *thread, const ni_pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
 create a new thread More...
 
LIB_API int ni_pthread_join (ni_pthread_t thread, void **value_ptr)
 join with a terminated thread More...
 
LIB_API int ni_pthread_cond_init (ni_pthread_cond_t *cond, const ni_pthread_condattr_t *attr)
 initialize condition variables More...
 
LIB_API int ni_pthread_cond_destroy (ni_pthread_cond_t *cond)
 destroy condition variables More...
 
LIB_API int ni_pthread_cond_broadcast (ni_pthread_cond_t *cond)
 broadcast a condition More...
 
LIB_API int ni_pthread_cond_wait (ni_pthread_cond_t *cond, ni_pthread_mutex_t *mutex)
 wait on a condition More...
 
LIB_API int ni_pthread_cond_signal (ni_pthread_cond_t *cond)
 signal a condition More...
 
LIB_API int ni_pthread_cond_timedwait (ni_pthread_cond_t *cond, ni_pthread_mutex_t *mutex, const struct timespec *abstime)
 wait on a condition More...
 
LIB_API int ni_pthread_sigmask (int how, const ni_sigset_t *set, ni_sigset_t *oldset)
 examine and change mask of blocked signals More...
 
const LIB_API char * ni_get_rc_txt (ni_retcode_t rc)
 Get text string for the provided error. More...
 
LIB_API int ni_param_get_key_value (char *p_str, char *key, char *value)
 Retrieve key and value from 'key=value' pair. More...
 
LIB_API int ni_retrieve_xcoder_params (char xcoderParams[], ni_xcoder_params_t *params, ni_session_context_t *ctx)
 Retrieve encoder config parameter values from –xcoder-params. More...
 
LIB_API int ni_retrieve_xcoder_gop (char xcoderGop[], ni_xcoder_params_t *params, ni_session_context_t *ctx)
 Retrieve custom gop config values from –xcoder-gop. More...
 
LIB_API int ni_retrieve_decoder_params (char xcoderParams[], ni_xcoder_params_t *params, ni_session_context_t *ctx)
 Retrieve decoder config parameter values from –decoder-params. More...
 
const LIB_API char * ni_ai_errno_to_str (int rc)
 return error string according to error code from firmware More...
 

Detailed Description

Utility definitions.


Definition in file ni_util.h.

Macro Definition Documentation

◆ BUFFER_POOL_SZ_PER_CONTEXT

#define BUFFER_POOL_SZ_PER_CONTEXT   300

Definition at line 109 of file ni_util.h.

◆ COMPILE_ASSERT

#define COMPILE_ASSERT (   condition)    ((void)sizeof(char[1 - 2 * !(condition)]))

Definition at line 102 of file ni_util.h.

◆ MAX15162AAWE_C_IRATIO

#define MAX15162AAWE_C_IRATIO   4000.0f

Definition at line 59 of file ni_util.h.

◆ MAX15162AAWE_R_IMON

#define MAX15162AAWE_R_IMON   1500.0f

Definition at line 60 of file ni_util.h.

◆ MAX17613B_C_IRATIO

#define MAX17613B_C_IRATIO   3000.0f

Definition at line 65 of file ni_util.h.

◆ MAX17613B_R_ISET_R2

#define MAX17613B_R_ISET_R2   1000.0f

Definition at line 64 of file ni_util.h.

◆ MAX17613B_R_ISET_TOTAL

#define MAX17613B_R_ISET_TOTAL   1510.0f /* Voltage Divider at ADC */

Definition at line 63 of file ni_util.h.

◆ MCU_FSR_ADC

#define MCU_FSR_ADC   4096.0f

Definition at line 67 of file ni_util.h.

◆ MCU_REF_VOLTAGE

#define MCU_REF_VOLTAGE   2500.0f

Definition at line 68 of file ni_util.h.

◆ ni_aligned_free

#define ni_aligned_free (   p_memptr)
Value:
{ \
free(p_memptr); \
p_memptr = NULL; \
}

Definition at line 399 of file ni_util.h.

◆ NI_DEC_FRAME_BUF_POOL_SIZE_EXPAND

#define NI_DEC_FRAME_BUF_POOL_SIZE_EXPAND   20

Definition at line 118 of file ni_util.h.

◆ NI_DEC_FRAME_BUF_POOL_SIZE_INIT

#define NI_DEC_FRAME_BUF_POOL_SIZE_INIT   20

Definition at line 117 of file ni_util.h.

◆ NI_INVALID_POWER

#define NI_INVALID_POWER   0xFFFFFFFF

Definition at line 44 of file ni_util.h.

◆ ni_memfree

#define ni_memfree (   p_memptr)
Value:
{ \
free(p_memptr); \
p_memptr = NULL; \
}

Definition at line 408 of file ni_util.h.

◆ NIALIGN

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

Definition at line 100 of file ni_util.h.

◆ TPS25940_GAIN_IMON

#define TPS25940_GAIN_IMON   52.0f

Definition at line 47 of file ni_util.h.

◆ TPS25940_IMON_OS

#define TPS25940_IMON_OS   0.8f

Definition at line 46 of file ni_util.h.

◆ TPS25940_R_IMON

#define TPS25940_R_IMON   5.6f

Definition at line 48 of file ni_util.h.

◆ TPS25946_GAIN_IMON

#define TPS25946_GAIN_IMON   182.0f

Definition at line 51 of file ni_util.h.

◆ TPS25946_GAIN_IMON_T1M

#define TPS25946_GAIN_IMON_T1M   105.5f

Definition at line 52 of file ni_util.h.

◆ TPS25946_R_IMON_T1M

#define TPS25946_R_IMON_T1M   750.0f

Definition at line 56 of file ni_util.h.

◆ TPS25946_R_IMON_T1S

#define TPS25946_R_IMON_T1S   562.0f

Definition at line 55 of file ni_util.h.

◆ TPS25946_R_IMON_T1U_UA

#define TPS25946_R_IMON_T1U_UA   1130.0f

Definition at line 54 of file ni_util.h.

◆ TPS25946_R_IMON_T2A

#define TPS25946_R_IMON_T2A   1000.0f

Definition at line 53 of file ni_util.h.

◆ XCODER_FRAME_OFFSET_DIFF_THRES

#define XCODER_FRAME_OFFSET_DIFF_THRES   100

Definition at line 105 of file ni_util.h.

◆ XCODER_MAX_ENC_PACKETS_PER_READ

#define XCODER_MAX_ENC_PACKETS_PER_READ   16

Definition at line 106 of file ni_util.h.

◆ XCODER_MAX_ENC_PIC_HEIGHT

#define XCODER_MAX_ENC_PIC_HEIGHT   8192

Definition at line 115 of file ni_util.h.

◆ XCODER_MAX_ENC_PIC_WIDTH

#define XCODER_MAX_ENC_PIC_WIDTH   8192

Definition at line 114 of file ni_util.h.

◆ XCODER_MAX_NUM_QUEUE_ENTRIES

#define XCODER_MAX_NUM_QUEUE_ENTRIES   6000

Definition at line 107 of file ni_util.h.

◆ XCODER_MAX_NUM_TEMPORAL_LAYER

#define XCODER_MAX_NUM_TEMPORAL_LAYER   7

Definition at line 108 of file ni_util.h.

◆ XCODER_MAX_NUM_TS_TABLE

#define XCODER_MAX_NUM_TS_TABLE   32

Definition at line 104 of file ni_util.h.

◆ XCODER_MIN_ENC_PIC_HEIGHT

#define XCODER_MIN_ENC_PIC_HEIGHT   128

Definition at line 113 of file ni_util.h.

◆ XCODER_MIN_ENC_PIC_WIDTH

#define XCODER_MIN_ENC_PIC_WIDTH   144

Definition at line 112 of file ni_util.h.

Function Documentation

◆ ni_ai_errno_to_str()

const LIB_API char* ni_ai_errno_to_str ( int  rc)

return error string according to error code from firmware


Parameters
[in]rcerror code return from firmware
Returns
error string

Definition at line 4321 of file ni_util.c.

◆ ni_ai_network_layer_dims()

LIB_API uint32_t ni_ai_network_layer_dims ( ni_network_layer_params_t p_param)

Definition at line 3369 of file ni_util.c.

◆ ni_ai_network_layer_size()

LIB_API uint32_t ni_ai_network_layer_size ( ni_network_layer_params_t p_param)

Definition at line 3363 of file ni_util.c.

◆ ni_atobool()

int32_t ni_atobool ( const char *  p_str,
bool *  b_error 
)

Convert string to boolean.


Parameters

Definition at line 1907 of file ni_util.c.

◆ ni_atof()

double ni_atof ( const char *  p_str,
bool *  b_error 
)

Convert string to floating.


Parameters

Definition at line 1950 of file ni_util.c.

◆ ni_atoi()

int32_t ni_atoi ( const char *  p_str,
bool *  b_error 
)

Convert string to integer.


Parameters

Definition at line 1930 of file ni_util.c.

◆ ni_buf_pool_allocate_buffer()

ni_buf_t* ni_buf_pool_allocate_buffer ( ni_buf_pool_t p_buffer_pool,
int  buffer_size 
)

Definition at line 585 of file ni_util.c.

◆ ni_buf_pool_get_buffer()

ni_buf_t* ni_buf_pool_get_buffer ( ni_buf_pool_t p_buffer_pool)

Definition at line 468 of file ni_util.c.

◆ ni_buf_pool_return_buffer()

void ni_buf_pool_return_buffer ( ni_buf_t buf,
ni_buf_pool_t p_buffer_pool 
)

Definition at line 529 of file ni_util.c.

◆ ni_buffer_pool_free()

void ni_buffer_pool_free ( ni_queue_buffer_pool_t p_buffer_pool)

Definition at line 789 of file ni_util.c.

◆ ni_calculate_sha256()

LIB_API void ni_calculate_sha256 ( const uint8_t  aui8Data[],
size_t  ui32DataLength,
uint8_t  aui8Hash[] 
)

Definition at line 3550 of file ni_util.c.

◆ ni_check_dev_name()

ni_retcode_t ni_check_dev_name ( const char *  p_dev)

check dev name


Parameters
[in]p_devDevice name represented as c string. ex: "/dev/nvmeXnY"
Returns
On success returns NI_RETCODE_SUCCESS On failure returns NI_RETCODE_FAILURE or NI_RETCODE_INVALID_PARAM

Definition at line 1252 of file ni_util.c.

◆ ni_cmp_fw_api_ver()

LIB_API int ni_cmp_fw_api_ver ( const char  ver1[],
const char  ver2[] 
)

Compare two 3 character strings containing a FW API version. Handle comparision when FW API version format length changed from 2 to 3.


Parameters
[in]ver1pointer to string containing FW API. Only up to 3 characters will be read
[in]ver2pointer to string containing FW API. Only up to 3 characters will be read
Returns
0 if ver1 == ver2, 1 if ver1 > ver2, -1 if ver1 < ver2

Definition at line 3674 of file ni_util.c.

◆ ni_copy_frame_data()

LIB_API void ni_copy_frame_data ( uint8_t *  p_dst[NI_MAX_NUM_DATA_POINTERS],
uint8_t *  p_src[NI_MAX_NUM_DATA_POINTERS],
int  frame_width,
int  frame_height,
int  factor,
ni_pix_fmt_t  pix_fmt,
int  conf_win_right,
int  dst_stride[NI_MAX_NUM_DATA_POINTERS],
int  dst_height[NI_MAX_NUM_DATA_POINTERS],
int  src_stride[NI_MAX_NUM_DATA_POINTERS],
int  src_height[NI_MAX_NUM_DATA_POINTERS] 
)

Copy RGBA or YUV data to Netint HW frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc.


Parameters
[out]p_dstpointers to which data is copied
[in]p_srcpointers from which data is copied
[in]widthsource frame width
[in]heightsource frame height
[in]factor1 for 8 bit, 2 for 10 bit
[in]pix_fmtpixel format to distinguish between planar types and/or components
[in]conf_win_rightright offset of conformance window
[in]dst_stridesize (in bytes) of each plane width in destination
[in]dst_heightsize of each plane height in destination
[in]src_stridesize (in bytes) of each plane width in source
[in]src_heightsize of each plane height in source
Returns
copied data

Definition at line 2398 of file ni_util.c.

◆ ni_copy_hw_descriptors()

LIB_API void ni_copy_hw_descriptors ( uint8_t *  p_dst[NI_MAX_NUM_DATA_POINTERS],
uint8_t *  p_src[NI_MAX_NUM_DATA_POINTERS] 
)

Copy Descriptor data to Netint HW descriptor frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc. Only necessary when metadata size in source is insufficient.


Parameters
[out]p_dstpointers of Y/Cb/Cr to which data is copied
[in]p_srcpointers of Y/Cb/Cr from which data is copied
Returns
descriptor data

Definition at line 3576 of file ni_util.c.

◆ ni_copy_hw_yuv420p()

LIB_API void ni_copy_hw_yuv420p ( uint8_t *  p_dst[NI_MAX_NUM_DATA_POINTERS],
uint8_t *  p_src[NI_MAX_NUM_DATA_POINTERS],
int  frame_width,
int  frame_height,
int  factor,
int  is_semiplanar,
int  conf_win_right,
int  dst_stride[NI_MAX_NUM_DATA_POINTERS],
int  dst_height[NI_MAX_NUM_DATA_POINTERS],
int  src_stride[NI_MAX_NUM_DATA_POINTERS],
int  src_height[NI_MAX_NUM_DATA_POINTERS] 
)

Copy YUV data to Netint HW YUV420p frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc.


Parameters
[out]p_dstpointers of Y/Cb/Cr to which data is copied
[in]p_srcpointers of Y/Cb/Cr from which data is copied
[in]widthsource YUV frame width
[in]heightsource YUV frame height
[in]bit_depth_factor1 for 8 bit, 2 for 10 bit
[in]is_semiplanarnon-0 for semiplanar frame, 0 otherwise
[in]conf_win_rightright offset of conformance window
[in]dst_stridesize (in bytes) of each plane width in destination
[in]dst_heightsize of each plane height in destination
[in]src_stridesize (in bytes) of each plane width in source
[in]src_heightsize of each plane height in source
Returns
Y/Cb/Cr data

Parameters
[out]p_dstpointers of Y/Cb/Cr to which data is copied
[in]p_srcpointers of Y/Cb/Cr from which data is copied
[in]widthsource YUV frame width
[in]heightsource YUV frame height
[in]factor1 for 8 bit, 2 for 10 bit
[in]is_semiplanarnon-0 for semiplanar frame, 0 otherwise
[in]conf_win_rightright offset of conformance window
[in]dst_stridesize (in bytes) of each plane width in destination
[in]dst_heightsize of each plane height in destination
[in]src_stridesize (in bytes) of each plane width in source
[in]src_heightsize of each plane height in source
Returns
Y/Cb/Cr data

Definition at line 2352 of file ni_util.c.

◆ ni_copy_yuv_444p_to_420p()

LIB_API void ni_copy_yuv_444p_to_420p ( uint8_t *  p_dst0[NI_MAX_NUM_DATA_POINTERS],
uint8_t *  p_dst1[NI_MAX_NUM_DATA_POINTERS],
uint8_t *  p_src[NI_MAX_NUM_DATA_POINTERS],
int  frame_width,
int  frame_height,
int  factor,
int  mode 
)

Copy yuv444p data to yuv420p frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_encoder_frame_buffer_alloc.


Parameters
[out]p_dst0pointers of Y/Cb/Cr as yuv420p output0
[out]p_dst1pointers of Y/Cb/Cr as yuv420p output1
[in]p_srcpointers of Y/Cb/Cr as yuv444p intput
[in]widthsource YUV frame width
[in]heightsource YUV frame height
[in]factor1 for 8 bit, 2 for 10 bit
[in]mode0 for out0 is Y+1/2V, with the original input as the out0, 1/4V copy to data[1] 1/4V copy to data[2] out1 is U+1/2V, U copy to data[0], 1/4V copy to data[1], 1/4V copy to data[2] mode 1 for out0 is Y+1/2u+1/2v, with the original input as the output0, 1/4U copy to data[1] 1/4V copy to data[2] out1 is (1/2U+1/2V)+1/4U+1/4V, 1/2U & 1/2V copy to data[0], 1/4U copy to data[1], 1/4V copy to data[2]
Returns
Y/Cb/Cr data

Definition at line 2478 of file ni_util.c.

◆ ni_dec_fme_buffer_pool_free()

void ni_dec_fme_buffer_pool_free ( ni_buf_pool_t p_buffer_pool)

Definition at line 735 of file ni_util.c.

◆ ni_dec_fme_buffer_pool_initialize()

int32_t ni_dec_fme_buffer_pool_initialize ( ni_session_context_t p_ctx,
int32_t  number_of_buffers,
int  width,
int  height,
int  height_align,
int  factor 
)

Definition at line 626 of file ni_util.c.

◆ ni_decode_power_measurement()

uint32_t ni_decode_power_measurement ( uint32_t  current_data,
const uint8_t *  serial_number 
)

decode the raw current obtained and determine power


Parameters
[in]current_valuecurrent value
[in]serial_numberboard SN
Returns
On success returns power On failure returns -1

Definition at line 4384 of file ni_util.c.

◆ ni_find_blk_name()

ni_retcode_t ni_find_blk_name ( const char *  p_dev,
char *  p_out_buf,
int  out_buf_len 
)

Find NVMe name space block from device name If none is found, assume nvme multi-pathing is disabled and return /dev/nvmeXn1.


Parameters
[in]p_devDevice name represented as c string. ex: "/dev/nvme0"
[in]out_bufOutput buffer to put NVMe name space block. Must be at least length 21
Returns
On success returns NI_RETCODE_SUCCESS On failure returns NI_RETCODE_FAILURE

Definition at line 1181 of file ni_util.c.

◆ ni_fmt_fw_api_ver_str()

LIB_API void ni_fmt_fw_api_ver_str ( const char  ver_str[],
char  fmt_str[] 
)

Get formatted FW API version string from unformatted FW API version string.


Parameters
[in]ver_strpointer to string containing FW API. Only up to 3 characters will be read
[out]fmt_strpointer to string buffer of at least size 5 to output formated version string to
Returns
none

Definition at line 3644 of file ni_util.c.

◆ ni_get_compat_fw_api_ver()

LIB_API NI_DEPRECATED char* ni_get_compat_fw_api_ver ( void  )

Get FW API version libxcoder is compatible with.


Returns
char pointer to FW API version libxcoder is compatible with

Get FW API version libxcoder is compatible with.


Returns
char pointer to FW API version libxcoder is compatible with

Definition at line 3612 of file ni_util.c.

◆ ni_get_frame_dim()

LIB_API void ni_get_frame_dim ( int  width,
int  height,
ni_pix_fmt_t  pix_fmt,
int  plane_stride[NI_MAX_NUM_DATA_POINTERS],
int  plane_height[NI_MAX_NUM_DATA_POINTERS] 
)

Get dimension information of frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_encoder_frame_buffer_alloc for buffer allocation. The returned stride and height info will take alignment requirements into account.


Parameters
[in]widthsource frame width
[in]heightsource frame height
[in]pix_fmtni pixel format
[out]plane_stridesize (in bytes) of each plane width
[out]plane_heightsize of each plane height
Returns
stride and height info

Definition at line 2092 of file ni_util.c.

◆ ni_get_hw_yuv420p_dim()

LIB_API void ni_get_hw_yuv420p_dim ( int  width,
int  height,
int  factor,
int  is_semiplanar,
int  plane_stride[NI_MAX_NUM_DATA_POINTERS],
int  plane_height[NI_MAX_NUM_DATA_POINTERS] 
)

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


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

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

Definition at line 2040 of file ni_util.c.

◆ ni_get_libxcoder_api_ver()

LIB_API char* ni_get_libxcoder_api_ver ( void  )

Get libxcoder API version.


Returns
char pointer to libxcoder API version

Definition at line 3600 of file ni_util.c.

◆ ni_get_libxcoder_release_ver()

LIB_API char* ni_get_libxcoder_release_ver ( void  )

Get libxcoder SW release version.


Returns
char pointer to libxcoder SW release version

Definition at line 3710 of file ni_util.c.

◆ ni_get_min_frame_dim()

LIB_API void ni_get_min_frame_dim ( int  width,
int  height,
ni_pix_fmt_t  pix_fmt,
int  plane_stride[NI_MAX_NUM_DATA_POINTERS],
int  plane_height[NI_MAX_NUM_DATA_POINTERS] 
)

Get dimension information of frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_encoder_frame_buffer_alloc for buffer allocation. The returned stride and height info will take into account both min resolution and alignment requirements.


Parameters
[in]widthsource frame width
[in]heightsource frame height
[in]pix_fmtni pixel format
[out]plane_stridesize (in bytes) of each plane width
[out]plane_heightsize of each plane height
Returns
stride and height info

Definition at line 2181 of file ni_util.c.

◆ ni_get_rc_txt()

const LIB_API char* ni_get_rc_txt ( ni_retcode_t  rc)

Get text string for the provided error.


Returns
char pointer for the provided error

Definition at line 3731 of file ni_util.c.

◆ ni_gettime_ns()

LIB_API uint64_t ni_gettime_ns ( void  )

Definition at line 1998 of file ni_util.c.

◆ ni_gettimeofday()

LIB_API int32_t ni_gettimeofday ( struct timeval *  p_tp,
void *  p_tzp 
)

Get time for logs with microsecond timestamps.


Parameters
[in/out]p_tp timeval struct
[in]p_tzpvoid *
Returns
return 0 for success, -1 for error

Definition at line 139 of file ni_util.c.

◆ ni_insert_emulation_prevent_bytes()

LIB_API int ni_insert_emulation_prevent_bytes ( uint8_t *  buf,
int  size 
)

Insert emulation prevention byte(s) as needed into the data buffer.


Parameters
bufdata buffer to be worked on - new byte(s) will be inserted size number of bytes starting from buf to check
Returns
the number of emulation prevention bytes inserted into buf, 0 if none.

Note: caller MUST ensure for newly inserted bytes, buf has enough free space starting from buf + size

Definition at line 2591 of file ni_util.c.

◆ ni_network_convert_data_to_tensor()

LIB_API ni_retcode_t ni_network_convert_data_to_tensor ( float *  dst,
uint32_t  dst_len,
uint8_t *  src,
uint32_t  src_len,
ni_network_layer_params_t p_param 
)

Definition at line 3256 of file ni_util.c.

◆ ni_network_convert_tensor_to_data()

LIB_API ni_retcode_t ni_network_convert_tensor_to_data ( uint8_t *  dst,
uint32_t  dst_len,
float *  src,
uint32_t  src_len,
ni_network_layer_params_t p_param 
)

Definition at line 3246 of file ni_util.c.

◆ ni_network_layer_convert_output()

LIB_API ni_retcode_t ni_network_layer_convert_output ( float *  dst,
uint32_t  num,
ni_packet_t p_packet,
ni_network_data_t p_network,
uint32_t  layer 
)

Definition at line 3084 of file ni_util.c.

◆ ni_network_layer_convert_tensor()

LIB_API ni_retcode_t ni_network_layer_convert_tensor ( uint8_t *  dst,
uint32_t  dst_len,
const char *  tensor_file,
ni_network_layer_params_t p_param 
)

Definition at line 3236 of file ni_util.c.

◆ ni_param_get_key_value()

LIB_API int ni_param_get_key_value ( char *  p_str,
char *  key,
char *  value 
)

Retrieve key and value from 'key=value' pair.


Parameters
[in]p_strpointer to string to extract pair from
[out]keypointer to key
[out]valuepointer to value
Returns
return 0 if successful, otherwise 1

Retrieve key and value from 'key=value' pair.


Parameters
[in]p_strpointer to string to extract pair from
[out]keypointer to key
[out]valuepointer to value
Returns
return 0 if successful, otherwise 1

Definition at line 3755 of file ni_util.c.

◆ ni_parse_name()

int32_t ni_parse_name ( const char *  arg,
const char *const *  names,
bool *  b_error 
)

Parse name.


Parameters

Definition at line 1970 of file ni_util.c.

◆ ni_posix_memalign()

LIB_API int ni_posix_memalign ( void **  memptr,
size_t  alignment,
size_t  size 
)

Allocate aligned memory.


Parameters
[in/out]memptr The address of the allocated memory will be a multiple of alignment, which must be a power of two and a multiple of sizeof(void *). If size is 0, then the value placed is either NULL, or a unique pointer value that can later be successfully passed to free.
[in]alignmentThe alignment value of the allocated value.
[in]sizeThe allocated memory size.
Returns
0 for success, ENOMEM for error

Definition at line 198 of file ni_util.c.

◆ ni_pthread_cond_broadcast()

LIB_API int ni_pthread_cond_broadcast ( ni_pthread_cond_t *  cond)

broadcast a condition


Parameters
[in]condcondition variable
Returns
On success returns 0 On failure returns <0

Definition at line 4214 of file ni_util.c.

◆ ni_pthread_cond_destroy()

LIB_API int ni_pthread_cond_destroy ( ni_pthread_cond_t *  cond)

destroy condition variables


Parameters
[in]condcondition variable
Returns
On success returns 0 On failure returns <0

Definition at line 4196 of file ni_util.c.

◆ ni_pthread_cond_init()

LIB_API int ni_pthread_cond_init ( ni_pthread_cond_t *  cond,
const ni_pthread_condattr_t *  attr 
)

initialize condition variables


Parameters
[in]condcondition variable
[in]attrattribute to the condvar
Returns
On success returns 0 On failure returns <0

Definition at line 4177 of file ni_util.c.

◆ ni_pthread_cond_signal()

LIB_API int ni_pthread_cond_signal ( ni_pthread_cond_t *  cond)

signal a condition


Parameters
[in]condcondition variable
Returns
On success returns 0 On failure returns <0

Definition at line 4251 of file ni_util.c.

◆ ni_pthread_cond_timedwait()

LIB_API int ni_pthread_cond_timedwait ( ni_pthread_cond_t *  cond,
ni_pthread_mutex_t *  mutex,
const struct timespec *  abstime 
)

wait on a condition


Parameters
[in]condcondition variable
[in]mutexmutex related to the condvar
[in[abstime abstract value of timeout
Returns
On success returns 0 On failure returns <0

Definition at line 4271 of file ni_util.c.

◆ ni_pthread_cond_wait()

LIB_API int ni_pthread_cond_wait ( ni_pthread_cond_t *  cond,
ni_pthread_mutex_t *  mutex 
)

wait on a condition


Parameters
[in]condcondition variable
[in]mutexmutex related to the condvar
Returns
On success returns 0 On failure returns <0

Definition at line 4233 of file ni_util.c.

◆ ni_pthread_create()

LIB_API int ni_pthread_create ( ni_pthread_t *  thread,
const ni_pthread_attr_t *  attr,
void *(*)(void *)  start_routine,
void *  arg 
)

create a new thread


Parameters
[in]threadthread id
[in]attrattributes to the new thread
[in]start_routineentry of the thread routine
[in]argsole argument of the routine
Returns
On success returns 0 On failure returns <0

Definition at line 4121 of file ni_util.c.

◆ ni_pthread_join()

LIB_API int ni_pthread_join ( ni_pthread_t  thread,
void **  value_ptr 
)

join with a terminated thread


Parameters
[in]threadthread id
[out]value_ptrreturn status
Returns
On success returns 0 On failure returns <0

Definition at line 4148 of file ni_util.c.

◆ ni_pthread_mutex_destroy()

LIB_API int ni_pthread_mutex_destroy ( ni_pthread_mutex_t *  mutex)

destory a mutex


Parameters
[in]threadmutex
Returns
On success returns 0 On failure returns <0

Definition at line 4039 of file ni_util.c.

◆ ni_pthread_mutex_init()

LIB_API int ni_pthread_mutex_init ( ni_pthread_mutex_t *  mutex)

initialize a mutex


Parameters
[in]threadmutex
Returns
On success returns 0 On failure returns <0

Definition at line 4001 of file ni_util.c.

◆ ni_pthread_mutex_lock()

LIB_API int ni_pthread_mutex_lock ( ni_pthread_mutex_t *  mutex)

thread mutex lock


Parameters
[in]threadmutex
Returns
On success returns 0 On failure returns <0

Definition at line 4057 of file ni_util.c.

◆ ni_pthread_mutex_unlock()

LIB_API int ni_pthread_mutex_unlock ( ni_pthread_mutex_t *  mutex)

thread mutex unlock


Parameters
[in]threadmutex
Returns
On success returns 0 On failure returns <0

Definition at line 4083 of file ni_util.c.

◆ ni_pthread_sigmask()

LIB_API int ni_pthread_sigmask ( int  how,
const ni_sigset_t *  set,
ni_sigset_t *  oldset 
)

examine and change mask of blocked signals


Parameters
[in]howbehavior of this call, can be value of SIG_BLOCK, SIG_UNBLOCK and SIG_SETMASK
[in]setcurrent value of the signal mask. If NULL, the mask keeps unchanged.
[in]old_setprevious value of the signal mask, can be NULL.
Returns
On success returns 0 On failure returns <0

Definition at line 4305 of file ni_util.c.

◆ ni_quadra_card_identify_precheck()

ni_retcode_t ni_quadra_card_identify_precheck ( const char *  p_dev)

precheck a device can be read by ni_device_capability_query() INFO OR ERROR logs will not be printed in this function


Parameters
[in]p_devdevice path string. eg: "/dev/nvme1n2"
Returns
returns NI_RETCODE_FAILURE when the device can not be read by ni_device_capability_query()

returns NI_RETCODE_SUCCESS when the device can not be read by ni_device_capability_query() or the result can not be determined to prevent query failures due to some reasons such as missing commands on the system


Parameters
[in]p_devdevice path string. eg: "/dev/nvme1n2"
Returns
returns NI_RETCODE_FAILURE when the device can not be read by ni_device_capability_query()

returns NI_RETCODE_SUCCESS when

  1. the device can not be read by ni_device_capability_query()
  2. the result can not be determined to prevent query failures due to some reasons such as missing commands on the system

Definition at line 4874 of file ni_util.c.

◆ ni_queue_free()

ni_retcode_t ni_queue_free ( ni_queue_t p_queue,
ni_queue_buffer_pool_t p_buffer_pool 
)

Free xcoder queue.


Parameters

Definition at line 1811 of file ni_util.c.

◆ ni_queue_init()

ni_retcode_t ni_queue_init ( ni_session_context_t p_ctx,
ni_queue_t p_queue,
const char *  name 
)

Initialize xcoder queue.


Parameters

Definition at line 1513 of file ni_util.c.

◆ ni_queue_pop()

ni_retcode_t ni_queue_pop ( ni_queue_t p_queue,
uint64_t  frame_info,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_queue_buffer_pool_t p_buffer_pool 
)

Pop from the xcoder queue.


Parameters

If only one entry, retrieve timestamp without checking

Definition at line 1611 of file ni_util.c.

◆ ni_queue_pop_threshold()

ni_retcode_t ni_queue_pop_threshold ( ni_queue_t p_queue,
uint64_t  frame_offset,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_queue_buffer_pool_t p_buffer_pool 
)

If only one entry, retrieve timestamp without checking

Definition at line 1716 of file ni_util.c.

◆ ni_queue_print()

ni_retcode_t ni_queue_print ( ni_queue_t p_queue)

Print xcoder queue info.


Parameters

Definition at line 1851 of file ni_util.c.

◆ ni_queue_push()

ni_retcode_t ni_queue_push ( ni_queue_buffer_pool_t p_buffer_pool,
ni_queue_t p_queue,
uint64_t  frame_info,
int64_t  timestamp 
)

Push into xcoder queue.


Parameters

Definition at line 1540 of file ni_util.c.

◆ ni_remove_emulation_prevent_bytes()

LIB_API int ni_remove_emulation_prevent_bytes ( uint8_t *  buf,
int  size 
)

Remove emulation prevention byte(s) as needed from the data buffer.


Parameters
bufdata buffer to be worked on - emu prevent byte(s) will be removed from. size number of bytes starting from buf to check
Returns
the number of emulation prevention bytes removed from buf, 0 if none.

Note: buf will be modified if emu prevent byte(s) found and removed.

Definition at line 2644 of file ni_util.c.

◆ ni_retrieve_decoder_params()

LIB_API int ni_retrieve_decoder_params ( char  xcoderParams[],
ni_xcoder_params_t params,
ni_session_context_t ctx 
)

Retrieve decoder config parameter values from –decoder-params.


Parameters
[in]xcoderParamspointer to string containing xcoder params
[out]paramspointer to xcoder params to fill out
[out]ctxpointer to session context
Returns
return 0 if successful, -1 otherwise

Retrieve decoder config parameter values from –decoder-params.


Parameters
[in]xcoderParamspointer to string containing xcoder params
[out]paramspointer to xcoder params to fill out
[out]ctxpointer to session context
Returns
return 0 if successful, -1 otherwise

Definition at line 3931 of file ni_util.c.

◆ ni_retrieve_xcoder_gop()

LIB_API int ni_retrieve_xcoder_gop ( char  xcoderGop[],
ni_xcoder_params_t params,
ni_session_context_t ctx 
)

Retrieve custom gop config values from –xcoder-gop.


Parameters
[in]xcoderGoppointer to string containing xcoder gop
[out]paramspointer to xcoder params to fill out
[out]ctxpointer to session context
Returns
return 0 if successful, -1 otherwise

Definition at line 3861 of file ni_util.c.

◆ ni_retrieve_xcoder_params()

LIB_API int ni_retrieve_xcoder_params ( char  xcoderParams[],
ni_xcoder_params_t params,
ni_session_context_t ctx 
)

Retrieve encoder config parameter values from –xcoder-params.


Parameters
[in]xcoderParamspointer to string containing xcoder params
[out]paramspointer to xcoder params to fill out
[out]ctxpointer to session context
Returns
return 0 if successful, -1 otherwise

Retrieve encoder config parameter values from –xcoder-params.


Parameters
[in]xcoderParamspointer to string containing xcoder params
[out]paramspointer to xcoder params to fill out
[out]ctxpointer to session context
Returns
return 0 if successful, -1 otherwise

Definition at line 3787 of file ni_util.c.

◆ ni_round_up()

uint32_t ni_round_up ( uint32_t  number_to_round,
uint32_t  multiple 
)

Definition at line 169 of file ni_util.c.

◆ ni_strtok()

LIB_API char* ni_strtok ( char *  s,
const char *  delim,
char **  saveptr 
)

Definition at line 420 of file ni_util.c.

◆ ni_timestamp_done()

ni_retcode_t ni_timestamp_done ( ni_timestamp_table_t p_table,
ni_queue_buffer_pool_t p_buffer_pool 
)

Clean up timestamp handling.


Parameters

Definition at line 1348 of file ni_util.c.

◆ ni_timestamp_get()

ni_retcode_t ni_timestamp_get ( ni_timestamp_table_t p_table,
uint64_t  frame_info,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_queue_buffer_pool_t p_buffer_pool 
)

Retrieve timestamp from table based on frameoffset info.


Parameters

Definition at line 1399 of file ni_util.c.

◆ ni_timestamp_get_v2()

ni_retcode_t ni_timestamp_get_v2 ( ni_timestamp_table_t p_table,
uint64_t  frame_offset,
int64_t *  p_timestamp,
int32_t  threshold,
ni_queue_buffer_pool_t p_buffer_pool 
)

Retrieve timestamp from table based on frameoffset info.


Parameters

Definition at line 1475 of file ni_util.c.

◆ ni_timestamp_get_with_threshold()

ni_retcode_t ni_timestamp_get_with_threshold ( ni_timestamp_table_t p_table,
uint64_t  frame_info,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_queue_buffer_pool_t p_buffer_pool 
)

Definition at line 1423 of file ni_util.c.

◆ ni_timestamp_init()

ni_retcode_t ni_timestamp_init ( ni_session_context_t p_ctx,
ni_timestamp_table_t **  pp_table,
const char *  name 
)

Initialize timestamp handling.


Parameters

Definition at line 1308 of file ni_util.c.

◆ ni_timestamp_register()

ni_retcode_t ni_timestamp_register ( ni_queue_buffer_pool_t p_buffer_pool,
ni_timestamp_table_t p_table,
int64_t  timestamp,
uint64_t  data_info 
)

Register timestamp in timestamp/frameoffset table.


Parameters

Definition at line 1373 of file ni_util.c.

◆ ni_timestamp_scan_cleanup()

void ni_timestamp_scan_cleanup ( ni_timestamp_table_t pts_list,
ni_timestamp_table_t dts_list,
ni_queue_buffer_pool_t p_buffer_pool 
)

Definition at line 1431 of file ni_util.c.

◆ ni_usleep()

LIB_API void ni_usleep ( int64_t  usec)

Definition at line 358 of file ni_util.c.