libxcoder  5.5.0
ni_util.h
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (C) 2022 NETINT Technologies
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18  * SOFTWARE.
19  *
20  ******************************************************************************/
21 
22 /*!*****************************************************************************
23  * \file ni_util.h
24  *
25  * \brief Utility definitions
26  ******************************************************************************/
27 
28 #pragma once
29 
30 #ifdef _WIN32
31 #define _SC_PAGESIZE 4096
32 #define sysconf(x) x
33 #endif
34 
35 #include "ni_device_api.h"
36 #include "ni_log.h"
37 #include "ni_defs.h"
38 
39 #ifdef __cplusplus
40 extern "C"
41 {
42 #endif
43 
44 #define NI_INVALID_POWER 0xFFFFFFFF
45 /* Value and formula retrieved from tps25940 EFUSE manual */
46 #define TPS25940_IMON_OS 0.8f
47 #define TPS25940_GAIN_IMON 52.0f
48 #define TPS25940_R_IMON 5.6f
49 
50 /* Value and formula retrieved from tps25946 EFUSE manual */
51 #define TPS25946_GAIN_IMON 182.0f
52 #define TPS25974_GAIN_IMON 105.5f
53 #define TPS25946_R_IMON_T2A 1000.0f
54 #define TPS25946_R_IMON_T1U_UA 1130.0f
55 #define TPS25946_R_IMON_T1S 562.0f
56 #define TPS25974_R_IMON_T1M 750.0f
57 
58 /* Value and formula retrieved from MAX15162AAWE+T EFUSE manual */
59 #define MAX15162AAWE_C_IRATIO 4000.0f
60 #define MAX15162AAWE_R_IMON 1500.0f
61 
62 /* Value and formula retrieved from MAX17613B EFUSE manual */
63 #define MAX17613B_R_ISET_TOTAL 1510.0f /* Voltage Divider at ADC */
64 #define MAX17613B_R_ISET_R2 1000.0f
65 #define MAX17613B_C_IRATIO 3000.0f
66 
67 #define MCU_FSR_ADC 4096.0f
68 #define MCU_REF_VOLTAGE 2500.0f //mV
69 
70 static inline int ni_min(int a, int b)
71 {
72  return a < b ? a : b;
73 }
74 
75 static inline int ni_max(int a, int b)
76 {
77  return a > b ? a : b;
78 }
79 
80 static inline float ni_minf(float a, float b)
81 {
82  return a < b ? a : b;
83 }
84 
85 static inline float ni_maxf(float a, float b)
86 {
87  return a > b ? a : b;
88 }
89 
90 static inline int clip3(int min, int max, int a)
91 {
92  return ni_min(ni_max(min, a), max);
93 }
94 
95 static inline float clip3f(float min, float max, float a)
96 {
97  return ni_minf(ni_maxf(min, a), max);
98 }
99 
100 #define NIALIGN(x, a) (((x) + (a)-1) & ~((a)-1))
101 // Compile time assert macro
102 #define COMPILE_ASSERT(condition) ((void)sizeof(char[1 - 2 * !(condition)]))
103 
104 #define XCODER_MAX_NUM_TS_TABLE 32
105 #define XCODER_FRAME_OFFSET_DIFF_THRES 100
106 #define XCODER_MAX_ENC_PACKETS_PER_READ 16
107 #define XCODER_MAX_NUM_QUEUE_ENTRIES 6000
108 #define XCODER_MAX_NUM_TEMPORAL_LAYER 7
109 #define BUFFER_POOL_SZ_PER_CONTEXT 300
110 
111 // for _T400_ENC
112 #define XCODER_MIN_ENC_PIC_WIDTH 144
113 #define XCODER_MIN_ENC_PIC_HEIGHT 128
114 #define XCODER_MAX_ENC_PIC_WIDTH 8192
115 #define XCODER_MAX_ENC_PIC_HEIGHT 8192
116 
117 #define NI_DEC_FRAME_BUF_POOL_SIZE_INIT 20
118 #define NI_DEC_FRAME_BUF_POOL_SIZE_EXPAND 20
119 
120 
121 // memory buffer pool operations (one use is for decoder frame buffer pool)
123 
124 void ni_buf_pool_return_buffer(ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool);
125 
126 ni_buf_t *ni_buf_pool_allocate_buffer(ni_buf_pool_t *p_buffer_pool, int buffer_size);
127 
128 // decoder frame buffer pool init & free
129 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);
130 void ni_dec_fme_buffer_pool_free(ni_buf_pool_t *p_buffer_pool);
131 
132 // timestamp buffer pool operations
133 void ni_buffer_pool_free(ni_queue_buffer_pool_t *p_buffer_pool);
134 
135 ni_retcode_t ni_find_blk_name(const char *p_dev, char *p_out_buf, int out_buf_len);
136 ni_retcode_t ni_check_dev_name(const char *p_dev);
137 ni_retcode_t ni_timestamp_init(ni_session_context_t* p_ctx, ni_timestamp_table_t **pp_table, const char *name);
139 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);
140 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);
141 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);
142 
143 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);
144 
146  ni_timestamp_table_t *dts_list,
147  ni_queue_buffer_pool_t *p_buffer_pool);
148 
149 ni_retcode_t ni_queue_init(ni_session_context_t* p_ctx, ni_queue_t *p_queue, const char *name);
150 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);
151 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);
152 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);
155 
156 int32_t ni_atobool(const char *p_str, bool *b_error);
157 int32_t ni_atoi(const char *p_str, bool *b_error);
158 double ni_atof(const char *p_str, bool *b_error);
159 int32_t ni_parse_name(const char *arg, const char *const *names, bool *b_error);
160 uint32_t ni_decode_power_measurement(uint32_t power_value, const uint8_t *serial_number);
161 
162 /*!******************************************************************************
163  * \brief precheck a device can be read by ni_device_capability_query()
164  * INFO OR ERROR logs will not be printed in this function
165  * \param[in] p_dev device path string. eg: "/dev/nvme1n2"
166  *
167  * \return
168  * returns NI_RETCODE_FAILURE
169  * when the device can not be read by ni_device_capability_query()
170  *
171  * returns NI_RETCODE_SUCCESS
172  * when the device can not be read by ni_device_capability_query() or
173  * the result can not be determined to prevent query failures due to
174  * some reasons such as missing commands on the system
175  *******************************************************************************/
177 
178 // Netint HW YUV420p data layout related utility functions
179 
180 /*!*****************************************************************************
181  * \brief Get dimension information of Netint HW YUV420p frame to be sent
182  * to encoder for encoding. Caller usually retrieves this info and
183  * uses it in the call to ni_encoder_frame_buffer_alloc for buffer
184  * allocation.
185  *
186  * \param[in] width source YUV frame width
187  * \param[in] height source YUV frame height
188  * \param[in] bit_depth_factor 1 for 8 bit, 2 for 10 bit
189  * \param[in] is_semiplanar non-0 for semiplnar frame, 0 otherwise
190  * \param[out] plane_stride size (in bytes) of each plane width
191  * \param[out] plane_height size of each plane height
192  *
193  * \return Y/Cb/Cr stride and height info
194  *
195  ******************************************************************************/
196 LIB_API void ni_get_hw_yuv420p_dim(int width, int height, int bit_depth_factor,
197  int is_semiplanar,
198  int plane_stride[NI_MAX_NUM_DATA_POINTERS],
199  int plane_height[NI_MAX_NUM_DATA_POINTERS]);
200 
201 /*!*****************************************************************************
202  * \brief Get dimension information of frame to be sent
203  * to encoder for encoding. Caller usually retrieves this info and
204  * uses it in the call to ni_encoder_frame_buffer_alloc for buffer
205  * allocation.
206  * The returned stride and height info will take alignment
207  * requirements into account.
208  *
209  * \param[in] width source frame width
210  * \param[in] height source frame height
211  * \param[in] pix_fmt ni pixel format
212  * \param[out] plane_stride size (in bytes) of each plane width
213  * \param[out] plane_height size of each plane height
214  *
215  * \return stride and height info
216  *
217  ******************************************************************************/
218 LIB_API void ni_get_frame_dim(int width, int height,
219  ni_pix_fmt_t pix_fmt,
220  int plane_stride[NI_MAX_NUM_DATA_POINTERS],
221  int plane_height[NI_MAX_NUM_DATA_POINTERS]);
222 
223 /*!*****************************************************************************
224  * \brief Get dimension information of frame to be sent
225  * to encoder for encoding. Caller usually retrieves this info and
226  * uses it in the call to ni_encoder_frame_buffer_alloc for buffer
227  * allocation.
228  * The returned stride and height info will take into account both min
229  * resolution and alignment requirements.
230  *
231  * \param[in] width source frame width
232  * \param[in] height source frame height
233  * \param[in] pix_fmt ni pixel format
234  * \param[out] plane_stride size (in bytes) of each plane width
235  * \param[out] plane_height size of each plane height
236  *
237  * \return stride and height info
238  *
239  ******************************************************************************/
240 LIB_API void ni_get_min_frame_dim(int width, int height,
241  ni_pix_fmt_t pix_fmt,
242  int plane_stride[NI_MAX_NUM_DATA_POINTERS],
243  int plane_height[NI_MAX_NUM_DATA_POINTERS]);
244 
245 /*!*****************************************************************************
246  * \brief Copy YUV data to Netint HW YUV420p frame layout to be sent
247  * to encoder for encoding. Data buffer (dst) is usually allocated by
248  * ni_encoder_frame_buffer_alloc.
249  *
250  * \param[out] p_dst pointers of Y/Cb/Cr to which data is copied
251  * \param[in] p_src pointers of Y/Cb/Cr from which data is copied
252  * \param[in] width source YUV frame width
253  * \param[in] height source YUV frame height
254  * \param[in] bit_depth_factor 1 for 8 bit, 2 for 10 bit
255  * \param[in] is_semiplanar non-0 for semiplanar frame, 0 otherwise
256  * \param[in] conf_win_right right offset of conformance window
257  * \param[in] dst_stride size (in bytes) of each plane width in destination
258  * \param[in] dst_height size of each plane height in destination
259  * \param[in] src_stride size (in bytes) of each plane width in source
260  * \param[in] src_height size of each plane height in source
261  *
262  * \return Y/Cb/Cr data
263  *
264  ******************************************************************************/
266  uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS],
267  int width, int height, int bit_depth_factor,
268  int is_semiplanar, int conf_win_right,
269  int dst_stride[NI_MAX_NUM_DATA_POINTERS],
270  int dst_height[NI_MAX_NUM_DATA_POINTERS],
271  int src_stride[NI_MAX_NUM_DATA_POINTERS],
272  int src_height[NI_MAX_NUM_DATA_POINTERS]);
273 
274 /*!*****************************************************************************
275  * \brief Copy RGBA or YUV data to Netint HW frame layout to be sent
276  * to encoder for encoding. Data buffer (dst) is usually allocated by
277  * ni_encoder_frame_buffer_alloc.
278  *
279  * \param[out] p_dst pointers to which data is copied
280  * \param[in] p_src pointers from which data is copied
281  * \param[in] width source frame width
282  * \param[in] height source frame height
283  * \param[in] factor 1 for 8 bit, 2 for 10 bit
284  * \param[in] pix_fmt pixel format to distinguish between planar types and/or components
285  * \param[in] conf_win_right right offset of conformance window
286  * \param[in] dst_stride size (in bytes) of each plane width in destination
287  * \param[in] dst_height size of each plane height in destination
288  * \param[in] src_stride size (in bytes) of each plane width in source
289  * \param[in] src_height size of each plane height in source
290  *
291  * \return copied data
292  *
293  ******************************************************************************/
295  uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS],
296  int frame_width, int frame_height,
297  int factor, ni_pix_fmt_t pix_fmt,
298  int conf_win_right,
299  int dst_stride[NI_MAX_NUM_DATA_POINTERS],
300  int dst_height[NI_MAX_NUM_DATA_POINTERS],
301  int src_stride[NI_MAX_NUM_DATA_POINTERS],
302  int src_height[NI_MAX_NUM_DATA_POINTERS]);
303 
304 /*!*****************************************************************************
305  * \brief Copy yuv444p data to yuv420p frame layout to be sent
306  * to encoder for encoding. Data buffer (dst) is usually allocated by
307  * ni_encoder_frame_buffer_alloc.
308  *
309  * \param[out] p_dst0 pointers of Y/Cb/Cr as yuv420p output0
310  * \param[out] p_dst1 pointers of Y/Cb/Cr as yuv420p output1
311  * \param[in] p_src pointers of Y/Cb/Cr as yuv444p intput
312  * \param[in] width source YUV frame width
313  * \param[in] height source YUV frame height
314  * \param[in] factor 1 for 8 bit, 2 for 10 bit
315  * \param[in] mode 0 for
316  * out0 is Y+1/2V, with the original input as the out0, 1/4V
317  * copy to data[1] 1/4V copy to data[2]
318  * out1 is U+1/2V, U copy to data[0], 1/4V copy to data[1], 1/4V
319  * copy to data[2]
320  * mode 1 for
321  * out0 is Y+1/2u+1/2v, with the original input as the output0,
322  * 1/4U copy to data[1] 1/4V copy to data[2]
323  * out1 is (1/2U+1/2V)+1/4U+1/4V, 1/2U & 1/2V copy to data[0],
324  * 1/4U copy to data[1], 1/4V copy to data[2]
325  *
326  * \return Y/Cb/Cr data
327  *
328  ******************************************************************************/
330  uint8_t *p_dst1[NI_MAX_NUM_DATA_POINTERS],
331  uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS],
332  int width, int height, int factor,
333  int mode);
334 
335 // NAL operations
336 
337 /*!*****************************************************************************
338  * \brief Insert emulation prevention byte(s) as needed into the data buffer
339  *
340  * \param buf data buffer to be worked on - new byte(s) will be inserted
341  * size number of bytes starting from buf to check
342  *
343  * \return the number of emulation prevention bytes inserted into buf, 0 if
344  * none.
345  *
346  * Note: caller *MUST* ensure for newly inserted bytes, buf has enough free
347  * space starting from buf + size
348  ******************************************************************************/
349 LIB_API int ni_insert_emulation_prevent_bytes(uint8_t *buf, int size);
350 
351 /*!*****************************************************************************
352  * \brief Remove emulation prevention byte(s) as needed from the data buffer
353  *
354  * \param buf data buffer to be worked on - emu prevent byte(s) will be
355  * removed from.
356  * size number of bytes starting from buf to check
357  *
358  * \return the number of emulation prevention bytes removed from buf, 0 if
359  * none.
360  *
361  * Note: buf will be modified if emu prevent byte(s) found and removed.
362  ******************************************************************************/
363 LIB_API int ni_remove_emulation_prevent_bytes(uint8_t *buf, int size);
364 
365 /*!*****************************************************************************
366  * \brief Get time for logs with microsecond timestamps
367  *
368  * \param[in/out] p_tp timeval struct
369  * \param[in] p_tzp void *
370  *
371  * \return return 0 for success, -1 for error
372  ******************************************************************************/
373 LIB_API int32_t ni_gettimeofday(struct timeval *p_tp, void *p_tzp);
374 
375 /*!*****************************************************************************
376  * \brief Allocate aligned memory
377  *
378  * \param[in/out] memptr The address of the allocated memory will be a
379  * multiple of alignment, which must be a power of two
380  * and a multiple of sizeof(void *). If size is 0, then
381  * the value placed is either NULL, or a unique pointer
382  * value that can later be successfully passed to free.
383  * \param[in] alignment The alignment value of the allocated value.
384  * \param[in] size The allocated memory size.
385  *
386  * \return 0 for success, ENOMEM for error
387  ******************************************************************************/
388 LIB_API int ni_posix_memalign(void **memptr, size_t alignment, size_t size);
389 
390 uint32_t ni_round_up(uint32_t number_to_round, uint32_t multiple);
391 
392 #ifdef _WIN32
393 #define ni_aligned_free(p_memptr) do { \
394  if ((p_memptr) != NULL) { \
395  _aligned_free(p_memptr); \
396  p_memptr = NULL; \
397  } \
398 }while(0)
399 #else
400 #define ni_aligned_free(p_memptr) do { \
401  if ((p_memptr) != NULL) { \
402  free(p_memptr); \
403  p_memptr = NULL; \
404  } \
405 }while(0)
406 #endif
407 
408 // This method is used in device session close function to unset all the
409 // pointers in the session context.
410 #define ni_memfree(p_memptr) do { \
411  if ((p_memptr) != NULL) { \
412  free(p_memptr); \
413  p_memptr = NULL; \
414  } \
415 }while(0)
416 
417 #if __linux__ || __APPLE__
418 uint32_t ni_get_kernel_max_io_size(const char * p_dev);
419 #endif
420 
421 LIB_API uint64_t ni_gettime_ns(void);
422 LIB_API void ni_usleep(int64_t usec);
423 LIB_API char *ni_strtok(char *s, const char *delim, char **saveptr);
424 LIB_API ni_retcode_t ni_strncpy(char *dest, size_t dmax,
425  const char *src, size_t slen);
426 LIB_API ni_retcode_t ni_strcpy(char *dest, size_t dmax, const char *src);
427 LIB_API ni_retcode_t ni_strerror(char *dest, size_t dmax, int errnum);
428 LIB_API ni_retcode_t ni_strcat(char *dest, size_t dmax, const char *src);
429 LIB_API ni_retcode_t ni_strncat(char *dest, size_t dmax, const char *src, size_t slen);
430 LIB_API ni_retcode_t ni_fopen(FILE **fp, const char *filename, const char *mode);
431 LIB_API struct tm* ni_localtime(struct tm *dest, const time_t *src);
432 LIB_API int ni_fscanf(FILE *stream, const char *fmt, ...);
433 LIB_API int ni_vsprintf(char *dest, const size_t dmax, const char *fmt, va_list args);
434 LIB_API int ni_sprintf(char *dest, size_t dmax, const char *fmt, ...);
435 
437 ni_network_layer_convert_output(float *dst, uint32_t num, ni_packet_t *p_packet,
438  ni_network_data_t *p_network, uint32_t layer);
442  uint8_t *dst, uint32_t dst_len, const char *tensor_file,
443  ni_network_layer_params_t *p_param);
445  uint8_t *dst, uint32_t dst_len, float *src, uint32_t src_len,
446  ni_network_layer_params_t *p_param);
448  float *dst, uint32_t dst_len, uint8_t *src, uint32_t src_len,
449  ni_network_layer_params_t *p_param);
450 
451 LIB_API void ni_calculate_sha256(const uint8_t aui8Data[],
452  size_t ui32DataLength, uint8_t aui8Hash[]);
453 /*!*****************************************************************************
454 * \brief Copy Descriptor data to Netint HW descriptor frame layout to be sent
455 * to encoder for encoding. Data buffer (dst) is usually allocated by
456 * ni_encoder_frame_buffer_alloc. Only necessary when metadata size in
457 * source is insufficient
458 *
459 * \param[out] p_dst pointers of Y/Cb/Cr to which data is copied
460 * \param[in] p_src pointers of Y/Cb/Cr from which data is copied
461 *
462 * \return descriptor data
463 *
464 ******************************************************************************/
466  uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS]);
467 
468 /*!*****************************************************************************
469  * \brief Get libxcoder API version
470  *
471  * \return char pointer to libxcoder API version
472  ******************************************************************************/
474 
475 #ifndef DEPRECATION_AS_ERROR
476 /*!*****************************************************************************
477  * \brief Get FW API version libxcoder is compatible with
478  *
479  * \return char pointer to FW API version libxcoder is compatible with
480  ******************************************************************************/
482 #endif
483 
484 /*!*****************************************************************************
485  * \brief Get formatted FW API version string from unformatted FW API version
486  * string
487  *
488  * \param[in] ver_str pointer to string containing FW API. Only up to 3
489  * characters will be read
490  * \param[out] fmt_str pointer to string buffer of at least size 5 to output
491  * formated version string to
492  *
493  * \return none
494  ******************************************************************************/
495 LIB_API void ni_fmt_fw_api_ver_str(const char ver_str[], char fmt_str[]);
496 
497 /*!*****************************************************************************
498  * \brief Compare two 3 character strings containing a FW API version. Handle
499  * comparision when FW API version format length changed from 2 to 3.
500  *
501  * \param[in] ver1 pointer to string containing FW API. Only up to 3
502  * characters will be read
503  * \param[in] ver2 pointer to string containing FW API. Only up to 3
504  * characters will be read
505  *
506  * \return 0 if ver1 == ver2, 1 if ver1 > ver2, -1 if ver1 < ver2
507  ******************************************************************************/
508 LIB_API int ni_cmp_fw_api_ver(const char ver1[], const char ver2[]);
509 
510 /*!*****************************************************************************
511  * \brief Get libxcoder SW release version
512  *
513  * \return char pointer to libxcoder SW release version
514  ******************************************************************************/
516 
517 /*!*****************************************************************************
518  * \brief initialize a mutex
519  *
520  * \param[in] thread mutex
521  *
522  * \return On success returns 0
523  * On failure returns <0
524  ******************************************************************************/
525 LIB_API int ni_pthread_mutex_init(ni_pthread_mutex_t *mutex);
526 
527 /*!*****************************************************************************
528  * \brief destory a mutex
529  *
530  * \param[in] thread mutex
531  *
532  * \return On success returns 0
533  * On failure returns <0
534  ******************************************************************************/
535 LIB_API int ni_pthread_mutex_destroy(ni_pthread_mutex_t *mutex);
536 
537 /*!*****************************************************************************
538  * \brief thread mutex lock
539  *
540  * \param[in] thread mutex
541  *
542  * \return On success returns 0
543  * On failure returns <0
544  ******************************************************************************/
545 LIB_API int ni_pthread_mutex_lock(ni_pthread_mutex_t *mutex);
546 
547 /*!*****************************************************************************
548  * \brief thread mutex unlock
549  *
550  * \param[in] thread mutex
551  *
552  * \return On success returns 0
553  * On failure returns <0
554  ******************************************************************************/
555 LIB_API int ni_pthread_mutex_unlock(ni_pthread_mutex_t *mutex);
556 
557 /*!*****************************************************************************
558  * \brief create a new thread
559  *
560  * \param[in] thread thread id
561  * \param[in] attr attributes to the new thread
562  * \param[in] start_routine entry of the thread routine
563  * \param[in] arg sole argument of the routine
564  *
565  * \return On success returns 0
566  * On failure returns <0
567  ******************************************************************************/
568 LIB_API int ni_pthread_create(ni_pthread_t *thread,
569  const ni_pthread_attr_t *attr,
570  void *(*start_routine)(void *), void *arg);
571 
572 /*!*****************************************************************************
573  * \brief join with a terminated thread
574  *
575  * \param[in] thread thread id
576  * \param[out] value_ptr return status
577  *
578  * \return On success returns 0
579  * On failure returns <0
580  ******************************************************************************/
581 LIB_API int ni_pthread_join(ni_pthread_t thread, void **value_ptr);
582 
583 /*!*****************************************************************************
584  * \brief initialize condition variables
585  *
586  * \param[in] cond condition variable
587  * \param[in] attr attribute to the condvar
588  *
589  * \return On success returns 0
590  * On failure returns <0
591  ******************************************************************************/
592 LIB_API int ni_pthread_cond_init(ni_pthread_cond_t *cond,
593  const ni_pthread_condattr_t *attr);
594 
595 /*!*****************************************************************************
596  * \brief destroy condition variables
597  *
598  * \param[in] cond condition variable
599  *
600  * \return On success returns 0
601  * On failure returns <0
602  ******************************************************************************/
603 LIB_API int ni_pthread_cond_destroy(ni_pthread_cond_t *cond);
604 
605 /*!*****************************************************************************
606  * \brief broadcast a condition
607  *
608  * \param[in] cond condition variable
609  *
610  * \return On success returns 0
611  * On failure returns <0
612  ******************************************************************************/
613 LIB_API int ni_pthread_cond_broadcast(ni_pthread_cond_t *cond);
614 
615 /*!*****************************************************************************
616  * \brief wait on a condition
617  *
618  * \param[in] cond condition variable
619  * \param[in] mutex mutex related to the condvar
620  *
621  * \return On success returns 0
622  * On failure returns <0
623  ******************************************************************************/
624 LIB_API int ni_pthread_cond_wait(ni_pthread_cond_t *cond,
625  ni_pthread_mutex_t *mutex);
626 
627 /*!******************************************************************************
628  * \brief signal a condition
629  *
630  * \param[in] cond condition variable
631  *
632  * \return On success returns 0
633  * On failure returns <0
634  *******************************************************************************/
635 LIB_API int ni_pthread_cond_signal(ni_pthread_cond_t *cond);
636 
637 /*!*****************************************************************************
638  * \brief wait on a condition
639  *
640  * \param[in] cond condition variable
641  * \param[in] mutex mutex related to the condvar
642  * \param[in[ abstime abstract value of timeout
643  *
644  * \return On success returns 0
645  * On failure returns <0
646  ******************************************************************************/
647 LIB_API int ni_pthread_cond_timedwait(ni_pthread_cond_t *cond,
648  ni_pthread_mutex_t *mutex,
649  const struct timespec *abstime);
650 
651 /*!*****************************************************************************
652  * \brief examine and change mask of blocked signals
653  *
654  * \param[in] how behavior of this call, can be value of SIG_BLOCK,
655  * SIG_UNBLOCK and SIG_SETMASK
656  * \param[in] set current value of the signal mask. If NULL, the mask keeps
657  * unchanged.
658  * \param[in] old_set previous value of the signal mask, can be NULL.
659  *
660  * \return On success returns 0
661  * On failure returns <0
662  ******************************************************************************/
663 LIB_API int ni_pthread_sigmask(int how, const ni_sigset_t *set,
664  ni_sigset_t *oldset);
665 
666 /*!*****************************************************************************
667  * \brief Get text string for the provided error
668  *
669  * \return char pointer for the provided error
670  ******************************************************************************/
671 LIB_API const char *ni_get_rc_txt(ni_retcode_t rc);
672 
673 /*!*****************************************************************************
674  * \brief Retrieve key and value from 'key=value' pair
675  *
676  * \param[in] p_str pointer to string to extract pair from
677  * \param[out] key pointer to key
678  * \param[out] value pointer to value
679  *
680  * \return return 0 if successful, otherwise 1
681  *
682  ******************************************************************************/
683 LIB_API int ni_param_get_key_value(char *p_str, char *key, char *value);
684 
685 /*!*****************************************************************************
686  * \brief Retrieve encoder config parameter values from --xcoder-params
687  *
688  * \param[in] xcoderParams pointer to string containing xcoder params
689  * \param[out] params pointer to xcoder params to fill out
690  * \param[out] ctx pointer to session context
691  *
692  * \return return 0 if successful, -1 otherwise
693  *
694  ******************************************************************************/
695 LIB_API int ni_retrieve_xcoder_params(char xcoderParams[],
696  ni_xcoder_params_t *params,
697  ni_session_context_t *ctx);
698 
699 /*!*****************************************************************************
700  * \brief Retrieve custom gop config values from --xcoder-gop
701  *
702  * \param[in] xcoderGop pointer to string containing xcoder gop
703  * \param[out] params pointer to xcoder params to fill out
704  * \param[out] ctx pointer to session context
705  *
706  * \return return 0 if successful, -1 otherwise
707  *
708  ******************************************************************************/
709 LIB_API int ni_retrieve_xcoder_gop(char xcoderGop[],
710  ni_xcoder_params_t *params,
711  ni_session_context_t *ctx);
712 
713 /*!*****************************************************************************
714  * \brief Retrieve decoder config parameter values from --decoder-params
715  *
716  * \param[in] xcoderParams pointer to string containing xcoder params
717  * \param[out] params pointer to xcoder params to fill out
718  * \param[out] ctx pointer to session context
719  *
720  * \return return 0 if successful, -1 otherwise
721  *
722  ******************************************************************************/
723 LIB_API int ni_retrieve_decoder_params(char xcoderParams[],
724  ni_xcoder_params_t *params,
725  ni_session_context_t *ctx);
726 
727 /*!*****************************************************************************
728  * \brief return error string according to error code from firmware
729  *
730  * \param[in] rc error code return from firmware
731  *
732  * \return error string
733  ******************************************************************************/
734 LIB_API const char *ni_ai_errno_to_str(int rc);
735 #ifdef __cplusplus
736 }
737 #endif
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 ...
Definition: ni_util.c:5348
ni_strcat
LIB_API ni_retcode_t ni_strcat(char *dest, size_t dmax, const char *src)
Definition: ni_util.c:689
ni_gettime_ns
LIB_API uint64_t ni_gettime_ns(void)
Definition: ni_util.c:2622
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 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 us...
Definition: ni_util.c:3102
ni_strtok
LIB_API char * ni_strtok(char *s, const char *delim, char **saveptr)
Definition: ni_util.c:424
_ni_network_data
Definition: ni_device_api.h:1377
ni_sprintf
LIB_API int ni_sprintf(char *dest, size_t dmax, const char *fmt,...)
Definition: ni_util.c:1063
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: ni_util.c:3708
ni_get_rc_txt
const LIB_API char * ni_get_rc_txt(ni_retcode_t rc)
Get text string for the provided error.
Definition: ni_util.c:4359
ni_pix_fmt_t
ni_pix_fmt_t
Definition: ni_device_api.h:264
ni_check_dev_name
ni_retcode_t ni_check_dev_name(const char *p_dev)
check dev name
Definition: ni_util.c:1875
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)
Definition: ni_util.c:2339
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: ni_util.c:2054
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.
Definition: ni_util.c:2022
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.
Definition: ni_util.c:2136
ni_buffer_pool_free
void ni_buffer_pool_free(ni_queue_buffer_pool_t *p_buffer_pool)
Definition: ni_util.c:1412
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.
Definition: ni_util.c:4239
ni_pthread_mutex_destroy
LIB_API int ni_pthread_mutex_destroy(ni_pthread_mutex_t *mutex)
destory a mutex
Definition: ni_util.c:4668
ni_decode_power_measurement
uint32_t ni_decode_power_measurement(uint32_t power_value, const uint8_t *serial_number)
decode the raw current obtained and determine power
Definition: ni_util.c:5013
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.
Definition: ni_util.c:2098
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.
Definition: ni_util.c:4272
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 a...
Definition: ni_util.c:1804
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
Definition: ni_util.c:4934
ni_strncat
LIB_API ni_retcode_t ni_strncat(char *dest, size_t dmax, const char *src, size_t slen)
Definition: ni_util.c:807
ni_atof
double ni_atof(const char *p_str, bool *b_error)
Convert string to floating.
Definition: ni_util.c:2574
ni_ai_network_layer_dims
LIB_API uint32_t ni_ai_network_layer_dims(ni_network_layer_params_t *p_param)
Definition: ni_util.c:3995
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 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....
Definition: ni_util.c:2976
ni_pthread_mutex_init
LIB_API int ni_pthread_mutex_init(ni_pthread_mutex_t *mutex)
initialize a mutex
Definition: ni_util.c:4630
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
Definition: ni_util.c:4900
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: ni_util.c:3882
ni_get_libxcoder_api_ver
LIB_API char * ni_get_libxcoder_api_ver(void)
Get libxcoder API version.
Definition: ni_util.c:4226
ni_pthread_create
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
Definition: ni_util.c:4750
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.
Definition: ni_util.c:1931
_ni_network_layer_params_t
Definition: ni_device_api.h:1340
ni_retcode_t
ni_retcode_t
Definition: ni_defs.h:439
ni_localtime
LIB_API struct tm * ni_localtime(struct tm *dest, const time_t *src)
Definition: ni_util.c:1003
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.
Definition: ni_util.c:4383
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: ni_util.c:2046
ni_strerror
LIB_API ni_retcode_t ni_strerror(char *dest, size_t dmax, int errnum)
Definition: ni_util.c:656
ni_log.h
Logging definitions.
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.
Definition: ni_util.c:1996
ni_usleep
LIB_API void ni_usleep(int64_t usec)
Definition: ni_util.c:362
ni_defs.h
Common NETINT definitions used by all modules.
ni_dec_fme_buffer_pool_free
void ni_dec_fme_buffer_pool_free(ni_buf_pool_t *p_buffer_pool)
Definition: ni_util.c:1358
ni_pthread_mutex_lock
LIB_API int ni_pthread_mutex_lock(ni_pthread_mutex_t *mutex)
thread mutex lock
Definition: ni_util.c:4686
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.
Definition: ni_util.c:1971
ni_buf_pool_return_buffer
void ni_buf_pool_return_buffer(ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool)
Definition: ni_util.c:1152
_ni_buf_t
Definition: ni_device_api.h:1286
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.
Definition: ni_util.c:2434
ni_pthread_cond_broadcast
LIB_API int ni_pthread_cond_broadcast(ni_pthread_cond_t *cond)
broadcast a condition
Definition: ni_util.c:4843
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.
Definition: ni_util.c:3215
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....
Definition: ni_util.c:3022
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 f...
Definition: ni_util.c:4302
ni_buf_pool_get_buffer
ni_buf_t * ni_buf_pool_get_buffer(ni_buf_pool_t *p_buffer_pool)
Definition: ni_util.c:1091
ni_pthread_mutex_unlock
LIB_API int ni_pthread_mutex_unlock(ni_pthread_mutex_t *mutex)
thread mutex unlock
Definition: ni_util.c:4712
ni_gettimeofday
LIB_API int32_t ni_gettimeofday(struct timeval *p_tp, void *p_tzp)
Get time for logs with microsecond timestamps.
Definition: ni_util.c:143
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_offset, int64_t timestamp)
Push into xcoder queue.
Definition: ni_util.c:2163
_ni_packet
Definition: ni_device_api.h:2993
_ni_buf_pool_t
Definition: ni_device_api.h:1296
ni_posix_memalign
LIB_API int ni_posix_memalign(void **memptr, size_t alignment, size_t size)
Allocate aligned memory.
Definition: ni_util.c:202
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
Definition: ni_util.c:4806
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.
Definition: ni_util.c:4416
ni_queue_print
ni_retcode_t ni_queue_print(ni_queue_t *p_queue)
Print xcoder queue info.
Definition: ni_util.c:2474
_ni_queue_buffer_pool_t
Definition: ni_device_api.h:1318
_ni_session_context
Definition: ni_device_api.h:1435
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: ni_util.c:3862
NI_MAX_NUM_DATA_POINTERS
#define NI_MAX_NUM_DATA_POINTERS
Definition: ni_defs.h:244
ni_atoi
int32_t ni_atoi(const char *p_str, bool *b_error)
Convert string to integer.
Definition: ni_util.c:2554
ni_buf_pool_allocate_buffer
ni_buf_t * ni_buf_pool_allocate_buffer(ni_buf_pool_t *p_buffer_pool, int buffer_size)
Definition: ni_util.c:1208
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
Definition: ni_util.c:4950
NI_DEPRECATED
#define NI_DEPRECATED
Definition: ni_defs.h:80
ni_ai_network_layer_size
LIB_API uint32_t ni_ai_network_layer_size(ni_network_layer_params_t *p_param)
Definition: ni_util.c:3989
ni_atobool
int32_t ni_atobool(const char *p_str, bool *b_error)
Convert string to boolean.
Definition: ni_util.c:2531
_ni_xcoder_params
Definition: ni_device_api.h:2814
ni_vsprintf
LIB_API int ni_vsprintf(char *dest, const size_t dmax, const char *fmt, va_list args)
Definition: ni_util.c:1040
ni_calculate_sha256
LIB_API void ni_calculate_sha256(const uint8_t aui8Data[], size_t ui32DataLength, uint8_t aui8Hash[])
Definition: ni_util.c:4176
ni_parse_name
int32_t ni_parse_name(const char *arg, const char *const *names, bool *b_error)
Parse name.
Definition: ni_util.c:2594
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: ni_util.c:1249
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.
Definition: ni_util.c:4490
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....
Definition: ni_util.c:4202
ni_round_up
uint32_t ni_round_up(uint32_t number_to_round, uint32_t multiple)
Definition: ni_util.c:173
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.
Definition: ni_util.c:4560
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.
Definition: ni_util.c:3268
ni_pthread_cond_signal
LIB_API int ni_pthread_cond_signal(ni_pthread_cond_t *cond)
signal a condition
Definition: ni_util.c:4880
ni_get_libxcoder_release_ver
LIB_API char * ni_get_libxcoder_release_ver(void)
Get libxcoder SW release version.
Definition: ni_util.c:4338
ni_pthread_join
LIB_API int ni_pthread_join(ni_pthread_t thread, void **value_ptr)
join with a terminated thread
Definition: ni_util.c:4777
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 ...
Definition: ni_util.c:2716
ni_queue_pop
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.
Definition: ni_util.c:2234
ni_device_api.h
Public definitions for operating NETINT video processing devices for video processing.
ni_strncpy
LIB_API ni_retcode_t ni_strncpy(char *dest, size_t dmax, const char *src, size_t slen)
Definition: ni_util.c:518
_ni_timestamp_table_t
Definition: ni_device_api.h:1335
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: ni_util.c:3872
ni_fscanf
LIB_API int ni_fscanf(FILE *stream, const char *fmt,...)
Definition: ni_util.c:1021
LIB_API
#define LIB_API
Definition: ni_libxcoder_dynamic_loading.h:54
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 ...
Definition: ni_util.c:2805
ni_fopen
LIB_API ni_retcode_t ni_fopen(FILE **fp, const char *filename, const char *mode)
Definition: ni_util.c:983
ni_pthread_cond_destroy
LIB_API int ni_pthread_cond_destroy(ni_pthread_cond_t *cond)
destroy condition variables
Definition: ni_util.c:4825
ni_get_hw_yuv420p_dim
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....
Definition: ni_util.c:2664
_ni_queue_t
Definition: ni_device_api.h:1327
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
Definition: ni_util.c:4862
ni_strcpy
LIB_API ni_retcode_t ni_strcpy(char *dest, size_t dmax, const char *src)
Definition: ni_util.c:453