29#if __linux__ || __APPLE__
32#include <linux/types.h>
86#if __linux__ || __APPLE__
87static struct stat g_nvme_stat = { 0 };
89static int close_fd_zero_atexit = 0;
91static void close_fd_zero(
void)
113 "ERROR: %s() Failed to allocate memory for session context\n",
142#ifdef MEASURE_LATENCY
166 int framerate_num = 0;
167 int framerate_denom = 0;
206 "ERROR %s(): init xcoder_low_delay_sync_mutex fail return\n",
213 "ERROR %s(): init xcoder_low_delay_sync_cond fail return\n",
244 p_ctx->debug_write_ptr = NULL;
245 p_ctx->debug_write_index_ptr = NULL;
246 p_ctx->debug_write_sent_size = 0;
249#ifdef MEASURE_LATENCY
283 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
289 event_handle = CreateEvent(NULL, FALSE, FALSE, NULL);
290 if (event_handle == NULL)
294 return NI_INVALID_EVENT_HANDLE;
298 return NI_INVALID_EVENT_HANDLE;
310 if ( NI_INVALID_DEVICE_HANDLE == event_handle )
323 retval = CloseHandle(event_handle);
337 err = close(event_handle);
340 char error_message[100] = {
'\0'};
341 char unknown_error_message[20] = {
'\0'};
342 ni_sprintf(error_message, 100,
"ERROR: %s(): ", __func__);
346 ni_strcat(error_message, 100,
"EBADF\n");
349 ni_strcat(error_message, 100,
"EINTR\n");
355 ni_sprintf(unknown_error_message, 20,
"Unknown error %d\n", err);
356 ni_strcat(error_message, 100, unknown_error_message);
364#ifndef DEPRECATION_AS_ERROR
379 HANDLE device_handle;
384 return NI_INVALID_DEVICE_HANDLE;
394 device_handle = CreateFile(p_dev, GENERIC_READ | GENERIC_WRITE,
395 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
396 OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
399 if (INVALID_HANDLE_VALUE == device_handle)
401 retval = GetLastError();
408 return device_handle;
411 ni_device_handle_t fd = NI_INVALID_DEVICE_HANDLE;
422 *p_max_io_size_out = ni_get_kernel_max_io_size(p_dev);
424 *p_max_io_size_out = MAX_IO_TRANSFER_SIZE;
433 fd = open(p_dev, O_RDWR | O_SYNC | O_DIRECT);
436 fd = open(p_dev, O_RDWR | O_SYNC);
446 fd = NI_INVALID_DEVICE_HANDLE;
459 if(close_fd_zero_atexit == 0)
461 close_fd_zero_atexit = 1;
462 atexit(close_fd_zero);
466 ni_log(
NI_LOG_ERROR,
"libxcoder has held the fd=0, but open fd=0 again, maybe fd=0 was closed accidently.");
468 fd = NI_INVALID_DEVICE_HANDLE;
473 retval = fcntl(fd, F_NOCACHE, 1);
479 fd = NI_INVALID_DEVICE_HANDLE;
484 retval = fstat(fd, &g_nvme_stat);
490 fd = NI_INVALID_DEVICE_HANDLE;
494 if (!S_ISCHR(g_nvme_stat.st_mode) && !S_ISBLK(g_nvme_stat.st_mode))
500 fd = NI_INVALID_DEVICE_HANDLE;
526 HANDLE device_handle;
527 DWORD dwDesiredAccess = 0;
532 return NI_INVALID_DEVICE_HANDLE;
540 dwDesiredAccess = GENERIC_READ;
544 dwDesiredAccess = GENERIC_WRITE;
549 dwDesiredAccess = GENERIC_READ | GENERIC_WRITE;
553 device_handle = CreateFile(p_dev, dwDesiredAccess,
554 FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
555 OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL);
558 if (INVALID_HANDLE_VALUE == device_handle)
560 retval = GetLastError();
567 return device_handle;
570 ni_device_handle_t fd = NI_INVALID_DEVICE_HANDLE;
587 open_flags = O_RDONLY;
591 open_flags = O_WRONLY;
600 open_flags |= O_SYNC;
602 open_flags |= O_DIRECT;
607 fd = open(p_dev, open_flags);
613 fd = NI_INVALID_DEVICE_HANDLE;
619 retval = fcntl(fd, F_NOCACHE, 1);
625 fd = NI_INVALID_DEVICE_HANDLE;
630 retval = fstat(fd, &g_nvme_stat);
636 fd = NI_INVALID_DEVICE_HANDLE;
640 if (!S_ISCHR(g_nvme_stat.st_mode) && !S_ISBLK(g_nvme_stat.st_mode))
646 fd = NI_INVALID_DEVICE_HANDLE;
668 if ( NI_INVALID_DEVICE_HANDLE == device_handle )
675 if(device_handle == 0)
692 retval = CloseHandle(device_handle);
696 "ERROR: %s(): closing device device_handle %p failed, error: %d\n",
707 err = close(device_handle);
710 char error_message[100] = {
'\0'};
711 char unknown_error_message[20] = {
'\0'};
712 ni_sprintf(error_message, 100,
"ERROR: %s(): ", __func__);
716 ni_strcat(error_message, 100,
"EBADF\n");
719 ni_strcat(error_message, 100,
"EINTR\n");
725 ni_sprintf(unknown_error_message, 20,
"Unknown error %d\n", err);
726 ni_strcat(error_message, 100, unknown_error_message);
737#ifndef DEPRECATION_AS_ERROR
755 void * p_buffer = NULL;
757 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
761 if ( (NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_cap) )
817 void * p_buffer = NULL;
819 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
823 if ( (NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_cap) )
890 bool use_model_load =
true;
894 uint32_t num_sw_instances = 0;
895 uint32_t pixel_load = 0xFFFFFFFFU;
896 int user_handles =
false;
897 ni_lock_handle_t lock = NI_INVALID_LOCK_HANDLE;
898 ni_device_handle_t handle = NI_INVALID_DEVICE_HANDLE;
899 ni_device_handle_t handle1 = NI_INVALID_DEVICE_HANDLE;
912 if (!IsUserAnAdmin())
923 if (!p_session_context)
932 "device_type %d, session id %d\n",
984 for (i = 0; i < 120; i++)
993 "%s: device type %d hw_id %d blk_dev_name: %s dev_xcoder_name: %s.\n",
1013 "%s: block device name %s type %d guid %d is to "
1014 "override passed in guid %d\n",
1015 __func__, p_ctx->
blk_dev_name, device_type, tmp_guid_id,
1017 p_ctx->
hw_id = tmp_guid_id;
1028 if ((handle1 == NI_INVALID_DEVICE_HANDLE) && (handle == NI_INVALID_DEVICE_HANDLE))
1030 if (p_ctx->
hw_id >=0)
1052 user_handles =
true;
1071 user_handles =
true;
1090 use_model_load =
false;
1129 for (i = 0; i < num_coders; i++)
1134 if (p_device_context == NULL)
1137 "ERROR: %s() ni_rsrc_get_device_context() failed\n",
1148 if (NI_INVALID_DEVICE_HANDLE == p_session_context->
device_handle)
1157 if (NI_INVALID_DEVICE_HANDLE != p_session_context->
device_handle)
1165 g_device_type_str[query_type],
1192 curr_load = p_dev_info->
load;
1195 if (i == 0 || curr_load < least_load ||
1196 (curr_load == least_load &&
1200 least_load = curr_load;
1212 NI_INVALID_DEVICE_HANDLE)
1226 p_ctx->
hw_id = guid;
1248 p_ctx->
hw_id = guid;
1256 else if((handle1 == NI_INVALID_DEVICE_HANDLE) || (handle == NI_INVALID_DEVICE_HANDLE))
1264 user_handles =
true;
1268 "Finish open the session dev:%s guid:%d handle:%p handle1:%p\n",
1275 if (p_device_context == NULL)
1278 "ERROR: %s() ni_rsrc_get_device_context() failed\n",
1280 if (user_handles !=
true)
1306 "ERROR: %s() cannot retrieve DDR configuration\n",
1308 if (user_handles !=
true)
1322 "ERROR: %s() keep_alive_timeout was 0, should be between 1-100. "
1323 "Setting to default of %u\n",
1327 switch (device_type)
1332 if (user_handles !=
true)
1355 if (p_enc_params && p_enc_params->
hwframes &&
1371 if (user_handles !=
true)
1389 if (user_handles !=
true)
1407 if (user_handles !=
true)
1425 if (user_handles !=
true)
1442 if (user_handles !=
true)
1452 __func__, device_type);
1518 p_device_pool = NULL;
1577 "join keep alive thread fail! : sid %u ret %d\n",
1588 switch (device_type)
1619 __func__, device_type);
1694 switch (device_type)
1710 __func__, device_type);
1752 0 == memcmp(p_ctx->
p_hdr_buf, hdr_data, hdr_size))
1764 memcpy(p_ctx->
p_hdr_buf, hdr_data, hdr_size);
1841 if (!p_ctx || !p_data)
1857 "ERROR: %s() keep alive thread has been closed, "
1858 "hw:%d, session:%d\n",
1875 switch (device_type)
1896 __func__, device_type);
1941 if ((!p_ctx) || (!p_data))
1958 "ERROR: %s() keep alive thread has been closed, "
1959 "hw:%d, session:%d\n",
1976 switch (device_type)
1980 int seq_change_read_count = 0;
1990 uint32_t aligned_width;
2000 if (0 == retval && seq_change_read_count)
2003 "%s (decoder): seq change NO data, next time.\n", __func__);
2009 else if (retval < 0)
2025 "%s (decoder): resolution change, frame size %ux%u -> %ux%u, "
2026 "width %u bit %d, pix_fromat_changed %d, actual_video_width %d, continue read ...\n",
2035 seq_change_read_count++;
2058 __func__, device_type);
2106 __func__, device_type);
2146 __func__, device_type);
2186 __func__, device_type);
2207 uint32_t namespace_num, uint32_t sriov_index)
2210 __func__, namespace_num, sriov_index);
2231 __func__, device_handle, mode);
2250 ni_device_handle_t device_handle_t,
2251 uint32_t over_provision)
2254 float f_over_provision = 0;
2255 memcpy(&f_over_provision, &over_provision,
sizeof(int32_t));
2257 __func__, device_handle, device_handle_t, f_over_provision);
2283 ni_device_handle_t device_handle_t,
2287 float f_allowance = 0;
2288 memcpy(&f_allowance, &allowance,
sizeof(int32_t));
2290 __func__, device_handle, device_handle_t, f_allowance);
2327 int video_height,
int alignment,
2328 int metadata_flag,
int factor,
2329 int hw_frame_count,
int is_planar)
2331 void* p_buffer = NULL;
2332 int metadata_size = 0;
2334 int width_aligned = video_width;
2335 int height_aligned = video_height;
2337 if ((!p_frame) || ((factor!=1) && (factor!=2) && (factor !=4))
2342 "factor %d, video_width %d, video_height %d\n",
2343 __func__, factor, video_width, video_height);
2358 width_aligned = ((((video_width * factor) + 127) / 128) * 128) / factor;
2359 height_aligned = ((video_height + 1) / 2) * 2;
2364 height_aligned = ((video_height + 1) / 2) * 2;
2372 width_aligned = ((video_width + 31) / 32) * 32;
2373 height_aligned = ((video_height + 7) / 8) * 8;
2376 height_aligned = ((video_height + 15) / 16) * 16;
2380 int luma_size = width_aligned * height_aligned * factor;
2385 int chroma_width_aligned = ((((video_width / 2 * factor) + 127) / 128) * 128) / factor;
2389 chroma_width_aligned =
2390 ((((video_width * factor) + 127) / 128) * 128) / factor;
2392 int chroma_height_aligned = height_aligned / 2;
2393 chroma_b_size = chroma_r_size = chroma_width_aligned * chroma_height_aligned * factor;
2401 chroma_b_size = chroma_r_size = 0;
2407 chroma_b_size = luma_size / 4;
2408 chroma_r_size = chroma_b_size;
2413 if (hw_frame_count == 0)
2414 buffer_size = luma_size + chroma_b_size + chroma_r_size + metadata_size;
2428 "%s: free current p_frame, p_frame->buffer_size=%u\n", __func__,
2466 p_frame->
data_len[1] = chroma_b_size;
2467 p_frame->
data_len[2] = chroma_r_size;
2486 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);
2525 int video_height,
int alignment,
2526 int metadata_flag,
int factor,
2527 int hw_frame_count,
int is_planar,
2534 if (((factor!=1) && (factor!=2) && (factor !=4))
2539 "factor %d, video_width %d, video_height %d\n",
2540 __func__, factor, video_width, video_height);
2567 dst_stride, height_aligned);
2575 video_height, dst_stride, alignment,
2597 int video_height,
int pixel_format)
2599 void *p_buffer = NULL;
2601 int width_aligned = video_width;
2602 int height_aligned = video_height;
2610 (video_height <= 0))
2613 "ERROR: %s passed parameters are null or not supported, "
2614 "video_width %d, video_height %d\n",
2615 __func__, video_width, video_height);
2619 switch (pixel_format)
2625 luma_size = width_aligned * height_aligned;
2628 chroma_r_size = chroma_b_size;
2634 luma_size = width_aligned * height_aligned * 2;
2636 chroma_r_size = chroma_b_size;
2642 luma_size = width_aligned * height_aligned;
2643 chroma_b_size = width_aligned * height_aligned / 2;
2650 luma_size = width_aligned * height_aligned * 2;
2651 chroma_b_size = width_aligned * height_aligned;
2656 height_aligned = video_height;
2658 luma_size = width_aligned * height_aligned;
2659 chroma_b_size = luma_size;
2665 height_aligned = video_height;
2667 luma_size = width_aligned * height_aligned * 2;
2677 height_aligned = video_height;
2679 luma_size = width_aligned * height_aligned * 4;
2685 height_aligned = video_height;
2687 luma_size = width_aligned * height_aligned;
2688 chroma_b_size = luma_size;
2689 chroma_r_size = luma_size;
2697 buffer_size = luma_size + chroma_b_size + chroma_r_size;
2703 __func__, luma_size, chroma_b_size, chroma_r_size, buffer_size);
2709 "%s: free current p_frame, p_frame->buffer_size=%u\n", __func__,
2721 "ERROR %d: %s() Cannot allocate p_frame buffer.\n",
NI_ERRNO,
2739 p_frame->
data_len[1] = chroma_b_size;
2740 p_frame->
data_len[2] = chroma_r_size;
2791 int video_width,
int video_height,
2792 int alignment,
int factor,
2800 if ((!p_frame) || ((factor!=1) && (factor!=2))
2805 "factor %d, video_width %d, video_height %d\n",
2806 __func__, factor, video_width, video_height);
2812 width_aligned = ((((video_width * factor) + 127) / 128) * 128) / factor;
2813 height_aligned = video_height;
2817 width_aligned = ((video_width + 31) / 32) * 32;
2818 height_aligned = ((video_height + 7) / 8) * 8;
2821 height_aligned = ((video_height + 15) / 16) * 16;
2826 width_aligned, height_aligned, video_width, video_height);
2828 int luma_size = width_aligned * height_aligned * factor;
2833 int chroma_width_aligned = ((((video_width / 2 * factor) + 127) / 128) * 128) / factor;
2836 chroma_width_aligned =
2837 ((((video_width * factor) + 127) / 128) * 128) / factor;
2839 int chroma_height_aligned = height_aligned / 2;
2840 chroma_b_size = chroma_r_size = chroma_width_aligned * chroma_height_aligned * factor;
2848 chroma_b_size = luma_size / 4;
2849 chroma_r_size = chroma_b_size;
2851 int buffer_size = luma_size + chroma_b_size + chroma_r_size +
2893 p_frame->
p_data[2] = p_frame->
p_data[1] + chroma_b_size;
2894 p_frame->
p_data[3] = p_frame->
p_data[2] + chroma_r_size;
2902 p_frame->
data_len[1] = chroma_b_size;
2903 p_frame->
data_len[2] = chroma_r_size;
2938 int width,
int height,
2939 const int linesize[],
2943 if ((!p_enc_ctx) || (!p_enc_params) || (!linesize)
2949 "p_enc_ctx %p, p_enc_params %p, linesize %p, "
2950 "width %d, height %d linesize[0] %d\n",
2951 __func__, p_enc_ctx, p_enc_params, linesize,
2952 width, height, (linesize) ? linesize[0] : 0);
2961 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s: not supported on device with FW API version < 6.Q\n", __func__);
2965 bool isrgba =
false;
2966 bool isplanar =
false;
2967 bool issemiplanar =
false;
2977 issemiplanar =
true;
2996 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s: semi-planar not supported on device with FW API version < 6.q\n", __func__);
3005 bool ishwframe = (p_enc_params->
hwframes) ?
true :
false;
3008 "p_enc_ctx %p, p_enc_params %p, linesize %p, "
3009 "width %d, height %d, linesize[0] %d linesize[1] %d\n",
3010 __func__, isrgba, issemiplanar, ishwframe, p_enc_ctx, p_enc_params, linesize,
3011 width, height, linesize[0], linesize[1]);
3013 if (linesize[0] <= max_linesize &&
3014 linesize[0] % 2 == 0 &&
3015 linesize[1] % 2 == 0 &&
3022 (!isplanar || linesize[2] == linesize[1])
3040 "luma_linesize %d, chroma_linesize %d, "
3041 "linesize[0] %d, linesize[1] %d\n",
3043 linesize[0], linesize[1]);
3050 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"%s: linesize changed from %u %u to %u %u - resolution change?\n", __func__,
3052 linesize[0], linesize[1]);
3086 const int linesize[],
const uint8_t *data[],
3087 int buf_size0,
int buf_size1,
int buf_size2,
3088 uint8_t *buf_data0, uint8_t *buf_data1, uint8_t *buf_data2)
3092 if (!p_frame || !p_enc_ctx || !data || !linesize)
3094 ni_log(
NI_LOG_ERROR,
"ERROR: %s: null parameters: p_frame=%p, p_enc_ctx=%p, linesize=%p, data=%p\n",
3095 __func__, p_frame, p_enc_ctx, linesize, data);
3107 const uint8_t *buf_data[3] = { buf_data0, buf_data1, buf_data2 };
3108 const int buf_size[3] = { buf_size0, buf_size1, buf_size2 };
3109 const uint8_t *end_used, *end_alloc;
3116 const int num_planes = (buf_size[2] != 0) ? 3 : (buf_size[1] != 0) ? 2 : 1;
3121 for (i = 0; i < num_planes; i++)
3123 if (!data[i] || !buf_data[i] || buf_size[i] <= 0)
3125 ni_log(
NI_LOG_ERROR,
"ERROR: %s: invalid parameter %d: data=%p, buf_data=%p, size=%d\n",
3126 __func__, i, data[i], buf_data[i], buf_size[i]);
3130 int plane_height = video_height >> (i > 0 ? 1 : 0);
3139 end_used = data[2] + linesize[2] * (video_height >> 1);
3144 end_used = data[1] + linesize[1] * (video_height >> 1);
3148 ni_log(
NI_LOG_ERROR,
"ERROR: %s: Single-plane pixel format not supported\n", __func__);
3155 end_used = data[i] + linesize[i] * plane_height;
3159 end_alloc = buf_data[i] + buf_size[i];
3162 int plane_offset = (int)(end_used - end_alloc);
3163 plane_offset = (plane_offset > 0) ? plane_offset : 0;
3169 offset = plane_offset * 2;
3170 ((uint8_t **)data)[0] -= offset;
3171 ((uint8_t **)data)[1] -= plane_offset;
3172 ((uint8_t **)data)[2] -= plane_offset;
3176 offset = plane_offset;
3177 ((uint8_t **)data)[0] -= plane_offset;
3178 ((uint8_t **)data)[1] -= plane_offset;
3183 ((uint8_t **)data)[i] -= plane_offset;
3186 offset = plane_offset;
3219 int video_width,
int video_height,
3220 const int linesize[],
const uint8_t *data[],
3225 if ((!p_frame) || (!linesize) || (!data))
3228 "p_frame %p, linesize %p, data %p\n",
3229 __func__, p_frame, linesize, data);
3234 "%s: resolution=%dx%d linesize=%d/%d/%d "
3235 "data=%p %p %p extra_len=%d\n",
3236 __func__, video_width, video_height,
3237 linesize[0], linesize[1], linesize[2],
3238 data[0], data[1], data[2], extra_len);
3246 p_frame->
p_buffer = (uint8_t *)data[0];
3247 p_frame->
p_data[0] = (uint8_t *)data[0];
3248 p_frame->
p_data[1] = (uint8_t *)data[1];
3249 p_frame->
p_data[2] = (uint8_t *)data[2];
3251 int luma_size = linesize[0] * video_height;
3252 int chroma_b_size = 0;
3253 int chroma_r_size = 0;
3257 chroma_b_size = linesize[1] * (video_height / 2);
3260 chroma_r_size = linesize[2] * (video_height / 2);
3264 uint32_t start_offset;
3265 uint32_t total_start_len = 0;
3271 if ((data[1] && (data[0] + luma_size != data[1]))
3272 || (data[2] && (data[1] + chroma_b_size != data[2])))
3283 total_start_len += p_frame->
start_len[i];
3291 total_start_len = p_frame->
start_len[0];
3304 if (total_start_len)
3316 int start_buffer_offset = 0;
3323 start_buffer_offset += p_frame->
start_len[i];
3329 p_frame->
data_len[1] = chroma_b_size;
3330 p_frame->
data_len[2] = chroma_r_size;
3337 "%s: success: p_metadata_buffer %p metadata_buffer_size %u "
3338 "p_start_buffer %p start_buffer_size %u data_len %u %u %u\n",
3368 int width,
int height,
3369 const int linesize[],
int pixel_format)
3372 if ((!p_upl_ctx) || (!linesize)
3378 "p_enc_ctx %p, linesize %p, "
3379 "width %d, height %d linesize[0] %d\n",
3380 __func__, p_upl_ctx, linesize,
3381 width, height, (linesize) ? linesize[0] : 0);
3390 ni_log2(p_upl_ctx,
NI_LOG_DEBUG,
"%s: not supported on device with FW API version < 6.S\n", __func__);
3400 "p_upl_ctx %p, linesize %p, "
3401 "width %d, height %d, linesize[0] %d\n",
3402 __func__, pixel_format, p_upl_ctx, linesize,
3403 width, height, linesize[0]);
3405 int bit_depth_factor;
3406 bool isrgba =
false;
3407 bool isplanar =
false;
3408 bool issemiplanar =
false;
3410 switch (pixel_format)
3414 bit_depth_factor = 1;
3418 bit_depth_factor = 2;
3421 issemiplanar =
true;
3422 bit_depth_factor = 1;
3425 issemiplanar =
true;
3426 bit_depth_factor = 2;
3433 bit_depth_factor = 4;
3446 ni_log2(p_upl_ctx,
NI_LOG_DEBUG,
"%s: semi-planar not supported on device with FW API version < 6.q\n", __func__);
3451 if (linesize[0] <= max_linesize &&
3460 linesize[2] == linesize[1])
3466 linesize[1] == linesize[0])
3501 int video_height,
int linesize[],
3502 int alignment,
int extra_len,
3503 bool alignment_2pass_wa)
3505 void* p_buffer = NULL;
3514 "p_frame %p, linesize %p, video_width %d, video_height %d\n",
3515 __func__, p_frame, linesize, video_width, video_height);
3521 height_aligned = ((video_height + 1) / 2) * 2;
3524 height_aligned = ((video_height + 7) / 8) * 8;
3528 height_aligned = ((video_height + 15) / 16) * 16;
3537 "%s: aligned=%dx%d org=%dx%d linesize=%d/%d/%d "
3539 __func__, video_width, height_aligned, video_width, video_height,
3540 linesize[0], linesize[1], linesize[2], extra_len);
3542 int luma_size = linesize[0] * height_aligned;
3547 chroma_b_size = chroma_r_size = linesize[1] * (height_aligned / 2);
3548 if (alignment_2pass_wa)
3551 chroma_r_size = linesize[1] * (((height_aligned + 31) / 32) * 32) / 2;
3557 chroma_b_size = luma_size / 4;
3558 chroma_r_size = luma_size / 4;
3562 int buffer_size = luma_size + chroma_b_size + chroma_r_size + extra_len;
3570 "%s: free current p_frame, "
3571 "p_frame->buffer_size=%u\n",
3588 memset(p_buffer, 0, buffer_size);
3599 p_frame->
p_data[1] = (uint8_t*)p_frame->
p_data[0] + luma_size;
3600 p_frame->
p_data[2] = (uint8_t*)p_frame->
p_data[1] + chroma_b_size;
3608 p_frame->
data_len[1] = chroma_b_size;
3609 p_frame->
data_len[2] = chroma_r_size;
3616 "%s: success: p_frame->p_buffer %p "
3617 "p_frame->buffer_size=%u\n",
3737 int video_height,
int linesize[],
3738 int extra_len,
bool alignment_2pass_wa)
3740 void* p_buffer = NULL;
3749 "p_frame %p, linesize %p, video_width %d, video_height %d\n",
3750 __func__, p_frame, linesize, video_width, video_height);
3754 height_aligned = ((video_height + 1) / 2) * 2;
3762 "%s: aligned=%dx%d org=%dx%d linesize=%d/%d/%d extra_len=%d\n",
3763 __func__, video_width, height_aligned, video_width, video_height,
3764 linesize[0], linesize[1], linesize[2], extra_len);
3766 int luma_size = linesize[0] * height_aligned;
3767 int chroma_br_size = luma_size / 2;
3769 if (alignment_2pass_wa)
3772 chroma_br_size = linesize[0] * ((((height_aligned + 31) / 32) * 32) / 2);
3776 int buffer_size = luma_size + chroma_br_size + extra_len;
3800 memset(p_buffer, 0, buffer_size);
3812 p_frame->
p_data[1] = (uint8_t*)p_frame->
p_data[0] + luma_size;
3813 p_frame->
p_data[2] = (uint8_t*)p_frame->
p_data[1] + chroma_br_size;
3820 p_frame->
data_len[1] = chroma_br_size;
3871 int video_width,
int video_height,
3872 int linesize[],
int alignment,
3874 bool alignment_2pass_wa)
3879 linesize, alignment, extra_len,
3880 alignment_2pass_wa);
3885 linesize, extra_len,
3886 alignment_2pass_wa);
3928 "%s: close p_surface->dma_buf_fd %d "
3929 "ui16FrameIdx %u\n",
3945 p_frame->
p_data[i] = NULL;
4014 p_frame->
p_data[i] = NULL;
4054 void* p_buffer = NULL;
4055 int metadata_size = 0;
4062 packet_size + metadata_size);
4064 if (!p_packet || !packet_size)
4089 "%s: free current p_packet, p_packet->buffer_size=%u\n", __func__,
4095 __func__, buffer_size);
4152 if (!p_buffer || !p_packet || !buffer_size)
4160 ni_log(
NI_LOG_INFO,
"Info: %s: Warning buffer not 4k aligned = %p!. Will do an extra copy\n",
4161 __func__, p_buffer);
4239 "%s(): no need to free previous av1 packet buffers\n", __func__);
4275int ni_packet_copy(
void* p_destination,
const void*
const p_source,
int cur_size,
void* p_leftover,
int* p_prev_size)
4278 int padding_size = 0;
4279 int prev_size = p_prev_size == NULL? 0 : *p_prev_size;
4281 int total_size = cur_size + prev_size;
4282 uint8_t* p_src = (uint8_t*)p_source;
4283 uint8_t* p_dst = (uint8_t*)p_destination;
4284 uint8_t* p_lftover = (uint8_t*)p_leftover;
4293 if ((0 == cur_size) && (0 == prev_size))
4298 if (((0 != cur_size) && (!p_source)) || (!p_destination) || (!p_leftover))
4305 if (copy_size > total_size)
4307 padding_size = copy_size - total_size;
4312 memcpy(p_dst, p_lftover, prev_size);
4317 memcpy(p_dst, p_src, cur_size);
4322 memset(p_dst, 0, padding_size);
4326 "%s(): exit, cur_size=%d, copy_size=%d, "
4327 "prev_size=%d, padding_size=%d\n", __func__, cur_size,
4328 copy_size, *p_prev_size, padding_size);
4353 "ERROR: %s No memory or exceeding max aux_data number !\n",
4359 ret->
size = data_size;
4360 ret->
data = calloc(1, data_size);
4386 const uint8_t *raw_data,
4392 memcpy(ret->
data, raw_data, data_size);
4436 if (aux->
type == type)
4487 int fps_num,
int fps_denom,
4488 long bit_rate,
int width,
4639 p_param->
bitrate = (int)bit_rate;
4739 p_enc->
qcomp = (float)0.6;
4834 ni_log(
NI_LOG_ERROR,
"AV1 Picture Width not aligned to %d - picture will be cropped\n",
4839 ni_log(
NI_LOG_ERROR,
"AV1 Picture Height not aligned to %d - picture will be cropped\n",
4908 int fps_num,
int fps_denom,
4909 long bit_rate,
int width,
4935 if(fps_num <= 0 || fps_denom <= 0)
4939 ni_log(
NI_LOG_INFO,
"%s(): FPS is not set, setting the default FPS to 30\n", __func__);
4997 p_param->
bitrate = (int)bit_rate;
5029 char keyChar[10] =
"";
5031 char valChar[10] =
"";
5037 FILE *reconf = NULL;
5046 ni_fopen(&reconf, reconf_file,
"r");
5055 while ((readc = fgetc(reconf)) != EOF)
5062 ni_strncat(keyChar, 10, (
const char *)(&readc), 1);
5066 ni_strncat(valChar, 10, (
const char *)(&readc), 1);
5069 else if (readc ==
':')
5072 key =
atoi(keyChar);
5073 hash_map[idx][0] = key;
5075 else if (readc ==
',')
5080 "ERROR: Number of entries per line in reconfig file is greater then the "
5086 val =
atoi(valChar);
5087 hash_map[idx][valIdx] = val;
5089 memset(valChar, 0, 10);
5091 else if (readc ==
'\n')
5096 "ERROR: Number of lines in reconfig file is greater then the "
5103 val =
atoi (valChar);
5104 hash_map[idx][valIdx] = val;
5106 memset(keyChar,0,10);
5107 memset(valChar,0,10);
5112 ni_log(
NI_LOG_ERROR,
"ERROR: character %c in reconfig file. this may lead to mistaken reconfiguration values\n", readc);
5121 "ERROR %d: %s(): Incorrect format / "
5122 "incomplete Key/Value pair in reconfig_file: %s\n",
5133 char valChar[5] =
"";
5139 FILE *reconf = NULL;
5141 if (!customize_file)
5148 ni_fopen(&reconf, customize_file,
"r");
5152 NI_ERRNO, __func__, customize_file);
5157 while ((readc = fgetc(reconf)) != EOF)
5162 ni_strncat(valChar, 5, (
const char *)(&readc), 1);
5164 else if (readc ==
'-') {
5167 else if (readc ==
',')
5172 "ERROR: Number of qpIdx %d greater then the limit of %d or"
5173 "Number of levelIdx %d greater then the limit of %d\n",
5180 qp_map[levelIdx][qpIdx] = val;
5182 val = clip3(0, 32,
atoi(valChar));
5183 qp_map[levelIdx][qpIdx] = val * -1;
5186 memset(valChar, 0, 5);
5189 else if (readc ==
'\n')
5194 "ERROR: Number of qpIdx %d greater then the limit of %d or"
5195 "Number of levelIdx %d greater then the limit of %d\n",
5202 qp_map[levelIdx][qpIdx] = val;
5204 val = clip3(0, 32,
atoi(valChar));
5205 qp_map[levelIdx][qpIdx] = val * -1;
5208 memset(valChar, 0, 5);
5214 ni_log(
NI_LOG_ERROR,
"ERROR: character %c in reconfig file. this may lead to mistaken reconfiguration values\n", readc);
5225#define atoi(p_str) ni_atoi(p_str, &b_error)
5226#define atof(p_str) ni_atof(p_str, &b_error)
5227#define atobool(p_str) (ni_atobool(p_str, &b_error))
5244 const char *name,
char *value)
5246 bool b_error =
false;
5247 bool bNameWasBool =
false;
5248 bool bValueWasNull = !value;
5250 char nameBuf[64] = { 0 };
5251 const char delim[2] =
",";
5252 const char xdelim[2] =
"x";
5254 int i, j, k, ppu_index;
5274 if (name[0] ==
'-' && name[1] ==
'-')
5280 if (strlen(name) + 1 <
sizeof(nameBuf) && strchr(name,
'_'))
5283 ni_strcpy(nameBuf,
sizeof(nameBuf), name);
5284 while ((c = strchr(nameBuf,
'_')) != 0)
5295 else if (value[0] ==
'=')
5300#if defined(_MSC_VER)
5301#define OPT(STR) else if (!_stricmp(name, STR))
5302#define OPT2(STR1, STR2) \
5303 else if (!_stricmp(name, STR1) || !_stricmp(name, STR2))
5304#define OPT6(STR1, STR2, STR3, STR4, STR5, STR6) \
5305 else if (!_stricmp(name, STR1) || !_stricmp(name, STR2) || \
5306 !_stricmp(name, STR3) || !_stricmp(name, STR4) || \
5307 !_stricmp(name, STR5) || !_stricmp(name, STR6))
5309#define OPT(STR) else if (!strcasecmp(name, STR))
5310#define OPT2(STR1, STR2) else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))
5311#define OPT6(STR1, STR2, STR3, STR4, STR5, STR6) \
5312 else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2) || \
5313 !strcasecmp(name, STR3) || !strcasecmp(name, STR4) || \
5314 !strcasecmp(name, STR5) || !strcasecmp(name, STR6))
5319 if (!strncmp(value,
"hw",
sizeof(
"hw"))){
5322 else if (!strncmp(value,
"sw",
sizeof(
"sw"))) {
5333 if (
atoi(value) == 1)
5338 if (
atoi(value) == 1)
5343 if (
atoi(value) == 1)
5348 if (
atoi(value) == 1)
5353 if (
atoi(value) == 1)
5358 if (
atoi(value) == 1 ||
atoi(value) == 2)
5363 if (
atoi(value) == 1 ||
atoi(value) == 2)
5368 if (
atoi(value) == 1 ||
atoi(value) == 2)
5373 if (!strncmp(value,
"manual",
sizeof(
"manual"))) {
5376 else if (!strncmp(value,
"auto",
sizeof(
"auto"))) {
5381 "ERROR: %s():cropMode0 input can only be <manual,auto> got %s\n",
5388 if (!strncmp(value,
"manual",
sizeof(
"manual"))) {
5391 else if (!strncmp(value,
"auto",
sizeof(
"auto"))) {
5396 "ERROR: %s():cropMode1 input can only be <manual,auto> got %s\n",
5403 if (!strncmp(value,
"manual",
sizeof(
"manual"))) {
5406 else if (!strncmp(value,
"auto",
sizeof(
"auto"))) {
5411 "ERROR: %s():cropMode2 input can only be <manual,auto> got %s\n",
5418 char *saveptr = NULL;
5419 chunk =
ni_strtok(value, delim, &saveptr);
5420 for (i = 0; i < 4; i++)
5427 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5429 p_dec->
cr_expr[0][i][k] = chunk[j];
5437 chunk =
ni_strtok(NULL, delim, &saveptr);
5454 char *saveptr = NULL;
5455 chunk =
ni_strtok(value, delim, &saveptr);
5456 for (i = 0; i < 4; i++)
5463 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5465 p_dec->
cr_expr[1][i][k] = chunk[j];
5473 chunk =
ni_strtok(NULL, delim, &saveptr);
5491 char *saveptr = NULL;
5492 chunk =
ni_strtok(value, delim, &saveptr);
5493 for (i = 0; i < 4; i++)
5500 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5502 p_dec->
cr_expr[2][i][k] = chunk[j];
5510 chunk =
ni_strtok(NULL, delim, &saveptr);
5531 if (*chunk == xdelim[0]) {
5540 char *saveptr = NULL;
5541 chunk =
ni_strtok(value, xdelim, &saveptr);
5542 for (i = 0; i < 2; i++)
5549 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5551 p_dec->
sc_expr[0][i][k] = chunk[j];
5559 chunk =
ni_strtok(NULL, xdelim, &saveptr);
5572 if (*chunk == xdelim[0]) {
5581 char *saveptr = NULL;
5582 chunk =
ni_strtok(value, xdelim, &saveptr);
5583 for (i = 0; i < 2; i++)
5590 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5592 p_dec->
sc_expr[1][i][k] = chunk[j];
5600 chunk =
ni_strtok(NULL, xdelim, &saveptr);
5613 if (*chunk == xdelim[0]) {
5622 char *saveptr = NULL;
5623 chunk =
ni_strtok(value, xdelim, &saveptr);
5624 for (i = 0; i < 2; i++)
5631 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5633 p_dec->
sc_expr[2][i][k] = chunk[j];
5641 chunk =
ni_strtok(NULL, xdelim, &saveptr);
5656 ppu_index = name[5] -
'0';
5657 i = name[6] ==
'w' ? 0 : 1;
5661 if (chunk[j] !=
'\"' && chunk[j] !=
'\'')
5663 p_dec->
sc_expr[ppu_index][i][k] = chunk[j];
5675 if ((
atoi(value) < 0) || (
atoi(value) > 2))
5683 if ((
atoi(value) < 0) || (
atoi(value) > 2))
5691 if ((
atoi(value) < 0) || (
atoi(value) > 2))
5699 if (
atoi(value) < 2 ||
atoi(value) % 2 != 0 ||
atoi(value) > 128)
5702 "and must be even number and less than or equal to 128. Got: %s\n",
5711 if (
atoi(value) < 2 ||
atoi(value) % 2 != 0 ||
atoi(value) > 128)
5714 "and must be even number and less than or equal to 128. Got: %s\n",
5722 if (
atoi(value) < 2 ||
atoi(value) % 2 != 0 ||
atoi(value) > 128)
5725 "and must be even number and less than or equal to 128. Got: %s\n",
5733 if (!strncmp(value,
"up",
sizeof(
"up"))){
5736 else if (!strncmp(value,
"down",
sizeof(
"down"))) {
5747 if (!strncmp(value,
"up",
sizeof(
"up"))){
5750 else if (!strncmp(value,
"down",
sizeof(
"down"))) {
5761 if (!strncmp(value,
"up",
sizeof(
"up"))){
5764 else if (!strncmp(value,
"down",
sizeof(
"down"))) {
5775 if ((
atoi(value) != 0) && (
atoi(value) != 1))
5783 if (
atoi(value) < 0)
5800 if (
atoi(value) < 0)
5808 if ((
atoi(value) != 0) && (
atoi(value) != 1))
5816 if (
atoi(value) < 0)
5824 if (
atoi(value) < 0)
5832 if ((
atoi(value) != 0) && (
atoi(value) != 1))
5875 if (strncmp(value,
"tolerant",
sizeof(
"tolerant")) == 0) {
5877 }
else if (strncmp(value,
"ignore",
sizeof(
"ignore")) == 0) {
5879 }
else if (strncmp(value,
"skip",
sizeof(
"skip")) == 0) {
5881 }
else if (strncmp(value,
"best_effort",
sizeof(
"best_effort")) == 0) {
5883 }
else if (strncmp(value,
"limited_error",
sizeof(
"limited_error")) == 0) {
5885 }
else if (strncmp(value,
"best_effort_out_dc",
sizeof(
"best_effort_out_dc")) == 0) {
5893 if (
atoi(value) != 0 &&
5903 if (
atoi(value) < 0 || (
atoi(value) > 100))
5911 if (
atoi(value) < 0 || (
atoi(value) > 2))
5919 if (
atoi(value) < 0 || (
atoi(value) > 1))
5927 if (
atoi(value) < 0 ||
atoi(value) > 255)
5935 if (
atoi(value) < 0 ||
atoi(value) > 1)
5943 if (
atoi(value) != 0 &&
atoi(value) != 1)
5951 if (
atoi(value) < 0 ||
5960 if (
atoi(value) != 0 &&
atoi(value) != 1)
5968 if (
atoi(value) < 0 ||
5977 if (
atoi(value) < 0 ||
atoi(value) > 1)
5985 if ((
atoi(value) != 0) && (
atoi(value) != 1))
5993 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6001 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6016 b_error |= bValueWasNull && !bNameWasBool;
6025#define atoi(p_str) ni_atoi(p_str, &b_error)
6026#define atof(p_str) ni_atof(p_str, &b_error)
6027#define atobool(p_str) (ni_atobool(p_str, &b_error))
6044 const char *name,
const char *value)
6046 bool b_error =
false;
6047 bool bNameWasBool =
false;
6048 bool bValueWasNull = !value;
6050 char nameBuf[64] = { 0 };
6070 if (name[0] ==
'-' && name[1] ==
'-')
6076 if (strlen(name) + 1 <
sizeof(nameBuf) && strchr(name,
'_'))
6079 ni_strcpy(nameBuf,
sizeof(nameBuf), name);
6080 while ((c = strchr(nameBuf,
'_')) != 0)
6091 else if (value[0] ==
'=')
6096#if defined(_MSC_VER)
6097#define OPT(STR) else if (!_stricmp(name, STR))
6098#define OPT2(STR1, STR2) \
6099 else if (!_stricmp(name, STR1) || !_stricmp(name, STR2))
6101#define OPT(STR) else if (!strcasecmp(name, STR))
6102#define OPT2(STR1, STR2) else if (!strcasecmp(name, STR1) || !strcasecmp(name, STR2))
6104#define COMPARE(STR1, STR2, STR3) \
6105 if ((atoi(STR1) > (STR2)) || (atoi(STR1) < (STR3))) \
6107 return NI_RETCODE_PARAM_ERROR_OOR; \
6148 if (0 >
atoi(value))
6156 if (
atoi(value) < 0 ||
atoi(value) > 7)
6166#ifndef DEPRECATION_AS_ERROR
6169 if (0 !=
atoi(value) && 1 !=
atoi(value))
6180 if (0 !=
atoi(value) && 1 !=
atoi(value))
6203 if (
atof(value) <= 10)
6361#ifndef DEPRECATION_AS_ERROR
6364 if ((
atoi(value) > 51) || (
atoi(value) < -1))
6403 if (0 !=
atoi(value) && 1 !=
atoi(value))
6410#ifndef DEPRECATION_AS_ERROR
6417 if (!_strnicmp(value,
"ratio", 5))
6419 if (!strncasecmp(value,
"ratio", 5))
6422 char value_buf[32] = {0};
6423 for (i = 0; i <
sizeof(value_buf); i++)
6425 if (value[i+6] ==
']')
6429 value_buf[i] = value[i+6];
6431 if (i ==
sizeof(value_buf) ||
atoi(value_buf) < 0)
6440 int size =
atoi(value);
6451 if (!_strnicmp(value,
"ratio", 5))
6453 if (!strncasecmp(value,
"ratio", 5))
6456 char value_buf[32] = {0};
6457 for (i = 0; i <
sizeof(value_buf); i++)
6459 if (value[i+6] ==
']')
6463 value_buf[i] = value[i+6];
6465 if (i ==
sizeof(value_buf) ||
atoi(value_buf) < 0)
6474 int size =
atoi(value) / 8;
6484 if (0 !=
atoi(value) && 1 !=
atoi(value))
6529 if (
atoi(value) <= 0 )
6539 if (
atoi(value) <= 0)
6587 if (0 !=
atoi(value) && 1 !=
atoi(value))
6616 if (0 !=
atoi(value) && 1 !=
atoi(value))
6646 if ((
atoi(value) > 255) || (
atoi(value) < 0))
6654 if (
atoi(value) != 0 &&
atoi(value) != 5)
6662 if ((
atoi(value) > 3) || (
atoi(value) < 1))
6670 const char delim[2] =
",";
6673 char *v = _strdup(value);
6675 char *v = strdup(value);
6677 char *saveptr = NULL;
6681 if ((
atoi(chunk) > 65535) || (
atoi(chunk) < 0))
6687 chunk =
ni_strtok(NULL, delim, &saveptr);
6690 if ((
atoi(chunk) > 65535) || (
atoi(chunk) < 0))
6715#define STRDUP(value) _strdup(value);
6717#define STRDUP(value) strdup(value);
6719 const char G[2] =
"G";
6720 const char B[2] =
"B";
6721 const char R[2] =
"R";
6722 const char W[2] =
"W";
6723 const char L[2] =
"L";
6724 const char P[2] =
"P";
6725 const char parL[2] =
"(";
6726 const char comma[2] =
",";
6727 const char parR[2] =
")";
6728 int synCheck_GBRWLPCP[8];
6729 int posCheck_GBRWL[5] = {0};
6734 for (i = 0; i<8; i++)
6736 synCheck_GBRWLPCP[i] = 0;
6745 synCheck_GBRWLPCP[0]++;
6746 posCheck_GBRWL[0] = i;
6748 else if (*chunk == B[0])
6750 synCheck_GBRWLPCP[1]++;
6751 posCheck_GBRWL[1] = i;
6753 else if (*chunk == R[0])
6755 synCheck_GBRWLPCP[2]++;
6756 posCheck_GBRWL[2] = i;
6758 else if (*chunk == W[0])
6760 synCheck_GBRWLPCP[3]++;
6761 posCheck_GBRWL[3] = i;
6763 else if (*chunk == L[0])
6765 synCheck_GBRWLPCP[4]++;
6766 posCheck_GBRWL[4] = i;
6768 else if (*chunk == parL[0])
6770 synCheck_GBRWLPCP[5]++;
6772 else if (*chunk == comma[0])
6774 synCheck_GBRWLPCP[6]++;
6776 else if (*chunk == parR[0])
6778 synCheck_GBRWLPCP[7]++;
6784 if (synCheck_GBRWLPCP[0] != 1 || synCheck_GBRWLPCP[1] != 1 || synCheck_GBRWLPCP[2] != 1 ||
6785 synCheck_GBRWLPCP[3] != 1 || synCheck_GBRWLPCP[4] != 1 || synCheck_GBRWLPCP[5] != 5 ||
6786 synCheck_GBRWLPCP[6] != 5 || synCheck_GBRWLPCP[7] != 5)
6792#define GBRWLPARSE(OUT1,OUT2,OFF,IDX) \
6794 char *v = STRDUP(value); \
6795 chunk = v + posCheck_GBRWL[IDX]; \
6797 while (chunk != NULL) \
6799 if (*chunk == parL[0] && i == 1+(OFF)) \
6803 if((OFF) == 1 && *chunk != P[0] && i == 1) \
6807 if (*chunk == parR[0]) \
6818 return NI_RETCODE_PARAM_INVALID_VALUE; \
6820 subchunk = malloc(i - 1 - (OFF)); \
6821 if (subchunk == NULL) \
6824 return NI_RETCODE_ERROR_MEM_ALOC; \
6826 memcpy(subchunk, v + posCheck_GBRWL[IDX] + 2 + (OFF), i - 2 - (OFF)); \
6827 subchunk[i - 2 - (OFF)] = '\0'; \
6828 char *saveptr = NULL; \
6829 chunk = ni_strtok(subchunk, comma, &saveptr); \
6830 if (chunk != NULL) \
6832 if(atoi(chunk) < 0) \
6835 if(subchunk != NULL){ \
6838 return NI_RETCODE_PARAM_INVALID_VALUE; \
6840 *(OUT1) = atoi(chunk); \
6842 chunk = ni_strtok(NULL, comma, &saveptr); \
6843 if (chunk != NULL) \
6845 if(atoi(chunk) < 0) \
6848 if(subchunk != NULL){ \
6851 return NI_RETCODE_PARAM_INVALID_VALUE; \
6853 *(OUT2) = atoi(chunk); \
6867 if (
atoi(value)!= 0 && ((
atoi(value) > 40 ) || (
atoi(value) < 4)))
6875 if (
atoi(value) != 0 &&
atoi(value) != 1)
6883 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6891 if (
atoi(value) != 0 &&
atoi(value) != 1)
6899 if (
atoi(value) != 0 &&
atoi(value) != 1)
6911 if (
atoi(value) < 1 ||
atoi(value) > 2)
6919 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6932 if ((
atoi(value) < 0) || (
atoi(value) > 3))
6954 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6983 if ((
atoi(value) != 0) && (
atoi(value) != 1))
6991 if ((
atoi(value) < 0) || (
atoi(value) > 9))
6999 if ((
atoi(value) > 12) || (
atoi(value) < -12))
7009 if ((
atoi(value) > 300) || (
atoi(value) < 1))
7017 if ((
atoi(value) > 2) || (
atoi(value) < 0))
7025 if ((
atoi(value) > 15) || (
atoi(value) < 0))
7033 if ((
atoi(value) > 500) || (
atoi(value) < 0))
7041 if ((
atoi(value) > 1) || (
atoi(value) < 0))
7049 if ((
atoi(value) > 1) || (
atoi(value) < 0))
7096 if (
atoi(value) != 0 &&
atoi(value) != 1)
7104 if (
atoi(value) < 0 ||
atoi(value) > 3)
7112 if (
atoi(value) < 1)
7120 if (
atoi(value) < 0 ||
atoi(value) > 1)
7128 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7136 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7144 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7156 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7164 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7170 ni_log(
NI_LOG_ERROR,
"Cannot set enableAIEnhance and enableHVSPlus at same time, just enableHVSPlus\n");
7176 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7184 if ((
atoi(value) != 0) && (
atoi(value) != 1) && (
atoi(value) != -1))
7192 if ((
atoi(value) == 0) || (
atoi(value) > 3))
7200 if ((
atoi(value) == 0) || (
atoi(value) > 2))
7226 if ((
atoi(value) < 0) ||
7235 if ((
atoi(value) < 0) ||
7244 if ((
atoi(value) > 51) || (
atoi(value) < -1))
7252 if ((
atof(value) > 1.0) || (
atof(value) < 0.0))
7260 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7268 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7276 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7284 if ((
atoi(value) > 10) || (
atoi(value) < 1))
7292 if ((
atof(value) > 10.0) || (
atof(value) < 0.01))
7300 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7308 if ((
atof(value) > 10.0) || (
atof(value) < 0.01))
7316 if ((
atof(value) > 1.0) || (
atof(value) < 0.1))
7324 if ((
atoi(value) > 51) || (
atoi(value) < -1))
7341 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7349 if ((
atoi(value) > 51) || (
atoi(value) < -1))
7357 if (((
atof(value) < 0.0) && (
atof(value) != -1.0)) ||
7358 (
atof(value) > 51.00))
7366 if ((
atoi(value) < 0) || (
atoi(value) > 31))
7374 if (
atoi(value) != 0 &&
atoi(value) != 1 &&
atoi(value) != 6)
7385 if ((
atoi(value) < 0 ||
atoi(value) > 6))
7396 if ((
atoi(value) < 0 ||
atoi(value) > 10))
7404 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7412 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7420 if (
atoi(value) < 0 ||
atoi(value) > 1)
7428 if (
atoi(value) < 0)
7436 if (
atoi(value) < 0 ||
atoi(value) > 255)
7444 if (
atoi(value) != 0 &&
atoi(value) != 1)
7452 if (
atoi(value) <= 0)
7460 if ((
atoi(value) < 0 ||
atoi(value) > 2) &&
7461 atoi(value) != 5 &&
atoi(value) != 6 &&
atoi(value) != 7)
7473 if (
atoi(value) != 0 &&
atoi(value) != 1)
7481 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7489 if ((
atof(value) > 1.0) || (
atof(value) < 0.0))
7497 if (
atoi(value) < 0 ||
atoi(value) > 2)
7505 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7531 if (
atoi(value) < 0 ||
atoi(value) > 2)
7548 if (
atoi(value) < 1 ||
atoi(value) > 4)
7556 if (
atoi(value) < 0 ||
atoi(value) > 1)
7564 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7572 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7580 if (
atoi(value)!= 0 && ((
atoi(value) > 40 ) || (
atoi(value) < 4)))
7588 if (
atoi(value) != 0 &&
atoi(value) != 1)
7596 if (
atoi(value) != 0 &&
atoi(value) != 1)
7604 if (
atoi(value) != 0 &&
atoi(value) != 1)
7612 if (
atoi(value) < 0 ||
atoi(value) > 100)
7620 if (
atoi(value) < 0 ||
atoi(value) > 100)
7628 const char delim[2] =
",";
7631 char *v = _strdup(value);
7633 char *v = strdup(value);
7635 char *saveptr = NULL;
7646 chunk =
ni_strtok(NULL, delim, &saveptr);
7653 const char delim[2] =
",";
7656 char *v = _strdup(value);
7658 char *v = strdup(value);
7660 char *saveptr = NULL;
7668 if (
atof(chunk) <= 10)
7676 chunk =
ni_strtok(NULL, delim, &saveptr);
7683 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7691 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7711 if (
atoi(value) < 0 ||
atoi(value) > 3)
7719 if (
atoi(value) < 0 ||
atoi(value) > 1)
7727 if (
atoi(value) < 0 ||
atoi(value) > 2)
7735 if (
atoi(value) < 0 ||
atoi(value) > 3)
7743 if (
atoi(value) < 0 ||
atoi(value) > 255)
7751 if ((
atoi(value) != 0) && (
atoi(value) != 1))
7765 b_error |= bValueWasNull && !bNameWasBool;
7774#define atoi(p_str) ni_atoi(p_str, &b_error)
7775#define atof(p_str) ni_atof(p_str, &b_error)
7776#define atobool(p_str) (ni_atobool(p_str, &b_error))
7797 bool b_error =
false;
7798 bool bNameWasBool =
false;
7799 bool bValueWasNull = !value;
7802 char nameBuf[64] = { 0 };
7823 if (name[0] ==
'-' && name[1] ==
'-')
7829 if (strlen(name) + 1 <
sizeof(nameBuf) && strchr(name,
'_'))
7832 ni_strcpy(nameBuf,
sizeof(nameBuf), name);
7833 while ((c = strchr(nameBuf,
'_')) != 0)
7844 else if (value[0] ==
'=')
7849#if defined(_MSC_VER)
7850#define OPT(STR) else if (!_stricmp(name, STR))
7852#define OPT(STR) else if (!strcasecmp(name, STR))
7877 OPT(NI_ENC_GOP_PARAMS_G0_PIC_QP)
7881 OPT(NI_ENC_GOP_PARAMS_G0_NUM_REF_PIC_L0)
7885 OPT(NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L0)
7889 OPT(NI_ENC_GOP_PARAMS_G0_NUM_REF_POC_L1)
7906 OPT(NI_ENC_GOP_PARAMS_G1_PIC_QP)
7910 OPT(NI_ENC_GOP_PARAMS_G1_NUM_REF_PIC_L0)
7914 OPT(NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L0)
7918 OPT(NI_ENC_GOP_PARAMS_G1_NUM_REF_POC_L1)
7935 OPT(NI_ENC_GOP_PARAMS_G2_PIC_QP)
7939 OPT(NI_ENC_GOP_PARAMS_G2_NUM_REF_PIC_L0)
7943 OPT(NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L0)
7947 OPT(NI_ENC_GOP_PARAMS_G2_NUM_REF_POC_L1)
7964 OPT(NI_ENC_GOP_PARAMS_G3_PIC_QP)
7968 OPT(NI_ENC_GOP_PARAMS_G3_NUM_REF_PIC_L0)
7972 OPT(NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L0)
7976 OPT(NI_ENC_GOP_PARAMS_G3_NUM_REF_POC_L1)
7993 OPT(NI_ENC_GOP_PARAMS_G4_PIC_QP)
7997 OPT(NI_ENC_GOP_PARAMS_G4_NUM_REF_PIC_L0)
8001 OPT(NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L0)
8005 OPT(NI_ENC_GOP_PARAMS_G4_NUM_REF_POC_L1)
8022 OPT(NI_ENC_GOP_PARAMS_G5_PIC_QP)
8026 OPT(NI_ENC_GOP_PARAMS_G5_NUM_REF_PIC_L0)
8030 OPT(NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L0)
8034 OPT(NI_ENC_GOP_PARAMS_G5_NUM_REF_POC_L1)
8051 OPT(NI_ENC_GOP_PARAMS_G6_PIC_QP)
8055 OPT(NI_ENC_GOP_PARAMS_G6_NUM_REF_PIC_L0)
8059 OPT(NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L0)
8063 OPT(NI_ENC_GOP_PARAMS_G6_NUM_REF_POC_L1)
8080 OPT(NI_ENC_GOP_PARAMS_G7_PIC_QP)
8084 OPT(NI_ENC_GOP_PARAMS_G7_NUM_REF_PIC_L0)
8088 OPT(NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L0)
8092 OPT(NI_ENC_GOP_PARAMS_G7_NUM_REF_POC_L1)
8593 b_error |= bValueWasNull && !bNameWasBool;
8643 if ((!p_ctx) || (!p_data))
8660 "ERROR: %s() keep alive thread has been closed, "
8661 "hw:%d, session:%d\n",
8678 switch (device_type)
8682 int seq_change_read_count = 0;
8693 uint32_t aligned_width;
8705 ", DFVWxDFVH %u x %u, AlWid %u, AVW x AVH %u x %u\n",
8710 if (0 == retval && seq_change_read_count)
8719 else if (retval < 0)
8735 "%s (decoder): resolution change, frame size %ux%u -> %ux%u, "
8736 "width %u bit %d, pix_fromat_changed %d, actual_video_width %d, continue read ...\n",
8745 seq_change_read_count++;
8777 __func__, device_type);
8809 if ((!hwdesc) || (!p_data))
8837 bool use_external_mutex =
false;
8838 uint32_t orig_session_id = p_ctx->
session_id;
8839 ni_device_handle_t orig_blk_io_handle = p_ctx->
blk_io_handle;
8844 ni_pthread_mutex_t *p_ctx_mutex = &(p_ctx->
mutex);
8850 use_external_mutex =
true;
8863 if (use_external_mutex)
8908 "%s function not supported in FW API version < 6rt\n",
8913 switch (device_type)
8962 if ((!hwdesc) || (!p_src_data))
8996 int video_height,
int extra_len)
8998 void* p_buffer = NULL;
8999 int height_aligned = video_height;
9035 memset(p_buffer, 0, buffer_size);
9047 p_frame->
p_data[0] = NULL;
9048 p_frame->
p_data[1] = NULL;
9049 p_frame->
p_data[2] = NULL;
9084 int32_t device_handle)
9092 "%s(): ui16FrameIdx=%d sessionId=%d device_handle=0x%x\n",
9116 int32_t saved_dma_buf_fd;
9126 "%s(): ui16FrameIdx=%d sessionId=%d device_handle=0x%x\n",
9161 uint32_t pool_size, uint32_t pool)
9223 "ERROR: %s function not supported in FW API version < 6r3\n",
9230 "ERROR: can't free or expand framepool of session 0x%x "
9231 "before init framepool\n", p_ctx->
session_id);
9272 if (!p_ctx || !p_params)
9300 void *p_scaler_config = NULL;
9303 uint32_t ui32LBA = 0;
9307 if (!p_ctx || !p_params)
9309 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s() passed parameters are null!, return\n", __func__);
9331 memset(p_scaler_config, 0, buffer_size);
9337 memcpy(p_scaler_config, p_params, buffer_size);
9340 p_scaler_config, buffer_size, ui32LBA) < 0)
9343 "ERROR: ni_nvme_send_write_cmd failed: blk_io_handle: %" PRIx64
9344 ", hw_id, %d, xcoder_inst_id: %d\n",
9351 "ERROR: %s failed: blk_io_handle: %" PRIx64
","
9352 "hw_id, %d, xcoder_inst_id: %d\n",
9380 void *p_scaler_config = NULL;
9383 uint32_t ui32LBA = 0;
9387 if (!p_ctx || !p_params)
9389 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s() passed parameters are null!, return\n", __func__);
9411 memset(p_scaler_config, 0, buffer_size);
9417 memcpy(p_scaler_config, p_params, buffer_size);
9420 p_scaler_config, buffer_size, ui32LBA) < 0)
9423 "ERROR: ni_nvme_send_write_cmd failed: blk_io_handle: %" PRIx64
9424 ", hw_id, %d, xcoder_inst_id: %d\n",
9431 "ERROR: %s failed: blk_io_handle: %" PRIx64
","
9432 "hw_id, %d, xcoder_inst_id: %d\n",
9481 int rectangle_width,
9482 int rectangle_height,
9500 switch (device_type)
9504 rectangle_width, rectangle_height,
9505 rectangle_x, rectangle_y,
9506 rgba_color, frame_index);
9558 switch (device_type)
9610 "Error: %s function not supported on device with FW API version < 6rL\n",
9650 if (!p_ctx || !p_cfg)
9698 if (!p_ctx || !p_cfg_in)
9742 const int linesize[])
9747 int luma, chroma_b, chroma_r;
9754 switch (pixel_format)
9793 switch (pixel_format)
9797 luma = linesize[0] * alignedh;
9798 chroma_b = linesize[1] * alignedh / 2;
9799 chroma_r = linesize[2] * alignedh / 2;
9806 luma = linesize[0] * alignedh;
9807 chroma_b = linesize[1] * alignedh / 2;
9849 int video_width,
int video_height,
9850 int linesize[],
int alignment,
9854 void *p_buffer = NULL;
9858 int chroma_b_size = 0;
9859 int chroma_r_size = 0;
9867 switch (pixel_format)
9938 switch (pixel_format)
9942 luma_size = linesize[0] * height_aligned;
9946 chroma_b_size = linesize[1] * height_aligned / 2;
9947 chroma_r_size = linesize[2] * height_aligned / 2;
9951 chroma_b_size = luma_size / 4;
9952 chroma_r_size = luma_size / 4;
9961 luma_size = linesize[0] * video_height;
9970 luma_size = linesize[0] * height_aligned;
9971 chroma_b_size = linesize[1] * height_aligned / 2;
9978 luma_size = linesize[0] * video_height;
9979 chroma_b_size = linesize[1] * video_height;
9987 luma_size = linesize[0] * video_height;
10006 buffer_size = luma_size + chroma_b_size + chroma_r_size + extra_len;
10028 memset(p_buffer, 0, buffer_size);
10038 switch (pixel_format)
10044 p_frame->
p_data[2] = p_frame->
p_data[1] + chroma_b_size;
10045 p_frame->
p_data[3] = NULL;
10048 p_frame->
data_len[1] = chroma_b_size;
10049 p_frame->
data_len[2] = chroma_r_size;
10060 p_frame->
p_data[1] = NULL;
10061 p_frame->
p_data[2] = NULL;
10062 p_frame->
p_data[3] = NULL;
10076 p_frame->
p_data[1] = (uint8_t *)p_frame->
p_data[0] + luma_size;
10077 p_frame->
p_data[2] = NULL;
10078 p_frame->
p_data[3] = NULL;
10081 p_frame->
data_len[1] = chroma_b_size;
10092 p_frame->
p_data[1] = (uint8_t *)p_frame->
p_data[0] + luma_size;
10093 p_frame->
p_data[2] = NULL;
10094 p_frame->
p_data[3] = NULL;
10097 p_frame->
data_len[1] = chroma_b_size;
10110 p_frame->
p_data[1] = NULL;
10111 p_frame->
p_data[2] = NULL;
10112 p_frame->
p_data[3] = NULL;
10125 p_frame->
p_data[1] = (uint8_t *)p_frame->
p_data[0] + luma_size;
10126 p_frame->
p_data[2] = (uint8_t *)p_frame->
p_data[1] + chroma_b_size;
10127 p_frame->
p_data[3] = NULL;
10130 p_frame->
data_len[1] = chroma_b_size;
10131 p_frame->
data_len[2] = chroma_r_size;
10146 __func__, video_width, video_height, buffer_size);
10163 struct stat file_stat;
10165 unsigned char *buffer = NULL;
10178 if (stat(file, &file_stat) != 0)
10187 if (file_stat.st_size == 0)
10204 buffer = malloc(file_stat.st_size);
10212 if (fread(buffer, file_stat.st_size, 1, fp) != 1)
10264 ni_log2(p_ctx,
NI_LOG_ERROR,
"Error: hvsplus filter not supported on device with FW API version < 6ro\n");
10300 uint32_t buffer_size = 0;
10301 void *p_buffer = NULL;
10303 uint32_t i, this_size;
10306 if (!p_frame || !p_network)
10312 p_linfo = &p_network->
linfo;
10313 for (i = 0; i < p_network->
input_num; i++)
10321 "ERROR: %s(): invalid buffer_size of network\n", __func__);
10324 buffer_size += this_size;
10328 p_frame->
data_len[0] = buffer_size;
10361 p_frame->
p_data[1] = NULL;
10362 p_frame->
p_data[2] = NULL;
10363 p_frame->
p_data[3] = NULL;
10365 p_frame->
iovec = NULL;
10384 void *p_buffer = NULL;
10386 uint32_t buffer_size = 0;
10387 uint32_t i, data_size;
10390 if (!p_packet || !p_network)
10397 p_linfo = &p_network->
linfo;
10406 "ERROR: %s(): invalid buffer_size of network\n", __func__);
10409 buffer_size += data_size;
10411 data_size = buffer_size;
10429 "%s(): free current p_packet, p_packet->buffer_size=%u\n",
10434 __func__, buffer_size);
10473 if (!p_ctx || bitrate < NI_MIN_BITRATE || bitrate >
NI_MAX_BITRATE)
10476 __func__, bitrate);
10485 "Warning: %s(): bitrate %d overwriting current one %d\n",
10512 int32_t intra_period)
10514 if (!p_ctx || intra_period < 0 || intra_period > 1024)
10517 __func__, intra_period);
10526 "Warning: %s(): intraPeriod %d overwriting current one %d\n",
10657 int32_t ltr_interval)
10714 if (!p_ctx || framerate_num <= 0 || framerate_denom <= 0)
10717 "ERROR: %s(): invalid framerate passed in (%d/%d)\n", __func__,
10718 framerate_num, framerate_denom);
10722 if ((framerate_num % framerate_denom) != 0)
10724 uint32_t numUnitsInTick = 1000;
10725 framerate_num = framerate_num / framerate_denom;
10726 framerate_denom = numUnitsInTick + 1;
10727 framerate_num += 1;
10728 framerate_num *= numUnitsInTick;
10731 framerate_num = framerate_num / framerate_denom;
10732 framerate_denom = 1;
10735 if (((framerate_num + framerate_denom - 1) / framerate_denom) >
10739 "ERROR: %s(): invalid framerate passed in (%d/%d)\n", __func__,
10750 "Warning: %s(): framerate (%d/%d) overwriting current "
10752 __func__, framerate_num, framerate_denom,
10781 int32_t bitrate, framerate_num, framerate_denom;
10782 uint32_t maxFrameSize = (uint32_t)max_frame_size / 2000;
10783 uint32_t min_maxFrameSize;
10787 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
10796 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): max_frame_size is valid only when lowDelay mode is enabled\n",
10797 __func__, max_frame_size);
10810 framerate_num = (int32_t) api_param->
fps_number;
10814 min_maxFrameSize = (((uint32_t)bitrate / framerate_num * framerate_denom) / 8) / 2000;
10816 if (maxFrameSize < min_maxFrameSize)
10819 __func__, max_frame_size);
10832 "Warning: %s(): max_frame_size %d overwriting current one %d\n",
10856 int32_t minQpI, maxQpI, maxDeltaQp, minQpPB, maxQpPB;
10858 if (!p_ctx || !p_min_max_qp)
10860 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_min_max_qp pointer\n",
10865 minQpI = p_min_max_qp->
minQpI;
10866 maxQpI = p_min_max_qp->
maxQpI;
10868 minQpPB = p_min_max_qp->
minQpPB;
10869 maxQpPB = p_min_max_qp->
maxQpPB;
10871 if (minQpI > maxQpI || minQpPB > maxQpPB ||
10872 maxQpI > 51 || minQpI < 0 || maxQpPB > 51 || minQpPB < 0)
10875 __func__, minQpI, maxQpI, maxDeltaQp, minQpPB, maxQpPB);
10910 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
10919 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): reconfigure crf value %d is valid only in CRF mode\n",
10924 if (crf < 0 || crf > 51)
10926 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): crf value %d is invalid (valid range in [0..51])\n",
10938 "Warning: %s(): crf reconfig value %d overwriting current reconfig_crf %d\n",
10967 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
10976 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): reconfigure crf value %f is valid only in CRF mode\n",
10981 if (crf < 0.0 || crf > 51.0)
10983 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): crf value %f is invalid (valid range in [0..51])\n",
10995 "Warning: %s(): crf reconfig value %d overwriting current "
10996 "reconfig_crf %d, reconfig_crf_decimal %d\n", __func__,
11021 int32_t vbvMaxRate, int32_t vbvBufferSize)
11026 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11030 if ((vbvBufferSize < 10 && vbvBufferSize != 0) || vbvBufferSize > 3000)
11033 __func__, vbvBufferSize);
11037 if (api_param->
bitrate > 0 && vbvMaxRate > 0 && vbvMaxRate < api_param->bitrate) {
11039 vbvMaxRate, api_param->
bitrate);
11042 if (vbvBufferSize == 0 && vbvMaxRate > 0) {
11044 "vbvBufferSize is 0, force vbvMaxRate to 0\n",
11073 int32_t bitrate, framerate_num, framerate_denom;
11074 uint32_t min_maxFrameSize, maxFrameSize;
11078 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11087 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): max_frame_size_ratio is valid only when lowDelay mode is enabled\n",
11088 __func__, max_frame_size_ratio);
11092 if (max_frame_size_ratio < 1) {
11094 max_frame_size_ratio);
11107 framerate_num = (int32_t) api_param->
fps_number;
11111 min_maxFrameSize = (((uint32_t)bitrate / framerate_num * framerate_denom) / 8) / 2000;
11122 "Warning: %s(): max_frame_size %d overwriting current one %d\n",
11150 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid ni_session_context_t or p_session_config pointer\n",
11159 ni_log2(p_ctx,
NI_LOG_ERROR,
"%s():not support to reconfig slice_arg when slice_mode disable.\n",
11170 int max_num_ctu_mb_row = (api_param->
source_height + ctu_mb_size - 1) / ctu_mb_size;
11171 if (sliceArg < 1 || sliceArg > max_num_ctu_mb_row)
11209 int ret, is_semi_planar;
11215 if (p_ctx == NULL || p_frame == NULL || p_frame->
p_data[3] == NULL)
11262 uexp.
fn = p_ctx->
fn;
11273 *p_surface = hwdesc;
11303 int is_semi_planar;
11309 if (p_ctx == NULL || p_frame == NULL || p_frame->
p_data[3] == NULL)
11341 *p_surface = hwdesc;
11370 struct pollfd pfds[1] = {0};
11373 if (p_upl_ctx == NULL || p_frame == NULL)
11379 if (p_frame->
p_data[3] == NULL)
11388 pfds[0].events = POLLIN;
11389 pfds[0].revents = 0;
11391 ret = poll(pfds, 1, -1);
11407 "%s: failed to attach dmabuf read fence errno %s\n", __func__,
11433 if ((p_upl_ctx == NULL) || (p_frame == NULL))
11436 p_upl_ctx, p_frame);
11442 if (p_surface == NULL)
11475 uint8_t *p_data, uint32_t len,
11482 if (p_upl_ctx == NULL || p_data == NULL || p_hwframe == NULL)
11488 if (p_hwframe->
p_data[3] == NULL)
11505 "%s: Failed to request dmabuf rendering errno %d\n", __func__,
11530 uint8_t *p_data, uint32_t
len,
11534 char bar4_name[128];
11549 snprintf(bar4_name, 128,
11550 "/sys/bus/pci/devices/%04x:%02x:%02x.%1x/resource4",
11553 bar4_fd = open(bar4_name, O_RDWR | O_SYNC);
11560 bar4_name, errmsg);
11564 if (fstat(bar4_fd, &stat) != 0)
11573 bar4_mm = mmap(NULL, stat.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, bar4_fd, 0);
11575 if (bar4_mm == MAP_FAILED)
11585 memcpy(bar4_mm + offset, p_data, len);
11587 munmap(bar4_mm, 0);
11609 if (p_frame == NULL)
11616 if (p_surface == NULL)
11642 unsigned int offset;
11661 uexp.
fn = p_ctx->
fn;
11696 int width,
int height,
11697 int bit_depth,
int src_endian,
11703 if (p_enc_ctx == NULL || p_enc_params == NULL)
11709 if (!(bit_depth == 8) && !(bit_depth == 10))
11741 alignedw = ((width + 1) / 2) * 2;
11743 (alignedw - width) / 2 * 2;
11756 alignedh = ((height + 1) / 2) * 2;
11758 (alignedh - height) / 2 * 2;
11783 int width,
int height,
11786 if (p_upl_ctx == NULL)
11792 switch (pixel_format)
11823 p_upl_ctx->
isP2P = isP2P;
11848 int bytes_read = 0;
11864 bytes_read += (rx_size - (int)p_ctx->
meta_size);
11869 }
else if (rx_size != 0)
11898 if (p_frame == NULL)
11906 if (p_surface == NULL)
11934 int width,
int height,
int bit_depth_factor,
ni_device_type_t device_type)
11944 ni_log2(p_ctx,
NI_LOG_ERROR,
"Error: %s function not supported on device with FW API version < 5.4\n", __func__);
11955 resolution.
width = width;
11956 resolution.
height = height;
11968 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: Config sequence change not supported when spatialLayers > 1\n");
11981 ni_log2(p_ctx,
NI_LOG_DEBUG,
"%s: resolution change config - width %d height %d bit_depth_factor %d "
11982 "luma_linesize %d chroma_linesize %d\n", __func__,
11986 switch (device_type)
11997 ni_log2(p_ctx,
NI_LOG_ERROR,
"ERROR: Config sequence change not supported for device type: %d", device_type);
12015 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12018 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_info))
12029 "ERROR: %s function not supported on device with FW API version < 6.h\n",
12043 memset(buffer, 0, size);
12095 "ERROR: %s function not supported on device with FW API version < 6.O\n",
12109 memset(buffer, 0, size);
12138 void *p_buffer = NULL;
12140 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12142 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_ns_vf))
12153 "ERROR: %s function not supported on device with FW API version < 6.m\n",
12166 memset(p_buffer, 0, size);
12180 p_dev_ns_vf->
vf_id = p_dev_ns_vf_data->
vf_id;
12181 p_dev_ns_vf->
ns_id = p_dev_ns_vf_data->
ns_id;
12191 void *p_buffer = NULL;
12193 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12195 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_temp))
12206 "ERROR: %s function not supported on device with FW API version < 6rC\n",
12219 memset(p_buffer, 0, size);
12236 ni_log(
NI_LOG_DEBUG,
"%s(): current composite temperature %d on board temperature %d on die temperature %d\n",
12246 void *p_buffer = NULL;
12248 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12250 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_extra_info))
12261 "ERROR: %s function not supported on device with FW API version < 6rC\n",
12274 memset(p_buffer, 0, size);
12297 p_dev_extra_info->
fw_flavour = (uint8_t)
'-';
12335 syslog(LOG_WARNING,
"ERROR: CRITICAL TEMP %ddegC HIT on SN %s!!!\n",temp_deg,device_capability_t.
serial_number);
12342 syslog(LOG_WARNING,
"ERROR: WARNING TEMP %ddegC HIT on SN %s!!!\n",temp_deg, device_capability_t.
serial_number);
12347 ni_log(
NI_LOG_DEBUG,
"%s(): current composite temperature %d on board temperature %d "
12348 "on die temperature %d power consumption %d current consumption %d\n",
12361 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12363 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_qos_header) || (!fw_rev))
12374 "ERROR: %s function not supported on device with FW API version < 6t0\n",
12389 memset(buffer, 0, size);
12432 ni_event_handle_t event_handle = NI_INVALID_EVENT_HANDLE;
12434 if ((NI_INVALID_DEVICE_HANDLE == device_handle) || (!p_dev_qos_ns) || (!fw_rev))
12445 "ERROR: %s function not supported on device with FW API version < 6t0\n",
12460 memset(buffer, 0, size);
12514 bool is_ext_buf =
true;
12515 if (*p_log_buffer == NULL)
12523 is_ext_buf =
false;
12526 if(*p_log_buffer != NULL){
12554 uint32_t ctu, i, j;
12558 int importanceLevelCentre = p_param->
roi_demo_mode == 1 ? 40 : 10;
12559 int importanceLevelRest = p_param->
roi_demo_mode == 1 ? 10 : 40;
12564 uint32_t block_size, max_cu_size, customMapSize;
12568 uint32_t roiMapBlockUnitSize;
12569 uint32_t entryPerMb;
12575 linesize_aligned = (linesize_aligned / 8) * 8;
12576 height_aligned = (height_aligned / 8) * 8;
12582 ((linesize_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) *
12583 ((height_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) /
12587 customMapSize = ((block_size + 63) & (~63));
12603 ((linesize_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) /
12604 roiMapBlockUnitSize;
12606 ((height_aligned + max_cu_size - 1) & (~(max_cu_size - 1))) /
12607 roiMapBlockUnitSize;
12608 numMbs = mbWidth * mbHeight;
12612 entryPerMb = (roiMapBlockUnitSize / 8) * (roiMapBlockUnitSize / 8);
12614 for (i = 0; i < numMbs; i++)
12616 bool bIsCenter = (i % mbWidth > mbWidth / 3) && (i % mbWidth < mbWidth * 2 / 3);
12617 for (j = 0; j < entryPerMb; j++)
12627 p_enc_ctx->
roi_map[i * entryPerMb + j]
12630 bIsCenter ? importanceLevelCentre : importanceLevelRest;
12634 p_enc_ctx->
roi_len = customMapSize;
12637 (sumQp + (numMbs >> 1)) / numMbs;
12645 uint32_t mbWidth = (linesize_aligned + 16 - 1) >> 4;
12647 uint32_t mbHeight = (height_aligned + 16 - 1) >> 4;
12648 uint32_t numMbs = mbWidth * mbHeight;
12649 uint32_t customMapSize =
12659 for (i = 0; i < numMbs; i++)
12661 if ((i % mbWidth > mbWidth / 3) && (i % mbWidth < mbWidth * 2 / 3))
12671 p_enc_ctx->
roi_len = customMapSize;
12673 (sumQp + (numMbs >> 1)) / numMbs;
12681 uint32_t ctuWidth = (linesize_aligned + 64 - 1) >> 6;
12683 uint32_t ctuHeight = (height_aligned + 64 - 1) >> 6;
12685 uint32_t subCtuWidth = ctuWidth * 2;
12687 uint32_t subCtuHeight = ctuHeight * 2;
12688 uint32_t numSubCtus = subCtuWidth * subCtuHeight;
12695 for (i = 0; i < numSubCtus; i++)
12697 if ((i % subCtuWidth > subCtuWidth / 3) &&
12698 (i % subCtuWidth < subCtuWidth * 2 / 3))
12714 for (i = 0; i < ctuHeight; i++)
12717 for (j = 0; j < ctuWidth; j++, ptr += 2)
12719 ctu = (i * ctuWidth + j);
12723 *(ptr + subCtuWidth);
12725 *(ptr + subCtuWidth + 1);
12735 (sumQp + (numSubCtus >> 1)) / numSubCtus;
12765 *((int32_t *)aux_data->
data) =
12787 int32_t intraprd = *((int32_t *)aux_data->
data) =
12790 "xcoder_send_frame: frame #%lu reconf "
12791 "intraPeriod %d\n",
12825 "xcoder_send_frame: frame #%lu reconf "
12826 "vui colorDescPresent %d colorPrimaries %d "
12827 "colorTrc %d colorSpace %d aspectRatioWidth %d "
12828 "aspectRatioHeight %d videoFullRange %d\n",
12859 "xcoder_send_frame: frame #%lu metadata "
12860 "use_cur_src_as_long_term_pic %d use_long_term_ref "
12900 *((int32_t *)aux_data->
data) =
12903 "xcoder_send_frame: frame #%lu reconf "
12904 "ltrInterval %d\n",
12921 *((int32_t *)aux_data->
data) =
12924 "xcoder_send_frame: frame #%lu reconf "
12925 "invalidFrameNum %d\n",
12951 "xcoder_send_frame: frame #%lu reconf "
12952 "framerate (%d/%d)\n",
12966 *((int32_t *)aux_data->
data) =
12969 "xcoder_send_frame: frame #%lu reconf "
12970 "maxFrameSize %d\n",
12985 *((int32_t *)aux_data->
data) =
12988 "xcoder_send_frame: frame #%lu reconf "
13006 *((
float *)aux_data->
data) = crf;
13008 "xcoder_send_frame: frame #%lu reconf "
13020 if ((vbvBufferSize < 10 && vbvBufferSize != 0) || vbvBufferSize > 3000)
13023 __func__, vbvBufferSize);
13026 if (p_param->
bitrate > 0 && vbvMaxRate > 0 && vbvMaxRate < p_param->bitrate) {
13028 vbvMaxRate, p_param->
bitrate);
13031 if (vbvBufferSize == 0 && vbvMaxRate > 0) {
13033 "vbvBufferSize is 0, force vbvMaxRate to 0\n",
13043 *((int32_t *)aux_data->
data) = vbvMaxRate;
13049 *((int32_t *)aux_data->
data) = vbvBufferSize;
13051 "xcoder_send_frame: frame #%lu reconfig vbvMaxRate %d vbvBufferSize "
13052 "%d by frame aux data\n",
13053 p_enc_ctx->
frame_num, vbvMaxRate, vbvBufferSize);
13062 if (maxFrameSizeRatio < 1) {
13064 maxFrameSizeRatio);
13073 int32_t bitrate, framerate_num, framerate_denom;
13074 uint32_t min_maxFrameSize, maxFrameSize;
13084 framerate_num = (int32_t) p_param->
fps_number;
13088 min_maxFrameSize = ((uint32_t)bitrate / framerate_num * framerate_denom) / 8;
13091 *((int32_t *)aux_data->
data) = maxFrameSize;
13093 "xcoder_send_frame: frame #%lu reconf "
13094 "maxFrameSizeRatio %d maxFrameSize %d\n",
13095 p_enc_ctx->
frame_num, maxFrameSizeRatio, maxFrameSize);
13108 *((int16_t *)aux_data->
data) =
13111 "xcoder_send_frame: frame #%lu reconf "
13125 "xcoder_send_frame: frame #%lu force IDR frame\n",
13140 "xcoder_send_frame: frame #%lu API reconfig BR %d\n",
13156 "xcoder_send_frame: frame #%lu API reconfig intraPeriod %d\n",
13185 "xcoder_send_frame: frame #%lu reconf "
13186 "vui colorDescPresent %d colorPrimaries %d "
13187 "colorTrc %d colorSpace %d aspectRatioWidth %d "
13188 "aspectRatioHeight %d videoFullRange %d\n",
13205 if ((retval =
ni_set_ltr(p_enc_ctx, <r))) {
13209 "xcoder_send_frame(): frame #%lu API set LTR\n",
13228 "%s(): frame %d minQpI %d maxQpI %d maxDeltaQp %d minQpPB %d maxQpPB %d\n",
13243 "xcoder_send_frame(): frame #%lu API set LTR interval %d\n",
13258 "xcoder_send_frame(): frame #%lu API set frame ref invalid "
13277 "xcoder_send_frame: frame #%lu API reconfig framerate "
13294 "xcoder_send_frame: frame #%lu API reconfig maxFrameSize %d\n",
13309 "xcoder_send_frame: frame #%lu API reconfig crf %d\n",
13325 "xcoder_send_frame: frame #%lu API reconfig crf %f\n",
13340 "xcoder_send_frame: frame #%lu API reconfig vbvMaxRate %d vbvBufferSize %d\n",
13357 "xcoder_send_frame: frame #%lu reconf maxFrameSizeRatio %d\n",
13371 "xcoder_send_frame: frame #%lu API reconfig sliceArg %d\n",
13389static int ni_tolower(
int c)
13391 if (c >=
'A' && c <=
'Z')
13401 c1 = ni_tolower(*a++);
13402 c2 = ni_tolower(*b++);
13403 }
while (c1 && c1 == c2);
13555 "g%drefPic%d specified without g%drefPic%dUsed specified!\n",
13573#ifndef DEPRECATION_AS_ERROR
13587 uint64_t ui64DestAddr,
13588 uint32_t ui32FrameSize)
13593 (void) ui64DestAddr;
13594 (void) ui32FrameSize;
13600#ifndef DEPRECATION_AS_ERROR
13614 uint64_t ui64DestAddr, uint32_t ui32FrameSize)
13619 (void) ui64DestAddr;
13620 (void) ui32FrameSize;
13648 if ((pSession == NULL) || (dmaAddrs == NULL) || (pSrcFrame == NULL))
13657 "%s: FW doesn't support this operation\n", __func__);
13664 ni_log2(pSession,
NI_LOG_ERROR,
"%s(): Can't DMA to destination (%d)\n", __func__, retval);
13692 if ((pSession == NULL) || (dmaAddrs == NULL) || (pDstFrame == NULL))
13701 "%s: FW doesn't support this operation\n", __func__);
13710 "%s(): Can't DMA from source (%d)\n", __func__, retval);
13749 switch (device_type)
13757 ni_log2(p_ctx,
NI_LOG_ERROR,
"Error: %s function not supported on device with FW API version < 5.4\n", __func__);
13769 if (video_width < NI_MIN_WIDTH || video_width >
NI_MAX_WIDTH ||
13770 video_height < NI_MIN_HEIGHT || video_height >
NI_MAX_HEIGHT)
13773 __func__, video_width, video_height);
13776 resolution.
width = video_width;
13777 resolution.
height = video_height;
13793 ni_log(
NI_LOG_ERROR,
"Failed to reconfig config the encoder session (status = %d)\n", retval);
13809 __func__, device_type);
13828 int ret = 0, i = 0;
13829 if (!p_session_ctx || !p_param || !p_ppu_config)
13836 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s: Warning ignore ppu reconfig before last config done!\n", __func__);
13845 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s: not supported on device with FW API version < 6sF\n", __func__);
13852 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): only supported for h264 and h265 decoder\n", __func__);
13857 if (p_dec_input_param->
hwframes != 1)
13864 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): not supported when disable_adaptive_buffers is disabled\n", __func__);
13867 if (p_dec_input_param->
mcmode)
13869 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): not supported when MulticoreJointMode is enabled\n", __func__);
13875 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): Error reconfig ppu1 while ppu1 is not enabled\n", __func__);
13881 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s(): Error reconfig ppu2 while ppu2 is not enabled\n", __func__);
13894 "out of range\n", __func__, i, p_ppu_config->
ppu_w[i], p_ppu_config->
ppu_h[i]);
13898 if ((p_ppu_config->
ppu_w[i] & 1) || (p_ppu_config->
ppu_h[i] & 1))
13901 __func__, i, p_ppu_config->
ppu_w[i], p_ppu_config->
ppu_h[i]);
#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.
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_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_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.
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_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 NI_ENC_PARAM_MAX_CONSUTIVE_SKIP_FRAME_NUMBER
#define NI_ENC_GOP_PARAMS_G7_POC_OFFSET
#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
#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_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_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
union _ni_enc_hevc_roi_custom_map ni_enc_hevc_roi_custom_map_t
encoder HEVC ROI custom map (1 CTU = 64bits)
#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_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_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_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_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_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_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
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_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