29#if __linux__ || __APPLE__
32#include <linux/types.h>
71#define strcasecmp _stricmp
92#if __linux__ || __APPLE__
93static struct stat g_nvme_stat = { 0 };
95static int close_fd_zero_atexit = 0;
97static void close_fd_zero(
void)
119 "ERROR: %s() Failed to allocate memory for session context\n",
148#ifdef MEASURE_LATENCY
172 int framerate_num = 0;
173 int framerate_denom = 0;
212 "ERROR %s(): init xcoder_low_delay_sync_mutex fail return\n",
219 "ERROR %s(): init xcoder_low_delay_sync_cond fail return\n",
250 p_ctx->debug_write_ptr = NULL;
251 p_ctx->debug_write_index_ptr = NULL;
252 p_ctx->debug_write_sent_size = 0;
255#ifdef MEASURE_LATENCY
289 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
295 event_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
296 if (event_handle == NULL)
300 return NI_INVALID_EVENT_HANDLE;
304 return NI_INVALID_EVENT_HANDLE;
316 if ( NI_INVALID_DEVICE_HANDLE == event_handle )
329 retval = CloseHandle(event_handle);
343 err = close(event_handle);
346 char error_message[100] = {
'\0'};
347 char unknown_error_message[20] = {
'\0'};
348 ni_sprintf(error_message, 100,
"ERROR: %s(): ", __func__);
352 ni_strcat(error_message, 100,
"EBADF\n");
355 ni_strcat(error_message, 100,
"EINTR\n");
361 ni_sprintf(unknown_error_message, 20,
"Unknown error %d\n", err);
362 ni_strcat(error_message, 100, unknown_error_message);
370#ifndef DEPRECATION_AS_ERROR
385 HANDLE device_handle;
390 return NI_INVALID_DEVICE_HANDLE;
400 device_handle = CreateFileA(p_dev, GENERIC_READ | GENERIC_WRITE,
401 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
402 OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
405 if (INVALID_HANDLE_VALUE == device_handle)
407 retval = GetLastError();
414 return device_handle;
417 ni_device_handle_t fd = NI_INVALID_DEVICE_HANDLE;
428 *p_max_io_size_out = ni_get_kernel_max_io_size(p_dev);
430 *p_max_io_size_out = MAX_IO_TRANSFER_SIZE;
439 fd = open(p_dev, O_RDWR | O_SYNC | O_DIRECT);
442 fd = open(p_dev, O_RDWR | O_SYNC);
452 fd = NI_INVALID_DEVICE_HANDLE;
465 if(close_fd_zero_atexit == 0)
467 close_fd_zero_atexit = 1;
468 (void)atexit(close_fd_zero);
472 ni_log(
NI_LOG_ERROR,
"libxcoder has held the fd=0, but open fd=0 again, maybe fd=0 was closed accidently.");
474 fd = NI_INVALID_DEVICE_HANDLE;
479 retval = fcntl(fd, F_NOCACHE, 1);
485 fd = NI_INVALID_DEVICE_HANDLE;
490 retval = fstat(fd, &g_nvme_stat);
496 fd = NI_INVALID_DEVICE_HANDLE;
500 if (!S_ISCHR(g_nvme_stat.st_mode) && !S_ISBLK(g_nvme_stat.st_mode))
506 fd = NI_INVALID_DEVICE_HANDLE;
532 HANDLE device_handle;
533 DWORD dwDesiredAccess = 0;
538 return NI_INVALID_DEVICE_HANDLE;
546 dwDesiredAccess = GENERIC_READ;
550 dwDesiredAccess = GENERIC_WRITE;
555 dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
559 device_handle = CreateFileA(p_dev, dwDesiredAccess,
560 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
561 OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
564 if (INVALID_HANDLE_VALUE == device_handle)
566 retval = GetLastError();
573 return device_handle;
576 ni_device_handle_t fd = NI_INVALID_DEVICE_HANDLE;
593 open_flags = O_RDONLY;
597 open_flags = O_WRONLY;
606 open_flags |= O_SYNC;
608 open_flags |= O_DIRECT;
613 fd = open(p_dev, open_flags);
619 fd = NI_INVALID_DEVICE_HANDLE;
625 retval = fcntl(fd, F_NOCACHE, 1);
631 fd = NI_INVALID_DEVICE_HANDLE;
636 retval = fstat(fd, &g_nvme_stat);
642 fd = NI_INVALID_DEVICE_HANDLE;
646 if (!S_ISCHR(g_nvme_stat.st_mode) && !S_ISBLK(g_nvme_stat.st_mode))
652 fd = NI_INVALID_DEVICE_HANDLE;
674 if ( NI_INVALID_DEVICE_HANDLE == device_handle )
681 if(device_handle == 0)
698 retval = CloseHandle(device_handle);
702 "ERROR: %s(): closing device device_handle %p failed, error: %d\n",
713 err = close(device_handle);
716 char error_message[100] = {
'\0'};
717 char unknown_error_message[20] = {
'\0'};
718 ni_sprintf(error_message, 100,
"ERROR: %s(): ", __func__);
722 ni_strcat(error_message, 100,
"EBADF\n");
725 ni_strcat(error_message, 100,
"EINTR\n");
731 ni_sprintf(unknown_error_message, 20,
"Unknown error %d\n", err);
732 ni_strcat(error_message, 100, unknown_error_message);
743#ifndef DEPRECATION_AS_ERROR
761 void * p_buffer = NULL;
763 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
767 if ( (NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_cap) )
823 void * p_buffer = NULL;
825 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
829 if ( (NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_cap) )
896 bool use_model_load =
true;
900 uint32_t num_sw_instances = 0;
901 uint32_t pixel_load = 0xFFFFFFFFU;
902 int user_handles =
false;
903 ni_lock_handle_t lock = NI_INVALID_LOCK_HANDLE;
904 ni_device_handle_t handle = NI_INVALID_DEVICE_HANDLE;
905 ni_device_handle_t handle1 = NI_INVALID_DEVICE_HANDLE;
918 if (!IsUserAnAdmin())
929 if (!p_session_context)
938 "device_type %d, session id %d\n",
990 for (i = 0; i < 120; i++)
999 "%s: device type %d hw_id %d blk_dev_name: %s dev_xcoder_name: %s.\n",
1019 "%s: block device name %s type %d guid %d is to "
1020 "override passed in guid %d\n",
1021 __func__, p_ctx->
blk_dev_name, device_type, tmp_guid_id,
1023 p_ctx->
hw_id = tmp_guid_id;
1034 if ((handle1 == NI_INVALID_DEVICE_HANDLE) && (handle == NI_INVALID_DEVICE_HANDLE))
1036 if (p_ctx->
hw_id >=0)
1039 if (rsrc_ctx == NULL)
1059 user_handles =
true;
1071 if (handle != NI_INVALID_DEVICE_HANDLE)
1073 if (handle == NI_INVALID_DEVICE_HANDLE || handle1 == NI_INVALID_DEVICE_HANDLE)
1080 user_handles =
true;
1099 use_model_load =
false;
1138 for (i = 0; i < num_coders; i++)
1143 if (p_device_context == NULL)
1146 "ERROR: %s() ni_rsrc_get_device_context() failed\n",
1157 if (NI_INVALID_DEVICE_HANDLE == p_session_context->
device_handle)
1166 if (NI_INVALID_DEVICE_HANDLE != p_session_context->
device_handle)
1174 g_device_type_str[query_type],
1201 curr_load = p_dev_info->
load;
1204 if (i == 0 || curr_load < least_load ||
1205 (curr_load == least_load &&
1209 least_load = curr_load;
1221 NI_INVALID_DEVICE_HANDLE)
1235 p_ctx->
hw_id = guid;
1243 if (handle != NI_INVALID_DEVICE_HANDLE)
1245 if (handle == NI_INVALID_DEVICE_HANDLE || handle1 == NI_INVALID_DEVICE_HANDLE)
1259 p_ctx->
hw_id = guid;
1267 else if((handle1 == NI_INVALID_DEVICE_HANDLE) || (handle == NI_INVALID_DEVICE_HANDLE))
1275 user_handles =
true;
1279 "Finish open the session dev:%s guid:%d handle:%p handle1:%p\n",
1286 if (p_device_context == NULL)
1289 "ERROR: %s() ni_rsrc_get_device_context() failed\n",
1291 if (user_handles !=
true)
1317 "ERROR: %s() cannot retrieve DDR configuration\n",
1319 if (user_handles !=
true)
1333 "ERROR: %s() keep_alive_timeout was 0, should be between 1-100. "
1334 "Setting to default of %u\n",
1338 switch (device_type)
1343 if (user_handles !=
true)
1366 if (p_enc_params && p_enc_params->
hwframes &&
1382 if (user_handles !=
true)
1400 if (user_handles !=
true)
1418 if (user_handles !=
true)
1436 if (user_handles !=
true)
1453 if (user_handles !=
true)
1463 __func__, device_type);
1529 p_device_pool = NULL;
1588 "join keep alive thread fail! : sid %u ret %d\n",
1599 switch (device_type)
1630 __func__, device_type);
1705 switch (device_type)
1721 __func__, device_type);
1763 0 == memcmp(p_ctx->
p_hdr_buf, hdr_data, hdr_size))
1775 memcpy(p_ctx->
p_hdr_buf, hdr_data, hdr_size);
1852 if (!p_ctx || !p_data)
1868 "ERROR: %s() keep alive thread has been closed, "
1869 "hw:%d, session:%d\n",
1886 switch (device_type)
1907 __func__, device_type);
1952 if ((!p_ctx) || (!p_data))
1969 "ERROR: %s() keep alive thread has been closed, "
1970 "hw:%d, session:%d\n",
1987 switch (device_type)
1991 int seq_change_read_count = 0;
2001 uint32_t aligned_width;
2011 if (0 == retval && seq_change_read_count)
2014 "%s (decoder): seq change NO data, next time.\n", __func__);
2020 else if (retval < 0)
2036 "%s (decoder): resolution change, frame size %ux%u -> %ux%u, "
2037 "width %u bit %d, pix_fromat_changed %d, actual_video_width %d, continue read ...\n",
2046 seq_change_read_count++;
2069 __func__, device_type);
2117 __func__, device_type);
2157 __func__, device_type);
2197 __func__, device_type);
2218 uint32_t namespace_num, uint32_t sriov_index)
2221 __func__, namespace_num, sriov_index);
2242 __func__, device_handle, mode);
2261 ni_device_handle_t device_handle_t,
2262 uint32_t over_provision)
2265 float f_over_provision = 0;
2266 memcpy(&f_over_provision, &over_provision,
sizeof(int32_t));
2268 __func__, device_handle, device_handle_t, f_over_provision);
2294 ni_device_handle_t device_handle_t,
2298 float f_allowance = 0;
2299 memcpy(&f_allowance, &allowance,
sizeof(int32_t));
2301 __func__, device_handle, device_handle_t, f_allowance);
2338 int video_height,
int alignment,
2339 int metadata_flag,
int factor,
2340 int hw_frame_count,
int is_planar)
2342 void* p_buffer = NULL;
2343 int metadata_size = 0;
2345 int width_aligned = video_width;
2346 int height_aligned = video_height;
2348 if ((!p_frame) || ((factor!=1) && (factor!=2) && (factor !=4))
2353 "factor %d, video_width %d, video_height %d\n",
2354 __func__, factor, video_width, video_height);
2369 width_aligned = ((((video_width * factor) + 127) / 128) * 128) / factor;
2370 height_aligned = ((video_height + 1) / 2) * 2;
2375 height_aligned = ((video_height + 1) / 2) * 2;
2383 width_aligned = ((video_width + 31) / 32) * 32;
2384 height_aligned = ((video_height + 7) / 8) * 8;
2387 height_aligned = ((video_height + 15) / 16) * 16;
2391 int luma_size = width_aligned * height_aligned * factor;
2396 int chroma_width_aligned = ((((video_width / 2 * factor) + 127) / 128) * 128) / factor;
2400 chroma_width_aligned =
2401 ((((video_width * factor) + 127) / 128) * 128) / factor;
2403 int chroma_height_aligned = height_aligned / 2;
2404 chroma_b_size = chroma_r_size = chroma_width_aligned * chroma_height_aligned * factor;
2412 chroma_b_size = chroma_r_size = 0;
2418 chroma_b_size = luma_size / 4;
2419 chroma_r_size = chroma_b_size;
2424 if (hw_frame_count == 0)
2425 buffer_size = luma_size + chroma_b_size + chroma_r_size + metadata_size;
2439 "%s: free current p_frame, p_frame->buffer_size=%u\n", __func__,
2477 p_frame->
data_len[1] = chroma_b_size;
2478 p_frame->
data_len[2] = chroma_r_size;
2497 ni_log(
NI_LOG_DEBUG,
"ni_frame_buffer_alloc: p_buffer %p p_data [%p %p %p %p] data_len [%d %d %d %d] video_width %d video_height %d\n", p_frame->
p_buffer, p_frame->
p_data[0], p_frame->
p_data[1], p_frame->
p_data[2], p_frame->
p_data[3], p_frame->
data_len[0], p_frame->
data_len[1], p_frame->
data_len[2], p_frame->
data_len[3], p_frame->
video_width, p_frame->
video_height);
2536 int video_height,
int alignment,
2537 int metadata_flag,
int factor,
2538 int hw_frame_count,
int is_planar,
2541 (void)hw_frame_count;
2547 if (((factor!=1) && (factor!=2) && (factor !=4))
2552 "factor %d, video_width %d, video_height %d\n",
2553 __func__, factor, video_width, video_height);
2580 dst_stride, height_aligned);
2588 video_height, dst_stride, alignment,
2610 int video_height,
int pixel_format)
2612 void *p_buffer = NULL;
2614 int width_aligned = video_width;
2615 int height_aligned = video_height;
2623 (video_height <= 0))
2626 "ERROR: %s passed parameters are null or not supported, "
2627 "video_width %d, video_height %d\n",
2628 __func__, video_width, video_height);
2632 switch (pixel_format)
2638 luma_size = width_aligned * height_aligned;
2641 chroma_r_size = chroma_b_size;
2647 luma_size = width_aligned * height_aligned * 2;
2649 chroma_r_size = chroma_b_size;
2655 luma_size = width_aligned * height_aligned;
2656 chroma_b_size = width_aligned * height_aligned / 2;
2663 luma_size = width_aligned * height_aligned * 2;
2664 chroma_b_size = width_aligned * height_aligned;
2669 height_aligned = video_height;
2671 luma_size = width_aligned * height_aligned;
2672 chroma_b_size = luma_size;
2678 height_aligned = video_height;
2680 luma_size = width_aligned * height_aligned * 2;
2690 height_aligned = video_height;
2692 luma_size = width_aligned * height_aligned * 4;
2698 height_aligned = video_height;
2700 luma_size = width_aligned * height_aligned;
2701 chroma_b_size = luma_size;
2702 chroma_r_size = luma_size;
2710 buffer_size = luma_size + chroma_b_size + chroma_r_size;
2716 __func__, luma_size, chroma_b_size, chroma_r_size, buffer_size);
2722 "%s: free current p_frame, p_frame->buffer_size=%u\n", __func__,
2734 "ERROR %d: %s() Cannot allocate p_frame buffer.\n",
NI_ERRNO,
2752 p_frame->
data_len[1] = chroma_b_size;
2753 p_frame->
data_len[2] = chroma_r_size;
2804 int video_width,
int video_height,
2805 int alignment,
int factor,
2813 if ((!p_frame) || ((factor!=1) && (factor!=2))
2818 "factor %d, video_width %d, video_height %d\n",
2819 __func__, factor, video_width, video_height);
2825 width_aligned = ((((video_width * factor) + 127) / 128) * 128) / factor;
2826 height_aligned = video_height;
2830 width_aligned = ((video_width + 31) / 32) * 32;
2831 height_aligned = ((video_height + 7) / 8) * 8;
2834 height_aligned = ((video_height + 15) / 16) * 16;
2839 width_aligned, height_aligned, video_width, video_height);
2841 int luma_size = width_aligned * height_aligned * factor;
2846 int chroma_width_aligned = ((((video_width / 2 * factor) + 127) / 128) * 128) / factor;
2849 chroma_width_aligned =
2850 ((((video_width * factor) + 127) / 128) * 128) / factor;
2852 int chroma_height_aligned = height_aligned / 2;
2853 chroma_b_size = chroma_r_size = chroma_width_aligned * chroma_height_aligned * factor;
2861 chroma_b_size = luma_size / 4;
2862 chroma_r_size = chroma_b_size;
2864 int buffer_size = luma_size + chroma_b_size + chroma_r_size +
2906 p_frame->
p_data[2] = p_frame->
p_data[1] + chroma_b_size;
2907 p_frame->
p_data[3] = p_frame->
p_data[2] + chroma_r_size;
2915 p_frame->
data_len[1] = chroma_b_size;
2916 p_frame->
data_len[2] = chroma_r_size;
2951 int width,
int height,
2952 const int linesize[],
2956 if ((!p_enc_ctx) || (!p_enc_params) || (!linesize)
2962 "p_enc_ctx %p, p_enc_params %p, linesize %p, "
2963 "width %d, height %d linesize[0] %d\n",
2964 __func__, p_enc_ctx, p_enc_params, linesize,
2965 width, height, (linesize) ? linesize[0] : 0);
2974 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s: not supported on device with FW API version < 6.Q\n", __func__);
2981 bool isrgba =
false;
2982 bool isplanar =
false;
2983 bool issemiplanar =
false;
2993 issemiplanar =
true;
3012 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s: semi-planar not supported on device with FW API version < 6.q\n", __func__);
3021 bool ishwframe = (p_enc_params->
hwframes) ?
true :
false;
3024 "p_enc_ctx %p, p_enc_params %p, linesize %p, "
3025 "width %d, height %d, linesize[0] %d linesize[1] %d\n",
3026 __func__, isrgba, issemiplanar, ishwframe, p_enc_ctx, p_enc_params, linesize,
3027 width, height, linesize[0], linesize[1]);
3029 if (linesize[0] <= max_linesize &&
3030 linesize[0] % 2 == 0 &&
3031 linesize[1] % 2 == 0 &&
3038 (!isplanar || linesize[2] == linesize[1])
3056 "luma_linesize %d, chroma_linesize %d, "
3057 "linesize[0] %d, linesize[1] %d\n",
3059 linesize[0], linesize[1]);
3066 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"%s: linesize changed from %u %u to %u %u - resolution change?\n", __func__,
3068 linesize[0], linesize[1]);
3102 const int linesize[],
const uint8_t *data[],
3103 int buf_size0,
int buf_size1,
int buf_size2,
3104 uint8_t *buf_data0, uint8_t *buf_data1, uint8_t *buf_data2)
3108 if (!p_frame || !p_enc_ctx || !data || !linesize)
3110 ni_log(
NI_LOG_ERROR,
"ERROR: %s: null parameters: p_frame=%p, p_enc_ctx=%p, linesize=%p, data=%p\n",
3111 __func__, p_frame, p_enc_ctx, linesize, data);
3123 const uint8_t *buf_data[3] = { buf_data0, buf_data1, buf_data2 };
3124 const int buf_size[3] = { buf_size0, buf_size1, buf_size2 };
3125 const uint8_t *end_used, *end_alloc;
3132 const int num_planes = (buf_size[2] != 0) ? 3 : (buf_size[1] != 0) ? 2 : 1;
3137 for (i = 0; i < num_planes; i++)
3139 if (!data[i] || !buf_data[i] || buf_size[i] <= 0)
3141 ni_log(
NI_LOG_ERROR,
"ERROR: %s: invalid parameter %d: data=%p, buf_data=%p, size=%d\n",
3142 __func__, i, data[i], buf_data[i], buf_size[i]);
3146 int plane_height = video_height >> (i > 0 ? 1 : 0);
3155 end_used = data[2] + (ptrdiff_t)linesize[2] * (video_height >> 1);
3160 end_used = data[1] + (ptrdiff_t)linesize[1] * (video_height >> 1);
3164 ni_log(
NI_LOG_ERROR,
"ERROR: %s: Single-plane pixel format not supported\n", __func__);
3171 end_used = data[i] + (ptrdiff_t)linesize[i] * plane_height;
3175 end_alloc = buf_data[i] + buf_size[i];
3178 int plane_offset = (int)(end_used - end_alloc);
3179 plane_offset = (plane_offset > 0) ? plane_offset : 0;
3185 offset = plane_offset * 2;
3186 ((uint8_t **)data)[0] -= offset;
3187 ((uint8_t **)data)[1] -= plane_offset;
3188 ((uint8_t **)data)[2] -= plane_offset;
3192 offset = plane_offset;
3193 ((uint8_t **)data)[0] -= plane_offset;
3194 ((uint8_t **)data)[1] -= plane_offset;
3199 ((uint8_t **)data)[i] -= plane_offset;
3202 offset = plane_offset;
3235 int video_width,
int video_height,
3236 const int linesize[],
const uint8_t *data[],
3241 if ((!p_frame) || (!linesize) || (!data))
3244 "p_frame %p, linesize %p, data %p\n",
3245 __func__, p_frame, linesize, data);
3250 "%s: resolution=%dx%d linesize=%d/%d/%d "
3251 "data=%p %p %p extra_len=%d\n",
3252 __func__, video_width, video_height,
3253 linesize[0], linesize[1], linesize[2],
3254 data[0], data[1], data[2], extra_len);
3262 p_frame->
p_buffer = (uint8_t *)data[0];
3263 p_frame->
p_data[0] = (uint8_t *)data[0];
3264 p_frame->
p_data[1] = (uint8_t *)data[1];
3265 p_frame->
p_data[2] = (uint8_t *)data[2];
3267 int luma_size = linesize[0] * video_height;
3268 int chroma_b_size = 0;
3269 int chroma_r_size = 0;
3273 chroma_b_size = linesize[1] * (video_height / 2);
3276 chroma_r_size = linesize[2] * (video_height / 2);
3280 uint32_t start_offset;
3281 uint32_t total_start_len = 0;
3287 if ((data[1] && (data[0] + luma_size != data[1]))
3288 || (data[2] && (data[1] + chroma_b_size != data[2])))
3299 total_start_len += p_frame->
start_len[i];
3307 total_start_len = p_frame->
start_len[0];
3320 if (total_start_len)
3332 int start_buffer_offset = 0;
3339 start_buffer_offset += (int)p_frame->
start_len[i];
3345 p_frame->
data_len[1] = chroma_b_size;
3346 p_frame->
data_len[2] = chroma_r_size;
3353 "%s: success: p_metadata_buffer %p metadata_buffer_size %u "
3354 "p_start_buffer %p start_buffer_size %u data_len %u %u %u\n",
3384 int width,
int height,
3385 const int linesize[],
int pixel_format)
3388 if ((!p_upl_ctx) || (!linesize)
3394 "p_enc_ctx %p, linesize %p, "
3395 "width %d, height %d linesize[0] %d\n",
3396 __func__, p_upl_ctx, linesize,
3397 width, height, (linesize) ? linesize[0] : 0);
3406 ni_log2(p_upl_ctx,
NI_LOG_DEBUG,
"%s: not supported on device with FW API version < 6.S\n", __func__);
3416 "p_upl_ctx %p, linesize %p, "
3417 "width %d, height %d, linesize[0] %d\n",
3418 __func__, pixel_format, p_upl_ctx, linesize,
3419 width, height, linesize[0]);
3421 int bit_depth_factor;
3422 bool isrgba =
false;
3423 bool isplanar =
false;
3424 bool issemiplanar =
false;
3426 switch (pixel_format)
3430 bit_depth_factor = 1;
3434 bit_depth_factor = 2;
3437 issemiplanar =
true;
3438 bit_depth_factor = 1;
3441 issemiplanar =
true;
3442 bit_depth_factor = 2;
3449 bit_depth_factor = 4;
3462 ni_log2(p_upl_ctx,
NI_LOG_DEBUG,
"%s: semi-planar not supported on device with FW API version < 6.q\n", __func__);
3467 if (linesize[0] <= max_linesize &&
3476 linesize[2] == linesize[1])
3482 linesize[1] == linesize[0])
3517 int video_height,
int linesize[],
3518 int alignment,
int extra_len,
3519 bool alignment_2pass_wa)
3521 void* p_buffer = NULL;
3530 "p_frame %p, linesize %p, video_width %d, video_height %d\n",
3531 __func__, p_frame, linesize, video_width, video_height);
3537 height_aligned = ((video_height + 1) / 2) * 2;
3540 height_aligned = ((video_height + 7) / 8) * 8;
3544 height_aligned = ((video_height + 15) / 16) * 16;
3553 "%s: aligned=%dx%d org=%dx%d linesize=%d/%d/%d "
3555 __func__, video_width, height_aligned, video_width, video_height,
3556 linesize[0], linesize[1], linesize[2], extra_len);
3558 int luma_size = linesize[0] * height_aligned;
3563 chroma_b_size = chroma_r_size = linesize[1] * (height_aligned / 2);
3564 if (alignment_2pass_wa)
3567 chroma_r_size = linesize[1] * (((height_aligned + 31) / 32) * 32) / 2;
3573 chroma_b_size = luma_size / 4;
3574 chroma_r_size = luma_size / 4;
3578 int buffer_size = luma_size + chroma_b_size + chroma_r_size + extra_len;
3586 "%s: free current p_frame, "
3587 "p_frame->buffer_size=%u\n",
3604 memset(p_buffer, 0, buffer_size);
3615 p_frame->
p_data[1] = (uint8_t*)p_frame->
p_data[0] + luma_size;
3616 p_frame->
p_data[2] = (uint8_t*)p_frame->
p_data[1] + chroma_b_size;
3624 p_frame->
data_len[1] = chroma_b_size;
3625 p_frame->
data_len[2] = chroma_r_size;
3632 "%s: success: p_frame->p_buffer %p "
3633 "p_frame->buffer_size=%u\n",
3757 int video_height,
int linesize[],
3758 int extra_len,
bool alignment_2pass_wa)
3760 void* p_buffer = NULL;
3769 "p_frame %p, linesize %p, video_width %d, video_height %d\n",
3770 __func__, p_frame, linesize, video_width, video_height);
3774 height_aligned = ((video_height + 1) / 2) * 2;
3782 "%s: aligned=%dx%d org=%dx%d linesize=%d/%d/%d extra_len=%d\n",
3783 __func__, video_width, height_aligned, video_width, video_height,
3784 linesize[0], linesize[1], linesize[2], extra_len);
3786 int luma_size = linesize[0] * height_aligned;
3787 int chroma_br_size = luma_size / 2;
3789 if (alignment_2pass_wa)
3792 chroma_br_size = linesize[0] * ((((height_aligned + 31) / 32) * 32) / 2);
3796 int buffer_size = luma_size + chroma_br_size + extra_len;
3820 memset(p_buffer, 0, buffer_size);
3832 p_frame->
p_data[1] = (uint8_t*)p_frame->
p_data[0] + luma_size;
3833 p_frame->
p_data[2] = (uint8_t*)p_frame->
p_data[1] + chroma_br_size;
3840 p_frame->
data_len[1] = chroma_br_size;
3891 int video_width,
int video_height,
3892 int linesize[],
int alignment,
3894 bool alignment_2pass_wa)
3899 linesize, alignment, extra_len,
3900 alignment_2pass_wa);
3905 linesize, extra_len,
3906 alignment_2pass_wa);
3948 "%s: close p_surface->dma_buf_fd %d "
3949 "ui16FrameIdx %u\n",
3965 p_frame->
p_data[i] = NULL;
4034 p_frame->
p_data[i] = NULL;
4074 void* p_buffer = NULL;
4075 int metadata_size = 0;
4082 packet_size + metadata_size);
4084 if (!p_packet || !packet_size)
4109 "%s: free current p_packet, p_packet->buffer_size=%u\n", __func__,
4115 __func__, buffer_size);
4172 if (!p_buffer || !p_packet || !buffer_size)
4180 ni_log(
NI_LOG_INFO,
"Info: %s: Warning buffer not 4k aligned = %p!. Will do an extra copy\n",
4181 __func__, p_buffer);
4259 "%s(): no need to free previous av1 packet buffers\n", __func__);
4295int ni_packet_copy(
void* p_destination,
const void*
const p_source,
int cur_size,
void* p_leftover,
int* p_prev_size)
4298 int padding_size = 0;
4299 int prev_size = p_prev_size == NULL? 0 : *p_prev_size;
4301 int total_size = cur_size + prev_size;
4302 uint8_t* p_src = (uint8_t*)p_source;
4303 uint8_t* p_dst = (uint8_t*)p_destination;
4304 uint8_t* p_lftover = (uint8_t*)p_leftover;
4313 if ((0 == cur_size) && (0 == prev_size))
4318 if (((0 != cur_size) && (!p_source)) || (!p_destination) || (!p_leftover))
4325 if (copy_size > total_size)
4327 padding_size = copy_size - total_size;
4332 memcpy(p_dst, p_lftover, prev_size);
4337 memcpy(p_dst, p_src, cur_size);
4342 memset(p_dst, 0, padding_size);
4346 "%s(): exit, cur_size=%d, copy_size=%d, "
4347 "prev_size=%d, padding_size=%d\n", __func__, cur_size,
4348 copy_size, *p_prev_size, padding_size);
4384 ret->
size = data_size;
4385 ret->
data = calloc(1, data_size);
4411 const uint8_t *raw_data,
4417 memcpy(ret->
data, raw_data, data_size);
4461 if (aux->
type == type)
4512 int fps_num,
int fps_denom,
4513 long bit_rate,
int width,
4664 p_param->
bitrate = (int)bit_rate;
4765 p_enc->
qcomp = (float)0.6;
4860 ni_log(
NI_LOG_ERROR,
"AV1 Picture Width not aligned to %d - picture will be cropped\n",
4865 ni_log(
NI_LOG_ERROR,
"AV1 Picture Height not aligned to %d - picture will be cropped\n",
4934 int fps_num,
int fps_denom,
4935 long bit_rate,
int width,
4961 if(fps_num <= 0 || fps_denom <= 0)
4965 ni_log(
NI_LOG_INFO,
"%s(): FPS is not set, setting the default FPS to 30\n", __func__);
5025 p_param->
bitrate = (int)bit_rate;
5057 char keyChar[10] =
"";
5059 char valChar[10] =
"";
5066 FILE *reconf = NULL;
5075 ni_fopen(&reconf, reconf_file,
"r");
5084 while ((readc = fgetc(reconf)) != EOF)
5091 ni_strncat(keyChar, 10, (
const char *)(&readc), 1);
5095 ni_strncat(valChar, 10, (
const char *)(&readc), 1);
5098 else if (readc ==
':')
5104 "ERROR: %s(): invalid key value '%s' in reconfig file\n",
5110 hash_map[idx][0] = key;
5112 else if (readc ==
',')
5117 "ERROR: Number of entries per line in reconfig file is greater then the "
5126 "ERROR: %s(): invalid value '%s' in reconfig file\n",
5132 hash_map[idx][valIdx] = val;
5134 memset(valChar, 0, 10);
5136 else if (readc ==
'\n')
5141 "ERROR: Number of lines in reconfig file is greater then the "
5151 "ERROR: %s(): invalid value '%s' in reconfig file\n",
5157 hash_map[idx][valIdx] = val;
5159 memset(keyChar,0,10);
5160 memset(valChar,0,10);
5165 ni_log(
NI_LOG_ERROR,
"ERROR: character %c in reconfig file. this may lead to mistaken reconfiguration values\n", readc);
5169 (void)fclose(reconf);
5174 "ERROR %d: %s(): Incorrect format / "
5175 "incomplete Key/Value pair in reconfig_file: %s\n",
5186 char valChar[5] =
"";
5193 FILE *reconf = NULL;
5195 if (!customize_file)
5202 ni_fopen(&reconf, customize_file,
"r");
5206 NI_ERRNO, __func__, customize_file);
5211 while ((readc = fgetc(reconf)) != EOF)
5216 ni_strncat(valChar, 5, (
const char *)(&readc), 1);
5218 else if (readc ==
'-') {
5221 else if (readc ==
',')
5226 "ERROR: Number of qpIdx %d greater then the limit of %d or"
5227 "Number of levelIdx %d greater then the limit of %d\n",
5235 "ERROR: %s(): invalid value '%s' in customize file\n",
5242 qp_map[levelIdx][qpIdx] = (int8_t)val;
5244 val = clip3(0, 32, (
int)tmp_val);
5245 qp_map[levelIdx][qpIdx] = (int8_t)(val * -1);
5248 memset(valChar, 0, 5);
5251 else if (readc ==
'\n')
5256 "ERROR: Number of qpIdx %d greater then the limit of %d or"
5257 "Number of levelIdx %d greater then the limit of %d\n",
5265 "ERROR: %s(): invalid value '%s' in customize file\n",
5272 qp_map[levelIdx][qpIdx] = (int8_t)val;
5274 val = clip3(0, 32, (
int)tmp_val);
5275 qp_map[levelIdx][qpIdx] = (int8_t)(val * -1);
5278 memset(valChar, 0, 5);
5284 ni_log(
NI_LOG_ERROR,
"ERROR: character %c in reconfig file. this may lead to mistaken reconfiguration values\n", readc);
5287 (void)fclose(reconf);
5295#define atoi(p_str) ni_atoi(p_str, &b_error)
5296#define atof(p_str) ni_atof(p_str, &b_error)
5297#define atobool(p_str) (ni_atobool(p_str, &b_error))
5314 const char *name,
char *value)
5316 bool b_error =
false;
5317 bool bNameWasBool =
false;
5318 bool bValueWasNull = !value;
5320 char nameBuf[64] = { 0 };
5321 const char delim[2] =
",";
5322 const char xdelim[2] =
"x";
5324 int i, j, k, ppu_index;
5344 if (name[0] ==
'-' && name[1] ==
'-')
5350 if (strlen(name) + 1 <
sizeof(nameBuf) && strchr(name,
'_'))
5353 ni_strcpy(nameBuf,
sizeof(nameBuf), name);
5354 while ((c = strchr(nameBuf,
'_')) != 0)
5365 else if (value[0] ==
'=')
5370#if defined(_MSC_VER)
5371#define OPT(STR) else if (!_stricmp(name, STR))
5372#define OPT2(STR1, STR2) \
5373 else if (!_stricmp(name, STR1) || !_stricmp(name, STR2))
5374#define OPT6(STR1, STR2, STR3, STR4, STR5, STR6) \
5375 else if (!_stricmp(name, STR1) || !_stricmp(name, STR2) || \
5376 !_stricmp(name, STR3) || !_stricmp(name, STR4) || \
5377 !_stricmp(name, STR5) || !_stricmp(name, STR6))
5379#define OPT(STR) else if (!strcasecmp(name, STR))
5380#define OPT2(STR1, STR2) else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))
5381#define OPT6(STR1, STR2, STR3, STR4, STR5, STR6) \
5382 else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2) || \
5383 !strcasecmp(name, STR3) || !strcasecmp(name, STR4) || \
5384 !strcasecmp(name, STR5) || !strcasecmp(name, STR6))
5389 if (!strncmp(value,
"hw",
sizeof(
"hw"))){
5392 else if (!strncmp(value,
"sw",
sizeof(
"sw"))) {
5403 if (
atoi(value) == 1)
5408 if (
atoi(value) == 1)
5413 if (
atoi(value) == 1)
5418 if (
atoi(value) == 1)
5423 if (
atoi(value) == 1)
5428 if (
atoi(value) == 1 ||
atoi(value) == 2)
5433 if (
atoi(value) == 1 ||
atoi(value) == 2)
5438 if (
atoi(value) == 1 ||
atoi(value) == 2)
5443 if (!strncmp(value,
"manual",
sizeof(
"manual"))) {
5446 else if (!strncmp(value,
"auto",
sizeof(
"auto"))) {
5451 "ERROR: %s():cropMode0 input can only be <manual,auto> got %s\n",
5458 if (!strncmp(value,
"manual",
sizeof(
"manual"))) {
5461 else if (!strncmp(value,
"auto",
sizeof(
"auto"))) {
5466 "ERROR: %s():cropMode1 input can only be <manual,auto> got %s\n",
5473 if (!strncmp(value,
"manual",
sizeof(
"manual"))) {
5476 else if (!strncmp(value,
"auto",
sizeof(
"auto"))) {
5481 "ERROR: %s():cropMode2 input can only be <manual,auto> got %s\n",
5488 char *saveptr = NULL;
5489 chunk =
ni_strtok(value, delim, &saveptr);
5490 for (i = 0; i < 4; i++)
5497 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5499 p_dec->
cr_expr[0][i][k] = chunk[j];
5507 chunk =
ni_strtok(NULL, delim, &saveptr);
5524 char *saveptr = NULL;
5525 chunk =
ni_strtok(value, delim, &saveptr);
5526 for (i = 0; i < 4; i++)
5533 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5535 p_dec->
cr_expr[1][i][k] = chunk[j];
5543 chunk =
ni_strtok(NULL, delim, &saveptr);
5561 char *saveptr = NULL;
5562 chunk =
ni_strtok(value, delim, &saveptr);
5563 for (i = 0; i < 4; i++)
5570 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5572 p_dec->
cr_expr[2][i][k] = chunk[j];
5580 chunk =
ni_strtok(NULL, delim, &saveptr);
5601 if (*chunk == xdelim[0]) {
5610 char *saveptr = NULL;
5611 chunk =
ni_strtok(value, xdelim, &saveptr);
5612 for (i = 0; i < 2; i++)
5619 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5621 p_dec->
sc_expr[0][i][k] = chunk[j];
5629 chunk =
ni_strtok(NULL, xdelim, &saveptr);
5642 if (*chunk == xdelim[0]) {
5651 char *saveptr = NULL;
5652 chunk =
ni_strtok(value, xdelim, &saveptr);
5653 for (i = 0; i < 2; i++)
5660 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5662 p_dec->
sc_expr[1][i][k] = chunk[j];
5670 chunk =
ni_strtok(NULL, xdelim, &saveptr);
5683 if (*chunk == xdelim[0]) {
5692 char *saveptr = NULL;
5693 chunk =
ni_strtok(value, xdelim, &saveptr);
5694 for (i = 0; i < 2; i++)
5701 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5703 p_dec->
sc_expr[2][i][k] = chunk[j];
5711 chunk =
ni_strtok(NULL, xdelim, &saveptr);
5726 ppu_index = name[5] -
'0';
5727 i = name[6] ==
'w' ? 0 : 1;
5731 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5733 p_dec->
sc_expr[ppu_index][i][k] = chunk[j];
5745 if ((
atoi(value) < 0) || (
atoi(value) > 2))
5753 if ((
atoi(value) < 0) || (
atoi(value) > 2))
5761 if ((
atoi(value) < 0) || (
atoi(value) > 2))
5769 if (
atoi(value) < 2 ||
atoi(value) % 2 != 0 ||
atoi(value) > 128)
5772 "and must be even number and less than or equal to 128. Got: %s\n",
5781 if (
atoi(value) < 2 ||
atoi(value) % 2 != 0 ||
atoi(value) > 128)
5784 "and must be even number and less than or equal to 128. Got: %s\n",
5792 if (
atoi(value) < 2 ||
atoi(value) % 2 != 0 ||
atoi(value) > 128)
5795 "and must be even number and less than or equal to 128. Got: %s\n",
5803 if (!strncmp(value,
"up",
sizeof(
"up"))){
5806 else if (!strncmp(value,
"down",
sizeof(
"down"))) {
5817 if (!strncmp(value,
"up",
sizeof(
"up"))){
5820 else if (!strncmp(value,
"down",
sizeof(
"down"))) {
5831 if (!strncmp(value,
"up",
sizeof(
"up"))){
5834 else if (!strncmp(value,
"down",
sizeof(
"down"))) {
5845 if ((
atoi(value) != 0) && (
atoi(value) != 1))
5853 if (
atoi(value) < 0)
5870 if (
atoi(value) < 0)
5878 if ((
atoi(value) != 0) && (
atoi(value) != 1))
5886 if (
atoi(value) < 0)
5894 if (
atoi(value) < 0)
5902 if ((
atoi(value) != 0) && (
atoi(value) != 1))
5945 if (strncmp(value,
"tolerant",
sizeof(
"tolerant")) == 0) {
5947 }
else if (strncmp(value,
"ignore",
sizeof(
"ignore")) == 0) {
5949 }
else if (strncmp(value,
"skip",
sizeof(
"skip")) == 0) {
5951 }
else if (strncmp(value,
"best_effort",
sizeof(
"best_effort")) == 0) {
5953 }
else if (strncmp(value,
"limited_error",
sizeof(
"limited_error")) == 0) {
5955 }
else if (strncmp(value,
"best_effort_out_dc",
sizeof(
"best_effort_out_dc")) == 0) {
5963 if (
atoi(value) != 0 &&
5973 if (
atoi(value) < 0 || (
atoi(value) > 100))
5981 if (
atoi(value) < 0 || (
atoi(value) > 2))
5989 if (
atoi(value) < 0 || (
atoi(value) > 1))
5997 if (
atoi(value) < 0 ||
atoi(value) > 255)
6005 if (
atoi(value) < 0 ||
atoi(value) > 252)
6013 if (strncmp(value,
"normal",
sizeof(
"normal")) == 0) {
6015 }
else if (strncmp(value,
"intra_only",
sizeof(
"intra_only")) == 0) {
6023 if (
atoi(value) < 0 ||
atoi(value) > 1)
6031 if (
atoi(value) != 0 &&
atoi(value) != 1)
6039 if (
atoi(value) < 0 ||
6048 if (
atoi(value) != 0 &&
atoi(value) != 1)
6056 if (
atoi(value) < 0 ||
6065 if (
atoi(value) < 0 ||
atoi(value) > 1)
6073 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6081 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6089 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6104 b_error |= bValueWasNull && !bNameWasBool;
6113#define atoi(p_str) ni_atoi(p_str, &b_error)
6114#define atof(p_str) ni_atof(p_str, &b_error)
6115#define atobool(p_str) (ni_atobool(p_str, &b_error))
6132 const char *name,
const char *value)
6134 bool b_error =
false;
6135 bool bNameWasBool =
false;
6136 bool bValueWasNull = !value;
6138 char nameBuf[64] = { 0 };
6158 if (name[0] ==
'-' && name[1] ==
'-')
6164 if (strlen(name) + 1 <
sizeof(nameBuf) && strchr(name,
'_'))
6167 ni_strcpy(nameBuf,
sizeof(nameBuf), name);
6168 while ((c = strchr(nameBuf,
'_')) != 0)
6179 else if (value[0] ==
'=')
6184#if defined(_MSC_VER)
6185#define OPT(STR) else if (!_stricmp(name, STR))
6186#define OPT2(STR1, STR2) \
6187 else if (!_stricmp(name, STR1) || !_stricmp(name, STR2))
6189#define OPT(STR) else if (!strcasecmp(name, STR))
6190#define OPT2(STR1, STR2) else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))
6192#define COMPARE(STR1, STR2, STR3) \
6193 if ((atoi(STR1) > (STR2)) || (atoi(STR1) < (STR3))) \
6195 return NI_RETCODE_PARAM_ERROR_OOR; \
6236 if (0 >
atoi(value))
6244 if (
atoi(value) < 0 ||
atoi(value) > 7)
6252 if (0 !=
atoi(value) && 1 !=
atoi(value))
6262#ifndef DEPRECATION_AS_ERROR
6265 if (0 !=
atoi(value) && 1 !=
atoi(value))
6276 if (0 !=
atoi(value) && 1 !=
atoi(value))
6297 if (!strcasecmp(value,
"1b"))
6306 if (
atof(value) <= 10)
6465#ifndef DEPRECATION_AS_ERROR
6468 if ((
atoi(value) > 51) || (
atoi(value) < -1))
6507 if (0 !=
atoi(value) && 1 !=
atoi(value))
6514#ifndef DEPRECATION_AS_ERROR
6521 if (!_strnicmp(value,
"ratio", 5))
6523 if (!strncasecmp(value,
"ratio", 5))
6526 char value_buf[32] = {0};
6527 for (i = 0; i <
sizeof(value_buf); i++)
6529 if (value[i+6] ==
']')
6533 value_buf[i] = value[i+6];
6535 if (i ==
sizeof(value_buf) ||
atoi(value_buf) < 0)
6544 int size =
atoi(value);
6555 if (!_strnicmp(value,
"ratio", 5))
6557 if (!strncasecmp(value,
"ratio", 5))
6560 char value_buf[32] = {0};
6561 for (i = 0; i <
sizeof(value_buf); i++)
6563 if (value[i+6] ==
']')
6567 value_buf[i] = value[i+6];
6569 if (i ==
sizeof(value_buf) ||
atoi(value_buf) < 0)
6578 int size =
atoi(value) / 8;
6588 if (0 !=
atoi(value) && 1 !=
atoi(value))
6633 if (
atoi(value) <= 0 )
6643 if (
atoi(value) <= 0)
6691 if (0 !=
atoi(value) && 1 !=
atoi(value))
6720 if (0 !=
atoi(value) && 1 !=
atoi(value))
6750 if ((
atoi(value) > 255) || (
atoi(value) < 0))
6758 if (
atoi(value) != 0 &&
atoi(value) != 5)
6766 if ((
atoi(value) > 3) || (
atoi(value) < 1))
6774 const char delim[2] =
",";
6777 char *v = _strdup(value);
6779 char *v = strdup(value);
6781 char *saveptr = NULL;
6785 if ((
atoi(chunk) > 65535) || (
atoi(chunk) < 0))
6791 chunk =
ni_strtok(NULL, delim, &saveptr);
6794 if ((
atoi(chunk) > 65535) || (
atoi(chunk) < 0))
6819#define STRDUP(value) _strdup(value);
6821#define STRDUP(value) strdup(value);
6823 const char G[2] =
"G";
6824 const char B[2] =
"B";
6825 const char R[2] =
"R";
6826 const char W[2] =
"W";
6827 const char L[2] =
"L";
6828 const char P[2] =
"P";
6829 const char parL[2] =
"(";
6830 const char comma[2] =
",";
6831 const char parR[2] =
")";
6832 int synCheck_GBRWLPCP[8];
6833 int posCheck_GBRWL[5] = {0};
6838 for (i = 0; i<8; i++)
6840 synCheck_GBRWLPCP[i] = 0;
6849 synCheck_GBRWLPCP[0]++;
6850 posCheck_GBRWL[0] = i;
6852 else if (*chunk == B[0])
6854 synCheck_GBRWLPCP[1]++;
6855 posCheck_GBRWL[1] = i;
6857 else if (*chunk == R[0])
6859 synCheck_GBRWLPCP[2]++;
6860 posCheck_GBRWL[2] = i;
6862 else if (*chunk == W[0])
6864 synCheck_GBRWLPCP[3]++;
6865 posCheck_GBRWL[3] = i;
6867 else if (*chunk == L[0])
6869 synCheck_GBRWLPCP[4]++;
6870 posCheck_GBRWL[4] = i;
6872 else if (*chunk == parL[0])
6874 synCheck_GBRWLPCP[5]++;
6876 else if (*chunk == comma[0])
6878 synCheck_GBRWLPCP[6]++;
6880 else if (*chunk == parR[0])
6882 synCheck_GBRWLPCP[7]++;
6888 if (synCheck_GBRWLPCP[0] != 1 || synCheck_GBRWLPCP[1] != 1 || synCheck_GBRWLPCP[2] != 1 ||
6889 synCheck_GBRWLPCP[3] != 1 || synCheck_GBRWLPCP[4] != 1 || synCheck_GBRWLPCP[5] != 5 ||
6890 synCheck_GBRWLPCP[6] != 5 || synCheck_GBRWLPCP[7] != 5)
6896#define GBRWLPARSE(OUT1,OUT2,OFF,IDX) \
6898 char *v = STRDUP(value); \
6899 chunk = v + posCheck_GBRWL[IDX]; \
6901 while (chunk != NULL) \
6903 if (*chunk == parL[0] && i == 1+(OFF)) \
6907 if((OFF) == 1 && *chunk != P[0] && i == 1) \
6911 if (*chunk == parR[0]) \
6922 return NI_RETCODE_PARAM_INVALID_VALUE; \
6924 subchunk = malloc(i - 1 - (OFF)); \
6925 if (subchunk == NULL) \
6928 return NI_RETCODE_ERROR_MEM_ALOC; \
6930 memcpy(subchunk, v + posCheck_GBRWL[IDX] + 2 + (OFF), i - 2 - (OFF)); \
6931 subchunk[i - 2 - (OFF)] = '\0'; \
6932 char *saveptr = NULL; \
6933 chunk = ni_strtok(subchunk, comma, &saveptr); \
6934 if (chunk != NULL) \
6936 if(atoi(chunk) < 0) \
6939 if(subchunk != NULL){ \
6942 return NI_RETCODE_PARAM_INVALID_VALUE; \
6944 *(OUT1) = atoi(chunk); \
6946 chunk = ni_strtok(NULL, comma, &saveptr); \
6947 if (chunk != NULL) \
6949 if(atoi(chunk) < 0) \
6952 if(subchunk != NULL){ \
6955 return NI_RETCODE_PARAM_INVALID_VALUE; \
6957 *(OUT2) = atoi(chunk); \
6971 if (
atoi(value)!= 0 && ((
atoi(value) > 40 ) || (
atoi(value) < 4)))
6979 if (
atoi(value) != 0 &&
atoi(value) != 1)
6987 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6995 if (
atoi(value) != 0 &&
atoi(value) != 1)
7003 if (
atoi(value) != 0 &&
atoi(value) != 1)
7015 if (
atoi(value) < 1 ||
atoi(value) > 2)
7023 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7036 if ((
atoi(value) < 0) || (
atoi(value) > 3))
7058 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7087 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7095 if ((
atoi(value) < 0) || (
atoi(value) > 9))
7103 if ((
atoi(value) > 12) || (
atoi(value) < -12))
7113 if ((
atoi(value) > 300) || (
atoi(value) < 1))
7121 if ((
atoi(value) > 2) || (
atoi(value) < 0))
7129 if ((
atoi(value) > 15) || (
atoi(value) < 0))
7137 if ((
atoi(value) > 500) || (
atoi(value) < 0))
7145 if ((
atoi(value) > 1) || (
atoi(value) < 0))
7153 if ((
atoi(value) > 1) || (
atoi(value) < 0))
7200 if (
atoi(value) != 0 &&
atoi(value) != 1)
7208 if (
atoi(value) < 0 ||
atoi(value) > 3)
7216 if (
atoi(value) < 1)
7224 if (
atoi(value) < 0 ||
atoi(value) > 1)
7232 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7240 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7248 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7260 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7268 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7274 ni_log(
NI_LOG_ERROR,
"Cannot set enableAIEnhance and enableHVSPlus at same time, just enableHVSPlus\n");
7280 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7288 if ((
atoi(value) != 0) && (
atoi(value) != 1) && (
atoi(value) != -1))
7296 if ((
atoi(value) == 0) || (
atoi(value) > 3))
7304 if ((
atoi(value) == 0) || (
atoi(value) > 2))
7330 if ((
atoi(value) < 0) ||
7339 if ((
atoi(value) < 0) ||
7348 if ((
atoi(value) > 51) || (
atoi(value) < -1))
7356 if ((
atof(value) > 1.0) || (
atof(value) < 0.0))
7364 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7372 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7380 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7388 if ((
atoi(value) > 10) || (
atoi(value) < 1))
7396 if ((
atof(value) > 10.0) || (
atof(value) < 0.01))
7404 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7412 if ((
atof(value) > 10.0) || (
atof(value) < 0.01))
7420 if ((
atof(value) > 1.0) || (
atof(value) < 0.1))
7428 if ((
atoi(value) > 51) || (
atoi(value) < -1))
7445 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7453 if ((
atoi(value) > 51) || (
atoi(value) < -1))
7461 if (((
atof(value) < 0.0) && (
atof(value) != -1.0)) ||
7462 (
atof(value) > 51.00))
7470 if ((
atoi(value) < 0) || (
atoi(value) > 31))
7478 if (
atoi(value) != 0 &&
atoi(value) != 1 &&
atoi(value) != 6)
7489 if ((
atoi(value) < 0 ||
atoi(value) > 6))
7500 if ((
atoi(value) < 0 ||
atoi(value) > 10))
7508 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7516 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7524 if (
atoi(value) < 0 ||
atoi(value) > 1)
7532 if (
atoi(value) < 0)
7540 if (
atoi(value) < 0 ||
atoi(value) > 255)
7548 if (
atoi(value) != 0 &&
atoi(value) != 1)
7556 if (
atoi(value) <= 0)
7564 if ((
atoi(value) < 0 ||
atoi(value) > 2) &&
7565 atoi(value) != 5 &&
atoi(value) != 6 &&
atoi(value) != 7)
7577 if (
atoi(value) != 0 &&
atoi(value) != 1)
7585 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7593 if ((
atof(value) > 1.0) || (
atof(value) < 0.0))
7601 if (
atoi(value) < 0 ||
atoi(value) > 2)
7609 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7652 if (
atoi(value) < 1 ||
atoi(value) > 4)
7660 if (
atoi(value) < 0 ||
atoi(value) > 1)
7668 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7676 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7684 if (
atoi(value)!= 0 && ((
atoi(value) > 40 ) || (
atoi(value) < 4)))
7692 if (
atoi(value) != 0 &&
atoi(value) != 1)
7700 if (
atoi(value) != 0 &&
atoi(value) != 1)
7708 if (
atoi(value) != 0 &&
atoi(value) != 1)
7716 if (
atoi(value) < 0 ||
atoi(value) > 100)
7724 if (
atoi(value) < 0 ||
atoi(value) > 100)
7732 const char delim[2] =
",";
7735 char *v = _strdup(value);
7737 char *v = strdup(value);
7739 char *saveptr = NULL;
7750 chunk =
ni_strtok(NULL, delim, &saveptr);
7757 const char delim[2] =
",";
7760 char *v = _strdup(value);
7762 char *v = strdup(value);
7764 char *saveptr = NULL;
7772 if (
atof(chunk) <= 10)
7780 chunk =
ni_strtok(NULL, delim, &saveptr);
7787 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7795 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7815 if (
atoi(value) < 0 ||
atoi(value) > 3)
7823 if (
atoi(value) < 0 ||
atoi(value) > 1)
7831 if (
atoi(value) < 0 ||
atoi(value) > 2)
7839 if (
atoi(value) < 0 ||
atoi(value) > 3)
7847 if (
atoi(value) < 0 ||
atoi(value) > 255)
7855 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7869 b_error |= bValueWasNull && !bNameWasBool;
7878#define atoi(p_str) ni_atoi(p_str, &b_error)
7879#define atof(p_str) ni_atof(p_str, &b_error)
7880#define atobool(p_str) (ni_atobool(p_str, &b_error))
7901 bool b_error =
false;
7902 bool bNameWasBool =
false;
7903 bool bValueWasNull = !value;
7906 char nameBuf[64] = { 0 };
7927 if (name[0] ==
'-' && name[1] ==
'-')
7933 if (strlen(name) + 1 <
sizeof(nameBuf) && strchr(name,
'_'))
7936 ni_strcpy(nameBuf,
sizeof(nameBuf), name);
7937 while ((c = strchr(nameBuf,
'_')) != 0)
7948 else if (value[0] ==
'=')
7953#if defined(_MSC_VER)
7954#define OPT(STR) else if (!_stricmp(name, STR))
7956#define OPT(STR) else if (!strcasecmp(name, STR))
7981 OPT(NI_ENC_GOP_PARAMS_G0_PIC_QP)
7985 OPT(NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC_L0)
7989 OPT(NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L0)
7993 OPT(NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L1)
8010 OPT(NI_ENC_GOP_PARAMS_G1_PIC_QP)
8014 OPT(NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC_L0)
8018 OPT(NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L0)
8022 OPT(NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L1)
8039 OPT(NI_ENC_GOP_PARAMS_G2_PIC_QP)
8043 OPT(NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC_L0)
8047 OPT(NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L0)
8051 OPT(NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L1)
8068 OPT(NI_ENC_GOP_PARAMS_G3_PIC_QP)
8072 OPT(NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC_L0)
8076 OPT(NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L0)
8080 OPT(NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L1)
8097 OPT(NI_ENC_GOP_PARAMS_G4_PIC_QP)
8101 OPT(NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC_L0)
8105 OPT(NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L0)
8109 OPT(NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L1)
8126 OPT(NI_ENC_GOP_PARAMS_G5_PIC_QP)
8130 OPT(NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC_L0)
8134 OPT(NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L0)
8138 OPT(NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L1)
8155 OPT(NI_ENC_GOP_PARAMS_G6_PIC_QP)
8159 OPT(NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC_L0)
8163 OPT(NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L0)
8167 OPT(NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L1)
8184 OPT(NI_ENC_GOP_PARAMS_G7_PIC_QP)
8188 OPT(NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC_L0)
8192 OPT(NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L0)
8196 OPT(NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L1)
8697 b_error |= bValueWasNull && !bNameWasBool;
8747 if ((!p_ctx) || (!p_data))
8764 "ERROR: %s() keep alive thread has been closed, "
8765 "hw:%d, session:%d\n",
8782 switch (device_type)
8786 int seq_change_read_count = 0;
8797 uint32_t aligned_width;
8809 ", DFVWxDFVH %u x %u, AlWid %u, AVW x AVH %u x %u\n",
8814 if (0 == retval && seq_change_read_count)
8823 else if (retval < 0)
8839 "%s (decoder): resolution change, frame size %ux%u -> %ux%u, "
8840 "width %u bit %d, pix_fromat_changed %d, actual_video_width %d, continue read ...\n",
8849 seq_change_read_count++;
8881 __func__, device_type);
8913 if ((!hwdesc) || (!p_data))
8941 bool use_external_mutex =
false;
8942 uint32_t orig_session_id = p_ctx->
session_id;
8943 ni_device_handle_t orig_blk_io_handle = p_ctx->
blk_io_handle;
8948 ni_pthread_mutex_t *p_ctx_mutex = &(p_ctx->
mutex);
8954 use_external_mutex =
true;
8967 if (use_external_mutex)
9012 "%s function not supported in FW API version < 6rt\n",
9017 switch (device_type)
9066 if ((!hwdesc) || (!p_src_data))
9100 int video_height,
int extra_len)
9102 void* p_buffer = NULL;
9103 int height_aligned = video_height;
9139 memset(p_buffer, 0, buffer_size);
9151 p_frame->
p_data[0] = NULL;
9152 p_frame->
p_data[1] = NULL;
9153 p_frame->
p_data[2] = NULL;
9188 int32_t device_handle)
9196 "%s(): ui16FrameIdx=%d sessionId=%d device_handle=0x%x\n",
9220 int32_t saved_dma_buf_fd;
9230 "%s(): ui16FrameIdx=%d sessionId=%d device_handle=0x%x\n",
9265 uint32_t pool_size, uint32_t pool)
9327 "ERROR: %s function not supported in FW API version < 6r3\n",
9334 "ERROR: can't free or expand framepool of session 0x%x "
9335 "before init framepool\n", p_ctx->
session_id);
9376 if (!p_ctx || !p_params)
9404 void *p_scaler_config = NULL;
9407 uint32_t ui32LBA = 0;
9411 if (!p_ctx || !p_params)
9413 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s() passed parameters are null!, return\n", __func__);
9435 memset(p_scaler_config, 0, buffer_size);
9441 memcpy(p_scaler_config, p_params, buffer_size);
9444 p_scaler_config, buffer_size, ui32LBA) < 0)
9447 "ERROR: ni_nvme_send_write_cmd failed: blk_io_handle: %" PRIx64
9448 ", hw_id, %d, xcoder_inst_id: %d\n",
9455 "ERROR: %s failed: blk_io_handle: %" PRIx64
","
9456 "hw_id, %d, xcoder_inst_id: %d\n",
9484 void *p_scaler_config = NULL;
9487 uint32_t ui32LBA = 0;
9491 if (!p_ctx || !p_params)
9493 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s() passed parameters are null!, return\n", __func__);
9515 memset(p_scaler_config, 0, buffer_size);
9521 memcpy(p_scaler_config, p_params, buffer_size);
9524 p_scaler_config, buffer_size, ui32LBA) < 0)
9527 "ERROR: ni_nvme_send_write_cmd failed: blk_io_handle: %" PRIx64
9528 ", hw_id, %d, xcoder_inst_id: %d\n",
9535 "ERROR: %s failed: blk_io_handle: %" PRIx64
","
9536 "hw_id, %d, xcoder_inst_id: %d\n",
9585 int rectangle_width,
9586 int rectangle_height,
9604 switch (device_type)
9608 rectangle_width, rectangle_height,
9609 rectangle_x, rectangle_y,
9610 rgba_color, frame_index);
9662 switch (device_type)
9714 "Error: %s function not supported on device with FW API version < 6rL\n",
9754 if (!p_ctx || !p_cfg)
9802 if (!p_ctx || !p_cfg_in)
9846 const int linesize[])
9851 int luma, chroma_b, chroma_r;
9858 switch (pixel_format)
9897 switch (pixel_format)
9901 luma = linesize[0] * alignedh;
9902 chroma_b = linesize[1] * alignedh / 2;
9903 chroma_r = linesize[2] * alignedh / 2;
9910 luma = linesize[0] * alignedh;
9911 chroma_b = linesize[1] * alignedh / 2;
9953 int video_width,
int video_height,
9954 int linesize[],
int alignment,
9958 void *p_buffer = NULL;
9962 int chroma_b_size = 0;
9963 int chroma_r_size = 0;
9971 switch (pixel_format)
10042 switch (pixel_format)
10046 luma_size = linesize[0] * height_aligned;
10050 chroma_b_size = linesize[1] * height_aligned / 2;
10051 chroma_r_size = linesize[2] * height_aligned / 2;
10055 chroma_b_size = luma_size / 4;
10056 chroma_r_size = luma_size / 4;
10065 luma_size = linesize[0] * video_height;
10074 luma_size = linesize[0] * height_aligned;
10075 chroma_b_size = linesize[1] * height_aligned / 2;
10082 luma_size = linesize[0] * video_height;
10083 chroma_b_size = linesize[1] * video_height;
10091 luma_size = linesize[0] * video_height;
10110 buffer_size = luma_size + chroma_b_size + chroma_r_size + extra_len;
10132 memset(p_buffer, 0, buffer_size);
10142 switch (pixel_format)
10148 p_frame->
p_data[2] = p_frame->
p_data[1] + chroma_b_size;
10149 p_frame->
p_data[3] = NULL;
10152 p_frame->
data_len[1] = chroma_b_size;
10153 p_frame->
data_len[2] = chroma_r_size;
10164 p_frame->
p_data[1] = NULL;
10165 p_frame->
p_data[2] = NULL;
10166 p_frame->
p_data[3] = NULL;
10180 p_frame->
p_data[1] = (uint8_t *)p_frame->
p_data[0] + luma_size;
10181 p_frame->
p_data[2] = NULL;
10182 p_frame->
p_data[3] = NULL;
10185 p_frame->
data_len[1] = chroma_b_size;
10196 p_frame->
p_data[1] = (uint8_t *)p_frame->
p_data[0] + luma_size;
10197 p_frame->
p_data[2] = NULL;
10198 p_frame->
p_data[3] = NULL;
10201 p_frame->
data_len[1] = chroma_b_size;
10214 p_frame->
p_data[1] = NULL;
10215 p_frame->
p_data[2] = NULL;
10216 p_frame->
p_data[3] = NULL;
10229 p_frame->
p_data[1] = (uint8_t *)p_frame->
p_data[0] + luma_size;
10230 p_frame->
p_data[2] = (uint8_t *)p_frame->
p_data[1] + chroma_b_size;
10231 p_frame->
p_data[3] = NULL;
10234 p_frame->
data_len[1] = chroma_b_size;
10235 p_frame->
data_len[2] = chroma_r_size;
10250 __func__, video_width, video_height, buffer_size);
10267 struct stat file_stat;
10269 unsigned char *buffer = NULL;
10282 if (stat(file, &file_stat) != 0)
10291 if (file_stat.st_size == 0)
10308 buffer = malloc(file_stat.st_size);
10318 if (fread(buffer, file_stat.st_size, 1, fp) != 1)
10371 ni_log2(p_ctx,
NI_LOG_ERROR,
"Error: hvsplus filter not supported on device with FW API version < 6ro\n");
10407 uint32_t buffer_size = 0;
10408 void *p_buffer = NULL;
10410 uint32_t i, this_size;
10413 if (!p_frame || !p_network)
10419 p_linfo = &p_network->
linfo;
10420 for (i = 0; i < p_network->
input_num; i++)
10428 "ERROR: %s(): invalid buffer_size of network\n", __func__);
10431 buffer_size += this_size;
10435 p_frame->
data_len[0] = buffer_size;
10468 p_frame->
p_data[1] = NULL;
10469 p_frame->
p_data[2] = NULL;
10470 p_frame->
p_data[3] = NULL;
10472 p_frame->
iovec = NULL;
10491 void *p_buffer = NULL;
10493 uint32_t buffer_size = 0;
10494 uint32_t i, data_size;
10497 if (!p_packet || !p_network)
10504 p_linfo = &p_network->
linfo;
10513 "ERROR: %s(): invalid buffer_size of network\n", __func__);
10516 buffer_size += data_size;
10518 data_size = buffer_size;
10536 "%s(): free current p_packet, p_packet->buffer_size=%u\n",
10541 __func__, buffer_size);
10580 if (!p_ctx || bitrate < NI_MIN_BITRATE || bitrate >
NI_MAX_BITRATE)
10583 __func__, bitrate);
10592 "Warning: %s(): bitrate %d overwriting current one %d\n",
10619 int32_t intra_period)
10621 if (!p_ctx || intra_period < 0 || intra_period > 1024)
10624 __func__, intra_period);
10633 "Warning: %s(): intraPeriod %d overwriting current one %d\n",
10764 int32_t ltr_interval)
10821 if (!p_ctx || framerate_num <= 0 || framerate_denom <= 0)
10824 "ERROR: %s(): invalid framerate passed in (%d/%d)\n", __func__,
10825 framerate_num, framerate_denom);
10829 if ((framerate_num % framerate_denom) != 0)
10831 uint32_t numUnitsInTick = 1000;
10832 framerate_num = framerate_num / framerate_denom;
10833 framerate_denom = (int)(numUnitsInTick + 1);
10834 framerate_num += 1;
10835 framerate_num *= (int)numUnitsInTick;
10838 framerate_num = framerate_num / framerate_denom;
10839 framerate_denom = 1;
10842 if (((framerate_num + framerate_denom - 1) / framerate_denom) >
10846 "ERROR: %s(): invalid framerate passed in (%d/%d)\n", __func__,
10857 "Warning: %s(): framerate (%d/%d) overwriting current "
10859 __func__, framerate_num, framerate_denom,
10888 int32_t bitrate, framerate_num, framerate_denom;
10889 uint32_t maxFrameSize = (uint32_t)max_frame_size / 2000;
10890 uint32_t min_maxFrameSize;
10894 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
10903 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): max_frame_size is valid only when lowDelay mode is enabled\n",
10904 __func__, max_frame_size);
10917 framerate_num = (int32_t) api_param->
fps_number;
10921 min_maxFrameSize = (((uint32_t)bitrate / framerate_num * framerate_denom) / 8) / 2000;
10923 if (maxFrameSize < min_maxFrameSize)
10926 __func__, max_frame_size);
10939 "Warning: %s(): max_frame_size %d overwriting current one %d\n",
10963 int32_t minQpI, maxQpI, maxDeltaQp, minQpPB, maxQpPB;
10965 if (!p_ctx || !p_min_max_qp)
10967 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_min_max_qp pointer\n",
10972 minQpI = p_min_max_qp->
minQpI;
10973 maxQpI = p_min_max_qp->
maxQpI;
10975 minQpPB = p_min_max_qp->
minQpPB;
10976 maxQpPB = p_min_max_qp->
maxQpPB;
10978 if (minQpI > maxQpI || minQpPB > maxQpPB ||
10979 maxQpI > 51 || minQpI < 0 || maxQpPB > 51 || minQpPB < 0)
10982 __func__, minQpI, maxQpI, maxDeltaQp, minQpPB, maxQpPB);
11017 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11026 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): reconfigure crf value %d is valid only in CRF mode\n",
11031 if (crf < 0 || crf > 51)
11033 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): crf value %d is invalid (valid range in [0..51])\n",
11045 "Warning: %s(): crf reconfig value %d overwriting current reconfig_crf %d\n",
11074 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11083 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): reconfigure crf value %f is valid only in CRF mode\n",
11088 if (crf < 0.0 || crf > 51.0)
11090 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): crf value %f is invalid (valid range in [0..51])\n",
11102 "Warning: %s(): crf reconfig value %d overwriting current "
11103 "reconfig_crf %d, reconfig_crf_decimal %d\n", __func__,
11128 int32_t vbvMaxRate, int32_t vbvBufferSize)
11133 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11137 if ((vbvBufferSize < 10 && vbvBufferSize != 0) || vbvBufferSize > 3000)
11140 __func__, vbvBufferSize);
11144 if (api_param->
bitrate > 0 && vbvMaxRate > 0 && vbvMaxRate < api_param->bitrate) {
11146 vbvMaxRate, api_param->
bitrate);
11149 if (vbvBufferSize == 0 && vbvMaxRate > 0) {
11151 "vbvBufferSize is 0, force vbvMaxRate to 0\n",
11180 int32_t bitrate, framerate_num, framerate_denom;
11181 uint32_t min_maxFrameSize, maxFrameSize;
11185 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11194 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): max_frame_size_ratio is valid only when lowDelay mode is enabled\n",
11195 __func__, max_frame_size_ratio);
11199 if (max_frame_size_ratio < 1) {
11201 max_frame_size_ratio);
11214 framerate_num = (int32_t) api_param->
fps_number;
11218 min_maxFrameSize = (((uint32_t)bitrate / framerate_num * framerate_denom) / 8) / 2000;
11229 "Warning: %s(): max_frame_size %d overwriting current one %d\n",
11257 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11266 ni_log2(p_ctx,
NI_LOG_ERROR,
"%s():not support to reconfig slice_arg when slice_mode disable.\n",
11277 int max_num_ctu_mb_row = (api_param->
source_height + ctu_mb_size - 1) / ctu_mb_size;
11278 if (sliceArg < 1 || sliceArg > max_num_ctu_mb_row)
11316 int ret, is_semi_planar;
11322 if (p_ctx == NULL || p_frame == NULL || p_frame->
p_data[3] == NULL)
11369 uexp.
fn = p_ctx->
fn;
11380 *p_surface = hwdesc;
11410 int is_semi_planar;
11416 if (p_ctx == NULL || p_frame == NULL || p_frame->
p_data[3] == NULL)
11448 *p_surface = hwdesc;
11477 struct pollfd pfds[1] = {0};
11480 if (p_upl_ctx == NULL || p_frame == NULL)
11486 if (p_frame->
p_data[3] == NULL)
11495 pfds[0].events = POLLIN;
11496 pfds[0].revents = 0;
11498 ret = poll(pfds, 1, -1);
11514 "%s: failed to attach dmabuf read fence errno %s\n", __func__,
11540 if ((p_upl_ctx == NULL) || (p_frame == NULL))
11543 p_upl_ctx, p_frame);
11549 if (p_surface == NULL)
11582 uint8_t *p_data, uint32_t len,
11589 if (p_upl_ctx == NULL || p_data == NULL || p_hwframe == NULL)
11595 if (p_hwframe->
p_data[3] == NULL)
11612 "%s: Failed to request dmabuf rendering errno %d\n", __func__,
11637 uint8_t *p_data, uint32_t
len,
11641 char bar4_name[128];
11656 (void)snprintf(bar4_name, 128,
11657 "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/resource4",
11660 bar4_fd = open(bar4_name, O_RDWR | O_SYNC);
11667 bar4_name, errmsg);
11671 if (fstat(bar4_fd, &stat) != 0)
11676 (void)close(bar4_fd);
11680 bar4_mm = mmap(NULL, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, bar4_fd, 0);
11682 if (bar4_mm == MAP_FAILED)
11687 (void)close(bar4_fd);
11692 memcpy(bar4_mm + offset, p_data, len);
11694 (void)munmap(bar4_mm, 0);
11695 (void)close(bar4_fd);
11716 if (p_frame == NULL)
11723 if (p_surface == NULL)
11749 unsigned int offset;
11768 uexp.
fn = p_ctx->
fn;
11803 int width,
int height,
11804 int bit_depth,
int src_endian,
11810 if (p_enc_ctx == NULL || p_enc_params == NULL)
11816 if (!(bit_depth == 8) && !(bit_depth == 10))
11848 alignedw = ((width + 1) / 2) * 2;
11850 (alignedw - width) / 2 * 2;
11863 alignedh = ((height + 1) / 2) * 2;
11865 (alignedh - height) / 2 * 2;
11890 int width,
int height,
11893 if (p_upl_ctx == NULL)
11899 switch (pixel_format)
11933 p_upl_ctx->
isP2P = isP2P;
11958 int bytes_read = 0;
11974 bytes_read += (rx_size - (int)p_ctx->
meta_size);
11979 }
else if (rx_size != 0)
12008 if (p_frame == NULL)
12016 if (p_surface == NULL)
12044 int width,
int height,
int bit_depth_factor,
ni_device_type_t device_type)
12054 ni_log2(p_ctx,
NI_LOG_ERROR,
"Error: %s function not supported on device with FW API version < 5.4\n", __func__);
12065 resolution.
width = width;
12066 resolution.
height = height;
12078 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: Config sequence change not supported when spatialLayers > 1\n");
12091 ni_log2(p_ctx,
NI_LOG_DEBUG,
"%s: resolution change config - width %d height %d bit_depth_factor %d "
12092 "luma_linesize %d chroma_linesize %d\n", __func__,
12096 switch (device_type)
12107 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: Config sequence change not supported for device type: %d", device_type);
12125 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12128 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_info))
12139 "ERROR: %s function not supported on device with FW API version < 6.h\n",
12153 memset(buffer, 0, size);
12205 "ERROR: %s function not supported on device with FW API version < 6.O\n",
12219 memset(buffer, 0, size);
12248 void *p_buffer = NULL;
12250 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12252 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_ns_vf))
12263 "ERROR: %s function not supported on device with FW API version < 6.m\n",
12276 memset(p_buffer, 0, size);
12290 p_dev_ns_vf->
vf_id = p_dev_ns_vf_data->
vf_id;
12291 p_dev_ns_vf->
ns_id = p_dev_ns_vf_data->
ns_id;
12301 void *p_buffer = NULL;
12303 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12305 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_temp))
12316 "ERROR: %s function not supported on device with FW API version < 6rC\n",
12329 memset(p_buffer, 0, size);
12346 ni_log(
NI_LOG_DEBUG,
"%s(): current composite temperature %d on board temperature %d on die temperature %d\n",
12356 void *p_buffer = NULL;
12358 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12360 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_extra_info))
12371 "ERROR: %s function not supported on device with FW API version < 6rC\n",
12384 memset(p_buffer, 0, size);
12407 p_dev_extra_info->
fw_flavour = (uint8_t)
'-';
12432 ni_log(
NI_LOG_DEBUG,
"%s(): current composite temperature %d on board temperature %d "
12433 "on die temperature %d power consumption %d current consumption %d\n",
12446 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12448 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_qos_header) || (!fw_rev))
12459 "INFO: %s function not supported on device with FW API version < 6t0\n",
12474 memset(buffer, 0, size);
12517 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12519 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_qos_ns) || (!fw_rev))
12530 "INFO: %s function not supported on device with FW API version < 6t0\n",
12545 memset(buffer, 0, size);
12599 bool is_ext_buf =
true;
12600 if (*p_log_buffer == NULL)
12608 is_ext_buf =
false;
12611 if(*p_log_buffer != NULL){
12636 bool gen_artifacts_file)
12651 "%s: firmware %.8s does not support artifacts (< 6tA), skipping\n",
12652 __func__, (
char *)p_ctx->
fw_rev);
12675 uint32_t ctu, i, j;
12679 int importanceLevelCentre = p_param->
roi_demo_mode == 1 ? 40 : 10;
12680 int importanceLevelRest = p_param->
roi_demo_mode == 1 ? 10 : 40;
12685 uint32_t block_size, max_cu_size, customMapSize;
12689 uint32_t roiMapBlockUnitSize;
12690 uint32_t entryPerMb;
12696 linesize_aligned = (linesize_aligned / 8) * 8;
12697 height_aligned = (height_aligned / 8) * 8;
12703 ((linesize_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) *
12704 ((height_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) /
12708 customMapSize = ((block_size + 63) & (~63));
12724 ((linesize_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) /
12725 roiMapBlockUnitSize;
12727 ((height_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) /
12728 roiMapBlockUnitSize;
12729 numMbs = mbWidth * mbHeight;
12733 entryPerMb = (roiMapBlockUnitSize / 8) * (roiMapBlockUnitSize / 8);
12735 for (i = 0; i < numMbs; i++)
12737 bool bIsCenter = (i % mbWidth > mbWidth / 3) && (i % mbWidth < mbWidth * 2 / 3);
12738 for (j = 0; j < entryPerMb; j++)
12748 p_enc_ctx->
roi_map[i * entryPerMb + j]
12751 bIsCenter ? importanceLevelCentre : importanceLevelRest;
12753 sumQp += p_enc_ctx->
roi_map[(ptrdiff_t)i * entryPerMb].field.
qp_info;
12755 p_enc_ctx->
roi_len = customMapSize;
12757 (numMbs > 0) ? (sumQp + (numMbs >> 1)) / numMbs : 0;
12765 uint32_t mbWidth = (linesize_aligned + 16 - 1) >> 4;
12767 uint32_t mbHeight = (height_aligned + 16 - 1) >> 4;
12768 uint32_t numMbs = mbWidth * mbHeight;
12769 uint32_t customMapSize =
12779 for (i = 0; i < numMbs; i++)
12781 if ((i % mbWidth > mbWidth / 3) && (i % mbWidth < mbWidth * 2 / 3))
12791 p_enc_ctx->
roi_len = customMapSize;
12793 (numMbs > 0) ? (sumQp + (numMbs >> 1)) / numMbs : 0;
12801 uint32_t ctuWidth = (linesize_aligned + 64 - 1) >> 6;
12803 uint32_t ctuHeight = (height_aligned + 64 - 1) >> 6;
12805 uint32_t subCtuWidth = ctuWidth * 2;
12807 uint32_t subCtuHeight = ctuHeight * 2;
12808 uint32_t numSubCtus = subCtuWidth * subCtuHeight;
12815 for (i = 0; i < numSubCtus; i++)
12817 if ((i % subCtuWidth > subCtuWidth / 3) &&
12818 (i % subCtuWidth < subCtuWidth * 2 / 3))
12834 for (i = 0; i < ctuHeight; i++)
12837 for (j = 0; j < ctuWidth; j++, ptr += 2)
12839 ctu = (i * ctuWidth + j);
12843 *(ptr + subCtuWidth);
12845 *(ptr + subCtuWidth + 1);
12855 (numSubCtus > 0) ? (sumQp + (numSubCtus >> 1)) / numSubCtus : 0;
12885 *((int32_t *)aux_data->
data) =
12907 int32_t intraprd = *((int32_t *)aux_data->
data) =
12910 "xcoder_send_frame: frame #%lu reconf "
12911 "intraPeriod %d\n",
12945 "xcoder_send_frame: frame #%lu reconf "
12946 "vui colorDescPresent %d colorPrimaries %d "
12947 "colorTrc %d colorSpace %d aspectRatioWidth %d "
12948 "aspectRatioHeight %d videoFullRange %d\n",
12979 "xcoder_send_frame: frame #%lu metadata "
12980 "use_cur_src_as_long_term_pic %d use_long_term_ref "
13020 *((int32_t *)aux_data->
data) =
13023 "xcoder_send_frame: frame #%lu reconf "
13024 "ltrInterval %d\n",
13041 *((int32_t *)aux_data->
data) =
13044 "xcoder_send_frame: frame #%lu reconf "
13045 "invalidFrameNum %d\n",
13071 "xcoder_send_frame: frame #%lu reconf "
13072 "framerate (%d/%d)\n",
13086 *((int32_t *)aux_data->
data) =
13089 "xcoder_send_frame: frame #%lu reconf "
13090 "maxFrameSize %d\n",
13105 *((int32_t *)aux_data->
data) =
13108 "xcoder_send_frame: frame #%lu reconf "
13126 *((
float *)aux_data->
data) = crf;
13128 "xcoder_send_frame: frame #%lu reconf "
13140 if ((vbvBufferSize < 10 && vbvBufferSize != 0) || vbvBufferSize > 3000)
13143 __func__, vbvBufferSize);
13146 if (p_param->
bitrate > 0 && vbvMaxRate > 0 && vbvMaxRate < p_param->bitrate) {
13148 vbvMaxRate, p_param->
bitrate);
13151 if (vbvBufferSize == 0 && vbvMaxRate > 0) {
13153 "vbvBufferSize is 0, force vbvMaxRate to 0\n",
13163 *((int32_t *)aux_data->
data) = vbvMaxRate;
13169 *((int32_t *)aux_data->
data) = vbvBufferSize;
13171 "xcoder_send_frame: frame #%lu reconfig vbvMaxRate %d vbvBufferSize "
13172 "%d by frame aux data\n",
13173 p_enc_ctx->
frame_num, vbvMaxRate, vbvBufferSize);
13182 if (maxFrameSizeRatio < 1) {
13184 maxFrameSizeRatio);
13193 int32_t bitrate, framerate_num, framerate_denom;
13194 uint32_t min_maxFrameSize, maxFrameSize;
13204 framerate_num = (int32_t) p_param->
fps_number;
13208 min_maxFrameSize = ((uint32_t)bitrate / framerate_num * framerate_denom) / 8;
13211 *((int32_t *)aux_data->
data) = (int32_t)maxFrameSize;
13213 "xcoder_send_frame: frame #%lu reconf "
13214 "maxFrameSizeRatio %d maxFrameSize %d\n",
13215 p_enc_ctx->
frame_num, maxFrameSizeRatio, maxFrameSize);
13228 *((int16_t *)aux_data->
data) =
13231 "xcoder_send_frame: frame #%lu reconf "
13245 "xcoder_send_frame: frame #%lu force IDR frame\n",
13261 "xcoder_send_frame: frame #%lu API reconfig BR %d\n",
13278 "xcoder_send_frame: frame #%lu API reconfig intraPeriod %d\n",
13308 "xcoder_send_frame: frame #%lu reconf "
13309 "vui colorDescPresent %d colorPrimaries %d "
13310 "colorTrc %d colorSpace %d aspectRatioWidth %d "
13311 "aspectRatioHeight %d videoFullRange %d\n",
13333 "xcoder_send_frame(): frame #%lu API set LTR\n",
13353 "%s(): frame %d minQpI %d maxQpI %d maxDeltaQp %d minQpPB %d maxQpPB %d\n",
13369 "xcoder_send_frame(): frame #%lu API set LTR interval %d\n",
13385 "xcoder_send_frame(): frame #%lu API set frame ref invalid "
13405 "xcoder_send_frame: frame #%lu API reconfig framerate "
13423 "xcoder_send_frame: frame #%lu API reconfig maxFrameSize %d\n",
13439 "xcoder_send_frame: frame #%lu API reconfig crf %d\n",
13456 "xcoder_send_frame: frame #%lu API reconfig crf %f\n",
13472 "xcoder_send_frame: frame #%lu API reconfig vbvMaxRate %d vbvBufferSize %d\n",
13490 "xcoder_send_frame: frame #%lu reconf maxFrameSizeRatio %d\n",
13505 "xcoder_send_frame: frame #%lu API reconfig sliceArg %d\n",
13523static int ni_tolower(
int c)
13525 if (c >=
'A' && c <=
'Z')
13535 c1 = ni_tolower(*a++);
13536 c2 = ni_tolower(*b++);
13537 }
while (c1 && c1 == c2);
13689 "g%drefPic%d specified without g%drefPic%dUsed specified!\n",
13707#ifndef DEPRECATION_AS_ERROR
13721 uint64_t ui64DestAddr,
13722 uint32_t ui32FrameSize)
13727 (void) ui64DestAddr;
13728 (void) ui32FrameSize;
13734#ifndef DEPRECATION_AS_ERROR
13748 uint64_t ui64DestAddr, uint32_t ui32FrameSize)
13753 (void) ui64DestAddr;
13754 (void) ui32FrameSize;
13782 if ((pSession == NULL) || (dmaAddrs == NULL) || (pSrcFrame == NULL))
13791 "%s: FW doesn't support this operation\n", __func__);
13798 ni_log2(pSession,
NI_LOG_ERROR,
"%s(): Can't DMA to destination (%d)\n", __func__, retval);
13826 if ((pSession == NULL) || (dmaAddrs == NULL) || (pDstFrame == NULL))
13835 "%s: FW doesn't support this operation\n", __func__);
13844 "%s(): Can't DMA from source (%d)\n", __func__, retval);
13883 switch (device_type)
13891 ni_log2(p_ctx,
NI_LOG_ERROR,
"Error: %s function not supported on device with FW API version < 5.4\n", __func__);
13903 if (video_width < NI_MIN_WIDTH || video_width >
NI_MAX_WIDTH ||
13904 video_height < NI_MIN_HEIGHT || video_height >
NI_MAX_HEIGHT)
13907 __func__, video_width, video_height);
13910 resolution.
width = video_width;
13911 resolution.
height = video_height;
13927 ni_log(
NI_LOG_ERROR,
"Failed to reconfig config the encoder session (status = %d)\n", retval);
13943 __func__, device_type);
13962 int ret = 0, i = 0;
13963 if (!p_session_ctx || !p_param || !p_ppu_config)
13970 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s: Warning ignore ppu reconfig before last config done!\n", __func__);
13979 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s: not supported on device with FW API version < 6sF\n", __func__);
13986 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): only supported for h264 and h265 decoder\n", __func__);
13991 if (p_dec_input_param->
hwframes != 1)
13998 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): not supported when disable_adaptive_buffers is disabled\n", __func__);
14001 if (p_dec_input_param->
mcmode)
14003 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): not supported when MulticoreJointMode is enabled\n", __func__);
14009 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): Error reconfig ppu1 while ppu1 is not enabled\n", __func__);
14015 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): Error reconfig ppu2 while ppu2 is not enabled\n", __func__);
14028 "out of range\n", __func__, i, p_ppu_config->
ppu_w[i], p_ppu_config->
ppu_h[i]);
14032 if ((p_ppu_config->
ppu_w[i] & 1) || (p_ppu_config->
ppu_h[i] & 1))
14035 __func__, i, p_ppu_config->
ppu_w[i], p_ppu_config->
ppu_h[i]);
14061 t = (((12.0 - 9.0 * B - 6.0 * C) * (t * tt))
14062 + ((-18.0 + 12.0 * B + 6.0 * C) * tt)
14064 return (
float)(t / 6.0);
14068 t = (((-1.0 * B - 6.0 * C) * (t * tt))
14069 + ((6.0 * B + 30.0 * C) * tt)
14070 + ((-12.0 * B - 48.0 * C) * t)
14071 + (8.0 * B + 24 * C));
14072 return (
float)(t / 6.0);
14079 if (!p_session_ctx)
14088 uint16_t kernel_array[],
int kernel_taps,
double param_b,
14089 double param_c,
int SrcSize,
int DstSize)
14093 float fSubpixelStep;
14096 float fSubpixelOffset;
14098 if (!p_session_ctx)
14106 "ni_scaler_build_kernel: scaler_coeff_fn is NULL\n");
14112 "ni_scaler_build_kernel: kernel_taps=%d out of range [1, %d]\n",
14121 memset(kernel_array, 0,
14125 kernelHalf = kernel_taps >> 1;
14128 fSubpixelStep = (float)(1.0f / 32.0f);
14130 fSubpixelOffset = 0.5f;
14133 float fSubpixelSet[9] = {0.0f};
14136 float fWeightSum = 0.0f;
14137 uint16_t weightSum = 0;
14138 int16_t adjustCount, adjustFrom;
14139 int16_t adjustment;
14141 int16_t underCnt=0;
14144 int index = kernelPos - padding;
14146 if ((index < 0) || (index >= kernel_taps))
14148 fSubpixelSet[kernelPos] = 0.0f;
14152 float fX = ((float)(index - kernelHalf ) + fSubpixelOffset);
14153 fSubpixelSet[kernelPos] =
14155 kernel_taps, (
float)fX, param_b, param_c);
14158 fWeightSum = fWeightSum + fSubpixelSet[kernelPos];
14164 float fWeight = fSubpixelSet[kernelPos] / fWeightSum;
14167 if (fWeight == 0.0f)
14169 kernel_array[kernelPos +
offset] = 0x0000;
14171 else if (fWeight >= 1.0f)
14173 kernel_array[kernelPos +
offset] = 0x4000;
14176 else if (fWeight <= -1.0f)
14178 kernel_array[kernelPos +
offset] = 0xC000;
14183 kernel_array[kernelPos +
offset] = (int16_t) (fWeight * 16384.0f);
14186 weightSum += kernel_array[kernelPos +
offset];
14190 adjustCount = (int16_t)(0x4000 - weightSum);
14191 if (adjustCount < 0)
14193 adjustCount = (int16_t)(-adjustCount);
14201 if (adjustCount < kernel_taps)
14204 for (kernelPos = 0; kernelPos < adjustCount; kernelPos++)
14206 kernel_array[adjustFrom + kernelPos +
offset] += adjustment;
14212 adjustment = (int16_t)((0x4000 - weightSum) / (kernel_taps - overCnt - underCnt));
14214 for (kernelPos = 0; kernelPos < kernel_taps; kernelPos++)
14216 if (kernel_array[adjustFrom+kernelPos +
offset] != 0x4000 &&
14217 kernel_array[adjustFrom+kernelPos +
offset] != 0xC000)
14219 kernel_array[adjustFrom + kernelPos +
offset] += adjustment;
14221 weightSum += kernel_array[adjustFrom + kernelPos +
offset];
14225 fSubpixelOffset = fSubpixelOffset - fSubpixelStep;
#define NI_MAX_FILTER_POOL_SIZE
#define NI_XCODER_REVISION_API_MAJOR_VER_IDX
#define NI_MAX_NUM_SW_FRAME_DATA_POINTERS
#define NI_MAX_NUM_DATA_POINTERS
#define NI_INVALID_IO_SIZE
#define NI_APP_ENC_FRAME_META_DATA_SIZE
#define NI_MAX_NUM_OF_DECODER_OUTPUTS
#define NI_MAX_UPLOAD_INSTANCE_FRAMEPOOL
@ NI_SCALER_OPCODE_OVERLAY
@ NI_SCALER_OPCODE_WATERMARK
#define NI_MEM_PAGE_ALIGNMENT
#define TOTAL_CPU_LOG_BUFFER_SIZE
#define NI_FW_META_DATA_SZ
@ NI_RETCODE_ERROR_LOCK_DOWN_DEVICE
@ NI_RETCODE_PARAM_WARNING_DEPRECATED
@ NI_RETCODE_PARAM_ERROR_HEIGHT_TOO_BIG
@ NI_RETCODE_PARAM_ERROR_ZERO
@ NI_RETCODE_ERROR_PERMISSION_DENIED
@ NI_RETCODE_ERROR_INVALID_SESSION
@ NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
@ NI_RETCODE_ERROR_GET_DEVICE_POOL
@ NI_RETCODE_ERROR_UNLOCK_DEVICE
@ NI_RETCODE_PARAM_INVALID_NAME
@ NI_RETCODE_PARAM_ERROR_AREA_TOO_BIG
@ NI_RETCODE_PARAM_ERROR_HEIGHT_TOO_SMALL
@ NI_RETCODE_ERROR_INVALID_HANDLE
@ NI_RETCODE_PARAM_ERROR_TOO_BIG
@ NI_RETCODE_PARAM_INVALID_VALUE
@ NI_RETCODE_PARAM_ERROR_WIDTH_TOO_BIG
@ NI_RETCODE_ERROR_NVME_CMD_FAILED
@ NI_RETCODE_ERROR_MEM_ALOC
@ NI_RETCODE_ERROR_UNSUPPORTED_FEATURE
@ NI_RETCODE_PARAM_ERROR_OOR
@ NI_RETCODE_PARAM_ERROR_WIDTH_TOO_SMALL
@ NI_RETCODE_INVALID_PARAM
@ NI_RETCODE_PARAM_ERROR_TOO_SMALL
@ NI_RETCODE_ERROR_OPEN_DEVICE
#define NI_MAX_PPU_PARAM_EXPR_CHAR
#define IS_XCODER_DEVICE_TYPE(t)
ni_retcode_t ni_p2p_recv(ni_session_context_t *pSession, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame)
Initiate a P2P transfer (P2P read)
ni_retcode_t ni_ai_config_network_binary(ni_session_context_t *p_ctx, ni_network_data_t *p_network, const char *file)
configure a network context based with the network binary
ni_retcode_t ni_frame_buffer_alloc_dl(ni_frame_t *p_frame, int video_width, int video_height, int pixel_format)
Allocate preliminary memory for the frame buffer based on provided parameters.
ni_retcode_t ni_device_session_flush(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Send a flush command to the device If device_type is NI_DEVICE_TYPE_DECODER sends EOS command to deco...
ni_aux_data_t * ni_frame_new_aux_data(ni_frame_t *frame, ni_aux_data_type_t type, int data_size)
Add a new auxiliary data to a frame.
const char *const g_xcoder_log_names[NI_XCODER_LOG_NAMES_ARRAY_LEN]
void ni_gop_params_check_set(ni_xcoder_params_t *p_param, char *value)
Set custom gop and prepare to check if success.
ni_retcode_t ni_reconfig_max_frame_size_ratio(ni_session_context_t *p_ctx, int32_t max_frame_size_ratio)
Reconfigure maxFrameSizeRatio dynamically during encoding.
#define COMPARE(STR1, STR2, STR3)
ni_retcode_t ni_ai_config_hvsplus(ni_session_context_t *p_ctx, ni_network_data_t *p_network)
configure a hvsplus filter
NI_DEPRECATED ni_device_handle_t ni_device_open(const char *p_dev, uint32_t *p_max_io_size_out)
Open device and return device device_handle if successful.
void ni_frame_free_aux_data(ni_frame_t *frame, ni_aux_data_type_t type)
If auxiliary data of the given type exists in the frame, free it and remove it from the frame.
float ni_bicubic_coeff_default(int filtersize, double offset, double B, double C)
ni_retcode_t ni_uploader_p2p_test_load(ni_session_context_t *p_upl_ctx, uint8_t *p_data, uint32_t len, ni_frame_t *p_hwframe)
Special P2P test API function. Copies video data from the software frame to the hardware P2P frame on...
ni_retcode_t ni_encoder_frame_zerocopy_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, const int linesize[], const uint8_t *data[], int extra_len)
Allocate memory for encoder zero copy (metadata, etc.) for encoding based on given parameters,...
void ni_frame_wipe_aux_data(ni_frame_t *frame)
Free and remove all auxiliary data from the frame.
int ni_calculate_total_frame_size(const ni_session_context_t *p_upl_ctx, const int linesize[])
Calculate the total size of a frame based on the upload context attributes and includes rounding up t...
ni_retcode_t ni_decoder_params_set_value(ni_xcoder_params_t *p_params, const char *name, char *value)
Set value referenced by name in decoder parameters structure.
ni_retcode_t ni_reconfig_intraprd(ni_session_context_t *p_ctx, int32_t intra_period)
Reconfigure intraPeriod dynamically during encoding.
ni_retcode_t ni_scaler_set_watermark_params(ni_session_context_t *p_ctx, ni_scaler_watermark_params_t *p_params)
Send a p_config command to configure scaling watermark parameters.
ni_retcode_t ni_dec_reconfig_ppu_params(ni_session_context_t *p_session_ctx, ni_xcoder_params_t *p_param, ni_ppu_config_t *p_ppu_config)
Send a p_config command to reconfigure decoding ppu params.
ni_retcode_t ni_frame_buffer_alloc_pixfmt(ni_frame_t *p_frame, int pixel_format, int video_width, int video_height, int linesize[], int alignment, int extra_len)
Allocate memory for the frame buffer based on provided parameters taking into account the pixel forma...
ni_retcode_t ni_query_nvme_status(ni_session_context_t *p_ctx, ni_load_query_t *p_load_query)
Query NVMe load from the device.
ni_retcode_t ni_frame_buffer_alloc_nv(ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int extra_len, bool alignment_2pass_wa)
Allocate memory for the frame buffer based on provided parameters taking into account pic line size a...
ni_retcode_t ni_frame_buffer_free(ni_frame_t *p_frame)
Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame...
int ni_packet_copy(void *p_destination, const void *const p_source, int cur_size, void *p_leftover, int *p_prev_size)
Copy video packet accounting for alignment.
ni_retcode_t ni_scaler_p2p_frame_acquire(ni_session_context_t *p_ctx, niFrameSurface1_t *p_surface, int data_len)
Acquire the scaler P2P DMA buffer for read/write.
ni_retcode_t ni_ai_frame_buffer_alloc(ni_frame_t *p_frame, ni_network_data_t *p_network)
Allocate input layers memory for AI frame buffer based on provided parameters taking into account wid...
void ni_device_session_context_free(ni_session_context_t *p_ctx)
Free previously allocated session context.
int ni_device_session_hwdl(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, niFrameSurface1_t *hwdesc)
Reads YUV data from hw descriptor stored location on device.
ni_retcode_t ni_device_config_qos_op(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t over_provision)
Send qos over provisioning mode to target namespace with specified logic block address.
int ni_strcasecmp(const char *a, const char *b)
ni_retcode_t ni_frame_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar)
Allocate preliminary memory for the frame buffer based on provided parameters. Applicable to YUV420 P...
ni_retcode_t ni_scaler_frame_pool_alloc(ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params)
init output pool of scaler frames
ni_retcode_t ni_scaler_set_drawbox_params(ni_session_context_t *p_ctx, ni_scaler_drawbox_params_t *p_params)
Send a p_config command to configure scaling drawbox parameters.
ni_retcode_t ni_device_clone_hwframe(ni_session_context_t *p_ctx, ni_frameclone_desc_t *p_frameclone_desc)
Copy the data of src hwframe to dst hwframe.
ni_retcode_t ni_ai_session_read_metrics(ni_session_context_t *p_ctx, ni_network_perf_metrics_t *p_metrics)
Fetch perf metrics of inferences from device.
ni_retcode_t ni_device_session_close(ni_session_context_t *p_ctx, int eos_recieved, ni_device_type_t device_type)
Close device session that was previously opened by calling ni_device_session_open() If device_type is...
NI_DEPRECATED ni_retcode_t ni_device_capability_query(ni_device_handle_t device_handle, ni_device_capability_t *p_cap)
Query device and return device capability structure This function had been replaced by ni_device_capa...
ni_retcode_t ni_device_session_open(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Open a new device session depending on the device_type parameter If device_type is NI_DEVICE_TYPE_DEC...
ni_event_handle_t ni_create_event(void)
Create event and return event handle if successful (Windows only)
#define OPT6(STR1, STR2, STR3, STR4, STR5, STR6)
ni_retcode_t ni_parse_customize_qpoffset_file(const char *customize_file, int8_t qp_map[][NI_CUSTOMIZE_ROI_QP_NUM])
ni_retcode_t ni_encoder_set_input_frame_format(ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params, int width, int height, int bit_depth, int src_endian, int planar)
Set the incoming frame format for the encoder.
void ni_decoder_frame_buffer_pool_return_buf(ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool)
Return a memory buffer to memory buffer pool.
ni_retcode_t ni_packet_buffer_free(ni_packet_t *p_packet)
Free packet buffer that was previously allocated with ni_packet_buffer_alloc.
int ni_device_session_hwup(ni_session_context_t *p_ctx, ni_session_data_io_t *p_src_data, niFrameSurface1_t *hwdesc)
Sends raw YUV input to uploader instance and retrieves a HW descriptor to represent it.
ni_retcode_t ni_p2p_send_v2(ni_session_context_t *pSession, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs)
Initiate P2P transfer with sgl list (P2P write)
ni_retcode_t ni_kernel_set_callback(ni_session_context_t *p_session_ctx, ni_kernel_coeff_fn fn)
Replace the kernel coefficient callback.
ni_retcode_t ni_encoder_frame_zerocopy_check(ni_session_context_t *p_enc_ctx, ni_xcoder_params_t *p_enc_params, int width, int height, const int linesize[], bool set_linesize)
Check if incoming frame is encoder zero copy compatible or not.
ni_retcode_t ni_hwframe_p2p_buffer_recycle(ni_frame_t *p_frame)
Recycle hw P2P frames.
ni_retcode_t ni_query_fl_fw_versions(ni_device_handle_t device_handle, ni_device_info_t *p_dev_info)
Query firmware loader and firmware versions from the device.
ni_retcode_t ni_encoder_init_default_params(ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height, ni_codec_format_t codec_format)
Initialize default encoder parameters.
ni_retcode_t ni_device_alloc_and_get_fw_log_artifacts(ni_session_context_t *p_ctx, bool gen_artifacts_file)
Read log artifacts from the device and save to disk.
ni_retcode_t ni_device_config_qos_allowance(ni_device_handle_t device_handle, ni_device_handle_t device_handle_t, uint32_t allowance)
Set QoS allowance for a specific namespace.
ni_retcode_t ni_uploader_p2p_test_send(ni_session_context_t *p_upl_ctx, uint8_t *p_data, uint32_t len, ni_frame_t *p_hwframe)
Special P2P test API function. Copies YUV data from the software frame to the hardware P2P frame on t...
int ni_device_session_read(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t device_type)
Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data packet from decoder If ...
ni_retcode_t ni_device_capability_query2(ni_device_handle_t device_handle, ni_device_capability_t *p_cap, bool device_in_ctxt)
Query device and return device capability structure This function had replaced ni_device_capability_q...
ni_retcode_t ni_uploader_frame_buffer_unlock(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Unlock a hardware P2P frame after encoding.
ni_retcode_t ni_scaler_dest_frame_alloc(ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params, niFrameSurface1_t *p_surface)
allocate device destination frame from scaler hwframe pool
ni_retcode_t ni_set_ltr(ni_session_context_t *p_ctx, ni_long_term_ref_t *ltr)
Set a frame's support of Long Term Reference frame during encoding.
ni_retcode_t ni_hwframe_buffer_recycle2(niFrameSurface1_t *surface)
Recycle a frame buffer on card, only hwframe descriptor is needed.
ni_retcode_t ni_device_session_query(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Query session data from the device - If device_type is valid, will query session data from specified ...
ni_retcode_t ni_hwframe_buffer_recycle(niFrameSurface1_t *surface, int32_t device_handle)
Recycle a frame buffer on card.
ni_retcode_t ni_device_session_copy(ni_session_context_t *src_p_ctx, ni_session_context_t *dst_p_ctx)
Copy existing decoding session params for hw frame usage.
ni_session_context_t * ni_device_session_context_alloc_init(void)
Allocate and initialize a new ni_session_context_t struct.
ni_retcode_t ni_reconfig_max_frame_size(ni_session_context_t *p_ctx, int32_t max_frame_size)
Reconfigure maxFrameSize dynamically during encoding.
ni_retcode_t ni_device_session_sequence_change(ni_session_context_t *p_ctx, int width, int height, int bit_depth_factor, ni_device_type_t device_type)
Send sequence change information to device.
ni_retcode_t ni_device_session_query_detail_v1(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_v1_t *detail_data)
Query detail session data from the device - If device_type is valid, will query session data from spe...
bool ni_gop_params_check(ni_xcoder_params_t *p_param)
Check custom gop params set.
int ni_device_session_acquire(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Acquire a P2P frame buffer from the hwupload session.
ni_retcode_t ni_query_vf_ns_id(ni_device_handle_t device_handle, ni_device_vf_ns_id_t *p_dev_ns_vf, uint8_t fw_rev[])
Query VF and NS id from device.
ni_retcode_t ni_set_ltr_interval(ni_session_context_t *p_ctx, int32_t ltr_interval)
Set Long Term Reference interval.
int ni_encoder_session_read_stream_header(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data)
Read encoder stream header from the device.
ni_retcode_t ni_uploader_set_frame_format(ni_session_context_t *p_upl_ctx, int width, int height, ni_pix_fmt_t pixel_format, int isP2P)
Set the outgoing frame format for the uploader.
ni_retcode_t ni_ai_packet_buffer_alloc(ni_packet_t *p_packet, ni_network_data_t *p_network)
Allocate output layers memory for the packet buffer based on provided network.
ni_retcode_t ni_reconfig_min_max_qp(ni_session_context_t *p_ctx, ni_rc_min_max_qp *p_min_max_qp)
Reconfigure min&max qp dynamically during encoding.
ni_aux_data_t * ni_frame_get_aux_data(const ni_frame_t *frame, ni_aux_data_type_t type)
Retrieve from the frame auxiliary data of a given type if exists.
ni_retcode_t ni_device_session_context_init(ni_session_context_t *p_ctx)
Initialize already allocated session context to a known state.
ni_retcode_t ni_force_idr_frame_type(ni_session_context_t *p_ctx)
Force next frame to be IDR frame during encoding.
ni_retcode_t ni_reconfig_framerate(ni_session_context_t *p_ctx, ni_framerate_t *framerate)
Reconfigure framerate dynamically during encoding.
ni_retcode_t ni_device_dec_session_flush(ni_session_context_t *p_ctx)
Flush a decoder session to get ready to continue decoding. Note: this is different from ni_device_ses...
ni_retcode_t ni_device_session_query_detail(ni_session_context_t *p_ctx, ni_device_type_t device_type, ni_instance_mgr_detail_status_t *detail_data)
Query detail session data from the device - If device_type is valid, will query session data from spe...
ni_retcode_t ni_decoder_init_default_params(ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height)
Initialize default decoder parameters.
ni_retcode_t ni_reconfig_crf(ni_session_context_t *p_ctx, int32_t crf)
Reconfigure crf value dynamically during encoding.
ni_retcode_t ni_scaler_input_frame_alloc(ni_session_context_t *p_ctx, ni_scaler_input_params_t scaler_params, niFrameSurface1_t *p_src_surface)
allocate device input frame by hw descriptor. This call won't actually allocate a frame but sends the...
ni_retcode_t ni_enc_prep_reconf_demo_data(ni_session_context_t *p_enc_ctx, ni_frame_t *p_frame)
Convert various reconfig and demo modes (stored in encoder configuration) to aux data and store them ...
NI_DEPRECATED ni_retcode_t ni_p2p_send(ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
Initiate P2P transfer (P2P write) (deprecated)
ni_aux_data_t * ni_frame_new_aux_data_from_raw_data(ni_frame_t *frame, ni_aux_data_type_t type, const uint8_t *raw_data, int data_size)
Add a new auxiliary data to a frame and copy in the raw data.
ni_retcode_t ni_uploader_frame_zerocopy_check(ni_session_context_t *p_upl_ctx, int width, int height, const int linesize[], int pixel_format)
Check if incoming frame is hwupload zero copy compatible or not.
ni_retcode_t ni_device_session_restart(ni_session_context_t *p_ctx, int video_width, int video_height, ni_device_type_t device_type)
Send a restart command after flush command Only support Encoder now.
const char *const g_xcoder_preset_names[NI_XCODER_PRESET_NAMES_ARRAY_LEN]
void ni_close_event(ni_event_handle_t event_handle)
Close event and release resources (Windows only)
ni_retcode_t ni_device_alloc_frame(ni_session_context_t *p_ctx, int width, int height, int format, int options, int rectangle_width, int rectangle_height, int rectangle_x, int rectangle_y, int rgba_color, int frame_index, ni_device_type_t device_type)
Allocate a frame on the device for 2D engine or AI engine to work on based on provided parameters.
ni_retcode_t ni_reconfig_vbv_value(ni_session_context_t *p_ctx, int32_t vbvMaxRate, int32_t vbvBufferSize)
Reconfigure vbv buffer size and vbv max rate dynamically during encoding.
ni_retcode_t ni_device_alloc_dst_frame(ni_session_context_t *p_ctx, niFrameSurface1_t *p_out_surface, ni_device_type_t device_type)
Allocate a frame on the device and return the frame index.
ni_retcode_t ni_device_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t *p_cfg)
Configure the 2D engine to work based on provided parameters.
NI_DEPRECATED ni_retcode_t ni_p2p_xfer(ni_session_context_t *pSession, niFrameSurface1_t *source, uint64_t ui64DestAddr, uint32_t ui32FrameSize)
Initiate P2P transfer (P2P write) (deprecated)
int ni_device_session_acquire_for_read(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Acquire a P2P frame buffer from the hwupload session for P2P read.
ni_retcode_t ni_reconfig_crf2(ni_session_context_t *p_ctx, float crf)
Reconfigure crf float point value dynamically during encoding.
ni_retcode_t ni_device_session_update_framepool(ni_session_context_t *p_ctx, uint32_t pool_size)
Sends frame pool change info to device.
ni_retcode_t ni_scaler_build_kernel(ni_session_context_t *p_session_ctx, uint16_t kernel_array[], int kernel_taps, double param_b, double param_c, int SrcSize, int DstSize)
Build scaler kernal array.
int32_t ni_get_dma_buf_file_descriptor(const ni_frame_t *p_frame)
Get the DMA buffer file descriptor from the P2P frame.
ni_retcode_t ni_set_demo_roi_map(ni_session_context_t *p_enc_ctx)
Set up hard coded demo ROI map.
ni_retcode_t ni_set_frame_ref_invalid(ni_session_context_t *p_ctx, int32_t frame_num)
Set frame reference invalidation.
void ni_device_close(ni_device_handle_t device_handle)
Close device and release resources.
ni_retcode_t ni_query_qos_info(ni_device_handle_t device_handle, ni_qos_header_info_log_page_t *p_dev_qos_header, uint8_t fw_rev[])
Query QoS information for the device.
ni_retcode_t ni_device_alloc_and_get_firmware_logs(ni_session_context_t *p_ctx, void **p_log_buffer, bool gen_log_file)
Allocate log buffer if needed and retrieve firmware logs from device.
ni_retcode_t ni_encoder_params_set_value(ni_xcoder_params_t *p_params, const char *name, const char *value)
Set value referenced by name in encoder parameters structure.
int ni_device_session_init_framepool(ni_session_context_t *p_ctx, uint32_t pool_size, uint32_t pool)
Sends frame pool setup info to device.
ni_retcode_t ni_encoder_gop_params_set_value(ni_xcoder_params_t *p_params, const char *name, const char *value)
Set GOP parameter value referenced by name in encoder parameters structure.
ni_retcode_t ni_device_config_namespace_num(ni_device_handle_t device_handle, uint32_t namespace_num, uint32_t sriov_index)
Send namespace num and SRIOv index to the device with specified logic block address.
ni_retcode_t ni_frame_buffer_alloc_hwenc(ni_frame_t *p_frame, int video_width, int video_height, int extra_len)
Allocate memory for the hwDescriptor buffer based on provided parameters taking into account pic size...
ni_retcode_t ni_decoder_frame_buffer_alloc(ni_buf_pool_t *p_pool, ni_frame_t *p_frame, int alloc_mem, int video_width, int video_height, int alignment, int factor, int is_planar)
Allocate memory for decoder frame buffer based on provided parameters; the memory is retrieved from a...
ni_retcode_t ni_enc_frame_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, int alignment, int metadata_flag, int factor, int hw_frame_count, int is_planar, ni_pix_fmt_t pix_fmt)
Wrapper function for ni_frame_buffer_alloc. Meant to handle RGBA min. resoulution considerations for ...
ni_retcode_t ni_reconfig_slice_arg(ni_session_context_t *p_ctx, int16_t sliceArg)
Reconfigure sliceArg dynamically during encoding.
int ni_device_session_read_hwdesc(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t device_type)
Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from decoder If ...
ni_retcode_t ni_query_extra_info(ni_device_handle_t device_handle, ni_device_extra_info_t *p_dev_extra_info, uint8_t fw_rev[])
Query CompositeTemp from device.
ni_retcode_t ni_parse_reconf_file(const char *reconf_file, int hash_map[][NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE])
ni_retcode_t ni_device_session_query_buffer_avail(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Query the session if a buffer is available.
ni_retcode_t ni_encoder_sw_frame_buffer_alloc(bool planar, ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
This API is a wrapper for ni_encoder_frame_buffer_alloc(), used for planar pixel formats,...
ni_device_handle_t ni_device_open2(const char *p_dev, ni_device_mode_t mode)
Open device and return device device_handle if successful.
ni_retcode_t ni_encoder_frame_zerocopy_adjust(ni_session_context_t *p_enc_ctx, ni_frame_t *p_frame, int video_height, const int linesize[], const uint8_t *data[], int buf_size0, int buf_size1, int buf_size2, uint8_t *buf_data0, uint8_t *buf_data1, uint8_t *buf_data2)
Check if the frame data transferred is within a frame boundary and adjust with offset if it doesn't....
ni_retcode_t ni_packet_buffer_alloc(ni_packet_t *p_packet, int packet_size)
Allocate memory for the packet buffer based on provided packet size.
ni_retcode_t ni_custom_packet_buffer_alloc(void *p_buffer, ni_packet_t *p_packet, int buffer_size)
Allocate packet buffer using a user provided pointer, the memory is expected to have already been all...
ni_retcode_t ni_scaler_set_params(ni_session_context_t *p_ctx, ni_scaler_params_t *p_params)
Set parameters on the device for the 2D engine.
ni_retcode_t ni_device_dec_session_save_hdrs(ni_session_context_t *p_ctx, uint8_t *hdr_data, uint8_t hdr_size)
Save a stream's headers in a decoder session that can be used later for continuous decoding from the ...
void ni_device_session_context_clear(ni_session_context_t *p_ctx)
Clear already allocated session context.
ni_retcode_t ni_device_multi_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t p_cfg_in[], int numInCfgs, ni_frame_config_t *p_cfg_out)
Configure the 2D engine to work based on provided parameters.
ni_retcode_t ni_packet_buffer_free_av1(ni_packet_t *p_packet)
Free packet buffer that was previously allocated with ni_packet_buffer_alloc for AV1 packets merge.
ni_retcode_t ni_reconfig_vui(ni_session_context_t *p_ctx, ni_vui_hrd_t *vui)
Reconfigure VUI HRD dynamically during encoding.
ni_retcode_t ni_query_temperature(ni_device_handle_t device_handle, ni_device_temp_t *p_dev_temp, uint8_t fw_rev[])
Query CompositeTemp from device.
ni_retcode_t ni_reconfig_bitrate(ni_session_context_t *p_ctx, int32_t bitrate)
Reconfigure bitrate dynamically during encoding.
ni_retcode_t ni_encoder_frame_buffer_alloc(ni_frame_t *p_frame, int video_width, int video_height, int linesize[], int alignment, int extra_len, bool alignment_2pass_wa)
Allocate memory for the frame buffer for encoding based on given parameters, taking into account pic ...
#define GBRWLPARSE(OUT1, OUT2, OFF, IDX)
ni_retcode_t ni_query_qos_namespace_info(ni_device_handle_t device_handle, ni_qos_namespace_info_log_page_t *p_dev_qos_ns, uint8_t fw_rev[])
Query QoS information for a specific namespace.
int ni_device_session_write(ni_session_context_t *p_ctx, ni_session_data_io_t *p_data, ni_device_type_t device_type)
Sends data to the device If device_type is NI_DEVICE_TYPE_DECODER sends data packet to decoder If dev...
ni_retcode_t ni_uploader_frame_buffer_lock(ni_session_context_t *p_upl_ctx, ni_frame_t *p_frame)
Lock a hardware P2P frame prior to encoding.
ni_retcode_t ni_device_config_qos(ni_device_handle_t device_handle, uint32_t mode)
Send qos mode to the device with specified logic block address.
ni_retcode_t ni_decoder_frame_buffer_free(ni_frame_t *p_frame)
Free decoder frame buffer that was previously allocated with ni_decoder_frame_buffer_alloc,...
Public definitions for operating NETINT video processing devices for video processing.
#define NI_PARAM_AV1_MIN_WIDTH
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1_USED
#define NI_ENC_PARAM_PASS1_QP
#define NI_ENC_PARAM_PSNR_INTERVAL
#define NI_ENC_PARAM_RDO_QUANT
#define NI_DEC_PARAM_CROP_PARAM_1
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2
@ SESSION_RUN_STATE_NORMAL
@ SESSION_RUN_STATE_SEQ_CHANGE_DRAINING
@ SESSION_RUN_STATE_FLUSHING
struct _ni_scaler_multi_drawbox_params_t ni_scaler_multi_drawbox_params_t
#define NI_PARAM_MIN_WIDTH
#define NI_DEC_PARAM_DISABLE_REORDER
#define NI_ENC_PARAM_GOP_SIZE
#define NI_ENC_PARAM_DECODING_REFRESH_TYPE
#define NI_ENC_PARAM_INTRA_REFRESH_MODE
#define NI_MIN_CU_SIZE_MODE
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0
#define NI_ENC_PARAM_DISABLE_AV1_TIMING_INFO
#define NI_DEC_PARAM_SCALE_0
#define NI_PARAM_MAX_HEIGHT
#define NI_DEC_PARAM_SCALE_2_W
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2_USED
#define AV_CODEC_DEFAULT_BITRATE
#define NI_ENC_PARAM_GOP_PRESET_IDX
#define NI_ENC_PARAM_MAX_FRAME_SIZE_BITS_LOW_DELAY
#define NI_FRAME_BIG_ENDIAN
#define NI_ENC_PARAM_ENABLE_2PASS_GOP
#define NI_DEC_PARAM_ENABLE_CPU_AFFINITY
#define NI_DEC_PARAM_SCALE_0_LONG_SHORT_ADAPT
#define NI_ENC_PARAM_FORCED_HEADER_ENABLE
#define NI_DEFAULT_CU_SIZE_MODE
#define NI_ENC_PARAM_STATIC_MMAP_THRESHOLD
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE_RATIO
@ XCODER_TEST_RECONF_VBV_API
@ XCODER_TEST_RECONF_FRAMERATE_API
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP_API
@ XCODER_TEST_RECONF_FRAMERATE
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE
@ XCODER_TEST_RECONF_CRF_FLOAT
@ XCODER_TEST_RECONF_LTR_INTERVAL_API
@ XCODER_TEST_RECONF_SLICE_ARG
@ XCODER_TEST_RECONF_VUI_HRD
@ XCODER_TEST_RECONF_LTR_INTERVAL
@ XCODER_TEST_RECONF_LTR_API
@ XCODER_TEST_RECONF_INTRAPRD
@ XCODER_TEST_RECONF_SLICE_ARG_API
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP
@ XCODER_TEST_CRF_FLOAT_API
@ XCODER_TEST_RECONF_VUI_HRD_API
@ XCODER_TEST_FORCE_IDR_FRAME
@ XCODER_TEST_RECONF_BR_API
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE_API
@ XCODER_TEST_RECONF_LONG_TERM_REF
@ XCODER_TEST_RECONF_MAX_FRAME_SIZE_RATIO_API
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP_REDUNDANT
@ XCODER_TEST_INVALID_REF_FRAME_API
@ XCODER_TEST_INVALID_REF_FRAME
@ XCODER_TEST_RECONF_INTRAPRD_API
@ XCODER_TEST_RECONF_RC_MIN_MAX_QP_API_REDUNDANT
#define NI_ENC_PARAM_TUNE_BFRAME_VISUAL
#define NI_ENC_PARAM_USE_RECOMMENDED_ENC_PARAMS
#define NI_ENC_PARAM_TEMPORAL_LAYERS_ENABLE
#define NI_MAX_USE_RECOMMENDED_ENC_PARAMS
#define NI_XCODER_LOG_NAME_WARN
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1_USED
#define NI_BEST_MODEL_LOAD_STR
#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_MAP
#define NI_ENC_PARAM_CONF_WIN_RIGHT
union _ni_enc_avc_roi_custom_map ni_enc_avc_roi_custom_map_t
encoder AVC ROI custom map (1 MB = 8bits)
#define NI_BITRATE_RECONFIG_FILE_MAX_LINES
Max number of lines supported for the bitrate reconfig file.
#define NI_DEC_PARAM_ENABLE_FOLLOW_IFRAME
#define NI_ENC_PARAM_CONF_WIN_LEFT
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1_USED
#define NI_ENC_PARAM_LTR_REF_INTERVAL
#define NI_MIN_MAX_NUM_MERGE
#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_MAX
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1
#define NI_ENC_PARAM_ROI_DEMO_MODE
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PICS
#define NI_DEC_PARAM_DECODER_MODE
#define NI_ENC_PARAM_PREFERRED_TRANSFER_CHARACTERISTICS
#define NI_ENC_PARAM_CPLX_DECAY
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2
#define NI_MIN_DYNAMIC_MERGE
#define NI_ENC_PARAM_MAX_DELTA_QP
#define NI_ENC_PARAM_QCOMP
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3_USED
#define NI_DEC_PARAM_ENABLE_PPU_SCALE_ADAPT
#define NI_XCODER_LOG_NAMES_ARRAY_LEN
#define NI_MAX_RESOLUTION_LINESIZE
#define NI_ENC_GOP_PARAMS_G5_PIC_TYPE
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0
#define NI_ENC_PARAM_ENABLE_CU_LEVEL_RATE_CONTROL
#define NI_ENC_PARAM_DOLBY_VISION_PROFILE
#define NI_ENC_PARAM_LTR_NEXT_INTERVAL
#define NI_DEC_PARAM_SCALE_1_ROUND
#define NI_XCODER_PRESET_NAME_MEDIUM
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PICS
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC0_USED
#define NI_ENC_PARAM_MIN_FRAMES_DELAY
#define NI_ENC_GOP_PARAMS_G3_TEMPORAL_ID
#define NI_DEC_PARAM_SCALE_0_RES_CEIL
#define NI_ENC_PARAM_MULTICORE_JOINT_MODE
#define NI_ENC_PARAM_VERTICAL_OFFSET
#define NI_ENC_PARAM_ENABLE_RATE_CONTROL
#define NI_ENC_PARAM_VIDEO_FULL_RANGE_FLAG
#define NI_ENC_PARAM_HORIZONTAL_OFFSET
#define NI_DEC_PARAM_ENABLE_ALL_SEI_PASSTHRU
#define NI_MAX_INTRA_QP_DELTA
struct _niFrameSurface1 niFrameSurface1_t
#define NI_DEC_PARAM_SCALE_1_LONG_SHORT_ADAPT
#define MOTION_CONSTRAINED_MODE_MAX
#define NI_ENC_PARAM_MAX_CONSUTIVE_SKIP_FRAME_NUMBER
#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET
#define NI_DEC_PARAM_EXTEND_POOL_SIZE
#define NI_MIN_FRAME_SIZE
#define NI_ENC_PARAM_ADAPTIVE_CUTREE
#define NI_DEC_PARAM_DISABLE_ADAPTIVE_BUFFERS
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC1
#define NI_ENC_PARAM_COLOR_PRIMARY
#define NI_DEC_PARAM_SEMI_PLANAR_1
#define NI_ENC_GOP_PARAMS_G6_PIC_TYPE
@ NI_PIXEL_PLANAR_FORMAT_SEMIPLANAR
@ NI_PIXEL_PLANAR_FORMAT_TILED4X4
@ NI_PIXEL_PLANAR_FORMAT_PLANAR
#define NI_ENC_PARAM_DISABLE_ADAPTIVE_BUFFERS
#define NI_DEC_PARAM_SCALE_0_H
#define NI_ENC_PARAM_SAR_DENOM
#define NI_ENC_PARAM_ADAPTIVE_LAMDA_MODE
#define NI_VPU_ALIGN16(_x)
#define NI_ENC_PARAM_MOTION_CONSTRAINED_MODE
#define NI_ENC_REPEAT_HEADERS_ALL_I_FRAMES
#define NI_ENC_GOP_PARAMS_G4_QP_OFFSET
#define NI_ENC_GOP_PARAMS_G7_QP_OFFSET
#define NI_DEC_PARAM_ENABLE_OUT_1
#define NI_ENC_PARAM_HVSPLUS_LEVEL
#define NI_MIN_KEEP_ALIVE_TIMEOUT
#define NI_XCODER_LOG_NAME_FULL
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2_USED
#define NI_ENC_GOP_PARAMS_G2_QP_OFFSET
#define NI_PARAM_AV1_MAX_HEIGHT
#define NI_ENC_PARAM_ALLOCATE_STRAEGY
#define NI_DEC_PARAM_SCALE_1_H
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1_USED
#define NI_DEC_PARAM_ENABLE_LOW_DELAY_CHECK
#define NI_XCODER_LOG_NAME_INFO
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0_USED
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3
#define NI_SCALER_FLAG_PC
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2
#define NI_DEC_PARAM_SCALE_2_RES_CEIL
#define NI_PARAM_AV1_MIN_HEIGHT
#define NI_ENC_PARAM_ADAPTIVE_CRF_MODE
#define NI_ENC_PARAM_INTRA_REFRESH_MIN_PERIOD
#define NI_ENC_PARAM_SKIP_FRAME_ENABLE
#define NI_VPU_ALIGN128(_x)
#define NI_ENC_PARAM_VBV_MAXRAE
#define NI_ENC_PARAM_ENABLE_MB_LEVEL_RC
#define NI_ENC_PARAM_MIN_QP
#define NI_MAX_RESOLUTION_RGBA_WIDTH
#define NI_DEC_PARAM_FORCE_8BIT_1
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3
#define NI_VPU_ALIGN32(_x)
#define NI_ENC_PARAM_RECONF_FILE
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC2
#define NI_ENC_PARAM_LOG_LEVEL
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3_USED
#define NI_ENC_GOP_PARAMS_G6_TEMPORAL_ID
#define NI_ENC_GOP_PARAMS_G5_TEMPORAL_ID
#define NI_ENC_PARAM_FORCE_BFRAME_QPFACTOR
#define NI_ENC_PARAM_MAX_NUM_MERGE
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0
#define NI_XCODER_PRESET_NAME_FAST
#define NI_ENC_ENABLE_SSIM
float(* ni_kernel_coeff_fn)(int filtersize, double offset, double B, double C)
#define NI_CUSTOMIZE_ROI_QP_NUM
Max number of entries per line supported for the qp number.
#define NI_ENC_GOP_PARAMS_G1_QP_OFFSET
#define NI_ENC_PARAM_AV1_OP_LEVEL
#define NI_PARAM_MIN_HEIGHT
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3
#define NI_DEC_PARAM_SCALE_1
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC1
#define NI_ENC_GOP_PARAMS_G5_POC_OFFSET
#define NI_ENC_PARAM_VBV_BUFFER_SIZE
#define NI_ENC_GOP_PARAMS_G3_POC_OFFSET
#define NI_ENC_GOP_PARAMS_G2_POC_OFFSET
#define NI_ENC_PARAM_BITRATE_WINDOW
#define NI_XCODER_PRESET_NAME_SLOWER
#define NI_ENC_PARAM_ENABLE_CPU_AFFINITY
#define NI_ENC_PARAM_CHROMA_QP_OFFSET
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC0_USED
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC0_USED
#define NI_ENC_GOP_PARAMS_G4_TEMPORAL_ID
#define NI_ENC_GOP_PARAMS_CUSTOM_GOP_SIZE
#define NI_MAX_FRAME_SIZE
#define NI_SCALER_KERNEL_SLOTS
#define NI_ENC_GOP_PARAMS_G3_PIC_TYPE
#define NI_DEC_PARAM_MAX_EXTRA_HW_FRAME_CNT
#define NI_ENC_PARAM_PADDING
@ NI_DEC_CROP_MODE_MANUAL
#define NI_ENC_PARAM_ENABLE_ACQUIRE_LIMIT
#define NI_ENC_RC_QP_DELTA_RANGE
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1_USED
#define NI_DEC_PARAM_SEMI_PLANAR_2
#define NI_PARAM_AV1_MAX_WIDTH
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC3
#define NI_ENC_PARAM_PRESET
#define NI_EC_POLICY_LIMITED_ERROR
#define NI_ENC_PARAM_ROI_ENABLE
@ NI_XCODER_READ_DESC_STATE
@ NI_XCODER_GENERAL_STATE
@ NI_FRAME_AUX_DATA_BITRATE
@ NI_FRAME_AUX_DATA_SLICE_ARG
@ NI_FRAME_AUX_DATA_CRF_FLOAT
@ NI_FRAME_AUX_DATA_MAX_MIN_QP
@ NI_FRAME_AUX_DATA_FRAMERATE
@ NI_FRAME_AUX_DATA_LTR_INTERVAL
@ NI_FRAME_AUX_DATA_VBV_MAX_RATE
@ NI_FRAME_AUX_DATA_INTRAPRD
@ NI_FRAME_AUX_DATA_MAX_FRAME_SIZE
@ NI_FRAME_AUX_DATA_INVALID_REF_FRAME
@ NI_FRAME_AUX_DATA_LONG_TERM_REF
@ NI_FRAME_AUX_DATA_VBV_BUFFER_SIZE
#define NI_MAX_RESOLUTION_WIDTH
#define NI_DEC_PARAM_ENABLE_CUSTOM_SEI_PASSTHRU
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2_USED
#define NI_ENC_PARAM_IP_RATIO
#define NI_DEC_PARAM_CROP_PARAM_2
#define NI_EC_POLICY_TOLERANT
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3_USED
#define NI_FRAME_LITTLE_ENDIAN
#define NI_ENC_PARAM_ENABLE_AUD
#define NI_ENC_PARAM_INTRA_REFRESH_ARG
#define NI_ENC_PARAM_DISABLE_BFRAME_RDOQ
#define NI_ENC_PARAM_HVS_QP_SCALE
#define NI_ENC_PARAM_GDR_DURATION
#define NI_EC_ERR_THRESHOLD_DEFAULT
#define NI_SCALER_FLAG_CS
#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR
#define NI_ENC_PARAM_NO_HW_MULTIPASS_SUPPORT
#define NI_MAX_DECODING_REFRESH_TYPE
#define NI_ENC_PARAM_FORCE_FRAME_TYPE
#define NI_ENC_PARAM_JPEG_QLEVEL
#define NI_MIN_CUSTOM_SEI_PASSTHRU
@ QOS_ALLOW_CONFIG_REC_ALLOW_CODE
@ QOS_OP_CONFIG_REC_OP_CODE
#define NI_ENC_GOP_PARAMS_G6_POC_OFFSET
#define NI_ENC_PARAM_HVS_BASE_MB_COMPLEXITY
#define NI_ENC_PARAM_TRANS_RATE
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PICS
#define NI_ENC_PARAM_ENABLE_DYNAMIC_32X32_MERGE
#define NI_ENC_GOP_PARAMS_G0_PIC_TYPE
#define NI_ENC_PARAM_ENABLE_HVS_QP
#define NI_DEC_PARAM_SCALE_1_RES_CEIL
#define NI_ENC_PARAM_ENABLE_TIMECODE
#define NI_ENC_PARAM_ENTROPY_CODING_MODE
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3
#define NI_MAX_MAX_NUM_MERGE
#define NI_ENC_GOP_PARAMS_G7_TEMPORAL_ID
#define NI_ENC_PARAM_INTRA_QP
#define NI_ENC_PARAM_SLICE_MODE
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0_USED
#define NI_DEC_PARAM_FORCE_8BIT_2
#define NI_DISABLE_USR_DATA_SEI_PASSTHRU
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC0
#define NI_ENC_PARAM_ENABLE_DYNAMIC_8X8_MERGE
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2_USED
#define NI_ENC_REPEAT_HEADERS_FIRST_IDR
#define NI_ENC_PARAM_RECONF_DEMO_MODE
#define NI_ENC_GOP_PARAMS_G0_QP_OFFSET
#define NI_ENC_PARAM_STILL_IMAGE_DETECT_LEVEL
#define NI_PARAM_AV1_ALIGN_WIDTH_HEIGHT
#define NI_XCODER_PRESET_NAME_SLOW
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC1
#define NI_ENC_NEW_RC_ENABLE
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC2
#define NI_EC_POLICY_IGNORE
#define NI_DEC_PARAM_ENABLE_ADVANCED_EC
#define NI_ENC_PARAM_BASE_LAYER_ONLY
#define NI_DEC_PARAM_ENABLE_OUT_2
#define NI_ENC_PARAM_CRF_MAX_IFRAME_ENABLE
#define NI_UPLOADER_FLAG_LM
#define NI_ENC_PARAM_USE_MCTF
#define NI_PARAM_AV1_MAX_AREA
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC1
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC1_USED
#define NI_ENC_PARAM_MAX_FRAME_SIZE_BYTES_LOW_DELAY
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC3_USED
#define NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL
Max number of lines supported for qpoffset level.
#define NI_INVALID_SESSION_ID
enum _ni_frame_aux_data_type ni_aux_data_type_t
#define NI_DEC_PARAM_EC_POLICY
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1_USED
#define NI_ENC_PARAM_FRAME_RATE_DENOM
#define NI_ENC_PARAM_MAX_QP
#define NI_ENC_PARAM_ENABLE_VFR
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3_USED
struct _ni_scaler_multi_watermark_params_t ni_scaler_multi_watermark_params_t
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC3_USED
#define NI_DEC_PARAM_ERROR_THRESHOLD
#define NI_ENC_PARAM_ENABLE_HVS_QP_SCALE
#define NI_ENC_GOP_PARAMS_G6_QP_OFFSET
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0_USED
#define NI_MAX_RESOLUTION_AREA
#define NI_VPU_ALIGN4096(_x)
#define NI_ENC_PARAM_AI_ENHANCE_LEVEL
#define NI_ENC_PARAM_CACHE_ROI
#define NI_ENC_PARAM_AV1_ERROR_RESILIENT_MODE
#define NI_SCALER_FLAG_P2
#define NI_DEC_PARAM_SCALE_1_W
#define NI_ENC_PARAM_ENABLE_AI_ENHANCE
#define NI_MAX_CUSTOM_SEI_PASSTHRU
enum _ni_codec_format ni_codec_format_t
This is an enumeration for supported codec formats.
#define NI_ENC_PARAM_GOP_LOW_DELAY
#define NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC2_USED
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC0
#define NI_ENC_PARAM_LOW_DELAY
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PICS
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0
#define NI_ENC_PARAM_PAST_FRAME_MAX_INTRA_RATIO
#define NI_ENC_PARAM_BITRATE_MODE
#define NI_ENC_PARAM_ENABLE_8X8_TRANSFORM
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PICS
#define NI_XCODER_LOG_NAME_NONE
#define NI_ENC_PARAM_CONF_WIN_TOP
#define NI_ENC_PARAM_TOL_RC_INTER
#define NI_ENC_PARAM_MAX_FRAME_SIZE_LOW_DELAY
#define NI_ENC_PARAM_ENABLE_IP_RATIO
#define NI_MAX_DYNAMIC_MERGE
#define NI_ENC_BLOCK_RC_SIZE
#define NI_DEC_PARAM_CROP_PARAM_0
#define NI_NUM_OF_PIXELS_1080P
#define NI_DEC_PARAM_SCALE_2
#define NI_ENC_PARAM_ENABLE_ALL_SEI_PASSTHRU
#define NI_ENC_PARAM_ENABLE_AI_HVSPLUS
#define NI_ENC_PARAM_VBV_BUFFER_REENCODE
#define NI_DEC_PARAM_SVC_T_DECODING_LAYER
#define NI_MIN_GOP_PRESET_IDX
#define NI_DEC_PARAM_LOW_DELAY
#define NI_DEC_PARAM_FORCE_LOW_DELAY
#define NI_DEC_PARAM_DDR_PRIORITY_MODE
#define NI_ENC_PARAM_NO_MBTREE
#define NI_ENC_PARAM_LEVEL
#define NI_DEC_PARAM_MULTICORE_JOINT_MODE
#define NI_ENC_GOP_PARAMS_G7_PIC_TYPE
#define NI_ENC_GOP_PARAMS_G1_POC_OFFSET
#define NI_ENC_PARAM_COLOR_SPACE
#define NI_MIN_INTRA_QP_DELTA
#define NI_ENC_CTB_ROW_QP_STEP
#define MAX_CHAR_IN_DEVICE_NAME
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC3_USED
#define NI_ENC_GOP_PARAMS_G3_QP_OFFSET
#define NI_ENC_PARAM_VBV_MINRATE
#define NI_ENC_PARAM_CU_SIZE_MODE
#define NI_ENC_PARAM_TOL_RC_INTRA
#define NI_ENC_GOP_PARAMS_G1_PIC_TYPE
#define NI_ENC_PARAM_STATISTIC_OUTPUT_LEVEL
#define NI_ENC_PARAM_USE_LOW_DELAY_POC_TYPE
#define NI_MIN_DECODING_REFRESH_TYPE
#define NI_DEC_PARAM_PKT_PTS_UNCHANGE
#define NI_ENC_PARAM_INTRA_REFRESH_RESET
#define NI_ENC_PARAM_QP_SCALE_ENABLE
#define NI_ENC_PARAM_LONG_TERM_REFERENCE_INTERVAL
#define NI_ENC_PARAM_SPATIAL_LAYERS
#define NI_EC_POLICY_BEST_EFFORT_OUT_DC
#define NI_ENC_PARAM_PB_RATIO
#define NI_DEC_PARAM_CROP_MODE_2
#define NI_ENC_GOP_PARAMS_G0_TEMPORAL_ID
#define NI_ENC_PARAM_SPATIAL_LAYER_BITRATE
#define NI_ENC_PARAM_ENABLE_DYNAMIC_16X16_MERGE
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1_USED
#define NI_ENC_PARAM_CROP_WIDTH
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC1
#define NI_ENC_GOP_PARAMS_G1_NUM_REF_PICS
#define NI_ENC_PARAM_CROP_HEIGHT
#define NI_MIN_RESOLUTION_WIDTH_SCALER
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC0
#define NI_ENC_PARAM_GET_PSNR_MODE
#define NI_XCODER_PRESET_NAME_FASTER
#define NI_ENC_PARAM_RDO_LEVEL
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PICS
#define NI_EC_POLICY_SKIP
#define NI_ENC_PARAM_CTB_RC_MODE
#define NI_MAX_SPATIAL_LAYERS
#define NI_ENC_PARAM_TOTAL_CUTREE_DEPTH
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC0_USED
#define NI_ENC_PARAM_LOOK_AHEAD_DEPTH
#define NI_ENC_PARAM_SLICE_ARG
#define NI_DEC_PARAM_SCALE_0_W
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC2_USED
#define NI_ENC_PARAM_BITRATE
#define NI_SCALER_MAX_KERNEL_TAPS
#define NI_ENC_GOP_PARAMS_G0_POC_OFFSET
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC3
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC0_USED
#define NI_ENC_PARAM_CONF_WIN_BOTTOM
#define NI_ENC_GOP_PARAMS_G2_PIC_TYPE
#define NI_ENC_PARAM_LINK_FRAME_MAX_INTRA_RATIO
#define NI_ENC_PARAM_INTRA_QP_DELTA
#define NI_DEC_PARAM_CROP_MODE_1
#define NI_ENC_GOP_PARAMS_G4_POC_OFFSET
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC3_USED
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC2_USED
#define NI_ENC_PARAM_SAR_NUM
#define NI_XCODER_PRESET_NAME_VERYFAST
#define NI_ENC_PARAM_GEN_HDRS
#define NI_ENC_PARAM_INTRA_MB_REFRESH_ARG
#define NI_SCALER_KERNEL_POSITIONS
#define NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC1
#define NI_DEC_PARAM_REDUCE_DPB_DELAY
#define NI_ENC_PARAM_IFRAME_SIZE_RATIO
#define NI_ENC_PARAM_MASTER_DISPLAY
#define NI_ENC_PARAM_PRE_INTRA_HANDLING
#define NI_ENC_PARAM_LONG_TERM_REFERENCE_COUNT
#define NI_MAX_ASPECTRATIO
#define NI_ENC_PARAM_SPATIAL_LAYERS_REF_BASE_LAYER
#define NI_DEC_MODE_INTRA_ONLY
#define NI_ENC_PARAM_ENABLE_PIC_SKIP
#define NI_MAX_KEEP_ALIVE_TIMEOUT
#define NI_DEC_PARAM_FORCE_8BIT_0
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PICS
#define NI_ENC_PARAM_SCENE_CHANG_DETECT_LEVEL
#define NI_PARAM_MAX_WIDTH
#define NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE
#define NI_DEFAULT_KEEP_ALIVE_TIMEOUT
#define NI_ENC_PARAM_ZEROCOPY_MODE
#define NI_ENC_PARAM_COLOR_TRANSFER_CHARACTERISTIC
#define NI_ENC_PARAM_LTR_REF_QPOFFSET
#define NI_KEEP_ALIVE_TIMEOUT
#define NI_MAX_CU_SIZE_MODE
#define NI_DEC_MODE_NORMAL
#define NI_ENABLE_USR_DATA_SEI_PASSTHRU
#define NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC1
#define NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC2
#define NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC2
#define NI_DEC_PARAM_SAVE_PKT
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC3
#define NI_DEC_PARAM_SCALE_2_ROUND
#define NI_SCALER_FLAG_IO
@ NI_ENC_MEM_ALLOCATE_STRATEGY_INVALID_MAX
@ NI_ENC_MEM_ALLOCATE_STRATEGY_INVALID_MIN
#define NI_DEC_PARAM_SEMI_PLANAR_0
#define NI_DEC_PARAM_SCALE_2_LONG_SHORT_ADAPT
#define NI_XCODER_PRESET_NAMES_ARRAY_LEN
#define NI_MAX_NUM_AUX_DATA_PER_FRAME
#define NI_ENC_GOP_PARAMS_G1_TEMPORAL_ID
#define NI_EC_POLICY_DEFAULT
#define NI_XCODER_PRESET_NAME_VERYSLOW
#define NI_ENC_PARAM_LONG_TERM_REFERENCE_ENABLE
#define NI_MAX_RESOLUTION_HEIGHT
#define NI_EC_POLICY_BEST_EFFORT
enum _ni_device_mode ni_device_mode_t
Device access mode enumeration.
#define NI_ENC_PARAM_INTRA_COMPENSATE_MODE
#define NI_ENC_PARAM_PROFILE
#define NI_ENC_PARAM_CU_TREE_FACTOR
#define NI_DEC_PARAM_ENABLE_USR_DATA_SEI_PASSTHRU
#define NI_ENC_PARAM_ENABLE_FILLER
#define NI_VPU_ALIGN64(_x)
#define NI_BEST_REAL_LOAD_STR
#define NI_ENC_PARAM_LTR_FIRST_GAP
#define NI_ENC_PARAM_INTRA_MB_REFRESH_MODE
#define NI_DEC_PARAM_MIN_PACKETS_DELAY
#define NI_ENC_GOP_PARAMS_G4_PIC_TYPE
#define NI_ENC_PARAM_FRAME_RATE
#define NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC3
#define NI_ENC_GOP_PARAMS_G5_QP_OFFSET
#define NI_DEC_PARAM_SKIP_PTS_GUESS
#define NI_XCODER_LOG_NAME_DEBUG
#define NI_ENC_PARAM_GET_RECONSTRUCTED_MODE
#define NI_ENC_PARAM_ENABLE_COMPENSATE_QP
#define NI_ENC_GOP_PARAMS_G2_TEMPORAL_ID
#define NI_ENC_PARAM_DDR_PRIORITY_MODE
#define NI_MIN_USE_RECOMMENDED_ENC_PARAMS
#define NI_DEC_PARAM_CROP_MODE_0
#define NI_DEC_PARAM_ENABLE_PPU_SCALE_LIMIT
#define NI_ENC_PARAM_FORCE_PIC_QP_DEMO_MODE
#define NI_ENC_PARAM_CUSTOM_MIN_COEFF_DIV
#define NI_DEC_PARAM_SCALE_0_ROUND
#define NI_ENC_INLOOP_DS_RATIO
#define NI_ENC_PARAM_HIGH_TIER
#define NI_VPU_ALIGN8(_x)
#define NI_XCODER_LOG_NAME_ERROR
#define NI_ENC_PARAM_INTRA_PERIOD
#define NI_ENC_PARAM_HRD_ENABLE
#define NI_INVALID_SVCT_DECODING_LAYER
#define NI_DEC_PARAM_SURVIVE_STREAM_ERR
#define NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC2_USED
#define NI_DEC_PARAM_SKIP_EXTRA_HEADERS
#define NI_ENC_PARAM_CONSTANT_RATE_FACTOR_FLOAT
#define NI_MAX_GOP_PRESET_IDX
#define NI_ENC_PARAM_MAX_CLL
#define NI_ENC_PARAM_AVCC_HVCC
#define NI_ENC_PARAM_RC_INIT_DELAY
#define NI_DEC_PARAM_SCALE_2_H
#define NI_VPU_CEIL(_data, _align)
#define NI_ENC_PARAM_ENABLE_SMOOTH_CRF
#define NI_ENC_PARAM_CUSTOMIZE_ROI_QP_LEVEL
#define NI_ENC_PARAM_PPS_INIT_QP
#define NI_ENC_PARAM_SKIP_FRAME_INTERVAL
#define NI_ENC_PARAM_GET_BITSTREAM_FEATURES
ni_retcode_t ni_encoder_session_open(ni_session_context_t *p_ctx)
Open a xcoder encoder instance.
ni_retcode_t ni_ai_alloc_hwframe(ni_session_context_t *p_ctx, int width, int height, int options, int pool_size, int frame_index)
ni_retcode_t ni_config_instance_set_decoder_ppu_params(ni_session_context_t *p_ctx, void *p_dec_ppu_config, int buffer_size)
Send a p_config command to configure decoding parameters.
ni_retcode_t ni_get_memory_offset(ni_session_context_t *p_ctx, const niFrameSurface1_t *hwdesc, uint32_t *p_offset)
Get an address offset from a hw descriptor.
ni_retcode_t ni_scaler_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t *p_cfg)
config a frame in the scaler
ni_retcode_t ni_scaler_multi_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t p_cfg_in[], int numInCfgs, ni_frame_config_t *p_cfg_out)
config multiple frames in the scaler
ni_retcode_t ni_decoder_session_copy_internal(ni_session_context_t *src_p_ctx, ni_session_context_t *dst_p_ctx)
Copy a xcoder decoder worker thread info.
int ni_hwupload_session_write(ni_session_context_t *p_ctx, ni_frame_t *p_frame, niFrameSurface1_t *hwdesc)
Send a YUV p_frame to upload session.
ni_retcode_t ni_encoder_session_sequence_change(ni_session_context_t *p_ctx, ni_resolution_t *p_resolution)
Send sequnce change to a xcoder encoder instance.
int ni_decoder_session_write(ni_session_context_t *p_ctx, ni_packet_t *p_packet)
Send a video p_packet to decoder.
ni_retcode_t ni_decoder_session_close(ni_session_context_t *p_ctx, int eos_recieved)
Close a xcoder decoder instance.
void ni_populate_device_capability_struct(ni_device_capability_t *p_cap, void *p_data, ni_device_handle_t device_handle, bool device_in_ctxt)
Get info from received xcoder capability.
ni_retcode_t ni_hwupload_session_query_buffer_avail(ni_session_context_t *p_ctx)
Query and acquire buffer from xcoder upload instance.
ni_retcode_t ni_scaler_session_close(ni_session_context_t *p_ctx, int eos_received)
close a scaler session
ni_retcode_t ni_ai_session_write(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
ni_retcode_t ni_config_instance_hvsplus(ni_session_context_t *p_ctx)
ni_retcode_t ni_scaler_session_query_buffer_avail(ni_session_context_t *p_ctx)
Query and acquire buffer from xcoder scaler instance.
ni_retcode_t ni_encoder_session_close(ni_session_context_t *p_ctx, int eos_recieved)
Close a xcoder encoder instance.
ni_retcode_t ni_ai_session_query_metrics(ni_session_context_t *p_ctx, ni_network_perf_metrics_t *p_metrics)
ni_retcode_t ni_encoder_session_send_eos(ni_session_context_t *p_ctx)
Flush encoder output.
ni_retcode_t ni_config_read_inout_layers(ni_session_context_t *p_ctx, ni_network_data_t *p_network)
int ni_decoder_session_read(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Retrieve a YUV p_frame from decoder.
ni_retcode_t ni_encoder_metadata_buffer_alloc(ni_frame_t *p_frame, int extra_len)
Allocate memory for the metadata header and auxillary data for encoder input data.
ni_retcode_t ni_ai_session_read(ni_session_context_t *p_ctx, ni_packet_t *p_packet)
ni_retcode_t ni_hwframe_clone(ni_session_context_t *p_ctx, ni_frameclone_desc_t *p_frameclone_desc)
Copy a src hw frame to a dst hw frame.
int ni_xcoder_session_query_detail(ni_session_context_t *p_ctx, ni_device_type_t device_type, void *detail_data, int ver)
Query current xcoder status.
ni_retcode_t ni_ai_alloc_dst_frame(ni_session_context_t *p_ctx, niFrameSurface1_t *p_out_surface)
ni_retcode_t ni_send_to_target_v2(ni_session_context_t *p_ctx, ni_frame_t *pSrcFrame, const ni_p2p_sgl_t *dmaAddrs)
Generates and writes a nvme command with sgl list.
ni_retcode_t ni_config_instance_set_uploader_params(ni_session_context_t *p_ctx, uint32_t pool_size, uint32_t pool)
Send a p_config command to configure uploading parameters.
ni_retcode_t ni_decoder_session_open(ni_session_context_t *p_ctx)
Open a xcoder decoder instance.
ni_retcode_t ni_encoder_start_buffer_alloc(ni_frame_t *p_frame)
Allocate memory for the non-4k-aligned part at the start of YUV data for encoder input data.
ni_retcode_t ni_dump_log_artifacts(ni_session_context_t *p_ctx, bool gen_artifacts_file)
Read log artifacts (tar.gz) from the device via NVMe and write them to "artifacts_slot_s_dddd....
ni_retcode_t ni_scaler_session_read_hwdesc(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
read a hardware descriptor from a scaler session
ni_retcode_t ni_uploader_session_close(ni_session_context_t *p_ctx)
Close an xcoder upload instance.
ni_retcode_t ni_scaler_alloc_frame(ni_session_context_t *p_ctx, int width, int height, int format, int options, int rectangle_width, int rectangle_height, int rectangle_x, int rectangle_y, int rgba_color, int frame_index)
allocate a frame in the scaler
ni_retcode_t ni_decoder_session_read_desc(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Retrieve a hw desc p_frame from decoder.
void * ni_session_keep_alive_thread(void *arguments)
decoder keep alive thread function triggers every 1 second
ni_retcode_t ni_recv_from_target(ni_session_context_t *p_ctx, const ni_p2p_sgl_t *dmaAddrs, ni_frame_t *pDstFrame)
ni_retcode_t ni_device_config_ns_qos(ni_device_handle_t device_handle, uint32_t key, uint32_t value)
Send namespace num / Opmode and SRIOv index/value to the device with specified logic block address.
ni_retcode_t ni_config_instance_network_binary(ni_session_context_t *p_ctx, void *nb_data, uint32_t nb_size)
int ni_hwupload_session_read_hwdesc(ni_session_context_t *p_ctx, niFrameSurface1_t *hwdesc)
Retrieve a HW descriptor of uploaded frame.
int ni_xcoder_session_query(ni_session_context_t *p_ctx, ni_device_type_t device_type)
Query current xcoder status.
ni_retcode_t ni_config_instance_set_scaler_params(ni_session_context_t *p_ctx, ni_scaler_params_t *p_params)
Send a p_config command to configure scaling parameters.
ni_retcode_t ni_device_get_ddr_configuration(ni_session_context_t *p_ctx)
Get DDR configuration of Quadra device.
ni_retcode_t ni_ai_session_read_hwdesc(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
read a hardware descriptor from a scaler session
ni_retcode_t ni_decoder_session_send_eos(ni_session_context_t *p_ctx)
Send end of stream signal to the decoder.
int ni_encoder_session_read(ni_session_context_t *p_ctx, ni_packet_t *p_packet)
ni_retcode_t ni_uploader_session_open(ni_session_context_t *p_ctx)
Open a xcoder upload instance.
ni_retcode_t ni_ai_session_open(ni_session_context_t *p_ctx)
ni_retcode_t ni_clear_instance_buf(niFrameSurface1_t *surface)
clear a particular xcoder instance buffer/data
ni_retcode_t ni_ai_multi_config_frame(ni_session_context_t *p_ctx, ni_frame_config_t p_cfg_in[], int numInCfgs, ni_frame_config_t *p_cfg_out)
ni_retcode_t ni_ai_session_close(ni_session_context_t *p_ctx, int eos_recieved)
int lower_pixel_rate(const ni_load_query_t *pQuery, uint32_t ui32CurrentLowest)
int ni_hwdownload_session_read(ni_session_context_t *p_ctx, ni_frame_t *p_frame, niFrameSurface1_t *hwdesc)
Retrieve a YUV p_frame from decoder.
ni_retcode_t ni_decoder_session_flush(ni_session_context_t *p_ctx)
Flush decoder output.
ni_retcode_t ni_dump_log_all_cores(ni_session_context_t *p_ctx, void *p_data, bool gen_log_file)
int ni_scaler_session_open(ni_session_context_t *p_ctx)
Open a xcoder scaler instance.
int ni_encoder_session_write(ni_session_context_t *p_ctx, ni_frame_t *p_frame)
Send a YUV p_frame to encoder.
int ni_hwdownload_by_frame_idx(niFrameSurface1_t *hwdesc, ni_frame_t *p_frame, int is_auto_dl)
Retrieve a YUV p_frame by frame index.
Private definitions used by ni_device_api.c for video processing tasks.
struct _ni_log_fl_fw_versions ni_log_fl_fw_versions_t
struct _ni_instance_mgr_general_status ni_instance_mgr_general_status_t
#define NI_AI_HW_ALIGN_SIZE
#define NI_VERSION_CHARACTER_COUNT
ni_lat_meas_q_t * ni_lat_meas_q_create(int capacity)
Create a latency measurement queue object of a given capacity.
void ni_lat_meas_q_destroy(ni_lat_meas_q_t *frame_time_q)
Destroy a latency measurement queue object.
Utility definitions for measuring frame/packet processing time in NETINT video processing devices.
void ni_log2(const void *p_context, ni_log_level_t level, const char *fmt,...)
print log message and additional information using ni_log_callback,
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
int32_t ni_nvme_send_read_cmd(ni_device_handle_t handle, ni_event_handle_t event_handle, void *p_data, uint32_t data_len, uint32_t lba)
Compose an io read command.
int32_t ni_nvme_send_write_cmd(ni_device_handle_t handle, ni_event_handle_t event_handle, void *p_data, uint32_t data_len, uint32_t lba)
Compose a io write command.
Private definitions for interfacing with NETINT video processing devices over NVMe.
#define QUERY_GET_NVME_STATUS_R
#define QUERY_GET_EXTTRA_INFO_R
#define QUERY_GET_QOS_INFO_R
#define CONFIG_INSTANCE_SetScalerDrawBoxPara_W(sid, instance)
#define QUERY_GET_NS_VF_R
#define QUERY_GET_TEMPERATURE_R
#define IDENTIFY_DEVICE_R
#define QUERY_GET_VERSIONS_R
#define NI_DATA_BUFFER_LEN
#define NI_NVME_IDENTITY_CMD_DATA_SZ
#define CONFIG_INSTANCE_SetScalerWatermarkPara_W(sid, instance)
#define QUERY_GET_QOS_NS_INFO_R
Definitions related to NETINT P2P kernel driver interface.
#define NETINT_IOCTL_ATTACH_RFENCE
#define NETINT_IOCTL_EXPORT_DMABUF
@ NI_DMABUF_WRITE_TO_DEVICE
#define NETINT_IOCTL_SIGNAL_RFENCE
#define NETINT_IOCTL_ISSUE_REQ
int ni_rsrc_unlock(int device_type, ni_lock_handle_t lock)
unlock a file lock
NI_DEPRECATED bool g_device_in_ctxt
ni_device_context_t * ni_rsrc_allocate_simple_direct(ni_device_type_t device_type, int guid)
Allocate resources for decoding/encoding, by designating explicitly the device to use....
int ni_rsrc_lock_and_open(int device_type, ni_lock_handle_t *lock)
lock a file lock and open a session on a device
void ni_rsrc_free_device_context(ni_device_context_t *p_device_context)
Free previously allocated device context.
int ni_rsrc_get_device_by_block_name(const char *blk_name, ni_device_type_t device_type)
Get GUID of the device by block device name and type.
void ni_rsrc_free_device_pool(ni_device_pool_t *p_device_pool)
Free all resources taken by the device pool.
NI_DEPRECATED ni_device_handle_t g_dev_handle
Public definitions for managing NETINT video processing devices.
struct _ni_device_extra_info ni_device_extra_info_t
struct _ni_qos_header_info_log_page ni_qos_header_info_log_page_t
struct _ni_qos_namespace_info_log_page ni_qos_namespace_info_log_page_t
struct _ni_device_vf_ns_id ni_device_vf_ns_id_t
LIB_API ni_device_context_t * ni_rsrc_get_device_context(ni_device_type_t type, int guid)
Allocates and returns a pointer to ni_device_context_t struct based on provided device_type and guid....
struct _ni_device_temp ni_device_temp_t
LIB_API ni_device_pool_t * ni_rsrc_get_device_pool(void)
Create and return the allocated ni_device_pool_t struct.
Private definitions used by ni_rsrc_api.cpp for management of NETINT video processing devices.
void ni_rsrc_update_record(ni_device_context_t *p_device_context, ni_session_context_t *p_session_ctx)
int ni_pthread_cond_init(ni_pthread_cond_t *cond, const ni_pthread_condattr_t *attr)
initialize condition variables
int ni_pthread_mutex_lock(ni_pthread_mutex_t *mutex)
thread mutex lock
int ni_pthread_cond_destroy(ni_pthread_cond_t *cond)
destroy condition variables
int32_t ni_parse_name(const char *arg, const char *const *names, bool *b_error)
Parse name.
ni_retcode_t ni_strncpy(char *dest, size_t dmax, const char *src, size_t slen)
int ni_posix_memalign(void **memptr, size_t alignment, size_t size)
Allocate aligned memory.
int ni_pthread_create(ni_pthread_t *thread, const ni_pthread_attr_t *attr, void *(*start_routine)(void *), void *arg)
create a new thread
ni_retcode_t ni_strncat(char *dest, size_t dmax, const char *src, size_t slen)
ni_buf_t * ni_buf_pool_get_buffer(ni_buf_pool_t *p_buffer_pool)
ni_retcode_t ni_strerror(char *dest, size_t dmax, int errnum)
int ni_pthread_mutex_destroy(ni_pthread_mutex_t *mutex)
destory a mutex
ni_retcode_t ni_strcat(char *dest, size_t dmax, const char *src)
void ni_get_hw_yuv420p_dim(int width, int height, int factor, int is_semiplanar, int plane_stride[NI_MAX_NUM_DATA_POINTERS], int plane_height[NI_MAX_NUM_DATA_POINTERS])
Get dimension information of Netint HW YUV420p frame to be sent to encoder for encoding....
char * ni_strtok(char *s, const char *delim, char **saveptr)
ni_retcode_t ni_fopen(FILE **fp, const char *filename, const char *mode)
ni_retcode_t ni_strcpy(char *dest, size_t dmax, const char *src)
uint32_t ni_ai_network_layer_size(ni_network_layer_params_t *p_param)
void ni_usleep(int64_t usec)
void ni_buf_pool_return_buffer(ni_buf_t *buf, ni_buf_pool_t *p_buffer_pool)
uint64_t ni_gettime_ns(void)
int ni_pthread_join(ni_pthread_t thread, void **value_ptr)
join with a terminated thread
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 ...
int ni_pthread_mutex_unlock(ni_pthread_mutex_t *mutex)
thread mutex unlock
int ni_sprintf(char *dest, size_t dmax, const char *fmt,...)
int ni_pthread_mutex_init(ni_pthread_mutex_t *mutex)
initialize a mutex
ni_retcode_t ni_strtoi(const char *str, int32_t *out_val)
Safely convert a decimal string to a 32-bit integer with full validation. Trailing whitespace is tole...
uint32_t ni_decode_power_measurement(uint32_t current_data, const uint8_t *serial_number)
decode the raw current obtained and determine power
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...
#define ni_aligned_free(p_memptr)
#define ni_memfree(p_memptr)
struct _ni_buf_pool_t * pool
ni_gop_params_t pic_param[NI_MAX_GOP_NUM]
uint8_t serial_number[20]
ni_device_info_t * p_device_info
char dev_name[NI_MAX_DEVICE_NAME_LEN]
char blk_name[NI_MAX_DEVICE_NAME_LEN]
uint8_t fl_ver_last_ran[8]
uint8_t fw_rev_nor_flash[8]
uint8_t fl_ver_nor_flash[8]
ni_device_queue_t * p_device_queue
int32_t xcoders[NI_DEVICE_TYPE_XCODER_MAX][NI_MAX_DEVICE_CNT]
uint32_t xcoder_cnt[NI_DEVICE_TYPE_XCODER_MAX]
int enable_dynamic_16x16_merge
int scene_change_detect_level
int linkFrameMaxIntraRatio
int intra_mb_refresh_mode
int preferred_transfer_characteristics
int motionConstrainedMode
int decoding_refresh_type
int enable_dynamic_32x32_merge
ni_custom_gop_params_t custom_gop_params
struct _ni_encoder_cfg_params::@16 rc
int enable_dynamic_8x8_merge
int av1_error_resilient_mode
int spatialLayerBitrate[NI_MAX_SPATIAL_LAYERS]
int crf_max_iframe_enable
float forceBframeQpfactor
int temporal_layers_enable
int pastFrameMaxIntraRatio
int av1OpLevel[NI_MAX_SPATIAL_LAYERS]
int spatial_layers_ref_base_layer
int long_term_ref_interval
int still_image_detect_level
int statistic_output_level
int enable_cu_level_rate_control
bool enable_all_sei_passthru
int max_consecutive_skip_num
int use_recommend_enc_params
int customize_roi_qp_level
bool disable_adaptive_buffers
This is a data structure for encoding parameters that have changed.
uint8_t inconsecutive_transfer
uint32_t data_len[NI_MAX_NUM_DATA_POINTERS]
ni_codec_format_t src_codec
uint32_t start_len[NI_MAX_NUM_DATA_POINTERS]
uint32_t start_buffer_size
uint8_t separate_metadata
uint32_t metadata_buffer_size
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
ni_pic_type_t ni_pict_type
uint16_t hor_adjust_offset
ni_aux_data_t * aux_data[NI_MAX_NUM_AUX_DATA_PER_FRAME]
uint8_t * p_metadata_buffer
ni_gop_rps_t rps[NI_MAX_REF_PIC]
uint8_t fw_share_mem_usage
uint32_t fw_share_mem_usage
uint32_t total_pixel_load
uint8_t nor_flash_fw_revision[NI_VERSION_CHARACTER_COUNT]
uint8_t last_ran_fl_version[NI_VERSION_CHARACTER_COUNT]
uint8_t nor_flash_fl_version[NI_VERSION_CHARACTER_COUNT]
uint8_t use_cur_src_as_long_term_pic
uint8_t use_long_term_ref
ni_network_layer_offset_t * inset
ni_network_layer_info_t linfo
ni_network_layer_offset_t * outset
ni_network_layer_params_t * in_param
ni_network_layer_params_t * out_param
uint32_t av1_data_len[MAX_AV1_ENCODER_GOP_NUM]
uint8_t * av1_p_buffer[MAX_AV1_ENCODER_GOP_NUM]
uint8_t * av1_p_data[MAX_AV1_ENCODER_GOP_NUM]
uint32_t av1_buffer_size[MAX_AV1_ENCODER_GOP_NUM]
uint16_t ppu_h[NI_MAX_NUM_OF_DECODER_OUTPUTS]
uint16_t ppu_w[NI_MAX_NUM_OF_DECODER_OUTPUTS]
uint32_t ui32BaseSliceTimeUs
uint8_t ui8VirtualFunction
char blk_xcoder_name[MAX_CHAR_IN_DEVICE_NAME]
int16_t reconfig_slice_arg
ni_pthread_cond_t low_delay_sync_cond
ni_event_handle_t thread_event_handle
int reconfig_vbv_max_rate
ni_thread_arg_struct_t * keep_alive_thread_args
uint64_t ppu_reconfig_pkt_pos
uint32_t keep_alive_timeout
int32_t ltr_frame_ref_invalid
char blk_dev_name[NI_MAX_DEVICE_NAME_LEN]
ni_device_handle_t sender_handle
ni_device_handle_t device_handle
ni_load_query_t load_query
ni_pthread_mutex_t * pext_mutex
uint32_t actual_video_width
uint32_t force_low_delay_cnt
int reconfig_intra_period
volatile uint64_t last_access_time
ni_enc_avc_roi_custom_map_t * avc_roi_map
void * p_master_display_meta_data
char dev_xcoder_name[MAX_CHAR_IN_DEVICE_NAME]
ni_pthread_t keep_alive_thread
ni_event_handle_t event_handle
ni_input_frame input_frame_fifo[120]
encoder:calculate PSNR start
ni_framerate_t last_framerate
int reconfig_vbv_buffer_size
uint32_t meta_size
Params used in VFR mode Done///.
ni_device_handle_t blk_io_handle
uint32_t max_nvme_io_size
ni_enc_hevc_roi_custom_map_t * hevc_roi_map
ni_long_term_ref_t ltr_to_set
int enable_low_delay_check
ni_session_run_state_t session_run_state
ni_encoder_change_params_t * enc_change_params
ni_pthread_mutex_t low_delay_sync_mutex
uint64_t session_timestamp
ni_kernel_coeff_fn scaler_coeff_fn
ni_enc_quad_roi_custom_map * roi_map
int16_t buffered_frame_index
ni_region_of_interest_t * av_rois
uint32_t active_video_width
uint32_t active_video_height
uint8_t * hevc_sub_ctu_roi_buf
ni_frame_pool_type_t pool_type
union _ni_session_data_io::@19 data
ni_event_handle_t thread_event_handle
ni_pthread_mutex_t * p_mutex
uint32_t keep_alive_timeout
ni_device_handle_t device_handle
uint64_t session_timestamp
volatile uint64_t * plast_access_time
int32_t aspectRatioHeight
int force_pic_qp_demo_mode
ni_encoder_cfg_params_t cfg_enc_params
int8_t customize_roi_qp_map[NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL][NI_CUSTOMIZE_ROI_QP_NUM]
ni_ddr_priority_mode_t ddr_priority_mode
ni_frame_t * p_first_frame
ni_decoder_input_params_t dec_input_params
int use_low_delay_poc_type
int color_transfer_characteristic
int video_full_range_flag
int reconf_hash[NI_BITRATE_RECONFIG_FILE_MAX_LINES][NI_BITRATE_RECONFIG_FILE_MAX_ENTRIES_PER_LINE]
encoder AVC ROI custom map (1 MB = 8bits)
struct _ni_enc_avc_roi_custom_map::@5 field
encoder HEVC ROI custom map (1 CTU = 64bits)
struct _ni_enc_hevc_roi_custom_map::@4 field
encoder AVC ROI custom map (1 MB = 8bits)
struct _ni_enc_quad_roi_custom_map::@6 field