libxcoder  5.4.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 TPS25946_GAIN_IMON_T1M 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 TPS25946_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) \
394 { \
395  _aligned_free(p_memptr); \
396  p_memptr = NULL; \
397 }
398 #else
399 #define ni_aligned_free(p_memptr) \
400 { \
401  free(p_memptr); \
402  p_memptr = NULL; \
403 }
404 #endif
405 
406 // This method is used in device session close function to unset all the
407 // pointers in the session context.
408 #define ni_memfree(p_memptr) \
409 { \
410  free(p_memptr); \
411  p_memptr = NULL; \
412 }
413 
414 #if __linux__ || __APPLE__
415 uint32_t ni_get_kernel_max_io_size(const char * p_dev);
416 #endif
417 
418 LIB_API uint64_t ni_gettime_ns(void);
419 LIB_API void ni_usleep(int64_t usec);
420 LIB_API char *ni_strtok(char *s, const char *delim, char **saveptr);
421 LIB_API ni_retcode_t ni_strncpy(char *dest, size_t dmax,
422  const char *src, size_t slen);
423 LIB_API ni_retcode_t ni_strcpy(char *dest, size_t dmax, const char *src);
424 LIB_API ni_retcode_t ni_strerror(char *dest, size_t dmax, int errnum);
425 LIB_API ni_retcode_t ni_strcat(char *dest, size_t dmax, const char *src);
426 LIB_API ni_retcode_t ni_strncat(char *dest, size_t dmax, const char *src, size_t slen);
427 LIB_API ni_retcode_t ni_fopen(FILE **fp, const char *filename, const char *mode);
428 LIB_API struct tm* ni_localtime(struct tm *dest, const time_t *src);
429 LIB_API int ni_fscanf(FILE *stream, const char *fmt, ...);
430 LIB_API int ni_vsprintf(char *dest, const size_t dmax, const char *fmt, va_list args);
431 LIB_API int ni_sprintf(char *dest, size_t dmax, const char *fmt, ...);
432 
434 ni_network_layer_convert_output(float *dst, uint32_t num, ni_packet_t *p_packet,
435  ni_network_data_t *p_network, uint32_t layer);
439  uint8_t *dst, uint32_t dst_len, const char *tensor_file,
440  ni_network_layer_params_t *p_param);
442  uint8_t *dst, uint32_t dst_len, float *src, uint32_t src_len,
443  ni_network_layer_params_t *p_param);
445  float *dst, uint32_t dst_len, uint8_t *src, uint32_t src_len,
446  ni_network_layer_params_t *p_param);
447 
448 LIB_API void ni_calculate_sha256(const uint8_t aui8Data[],
449  size_t ui32DataLength, uint8_t aui8Hash[]);
450 /*!*****************************************************************************
451 * \brief Copy Descriptor data to Netint HW descriptor frame layout to be sent
452 * to encoder for encoding. Data buffer (dst) is usually allocated by
453 * ni_encoder_frame_buffer_alloc. Only necessary when metadata size in
454 * source is insufficient
455 *
456 * \param[out] p_dst pointers of Y/Cb/Cr to which data is copied
457 * \param[in] p_src pointers of Y/Cb/Cr from which data is copied
458 *
459 * \return descriptor data
460 *
461 ******************************************************************************/
463  uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS]);
464 
465 /*!*****************************************************************************
466  * \brief Get libxcoder API version
467  *
468  * \return char pointer to libxcoder API version
469  ******************************************************************************/
471 
472 #ifndef DEPRECATION_AS_ERROR
473 /*!*****************************************************************************
474  * \brief Get FW API version libxcoder is compatible with
475  *
476  * \return char pointer to FW API version libxcoder is compatible with
477  ******************************************************************************/
479 #endif
480 
481 /*!*****************************************************************************
482  * \brief Get formatted FW API version string from unformatted FW API version
483  * string
484  *
485  * \param[in] ver_str pointer to string containing FW API. Only up to 3
486  * characters will be read
487  * \param[out] fmt_str pointer to string buffer of at least size 5 to output
488  * formated version string to
489  *
490  * \return none
491  ******************************************************************************/
492 LIB_API void ni_fmt_fw_api_ver_str(const char ver_str[], char fmt_str[]);
493 
494 /*!*****************************************************************************
495  * \brief Compare two 3 character strings containing a FW API version. Handle
496  * comparision when FW API version format length changed from 2 to 3.
497  *
498  * \param[in] ver1 pointer to string containing FW API. Only up to 3
499  * characters will be read
500  * \param[in] ver2 pointer to string containing FW API. Only up to 3
501  * characters will be read
502  *
503  * \return 0 if ver1 == ver2, 1 if ver1 > ver2, -1 if ver1 < ver2
504  ******************************************************************************/
505 LIB_API int ni_cmp_fw_api_ver(const char ver1[], const char ver2[]);
506 
507 /*!*****************************************************************************
508  * \brief Get libxcoder SW release version
509  *
510  * \return char pointer to libxcoder SW release version
511  ******************************************************************************/
513 
514 /*!*****************************************************************************
515  * \brief initialize a mutex
516  *
517  * \param[in] thread mutex
518  *
519  * \return On success returns 0
520  * On failure returns <0
521  ******************************************************************************/
522 LIB_API int ni_pthread_mutex_init(ni_pthread_mutex_t *mutex);
523 
524 /*!*****************************************************************************
525  * \brief destory a mutex
526  *
527  * \param[in] thread mutex
528  *
529  * \return On success returns 0
530  * On failure returns <0
531  ******************************************************************************/
532 LIB_API int ni_pthread_mutex_destroy(ni_pthread_mutex_t *mutex);
533 
534 /*!*****************************************************************************
535  * \brief thread mutex lock
536  *
537  * \param[in] thread mutex
538  *
539  * \return On success returns 0
540  * On failure returns <0
541  ******************************************************************************/
542 LIB_API int ni_pthread_mutex_lock(ni_pthread_mutex_t *mutex);
543 
544 /*!*****************************************************************************
545  * \brief thread mutex unlock
546  *
547  * \param[in] thread mutex
548  *
549  * \return On success returns 0
550  * On failure returns <0
551  ******************************************************************************/
552 LIB_API int ni_pthread_mutex_unlock(ni_pthread_mutex_t *mutex);
553 
554 /*!*****************************************************************************
555  * \brief create a new thread
556  *
557  * \param[in] thread thread id
558  * \param[in] attr attributes to the new thread
559  * \param[in] start_routine entry of the thread routine
560  * \param[in] arg sole argument of the routine
561  *
562  * \return On success returns 0
563  * On failure returns <0
564  ******************************************************************************/
565 LIB_API int ni_pthread_create(ni_pthread_t *thread,
566  const ni_pthread_attr_t *attr,
567  void *(*start_routine)(void *), void *arg);
568 
569 /*!*****************************************************************************
570  * \brief join with a terminated thread
571  *
572  * \param[in] thread thread id
573  * \param[out] value_ptr return status
574  *
575  * \return On success returns 0
576  * On failure returns <0
577  ******************************************************************************/
578 LIB_API int ni_pthread_join(ni_pthread_t thread, void **value_ptr);
579 
580 /*!*****************************************************************************
581  * \brief initialize condition variables
582  *
583  * \param[in] cond condition variable
584  * \param[in] attr attribute to the condvar
585  *
586  * \return On success returns 0
587  * On failure returns <0
588  ******************************************************************************/
589 LIB_API int ni_pthread_cond_init(ni_pthread_cond_t *cond,
590  const ni_pthread_condattr_t *attr);
591 
592 /*!*****************************************************************************
593  * \brief destroy condition variables
594  *
595  * \param[in] cond condition variable
596  *
597  * \return On success returns 0
598  * On failure returns <0
599  ******************************************************************************/
600 LIB_API int ni_pthread_cond_destroy(ni_pthread_cond_t *cond);
601 
602 /*!*****************************************************************************
603  * \brief broadcast a condition
604  *
605  * \param[in] cond condition variable
606  *
607  * \return On success returns 0
608  * On failure returns <0
609  ******************************************************************************/
610 LIB_API int ni_pthread_cond_broadcast(ni_pthread_cond_t *cond);
611 
612 /*!*****************************************************************************
613  * \brief wait on a condition
614  *
615  * \param[in] cond condition variable
616  * \param[in] mutex mutex related to the condvar
617  *
618  * \return On success returns 0
619  * On failure returns <0
620  ******************************************************************************/
621 LIB_API int ni_pthread_cond_wait(ni_pthread_cond_t *cond,
622  ni_pthread_mutex_t *mutex);
623 
624 /*!******************************************************************************
625  * \brief signal a condition
626  *
627  * \param[in] cond condition variable
628  *
629  * \return On success returns 0
630  * On failure returns <0
631  *******************************************************************************/
632 LIB_API int ni_pthread_cond_signal(ni_pthread_cond_t *cond);
633 
634 /*!*****************************************************************************
635  * \brief wait on a condition
636  *
637  * \param[in] cond condition variable
638  * \param[in] mutex mutex related to the condvar
639  * \param[in[ abstime abstract value of timeout
640  *
641  * \return On success returns 0
642  * On failure returns <0
643  ******************************************************************************/
644 LIB_API int ni_pthread_cond_timedwait(ni_pthread_cond_t *cond,
645  ni_pthread_mutex_t *mutex,
646  const struct timespec *abstime);
647 
648 /*!*****************************************************************************
649  * \brief examine and change mask of blocked signals
650  *
651  * \param[in] how behavior of this call, can be value of SIG_BLOCK,
652  * SIG_UNBLOCK and SIG_SETMASK
653  * \param[in] set current value of the signal mask. If NULL, the mask keeps
654  * unchanged.
655  * \param[in] old_set previous value of the signal mask, can be NULL.
656  *
657  * \return On success returns 0
658  * On failure returns <0
659  ******************************************************************************/
660 LIB_API int ni_pthread_sigmask(int how, const ni_sigset_t *set,
661  ni_sigset_t *oldset);
662 
663 /*!*****************************************************************************
664  * \brief Get text string for the provided error
665  *
666  * \return char pointer for the provided error
667  ******************************************************************************/
668 LIB_API const char *ni_get_rc_txt(ni_retcode_t rc);
669 
670 /*!*****************************************************************************
671  * \brief Retrieve key and value from 'key=value' pair
672  *
673  * \param[in] p_str pointer to string to extract pair from
674  * \param[out] key pointer to key
675  * \param[out] value pointer to value
676  *
677  * \return return 0 if successful, otherwise 1
678  *
679  ******************************************************************************/
680 LIB_API int ni_param_get_key_value(char *p_str, char *key, char *value);
681 
682 /*!*****************************************************************************
683  * \brief Retrieve encoder config parameter values from --xcoder-params
684  *
685  * \param[in] xcoderParams pointer to string containing xcoder params
686  * \param[out] params pointer to xcoder params to fill out
687  * \param[out] ctx pointer to session context
688  *
689  * \return return 0 if successful, -1 otherwise
690  *
691  ******************************************************************************/
692 LIB_API int ni_retrieve_xcoder_params(char xcoderParams[],
693  ni_xcoder_params_t *params,
694  ni_session_context_t *ctx);
695 
696 /*!*****************************************************************************
697  * \brief Retrieve custom gop config values from --xcoder-gop
698  *
699  * \param[in] xcoderGop pointer to string containing xcoder gop
700  * \param[out] params pointer to xcoder params to fill out
701  * \param[out] ctx pointer to session context
702  *
703  * \return return 0 if successful, -1 otherwise
704  *
705  ******************************************************************************/
706 LIB_API int ni_retrieve_xcoder_gop(char xcoderGop[],
707  ni_xcoder_params_t *params,
708  ni_session_context_t *ctx);
709 
710 /*!*****************************************************************************
711  * \brief Retrieve decoder config parameter values from --decoder-params
712  *
713  * \param[in] xcoderParams pointer to string containing xcoder params
714  * \param[out] params pointer to xcoder params to fill out
715  * \param[out] ctx pointer to session context
716  *
717  * \return return 0 if successful, -1 otherwise
718  *
719  ******************************************************************************/
720 LIB_API int ni_retrieve_decoder_params(char xcoderParams[],
721  ni_xcoder_params_t *params,
722  ni_session_context_t *ctx);
723 
724 /*!*****************************************************************************
725  * \brief return error string according to error code from firmware
726  *
727  * \param[in] rc error code return from firmware
728  *
729  * \return error string
730  ******************************************************************************/
731 LIB_API const char *ni_ai_errno_to_str(int rc);
732 #ifdef __cplusplus
733 }
734 #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:5499
ni_strcat
LIB_API ni_retcode_t ni_strcat(char *dest, size_t dmax, const char *src)
Definition: ni_util.c:685
ni_gettime_ns
LIB_API uint64_t ni_gettime_ns(void)
Definition: ni_util.c:2618
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:3098
ni_strtok
LIB_API char * ni_strtok(char *s, const char *delim, char **saveptr)
Definition: ni_util.c:420
_ni_network_data
Definition: ni_device_api.h:1376
ni_sprintf
LIB_API int ni_sprintf(char *dest, size_t dmax, const char *fmt,...)
Definition: ni_util.c:1059
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:3704
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:4355
ni_pix_fmt_t
ni_pix_fmt_t
Definition: ni_device_api.h:263
ni_check_dev_name
ni_retcode_t ni_check_dev_name(const char *p_dev)
check dev name
Definition: ni_util.c:1871
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:2335
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:2050
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:2018
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:2132
ni_buffer_pool_free
void ni_buffer_pool_free(ni_queue_buffer_pool_t *p_buffer_pool)
Definition: ni_util.c:1408
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:4235
ni_pthread_mutex_destroy
LIB_API int ni_pthread_mutex_destroy(ni_pthread_mutex_t *mutex)
destory a mutex
Definition: ni_util.c:4664
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:5009
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:2094
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:4268
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:1800
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:4930
ni_strncat
LIB_API ni_retcode_t ni_strncat(char *dest, size_t dmax, const char *src, size_t slen)
Definition: ni_util.c:803
ni_atof
double ni_atof(const char *p_str, bool *b_error)
Convert string to floating.
Definition: ni_util.c:2570
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:3991
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:2972
ni_pthread_mutex_init
LIB_API int ni_pthread_mutex_init(ni_pthread_mutex_t *mutex)
initialize a mutex
Definition: ni_util.c:4626
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:4896
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:3878
ni_get_libxcoder_api_ver
LIB_API char * ni_get_libxcoder_api_ver(void)
Get libxcoder API version.
Definition: ni_util.c:4222
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:4746
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:1927
_ni_network_layer_params_t
Definition: ni_device_api.h:1339
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:999
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:4379
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:2042
ni_strerror
LIB_API ni_retcode_t ni_strerror(char *dest, size_t dmax, int errnum)
Definition: ni_util.c:652
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:1992
ni_usleep
LIB_API void ni_usleep(int64_t usec)
Definition: ni_util.c:358
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:1354
ni_pthread_mutex_lock
LIB_API int ni_pthread_mutex_lock(ni_pthread_mutex_t *mutex)
thread mutex lock
Definition: ni_util.c:4682
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:1967
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:1148
_ni_buf_t
Definition: ni_device_api.h:1285
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:2430
ni_pthread_cond_broadcast
LIB_API int ni_pthread_cond_broadcast(ni_pthread_cond_t *cond)
broadcast a condition
Definition: ni_util.c:4839
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:3211
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:3018
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:4298
ni_buf_pool_get_buffer
ni_buf_t * ni_buf_pool_get_buffer(ni_buf_pool_t *p_buffer_pool)
Definition: ni_util.c:1087
ni_pthread_mutex_unlock
LIB_API int ni_pthread_mutex_unlock(ni_pthread_mutex_t *mutex)
thread mutex unlock
Definition: ni_util.c:4708
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:139
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:2159
_ni_packet
Definition: ni_device_api.h:2902
_ni_buf_pool_t
Definition: ni_device_api.h:1295
ni_posix_memalign
LIB_API int ni_posix_memalign(void **memptr, size_t alignment, size_t size)
Allocate aligned memory.
Definition: ni_util.c:198
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:4802
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:4412
ni_queue_print
ni_retcode_t ni_queue_print(ni_queue_t *p_queue)
Print xcoder queue info.
Definition: ni_util.c:2470
_ni_queue_buffer_pool_t
Definition: ni_device_api.h:1317
_ni_session_context
Definition: ni_device_api.h:1434
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:3858
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:2550
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:1204
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:4946
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:3985
ni_atobool
int32_t ni_atobool(const char *p_str, bool *b_error)
Convert string to boolean.
Definition: ni_util.c:2527
_ni_xcoder_params
Definition: ni_device_api.h:2787
ni_vsprintf
LIB_API int ni_vsprintf(char *dest, const size_t dmax, const char *fmt, va_list args)
Definition: ni_util.c:1036
ni_calculate_sha256
LIB_API void ni_calculate_sha256(const uint8_t aui8Data[], size_t ui32DataLength, uint8_t aui8Hash[])
Definition: ni_util.c:4172
ni_parse_name
int32_t ni_parse_name(const char *arg, const char *const *names, bool *b_error)
Parse name.
Definition: ni_util.c:2590
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:1245
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:4486
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:4198
ni_round_up
uint32_t ni_round_up(uint32_t number_to_round, uint32_t multiple)
Definition: ni_util.c:169
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:4556
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:3264
ni_pthread_cond_signal
LIB_API int ni_pthread_cond_signal(ni_pthread_cond_t *cond)
signal a condition
Definition: ni_util.c:4876
ni_get_libxcoder_release_ver
LIB_API char * ni_get_libxcoder_release_ver(void)
Get libxcoder SW release version.
Definition: ni_util.c:4334
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:4773
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:2712
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:2230
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:514
_ni_timestamp_table_t
Definition: ni_device_api.h:1334
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:3868
ni_fscanf
LIB_API int ni_fscanf(FILE *stream, const char *fmt,...)
Definition: ni_util.c:1017
LIB_API
#define LIB_API
Definition: ni_libxcoder_dynamic_loading.h:52
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:2801
ni_fopen
LIB_API ni_retcode_t ni_fopen(FILE **fp, const char *filename, const char *mode)
Definition: ni_util.c:979
ni_pthread_cond_destroy
LIB_API int ni_pthread_cond_destroy(ni_pthread_cond_t *cond)
destroy condition variables
Definition: ni_util.c:4821
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:2660
_ni_queue_t
Definition: ni_device_api.h:1326
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:4858
ni_strcpy
LIB_API ni_retcode_t ni_strcpy(char *dest, size_t dmax, const char *src)
Definition: ni_util.c:449