libxcoder  3.5.1
ni_util_logan.h File Reference

Exported utility routines definition. More...

#include "ni_device_api_logan.h"
#include "ni_log_logan.h"

Go to the source code of this file.

Data Structures

struct  _ni_logan_queue_t
 
struct  _ni_logan_timestamp_table_t
 
struct  ni_task
 
struct  threadpool
 

Macros

#define NI_LOGAN_NVME_PREFIX   "nvme"
 
#define NI_LOGAN_NVME_PREFIX_SZ   4
 
#define LOGAN_XCODER_FRAME_OFFSET_DIFF_THRES   100
 
#define LOGAN_XCODER_MAX_NUM_QUEUE_ENTRIES   6000
 
#define LOGAN_XCODER_MAX_NUM_TEMPORAL_LAYER   7
 
#define LOGAN_BUFFER_POOL_SZ_PER_CONTEXT   300
 
#define LOGAN_XCODER_MIN_ENC_PIC_WIDTH   256
 
#define LOGAN_XCODER_MIN_ENC_PIC_HEIGHT   128
 
#define LOGAN_XCODER_MAX_ENC_PIC_WIDTH   8192
 
#define LOGAN_XCODER_MAX_ENC_PIC_HEIGHT   8192
 
#define NI_LOGAN_DEC_FRAME_BUF_POOL_SIZE_INIT   20
 
#define NI_LOGAN_DEC_FRAME_BUF_POOL_SIZE_EXPAND   20
 
#define NI_LOGAN_INPUT_DATA_BUF_CNT_INIT   30
 
#define NI_LOGAN_VPU_FREQ   450
 
#define MAX_THREADS   1000
 
#define NI_LOGAN_ODD2EVEN(X)   ((X&1)&&(X>31))?(X+1):(X)
 
#define ni_logan_aligned_free(p_memptr)
 

Typedefs

typedef struct _ni_logan_queue_t ni_logan_queue_t
 
typedef struct _ni_logan_timestamp_table_t ni_logan_timestamp_table_t
 
typedef struct ni_task ni_task_t
 
typedef struct threadpool threadpool_t
 

Functions

ni_logan_buf_tni_logan_buf_pool_get_buffer (ni_logan_buf_pool_t *p_buffer_pool)
 get a free memory buffer from the pool More...
 
void ni_logan_buf_pool_return_buffer (ni_logan_buf_t *buf, ni_logan_buf_pool_t *p_buffer_pool)
 return a used memory buffer to the pool More...
 
ni_logan_buf_tni_logan_buf_pool_allocate_buffer (ni_logan_buf_pool_t *p_buffer_pool, int buffer_size)
 allocate a memory buffer and place it in the pool More...
 
int32_t ni_logan_dec_fme_buffer_pool_initialize (ni_logan_session_context_t *p_ctx, int32_t number_of_buffers, int width, int height, int height_align, int factor)
 decoder frame buffer pool init & free More...
 
void ni_logan_dec_fme_buffer_pool_free (ni_logan_buf_pool_t *p_buffer_pool)
 free decoder frame buffer pool More...
 
void ni_logan_buffer_pool_free (ni_logan_queue_buffer_pool_t *p_buffer_pool)
 free buffer memory pool More...
 
ni_logan_retcode_t ni_logan_find_blk_name (const char *p_dev, char *p_out_buf, int out_buf_len)
 Find NVMe name space block from device name If none is found, assume nvme multi-pathing is disabled and return /dev/nvmeXn1. More...
 
ni_logan_retcode_t ni_logan_timestamp_init (ni_logan_session_context_t *p_ctx, ni_logan_timestamp_table_t **pp_table, const char *name)
 Initialize timestamp handling. More...
 
ni_logan_retcode_t ni_logan_timestamp_done (ni_logan_timestamp_table_t *p_table, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Clean up timestamp handling. More...
 
ni_logan_retcode_t ni_logan_timestamp_register (ni_logan_queue_buffer_pool_t *p_buffer_pool, ni_logan_timestamp_table_t *p_table, int64_t timestamp, uint64_t data_info)
 Register timestamp in timestamp/frame offset table. More...
 
ni_logan_retcode_t ni_logan_timestamp_get (ni_logan_timestamp_table_t *p_table, uint64_t frame_info, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Retrieve timestamp from table based on frame offset info. More...
 
ni_logan_retcode_t ni_logan_timestamp_get_v2 (ni_logan_timestamp_table_t *p_table, uint64_t frame_offset, int64_t *p_timestamp, int32_t threshold, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Retrieve timestamp from table based on frame offset info. More...
 
ni_logan_retcode_t ni_logan_timestamp_get_with_threshold (ni_logan_timestamp_table_t *p_table, uint64_t frame_info, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Retrieve timestamp from table based on frame offset info with respect to threshold. More...
 
void ni_logan_timestamp_scan_cleanup (ni_logan_timestamp_table_t *pts_list, ni_logan_timestamp_table_t *dts_list, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Timestamp queue clean up. More...
 
ni_logan_retcode_t ni_logan_queue_init (ni_logan_session_context_t *p_ctx, ni_logan_queue_t *p_queue, const char *name)
 Initialize xcoder queue. More...
 
ni_logan_retcode_t ni_logan_queue_push (ni_logan_queue_buffer_pool_t *p_buffer_pool, ni_logan_queue_t *p_queue, uint64_t frame_offset, int64_t timestamp)
 Push into xcoder queue. More...
 
ni_logan_retcode_t ni_logan_queue_pop (ni_logan_queue_t *p_queue, uint64_t frame_offset, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Pop from the xcoder queue. More...
 
ni_logan_retcode_t ni_logan_queue_pop_threshold (ni_logan_queue_t *p_queue, uint64_t frame_offset, int64_t *p_timestamp, int32_t threshold, int32_t print, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Pop from the xcoder queue with respect to threshold. More...
 
ni_logan_retcode_t ni_logan_queue_free (ni_logan_queue_t *p_queue, ni_logan_queue_buffer_pool_t *p_buffer_pool)
 Free xcoder queue. More...
 
ni_logan_retcode_t ni_logan_queue_print (ni_logan_queue_t *p_queue)
 Print xcoder queue. More...
 
ni_logan_fifo_buffer_tni_logan_fifo_initialize (uint32_t number_of_buffers, uint32_t size)
 Initialize a fifo buffer. More...
 
void ni_logan_fifo_free (ni_logan_fifo_buffer_t *p_fifo)
 Free a fifo. More...
 
int ni_logan_fifo_is_full (ni_logan_fifo_buffer_t *p_fifo)
 Check if a fifo is full. More...
 
int ni_logan_fifo_is_empty (ni_logan_fifo_buffer_t *p_fifo)
 Check if a fifo is empty. More...
 
uint8_t * ni_logan_fifo_generic_write (ni_logan_fifo_buffer_t *p_fifo)
 Get free buffer to write in the fifo. More...
 
uint8_t * ni_logan_fifo_generic_read (ni_logan_fifo_buffer_t *p_fifo)
 Get first filled buffer to read in the fifo. More...
 
int ni_logan_fifo_return_read (ni_logan_fifo_buffer_t *p_fifo)
 Push back the last read buffer to the fifo. More...
 
int32_t ni_logan_atobool (const char *p_str, bool *b_error)
 convert string to boolean More...
 
int32_t ni_logan_atoi (const char *p_str, bool *b_error)
 convert string to integer More...
 
double ni_logan_atof (const char *p_str, bool *b_error)
 convert string to float More...
 
int32_t ni_logan_parse_name (const char *arg, const char *const *names, bool *b_error)
 string parser More...
 
void threadpool_init (threadpool_t *pool)
 Init the threadpool. More...
 
int threadpool_add_task (threadpool_t *pool, void *(*run)(void *arg), void *arg)
 add task to threadpool More...
 
int threadpool_auto_add_task_thread (threadpool_t *pool, void *(*run)(void *arg), void *arg, int newThread)
 add task to threadpool using newThread control it More...
 
void threadpool_destroy (threadpool_t *pool)
 destroy threadpool More...
 
void * thread_routine (void *arg)
 threadpool control More...
 
LIB_API void ni_logan_get_hw_yuv420p_dim (int width, int height, int bit_depth_factor, int is_h264, int plane_stride[NI_LOGAN_MAX_NUM_DATA_POINTERS], int plane_height[NI_LOGAN_MAX_NUM_DATA_POINTERS])
 Get dimension information of Netint HW YUV420p frame to be sent to encoder for encoding. Caller usually retrieves this info and uses it in the call to ni_logan_encoder_frame_buffer_alloc for buffer allocation. More...
 
LIB_API void ni_logan_copy_hw_yuv420p (uint8_t *p_dst[NI_LOGAN_MAX_NUM_DATA_POINTERS], uint8_t *p_src[NI_LOGAN_MAX_NUM_DATA_POINTERS], int width, int height, int bit_depth_factor, int dst_stride[NI_LOGAN_MAX_NUM_DATA_POINTERS], int dst_height[NI_LOGAN_MAX_NUM_DATA_POINTERS], int src_stride[NI_LOGAN_MAX_NUM_DATA_POINTERS], int src_height[NI_LOGAN_MAX_NUM_DATA_POINTERS])
 Copy YUV data to Netint HW YUV420p frame layout to be sent to encoder for encoding. Data buffer (dst) is usually allocated by ni_logan_encoder_frame_buffer_alloc. More...
 
LIB_API int ni_logan_insert_emulation_prevent_bytes (uint8_t *buf, int size)
 Insert emulation prevention byte(s) as needed into the data buffer. More...
 
LIB_API int ni_logan_remove_emulation_prevent_bytes (uint8_t *buf, int size)
 Remove emulation prevention byte(s) as needed from the data buffer. More...
 
LIB_API void ni_logan_overwrite_specified_pos (uint8_t *buf, int pos, int value)
 overwrite the 32 bits of integer value at bit position pos More...
 
LIB_API uint64_t ni_logan_gettime_ns (void)
 
LIB_API void ni_logan_usleep (int64_t usec)
 
LIB_API int32_t ni_logan_gettimeofday (struct timeval *p_tp, void *p_tzp)
 
int32_t ni_logan_posix_memalign (void **pp_memptr, size_t alignment, size_t size)
 
uint32_t ni_logan_round_up (uint32_t number_to_round, uint32_t multiple)
 

Detailed Description

Exported utility routines definition.


Definition in file ni_util_logan.h.

Macro Definition Documentation

◆ LOGAN_BUFFER_POOL_SZ_PER_CONTEXT

#define LOGAN_BUFFER_POOL_SZ_PER_CONTEXT   300

Definition at line 63 of file ni_util_logan.h.

◆ LOGAN_XCODER_FRAME_OFFSET_DIFF_THRES

#define LOGAN_XCODER_FRAME_OFFSET_DIFF_THRES   100

Definition at line 59 of file ni_util_logan.h.

◆ LOGAN_XCODER_MAX_ENC_PIC_HEIGHT

#define LOGAN_XCODER_MAX_ENC_PIC_HEIGHT   8192

Definition at line 69 of file ni_util_logan.h.

◆ LOGAN_XCODER_MAX_ENC_PIC_WIDTH

#define LOGAN_XCODER_MAX_ENC_PIC_WIDTH   8192

Definition at line 68 of file ni_util_logan.h.

◆ LOGAN_XCODER_MAX_NUM_QUEUE_ENTRIES

#define LOGAN_XCODER_MAX_NUM_QUEUE_ENTRIES   6000

Definition at line 61 of file ni_util_logan.h.

◆ LOGAN_XCODER_MAX_NUM_TEMPORAL_LAYER

#define LOGAN_XCODER_MAX_NUM_TEMPORAL_LAYER   7

Definition at line 62 of file ni_util_logan.h.

◆ LOGAN_XCODER_MIN_ENC_PIC_HEIGHT

#define LOGAN_XCODER_MIN_ENC_PIC_HEIGHT   128

Definition at line 67 of file ni_util_logan.h.

◆ LOGAN_XCODER_MIN_ENC_PIC_WIDTH

#define LOGAN_XCODER_MIN_ENC_PIC_WIDTH   256

Definition at line 66 of file ni_util_logan.h.

◆ MAX_THREADS

#define MAX_THREADS   1000

Definition at line 78 of file ni_util_logan.h.

◆ ni_logan_aligned_free

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

Definition at line 641 of file ni_util_logan.h.

◆ NI_LOGAN_DEC_FRAME_BUF_POOL_SIZE_EXPAND

#define NI_LOGAN_DEC_FRAME_BUF_POOL_SIZE_EXPAND   20

Definition at line 72 of file ni_util_logan.h.

◆ NI_LOGAN_DEC_FRAME_BUF_POOL_SIZE_INIT

#define NI_LOGAN_DEC_FRAME_BUF_POOL_SIZE_INIT   20

Definition at line 71 of file ni_util_logan.h.

◆ NI_LOGAN_INPUT_DATA_BUF_CNT_INIT

#define NI_LOGAN_INPUT_DATA_BUF_CNT_INIT   30

Definition at line 74 of file ni_util_logan.h.

◆ NI_LOGAN_NVME_PREFIX

#define NI_LOGAN_NVME_PREFIX   "nvme"

Definition at line 54 of file ni_util_logan.h.

◆ NI_LOGAN_NVME_PREFIX_SZ

#define NI_LOGAN_NVME_PREFIX_SZ   4

Definition at line 55 of file ni_util_logan.h.

◆ NI_LOGAN_ODD2EVEN

#define NI_LOGAN_ODD2EVEN (   X)    ((X&1)&&(X>31))?(X+1):(X)

Definition at line 80 of file ni_util_logan.h.

◆ NI_LOGAN_VPU_FREQ

#define NI_LOGAN_VPU_FREQ   450

Definition at line 76 of file ni_util_logan.h.

Typedef Documentation

◆ ni_logan_queue_t

◆ ni_logan_timestamp_table_t

◆ ni_task_t

typedef struct ni_task ni_task_t

◆ threadpool_t

typedef struct threadpool threadpool_t

Function Documentation

◆ ni_logan_atobool()

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

convert string to boolean


Parameters

Definition at line 1986 of file ni_util_logan.c.

◆ ni_logan_atof()

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

convert string to float


Parameters

Definition at line 2033 of file ni_util_logan.c.

◆ ni_logan_atoi()

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

convert string to integer


Parameters

Definition at line 2013 of file ni_util_logan.c.

◆ ni_logan_buf_pool_allocate_buffer()

ni_logan_buf_t* ni_logan_buf_pool_allocate_buffer ( ni_logan_buf_pool_t p_buffer_pool,
int  buffer_size 
)

allocate a memory buffer and place it in the pool


Parameters

Definition at line 516 of file ni_util_logan.c.

◆ ni_logan_buf_pool_get_buffer()

ni_logan_buf_t* ni_logan_buf_pool_get_buffer ( ni_logan_buf_pool_t p_buffer_pool)

get a free memory buffer from the pool


Parameters

Definition at line 365 of file ni_util_logan.c.

◆ ni_logan_buf_pool_return_buffer()

void ni_logan_buf_pool_return_buffer ( ni_logan_buf_t buf,
ni_logan_buf_pool_t p_buffer_pool 
)

return a used memory buffer to the pool


Parameters

Definition at line 428 of file ni_util_logan.c.

◆ ni_logan_buffer_pool_free()

void ni_logan_buffer_pool_free ( ni_logan_queue_buffer_pool_t p_buffer_pool)

free buffer memory pool


Parameters

Definition at line 699 of file ni_util_logan.c.

◆ ni_logan_copy_hw_yuv420p()

LIB_API void ni_logan_copy_hw_yuv420p ( uint8_t *  p_dst[NI_LOGAN_MAX_NUM_DATA_POINTERS],
uint8_t *  p_src[NI_LOGAN_MAX_NUM_DATA_POINTERS],
int  frame_width,
int  frame_height,
int  bit_depth_factor,
int  dst_stride[NI_LOGAN_MAX_NUM_DATA_POINTERS],
int  dst_height[NI_LOGAN_MAX_NUM_DATA_POINTERS],
int  src_stride[NI_LOGAN_MAX_NUM_DATA_POINTERS],
int  src_height[NI_LOGAN_MAX_NUM_DATA_POINTERS] 
)

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


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

Definition at line 2397 of file ni_util_logan.c.

◆ ni_logan_dec_fme_buffer_pool_free()

void ni_logan_dec_fme_buffer_pool_free ( ni_logan_buf_pool_t p_buffer_pool)

free decoder frame buffer pool


Parameters

Definition at line 642 of file ni_util_logan.c.

◆ ni_logan_dec_fme_buffer_pool_initialize()

int32_t ni_logan_dec_fme_buffer_pool_initialize ( ni_logan_session_context_t p_ctx,
int32_t  number_of_buffers,
int  width,
int  height,
int  height_align,
int  factor 
)

decoder frame buffer pool init & free


Parameters

Definition at line 560 of file ni_util_logan.c.

◆ ni_logan_fifo_free()

void ni_logan_fifo_free ( ni_logan_fifo_buffer_t p_fifo)

Free a fifo.


Parameters
[in]p_fifoThe pointer of ni_logan_fifo_buffer_t
Returns

Definition at line 1852 of file ni_util_logan.c.

◆ ni_logan_fifo_generic_read()

uint8_t* ni_logan_fifo_generic_read ( ni_logan_fifo_buffer_t p_fifo)

Get first filled buffer to read in the fifo.


Parameters
[in]p_fifoThe pointer of ni_logan_fifo_buffer_t
Returns
On success return the pointer of filled buffer in fifo, On failure return NULL

Definition at line 1932 of file ni_util_logan.c.

◆ ni_logan_fifo_generic_write()

uint8_t* ni_logan_fifo_generic_write ( ni_logan_fifo_buffer_t p_fifo)

Get free buffer to write in the fifo.


Parameters
[in]p_fifoThe pointer of ni_logan_fifo_buffer_t
Returns
On success return the pointer of free buffer, On failure return NULL

Definition at line 1903 of file ni_util_logan.c.

◆ ni_logan_fifo_initialize()

ni_logan_fifo_buffer_t* ni_logan_fifo_initialize ( uint32_t  number_of_buffers,
uint32_t  size 
)

Initialize a fifo buffer.


Parameters
[in]number_of_buffersTotal number of buffers in this fifo
[in]sizeThe size of every buffer
Returns
On success return fifo pointer, On failure return NULL

Definition at line 1812 of file ni_util_logan.c.

◆ ni_logan_fifo_is_empty()

int ni_logan_fifo_is_empty ( ni_logan_fifo_buffer_t p_fifo)

Check if a fifo is empty.


Parameters
[in]p_fifoThe pointer of ni_logan_fifo_buffer_t
Returns
1 is empty; 0 is not empty

Definition at line 1890 of file ni_util_logan.c.

◆ ni_logan_fifo_is_full()

int ni_logan_fifo_is_full ( ni_logan_fifo_buffer_t p_fifo)

Check if a fifo is full.


Parameters
[in]p_fifoThe pointer of ni_logan_fifo_buffer_t
Returns
1 is full; 0 is not full

Definition at line 1878 of file ni_util_logan.c.

◆ ni_logan_fifo_return_read()

int ni_logan_fifo_return_read ( ni_logan_fifo_buffer_t p_fifo)

Push back the last read buffer to the fifo.


Parameters
[in]p_fifoThe pointer of ni_logan_fifo_buffer_t
Returns
On success return 0, On failure return -1

Definition at line 1960 of file ni_util_logan.c.

◆ ni_logan_find_blk_name()

ni_logan_retcode_t ni_logan_find_blk_name ( const char *  p_dev,
char *  p_out_buf,
int  out_buf_len 
)

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


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

Parameters
[in]p_devDevice name represented as c string. ex: "/dev/nvme0"
[out]p_out_bufOutput buffer to put NVMe name space block. Must be at least length 21
[in]out_buf_lenLength of memory allocated to p_out_buf
Returns
On success returns NI_LOGAN_RETCODE_SUCCESS On failure returns NI_LOGAN_RETCODE_FAILURE

Definition at line 1060 of file ni_util_logan.c.

◆ ni_logan_get_hw_yuv420p_dim()

LIB_API void ni_logan_get_hw_yuv420p_dim ( int  width,
int  height,
int  bit_depth_factor,
int  is_h264,
int  plane_stride[NI_LOGAN_MAX_NUM_DATA_POINTERS],
int  plane_height[NI_LOGAN_MAX_NUM_DATA_POINTERS] 
)

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


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

Definition at line 2352 of file ni_util_logan.c.

◆ ni_logan_gettime_ns()

LIB_API uint64_t ni_logan_gettime_ns ( void  )

Definition at line 81 of file ni_util_logan.c.

◆ ni_logan_gettimeofday()

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

timezone information is stored outside the kernel so tzp isn't used anymore.

Note: this function is not for Win32 high precision timing purpose. See elapsed_time().

Definition at line 56 of file ni_util_logan.c.

◆ ni_logan_insert_emulation_prevent_bytes()

LIB_API int ni_logan_insert_emulation_prevent_bytes ( uint8_t *  buf,
int  size 
)

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


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

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

Definition at line 2511 of file ni_util_logan.c.

◆ ni_logan_overwrite_specified_pos()

LIB_API void ni_logan_overwrite_specified_pos ( uint8_t *  buf,
int  pos,
int  value 
)

overwrite the 32 bits of integer value at bit position pos


Parameters
bufdata buffer to be worked on pos the position to be modified value The value that needs to be modified to
Returns
void

Note: caller MUST ensure that the pos and value won't go beyond the memory boundary of data. otherwise memory corruption would occur.

Definition at line 2616 of file ni_util_logan.c.

◆ ni_logan_parse_name()

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

string parser


Parameters

Definition at line 2053 of file ni_util_logan.c.

◆ ni_logan_posix_memalign()

int32_t ni_logan_posix_memalign ( void **  pp_memptr,
size_t  alignment,
size_t  size 
)

Definition at line 122 of file ni_util_logan.c.

◆ ni_logan_queue_free()

ni_logan_retcode_t ni_logan_queue_free ( ni_logan_queue_t p_queue,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Free xcoder queue.


Parameters

Definition at line 1718 of file ni_util_logan.c.

◆ ni_logan_queue_init()

ni_logan_retcode_t ni_logan_queue_init ( ni_logan_session_context_t p_ctx,
ni_logan_queue_t p_queue,
const char *  name 
)

Initialize xcoder queue.


Parameters

Definition at line 1396 of file ni_util_logan.c.

◆ ni_logan_queue_pop()

ni_logan_retcode_t ni_logan_queue_pop ( ni_logan_queue_t p_queue,
uint64_t  frame_info,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Pop from the xcoder queue.


Parameters

If only one entry, retrieve timestamp without checking

Definition at line 1496 of file ni_util_logan.c.

◆ ni_logan_queue_pop_threshold()

ni_logan_retcode_t ni_logan_queue_pop_threshold ( ni_logan_queue_t p_queue,
uint64_t  frame_offset,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Pop from the xcoder queue with respect to threshold.


Parameters

If only one entry, retrieve timestamp without checking

Definition at line 1614 of file ni_util_logan.c.

◆ ni_logan_queue_print()

ni_logan_retcode_t ni_logan_queue_print ( ni_logan_queue_t p_queue)

Print xcoder queue.


Parameters

Definition at line 1758 of file ni_util_logan.c.

◆ ni_logan_queue_push()

ni_logan_retcode_t ni_logan_queue_push ( ni_logan_queue_buffer_pool_t p_buffer_pool,
ni_logan_queue_t p_queue,
uint64_t  frame_info,
int64_t  timestamp 
)

Push into xcoder queue.


Parameters

Definition at line 1426 of file ni_util_logan.c.

◆ ni_logan_remove_emulation_prevent_bytes()

LIB_API int ni_logan_remove_emulation_prevent_bytes ( uint8_t *  buf,
int  size 
)

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


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

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

Definition at line 2564 of file ni_util_logan.c.

◆ ni_logan_round_up()

uint32_t ni_logan_round_up ( uint32_t  number_to_round,
uint32_t  multiple 
)

Definition at line 104 of file ni_util_logan.c.

◆ ni_logan_timestamp_done()

ni_logan_retcode_t ni_logan_timestamp_done ( ni_logan_timestamp_table_t p_table,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Clean up timestamp handling.


Parameters

Definition at line 1223 of file ni_util_logan.c.

◆ ni_logan_timestamp_get()

ni_logan_retcode_t ni_logan_timestamp_get ( ni_logan_timestamp_table_t p_table,
uint64_t  frame_info,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Retrieve timestamp from table based on frame offset info.


Parameters

Definition at line 1277 of file ni_util_logan.c.

◆ ni_logan_timestamp_get_v2()

ni_logan_retcode_t ni_logan_timestamp_get_v2 ( ni_logan_timestamp_table_t p_table,
uint64_t  frame_offset,
int64_t *  p_timestamp,
int32_t  threshold,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Retrieve timestamp from table based on frame offset info.


Parameters

Definition at line 1358 of file ni_util_logan.c.

◆ ni_logan_timestamp_get_with_threshold()

ni_logan_retcode_t ni_logan_timestamp_get_with_threshold ( ni_logan_timestamp_table_t p_table,
uint64_t  frame_info,
int64_t *  p_timestamp,
int32_t  threshold,
int32_t  print,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Retrieve timestamp from table based on frame offset info with respect to threshold.


Parameters

Definition at line 1301 of file ni_util_logan.c.

◆ ni_logan_timestamp_init()

ni_logan_retcode_t ni_logan_timestamp_init ( ni_logan_session_context_t p_ctx,
ni_logan_timestamp_table_t **  pp_table,
const char *  name 
)

Initialize timestamp handling.


Parameters

Definition at line 1182 of file ni_util_logan.c.

◆ ni_logan_timestamp_register()

ni_logan_retcode_t ni_logan_timestamp_register ( ni_logan_queue_buffer_pool_t p_buffer_pool,
ni_logan_timestamp_table_t p_table,
int64_t  timestamp,
uint64_t  data_info 
)

Register timestamp in timestamp/frame offset table.


Parameters

Definition at line 1249 of file ni_util_logan.c.

◆ ni_logan_timestamp_scan_cleanup()

void ni_logan_timestamp_scan_cleanup ( ni_logan_timestamp_table_t pts_list,
ni_logan_timestamp_table_t dts_list,
ni_logan_queue_buffer_pool_t p_buffer_pool 
)

Timestamp queue clean up.


Parameters

Definition at line 1311 of file ni_util_logan.c.

◆ ni_logan_usleep()

LIB_API void ni_logan_usleep ( int64_t  usec)

Definition at line 295 of file ni_util_logan.c.

◆ thread_routine()

void* thread_routine ( void *  arg)

threadpool control


Parameters
[in]params
Returns
NULL

Definition at line 2076 of file ni_util_logan.c.

◆ threadpool_add_task()

int threadpool_add_task ( threadpool_t pool,
void *(*)(void *arg)  run,
void *  arg 
)

add task to threadpool


Parameters
[in]poolthreadpool address
[in]runrun function
[in]argrun function params
Returns
0 success <0 failed

Definition at line 2241 of file ni_util_logan.c.

◆ threadpool_auto_add_task_thread()

int threadpool_auto_add_task_thread ( threadpool_t pool,
void *(*)(void *arg)  run,
void *  arg,
int  newThread 
)

add task to threadpool using newThread control it


Parameters
[in]poolthreadpool address
[in]runrun function
[in]argrun function params
[in]newThread1: create a new thread. 0: do not create a new thread.
Returns
0 success <0 failed

Definition at line 2159 of file ni_util_logan.c.

◆ threadpool_destroy()

void threadpool_destroy ( threadpool_t pool)

destroy threadpool


Parameters
[in]poolthreadpool address
Returns
NULL

Definition at line 2303 of file ni_util_logan.c.

◆ threadpool_init()

void threadpool_init ( threadpool_t pool)

Init the threadpool.


Parameters
[in]poolthreadpool address
Returns
NULL

Definition at line 2133 of file ni_util_logan.c.