 |
libxcoder
5.2.0
|
Go to the documentation of this file.
64 p_fifo->
buffer = malloc(number_of_buffers * size);
65 if (p_fifo->
buffer == NULL)
73 memset(p_fifo->
buffer, 0, (number_of_buffers * size));
244 "ERROR %d:%s() line %d, alloc dst_frame failed\n",
NI_ERRNO,
245 __FUNCTION__, __LINE__);
260 "ERROR %d:%s() line %d, alloc dst_pkt failed\n",
NI_ERRNO,
261 __FUNCTION__, __LINE__);
277 "ERROR %d:%s() line %d, alloc session context failed\n",
283 nifilter->
api_ctx = p_session_ctx;
330 "ERROR %d:%s() line %d, alloc session context failed\n",
336 nifilter->
params = p_param;
382 int height,
int out_format,
int pool_size)
389 if (p_session_ctx->
isP2P)
395 NIALIGN(height, 2), out_format, options,
407 int video_width,
int video_height,
412 video_height, extra_len);
416 int height,
int format,
int options,
418 int rectangle_height,
int rectangle_x,
419 int rectangle_y,
int rgba_color,
420 int frame_index,
int type)
424 rectangle_width, rectangle_height, rectangle_x,
425 rectangle_y, rgba_color, frame_index, type);
478 uint8_t *data,
int width,
int height)
511 "ERROR %d:%s() line %d, alloc session data failed\n",
521 int video_height,
int pixel_format)
526 video_height, pixel_format);
626 float *dst, uint32_t num,
636 int video_width,
int video_height,
637 int linesize[],
int alignment,
642 video_width, video_height, linesize,
643 alignment, extra_len);
663 "ERROR %d:%s() line %d, alloc session context failed\n",
669 ni_ctx->
api_ctx = p_session_ctx;
711 for (i = 0; i < 3; i++)
713 p_split_ctx->
w[i] = w;
714 p_split_ctx->
h[i] = h;
715 p_split_ctx->
f[i] = -1;
730 ni_device_handle_t fd = ni_hw_ctx->
cards[i];
731 if (fd != NI_INVALID_DEVICE_HANDLE)
733 ni_hw_ctx->
cards[i] = NI_INVALID_DEVICE_HANDLE;
810 int *height,
int ni_fmat,
int keep_alive_time)
813 int linesize_aligned, height_aligned;
814 linesize_aligned = *width;
817 linesize_aligned =
NI_VPU_CEIL(linesize_aligned, 2);
820 linesize_aligned = ((*width + 31) / 32) * 32;
824 }
else if (linesize_aligned > *width)
828 *width = linesize_aligned;
830 height_aligned = *height;
836 height_aligned = ((*height + 15) / 16) * 16;
841 }
else if (height_aligned > *height)
843 *height = height_aligned;
962 int i, module_id = 0, ret = 0;
963 ni_device_handle_t fd;
964 uint32_t max_io_size = 0;
996 ni_hw_ctx->
cards[i] = NI_INVALID_DEVICE_HANDLE;
1011 if (fd != NI_INVALID_DEVICE_HANDLE)
1013 ni_hw_ctx->
cards[module_id] = fd;
1026 uint8_t **dstdata, uint32_t *data_len,
1027 int width,
int height,
int is_planar)
1035 memset(p_dst_session_data, 0,
sizeof(dst_session_io_data));
1065 static int av_to_niframe_copy(
const int dst_stride[4],
ni_frame_t *dst,
1066 int width,
int height,
int ni_fmat,
int nb_planes,
1067 const int *linesize, uint8_t **src_data)
1069 int src_height[4], hpad[4], vpad[4];
1071 uint8_t *src_line, *dst_line, YUVsample, *sample, *dest;
1078 hpad[0] =
NIMAX(dst_stride[0] - linesize[0], 0);
1079 hpad[1] =
NIMAX(dst_stride[1] - linesize[1], 0);
1080 hpad[2] =
NIMAX(dst_stride[2] - linesize[2], 0);
1083 src_height[0] = height;
1084 src_height[1] =
NIALIGN(height, 2) / 2;
1085 src_height[2] =
NIALIGN(height, 2) / 2;
1088 vpad[0] =
NIALIGN(src_height[0], 2) - src_height[0];
1089 vpad[1] =
NIALIGN(src_height[1], 2) - src_height[1];
1090 vpad[2] =
NIALIGN(src_height[2], 2) - src_height[2];
1097 hpad[0] =
NIMAX(dst_stride[0] - linesize[0], 0);
1098 hpad[1] =
NIMAX(dst_stride[1] - linesize[1], 0);
1099 hpad[2] =
NIMAX(dst_stride[2] - linesize[2], 0);
1102 src_height[0] = height;
1103 src_height[1] =
NIALIGN(height, 2) / 2;
1104 src_height[2] =
NIALIGN(height, 2) / 2;
1107 vpad[0] =
NIALIGN(src_height[0], 2) - src_height[0];
1108 vpad[1] =
NIALIGN(src_height[1], 2) - src_height[1];
1109 vpad[2] =
NIALIGN(src_height[2], 2) - src_height[2];
1116 hpad[0] =
NIMAX(dst_stride[0] - linesize[0], 0);
1117 hpad[1] =
NIMAX(dst_stride[1] - linesize[1], 0);
1121 src_height[0] = height;
1122 src_height[1] =
NIALIGN(height, 2) / 2;
1126 vpad[0] =
NIALIGN(src_height[0], 2) - src_height[0];
1127 vpad[1] =
NIALIGN(src_height[1], 2) - src_height[1];
1139 src_height[0] = height;
1140 src_height[1] = height;
1153 hpad[0] =
NIMAX(dst_stride[0] - linesize[0], 0);
1154 hpad[1] =
NIMAX(dst_stride[1] - linesize[1], 0);
1158 src_height[0] = height;
1159 src_height[1] =
NIALIGN(height, 2) / 2;
1163 vpad[0] =
NIALIGN(src_height[0], 2) - src_height[0];
1164 vpad[1] =
NIALIGN(src_height[1], 2) - src_height[1];
1176 hpad[0] =
NIMAX(dst_stride[0] - linesize[0], 0);
1181 src_height[0] = height;
1195 hpad[0] =
NIMAX(dst_stride[0] - linesize[0], 0);
1196 hpad[1] =
NIMAX(dst_stride[1] - linesize[1], 0);
1197 hpad[2] =
NIMAX(dst_stride[2] - linesize[2], 0);
1200 src_height[0] = height;
1201 src_height[1] = height;
1202 src_height[2] = height;
1215 hpad[0] =
NIMAX(dst_stride[0] - linesize[0], 0);
1220 src_height[0] = height;
1238 for (i = 0; i < nb_planes; i++)
1240 dst_line = dst->
p_data[i];
1241 src_line = src_data[i];
1243 for (h = 0; h < src_height[i]; h++)
1245 memcpy(dst_line, src_line,
NIMIN(linesize[i], dst_stride[i]));
1249 lastidx = linesize[i];
1253 sample = &src_line[lastidx - 2];
1254 dest = &dst_line[lastidx];
1257 for (j = 0; j < hpad[i] / 2; j++)
1259 memcpy(dest, sample, 2);
1264 YUVsample = dst_line[lastidx - 1];
1265 memset(&dst_line[lastidx], YUVsample, hpad[i]);
1269 src_line += linesize[i];
1270 dst_line += dst_stride[i];
1274 src_line = dst_line - dst_stride[i];
1275 for (h = 0; h < vpad[i]; h++)
1277 memcpy(dst_line, src_line, dst_stride[i]);
1278 dst_line += dst_stride[i];
1285 static int ni_to_avframe_copy(
const ni_frame_t *src,
int width,
int height,
1286 int ni_fmat,
int nb_planes,
const int *linesize,
1289 int src_linesize[4], src_height[4];
1291 uint8_t *src_line, *dst_line;
1296 src_linesize[0] =
NIALIGN(width, 128);
1297 src_linesize[1] =
NIALIGN(width / 2, 128);
1298 src_linesize[2] = src_linesize[1];
1299 src_linesize[3] = 0;
1301 src_height[0] = height;
1302 src_height[1] =
NIALIGN(height, 2) / 2;
1303 src_height[2] = src_height[1];
1308 src_linesize[0] =
NIALIGN(width * 2, 128);
1309 src_linesize[1] =
NIALIGN(width, 128);
1310 src_linesize[2] = src_linesize[1];
1311 src_linesize[3] = 0;
1313 src_height[0] = height;
1314 src_height[1] =
NIALIGN(height, 2) / 2;
1315 src_height[2] = src_height[1];
1320 src_linesize[0] =
NIALIGN(width, 128);
1321 src_linesize[1] =
NIALIGN(width, 128);
1322 src_linesize[2] = 0;
1323 src_linesize[3] = 0;
1325 src_height[0] = height;
1326 src_height[1] =
NIALIGN(height, 2) / 2;
1332 src_linesize[0] =
NIALIGN(width, 64);
1333 src_linesize[1] =
NIALIGN(width, 64);
1334 src_linesize[2] = 0;
1335 src_linesize[3] = 0;
1337 src_height[0] = height;
1338 src_height[1] = height;
1345 src_linesize[0] =
NIALIGN(width, 16) * 2;
1346 src_linesize[1] = 0;
1347 src_linesize[2] = 0;
1348 src_linesize[3] = 0;
1350 src_height[0] = height;
1357 src_linesize[0] =
NIALIGN(width * 2, 128);
1358 src_linesize[1] =
NIALIGN(width * 2, 128);
1359 src_linesize[2] = 0;
1360 src_linesize[3] = 0;
1362 src_height[0] = height;
1363 src_height[1] =
NIALIGN(height, 2) / 2;
1373 src_linesize[0] =
NIALIGN(width, 16) * 4;
1374 src_linesize[1] = 0;
1375 src_linesize[2] = 0;
1376 src_linesize[3] = 0;
1378 src_height[0] = height;
1385 src_linesize[0] =
NIALIGN(width, 32);
1386 src_linesize[1] =
NIALIGN(width, 32);
1387 src_linesize[2] =
NIALIGN(width, 32);
1388 src_linesize[3] = 0;
1390 src_height[0] = height;
1391 src_height[1] = height;
1392 src_height[2] = height;
1401 for (i = 0; i < nb_planes; i++)
1403 dst_line = dst_data[i];
1404 src_line = src->
p_data[i];
1405 for (h = 0; h < src_height[i]; h++)
1407 memcpy(dst_line, src_line,
NIMIN(src_linesize[i], linesize[i]));
1408 dst_line += linesize[i];
1409 src_line += src_linesize[i];
1418 int height,
int ni_fmat,
int nb_planes,
1419 const int *linesize, uint8_t **src_data)
1424 int need_to_copy = 1;
1433 dst_stride[0] =
NIALIGN(width, 128);
1434 dst_stride[1] =
NIALIGN((width / 2), 128);
1435 dst_stride[2] = dst_stride[1];
1438 isSemiPlanar =
false;
1443 dst_stride[0] =
NIALIGN(width * 2, 128);
1444 dst_stride[1] =
NIALIGN(width, 128);
1445 dst_stride[2] = dst_stride[1];
1448 isSemiPlanar =
false;
1453 dst_stride[0] =
NIALIGN(width, 128);
1454 dst_stride[1] = dst_stride[0];
1458 isSemiPlanar =
true;
1463 dst_stride[0] =
NIALIGN(width, 64);
1464 dst_stride[1] = dst_stride[0];
1468 isSemiPlanar =
false;
1474 dst_stride[0] =
NIALIGN(width, 16) * 2;
1479 isSemiPlanar =
false;
1484 dst_stride[0] =
NIALIGN(width * 2, 128);
1485 dst_stride[1] = dst_stride[0];
1489 isSemiPlanar =
true;
1499 dst_stride[0] =
NIALIGN(width, 16) * 4;
1504 isSemiPlanar =
false;
1526 (
const int *)linesize,
1534 &p_src_session_data->
data.
frame, width, height,
1535 (
const int *)linesize, (
const uint8_t **)src_data,
1546 &p_src_session_data->
data.
frame, ni_fmat, width, height, dst_stride,
1557 ret = av_to_niframe_copy(dst_stride, &p_src_session_data->
data.
frame,
1558 width, height, ni_fmat, nb_planes, linesize,
1573 dst_surf->
ui16width = p_split_ctx->
w[0] = width;
1574 dst_surf->
ui16height = p_split_ctx->
h[0] = height;
1590 int height,
int ni_fmat,
int nb_planes,
1591 const int *linesize, uint8_t **dst_data)
1615 ret = ni_to_avframe_copy(&p_session_data->
data.
frame, width, height,
1616 ni_fmat, nb_planes, linesize, dst_data);
1632 int num_extra_outputs)
1635 split_ctx->
enabled = (num_extra_outputs >= 1) ? 1 : 0;
1640 split_ctx->
w[1] = (num_extra_outputs >= 1) ? ni_surf_1->
ui16width : 0;
1641 split_ctx->
h[1] = (num_extra_outputs >= 1) ? ni_surf_1->
ui16height : 0;
1642 split_ctx->
f[1] = (num_extra_outputs >= 1) ? ni_surf_1->
encoding_type : 0;
1643 split_ctx->
f8b[1] = (num_extra_outputs >= 1) ? ni_surf_1->
bit_depth : 0;
1644 split_ctx->
w[2] = (num_extra_outputs == 2) ? ni_surf_2->
ui16width : 0;
1645 split_ctx->
h[2] = (num_extra_outputs == 2) ? ni_surf_2->
ui16height : 0;
1646 split_ctx->
f[2] = (num_extra_outputs == 2) ? ni_surf_2->
encoding_type : 0;
1647 split_ctx->
f8b[2] = (num_extra_outputs == 2) ? ni_surf_2->
bit_depth : 0;
1653 return p_session_ctx->
hw_id;
1700 return p_session_ctx->
status;
1790 int32_t device_handle)
1796 int is_semiplanar,
int plane_stride[4],
1797 int plane_height[4])
1802 plane_stride[0] = ((
NI_MIN_WIDTH * factor + 127) / 128) * 128;
1804 (((
NI_MIN_WIDTH / (is_semiplanar ? 1 : 2) * factor) + 127) / 128) *
1807 ((((is_semiplanar ? 0 :
NI_MIN_WIDTH) / 2 * factor) + 127) / 128) *
1811 width = ((width + 1) / 2) * 2;
1812 plane_stride[0] = ((width * factor + 127) / 128) * 128;
1814 (((width / (is_semiplanar ? 1 : 2) * factor) + 127) / 128) * 128;
1815 plane_stride[2] = (is_semiplanar ? 0 : plane_stride[1]);
1824 plane_height[0] = ((height + 1) / 2) * 2;
1826 plane_height[1] = plane_height[2] = plane_height[0] / 2;
1873 int preferential_device_type,
1882 preferential_device_type,
2042 int video_width,
int video_height,
2047 video_height, extra_len);
2061 return p_session_ctx->
pkt_num;
void ni_quadra_set_device_handle(void *session_ctx, int32_t handle)
Set session device handle.
int ni_pthread_mutex_unlock(ni_pthread_mutex_t *mutex)
thread mutex unlock
int ni_quadra_get_session_runstatus(void *session_ctx)
Get session context run status.
int ni_quadra_rsrc_get_device_by_block_name(const char *blk_name, ni_quadra_device_type_t device_type)
Get GUID of the device by block device name and type.
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.
int ni_quadra_ai_packet_buffer_alloc(void *p_pkt, ni_quadra_network_data_t *p_network)
Allocate output layers memory for the packet buffer based on provided network.
void ni_quadra_log_set_callback(void(*log_callback)(int, const char *, va_list))
Set ni_log() callback.
#define NI_MAX_RESOLUTION_HEIGHT
int ni_quadra_ai_config_hvsplus(ni_quadra_filter_t *nifilter, ni_quadra_network_data_t *p_network, int nb_width, int nb_height, int level, int format)
configure a hvsplus context based with the network binary
ni_log_level_t ff_to_ni_log_level(int fflog_level)
Convert ffmpeg log level integer to appropriate ni_log_level_t.
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_quadra_log_level_t ni_quadra_ff_to_ni_log_level(int fflog_level)
Convert ffmpeg log level integer to appropriate ni_quadra_log_level_t.
Utility definitions to operate on bits in a bitstream.
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...
ni_device_info_t xcoders[NI_DEVICE_TYPE_XCODER_MAX][NI_MAX_DEVICE_CNT]
int ni_quadra_device_session_open(void *p_ctx, ni_quadra_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_quadra_hw_device_info_t * ni_quadra_hw_device_info_alloc(int device_type_num, int avaliable_card_num)
Create a pointer to ni_hw_device_info_quadra_t instance .
@ NI_QUADRA_SCALER_OPCODE_MERGE
void ni_destory_hw_device_info_quadra_coder_param(ni_hw_device_info_quadra_coder_param_t *p_hw_device_info_quadra_coder_param)
Free resource in p_hw_device_info_quadra_coder_param This function is used for ni_check_hw_info()
int ni_quadra_network_layer_convert_output(void *p_data, float *dst, uint32_t num, ni_quadra_network_data_t *p_network, uint32_t layer)
Convert data from nipacket to dst data.
void ni_quadra_device_close(int32_t handle)
Close device handle.
uint32_t metadata_buffer_size
uint16_t ni_quadra_get_frame_idx(void *niframe)
Get niframui16FrameIdxe.
void ni_device_close(ni_device_handle_t device_handle)
Close device and release resources.
uint8_t * ni_fifo_generic_write(ni_fifo_buffer_t *p_fifo)
Get free buffer to write in the fifo.
void ni_quadra_split_ctx_set(NIFramesContext *ni_ctx, niquadraFrameSurface1_t *ni_surf, niquadraFrameSurface1_t *ni_surf_1, niquadraFrameSurface1_t *ni_surf_2, int num_extra_outputs)
Split context set.
uint8_t * ni_quadra_get_packet_data(void *nipacket)
Get nipacket data address.
int ni_fifo_return_read(ni_fifo_buffer_t *p_fifo)
Push back the last read buffer to the fifo.
ni_retcode_t ni_network_layer_convert_output(float *dst, uint32_t dst_len, ni_packet_t *p_packet, ni_network_data_t *p_network, uint32_t layer)
uint8_t ** ni_quadra_get_frame_data(void *niframe)
Get niframe data address.
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...
int ni_quadra_frame_buffer_alloc_pixfmt(void *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...
uint32_t scaler_operation
uint32_t active_video_width
int ni_quadra_get_session_blkiohandle(void *session_ctx)
Get session context blk_io_handle.
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.
uint8_t * ni_fifo_generic_read(ni_fifo_buffer_t *p_fifo)
Get first filled buffer to read in the fifo.
#define NI_INVALID_SESSION_ID
void ni_log_set_level(ni_log_level_t level)
Set ni_log_level.
Public definitions for managing NETINT video processing devices.
int xcoder_cnt[NI_DEVICE_TYPE_XCODER_MAX]
Audio/video related utility definitions.
int ni_quadra_filter_hwframe_recycle(void *session_ctx, void *niframe)
Recycle a frame buffer on card.
ni_retcode_t ni_packet_buffer_free(ni_packet_t *p_packet)
Free packet buffer that was previously allocated with ni_packet_buffer_alloc.
ni_device_handle_t blk_io_handle
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.
struct _ni_custom_sei_set ni_custom_sei_set_t
int ni_quadra_filter_hwup_frame(NIFramesContext *ni_ctx, niquadraFrameSurface1_t *dst_surf, int width, int height, int ni_fmat, int nb_planes, const int *linesize, uint8_t **src_data)
Upload frame.
uint8_t * ni_quadra_get_niframe(void *niframe)
Get niframe address.
int ni_quadra_filter_device_config_frame(void *p_ctx, ni_quadra_frame_config_t *p_cfg)
Configure the 2D engine to work based on provided parameters.
#define NI_SCALER_FLAG_IO
uint8_t * ni_quadra_filter_get_data3(void *p_frame)
Get niframe data3 from device.
ni_retcode_t ni_ai_config_hvsplus(ni_session_context_t *p_ctx, ni_network_data_t *p_network)
configure a hvsplus filter
ni_hw_device_info_quadra_coder_param_t * ni_create_hw_device_info_quadra_coder_param(int mode)
Create and alloc a pointer to ni_hw_device_info_quadra_coder_param_t This function is used for ni_che...
void ni_quadra_set_session_runstatus(void *session_ctx, int status)
Set session context run status.
#define NI_DEFAULT_KEEP_ALIVE_TIMEOUT
int ni_quadra_build_frame_pool(ni_quadra_filter_t *nifilter, int width, int height, int out_format, int pool_size)
Alloc frame pool for filter.
int ni_quadra_scaler_set_drawbox_params(ni_quadra_filter_t *nifilter, ni_quadra_scaler_drawbox_params_t *p_params)
Send a p_config command to configure scaling drawbox parameters.
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_quadra_hw_device_info_coder_param_t * ni_quadra_create_hw_device_info_coder_param(int mode)
Create a pointer to hw_device_info_coder_param_t instance. This instance will be created and set to d...
int ni_fifo_is_empty(ni_fifo_buffer_t *p_fifo)
Check if a fifo is empty.
int ni_quadra_check_hw_info(ni_quadra_hw_device_info_t **pointer_to_p_hw_device_info, int task_mode, ni_quadra_hw_device_info_threshold_param_t *hw_info_threshold_param, int preferential_device_type, ni_quadra_hw_device_info_coder_param_t *coder_param, int hw_mode, int consider_mem)
check hw info, return the appropriate card number to use depends on the load&task_num&used resource
int ni_quadra_device_session_close(void *p_ctx, int eos_recieved, ni_quadra_device_type_t device_type)
Close device session that was previously opened by calling ni_device_session_open() If device_type is...
@ NI_RETCODE_ERROR_MEM_ALOC
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.
int ni_quadra_device_session_read_hwdesc(void *p_ctx, void *p_data, int device_type)
Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data hwdesc from decoder If ...
@ SESSION_RUN_STATE_NORMAL
void ni_quadra_set_framerate(void *p_ctx, int num, int den)
uint32_t number_of_buffers_used
int ni_quadra_init_split_rsrc(NIFramesContext *ni_ctx, int w, int h)
Init filter split context malloc session and set it default.
int ni_quadra_device_session_read(void *p_ctx, void *p_data, int device_type)
Read data from the device If device_type is NI_DEVICE_TYPE_DECODER reads data packet from decoder If ...
int ni_quadra_device_session_write(void *p_ctx, void *p_data, ni_quadra_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_QUADRA_DEVICE_TYPE_AI
LIB_API ni_device_pool_t * ni_rsrc_get_device_pool(void)
Create and return the allocated ni_device_pool_t struct.
#define NI_APP_ENC_FRAME_META_DATA_SIZE
int ni_quadra_packet_buffer_free(void *p_data)
Free packet buffer that was previously allocated with ni_packet_buffer_alloc.
#define NI_MAX_RESOLUTION_WIDTH
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.
Common NETINT definitions used by all modules.
int ni_quadra_filter_device_create(AVNIDeviceContext *ni_hw_ctx, const char *device)
Sends frame pool setup info to device.
uint32_t data_len[NI_MAX_NUM_DATA_POINTERS]
unsigned int extra_data_len
int ni_quadra_device_session_copy(void *src_ctx, void *dst_ctx)
Copy filter session context.
void ni_quadra_device_session_context_clear(void *p_ctx)
Clear already allocated session context.
void ni_quadra_get_hw_yuv420p_dim(int width, int height, int factor, int is_semiplanar, int plane_stride[4], int plane_height[4])
Get dimension information of Netint HW YUV420p frame to be sent to encoder for encoding....
int ni_quadra_filter_device_session_init_framepool(NIFramesContext *ni_ctx, uint32_t pool_size, uint32_t pool)
Sends frame pool setup info to device.
int ni_quadra_get_session_frame_num(void *p_ctx)
Get session_ctx send/recieve frame number.
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.
int ni_quadra_init_filters(ni_quadra_filter_t *nifilter)
Init filter.
void * src_session_io_data
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.
int ni_pthread_mutex_lock(ni_pthread_mutex_t *mutex)
thread mutex lock
ni_device_handle_t device_handle
uint32_t ni_ai_network_layer_dims(ni_network_layer_params_t *p_param)
NETINT filters API header file.
int ni_quadra_get_session_status(void *session_ctx)
Get session context status.
int ni_quadra_init_internal_session(NIFramesContext *ni_ctx)
Init filter session context only malloc session.
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
int32_t ni_quadra_get_device_handle(void *session_ctx)
Get session device handle id.
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...
uint32_t ni_quadra_get_session_id(void *session_ctx)
Get session device session id.
void ni_quadra_session_timestamp_copy(void *src_ctx, void *dst_ctx)
Copy filter session context.
uint32_t keep_alive_timeout
int ni_quadra_upload_device_session_open(NIFramesContext *ni_ctx)
Open hwupload filter.
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_quadra_filter_session_dl_set(void *session_ctx, bool value)
Set download filter session context.
uint8_t * ni_quadra_get_frame_buffer(void *niframe)
Get niframe buffer address.
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,...
@ NI_PIXEL_PLANAR_FORMAT_SEMIPLANAR
bool enable_scaler_params
int32_t suspended_device_handle
int ni_quadra_filter_frames_close(NIFramesContext *ni_ctx, int pool_size)
Close filter context and frame.
void ni_quadra_hw_device_info_free(ni_quadra_hw_device_info_t *p_hw_device_info)
Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param...
void ni_device_session_context_clear(ni_session_context_t *p_ctx)
Clear already allocated session context.
uint32_t ni_quadra_get_packet_data_len(void *nipacket)
Get nipacket data len.
int ni_quadra_get_device_id(void *session_ctx)
Get session device id.
int ni_quadra_frame_buffer_free(void *p_data)
Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame...
int ni_quadra_ai_frame_buffer_alloc(void *p_frame, ni_quadra_network_data_t *p_network)
Allocate input layers memory for AI frame buffer based on provided parameters taking into account wid...
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
#define NI_VPU_CEIL(_data, _align)
int ni_quadra_device_session_hwdl(void *p_ctx, void *p_data, niquadraFrameSurface1_t *hwdesc)
Reads YUV data from hw descriptor stored location on device.
ni_fifo_buffer_t * ni_fifo_initialize(uint32_t number_of_buffers, uint32_t size)
Initialize a fifo buffer.
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.
void ni_log_set_callback(void(*log_callback)(int, const char *, va_list))
Set ni_log() callback.
char blk_name[NI_MAX_DEVICE_NAME_LEN]
#define NI_QUADRA_MAX_NUM_DATA_POINTERS
int ni_quadra_hwframe_buffer_recycle(niquadraFrameSurface1_t *surface, int32_t device_handle)
Recycle a frame buffer on card.
int ni_fifo_is_full(ni_fifo_buffer_t *p_fifo)
Check if a fifo is full.
int ni_quadra_filter_device_alloc_frame(ni_quadra_filter_t *nifilter, 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, int type)
Allocate a frame on the device for 2D engine or AI engine to work on based on provided parameters.
uint32_t ni_fifo_number_of_buffers(ni_fifo_buffer_t *p_fifo)
Get number of buffers used in fifo.
void ni_quadra_filter_device_close(AVNIDeviceContext *ni_hw_ctx)
Close device.
#define NI_MAX_DEVICE_CNT
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_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_QUADRA_SCALER_OPCODE_SCALE
int ni_pthread_mutex_init(ni_pthread_mutex_t *mutex)
initialize a mutex
union _ni_session_data_io::@19 data
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...
int ni_quadra_filter_frame_buffer_alloc_hwenc(ni_quadra_filter_t *nifilter, 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_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.
int ni_quadra_filter_frame_buffer_alloc_dl(void *niframe, int video_width, int video_height, int pixel_format)
Allocate preliminary memory for the frame buffer based on provided parameters.
uint32_t ni_quadra_get_frame_buffer_size(void *niframe)
Get niframe buffer size.
uint32_t scaler_operation
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.
int ni_quadra_filter_device_alloc_dst_frame(ni_quadra_filter_t *nifilter, niquadraFrameSurface1_t *p_hwdesc, int type)
Allocate a frame on the device and return the frame index.
int ni_quadra_scaler_set_watermark_params(ni_quadra_filter_t *nifilter, ni_quadra_scaler_watermark_params_t *p_params)
Send a p_config command to configure watermark parameters.
uint32_t ni_quadra_ai_network_layer_size(ni_quadra_network_layer_params_t *p_param)
void ni_quadra_filter_frame_free(void *opaque, uint8_t *data)
Free filter frame.
@ NI_QUADRA_SCALER_OPCODE_DRAWBOX
int ni_quadra_filter_get_output_data(ni_quadra_filter_t *nifilter, uint8_t *data, int width, int height)
Get data from device.
#define NI_SCALER_FLAG_P2
ni_quadra_device_pool_t * ni_quadra_rsrc_get_device_pool(void)
Create and return the allocated ni_device_pool_t struct.
int ni_quadra_filter_get_buffer(NIFramesContext *ni_ctx, uint8_t **dstbuf, uint8_t **dstdata, uint32_t *data_len, int width, int height, int is_planar)
Sends frame pool setup info to device.
int ni_check_hw_info(ni_hw_device_info_quadra_t **pointer_to_p_hw_device_info, int task_mode, ni_hw_device_info_quadra_threshold_param_t *hw_info_threshold_param, ni_device_type_t preferential_device_type, ni_hw_device_info_quadra_coder_param_t *coder_param, int hw_mode, int consider_mem)
check hw info, return the appropriate card number to use depends on the load&task_num&used resource
ni_retcode_t ni_rsrc_list_all_devices(ni_device_t *p_device)
List all devices with full information including s/w instances on the system.
int hvsplus_level
encoder:calculate PSNR end
uint32_t active_video_height
int ni_pthread_mutex_destroy(ni_pthread_mutex_t *mutex)
destory a mutex
void ni_fifo_free(ni_fifo_buffer_t *p_fifo)
Free a fifo.
ni_session_run_state_t session_run_state
int ni_quadra_filter_device_clone_hwframe(ni_quadra_filter_t *nifilter, ni_quadra_frameclone_desc_t *p_frameclone_desc)
Copy the data of src hwframe to dst hwframe.
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...
Public definitions for operating NETINT video processing devices for video processing.
ni_retcode_t ni_hwframe_buffer_recycle(niFrameSurface1_t *surface, int32_t device_handle)
Recycle a frame buffer on card.
uint64_t session_timestamp
int ni_quadra_get_session_packet_num(void *p_ctx)
Get session_ctx send/recive packet number.
uint32_t number_of_buffers
void ni_quadra_log_set_level(int level)
Set ni_log_level.
#define NI_SCALER_FLAG_PC
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.
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 ...
void ni_quadra_filter_close(ni_quadra_filter_t *nifilter)
Close filter.
void ni_quadra_destory_hw_device_info_coder_param(ni_quadra_hw_device_info_coder_param_t *p_quadra_hw_device_info_coder_param)
Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_par...
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_hw_device_info_quadra_t * ni_hw_device_info_alloc_quadra(int device_type_num, int avaliable_card_num)
Create a ni_hw_device_info_quadra_t This function is used for ni_check_hw_info()
int ni_quadra_filter_frames_init(NIFramesContext *ni_ctx, int *width, int *height, int ni_fmat, int keep_alive_time)
Init filter frame context and set value to session context.
#define ni_aligned_free(p_memptr)
int ni_quadra_frame_buffer_alloc_hwenc(void *niframe, int video_width, int video_height, int extra_len)
uint32_t ni_quadra_ai_network_layer_dims(ni_quadra_network_layer_params_t *p_param)
Get dims from ni_quadra_network_layer_params_t.
void ni_quadra_get_frame_data_len(void *niframe, uint32_t *dst_datalen)
Get niframe data datalen.
uint32_t start_buffer_size
int ni_quadra_filter_hwdl_frame(NIFramesContext *ni_ctx, niquadraFrameSurface1_t *src_surf, int width, int height, int ni_fmat, int nb_planes, const int *linesize, uint8_t **dst_data)
Download frame.
#define NI_FRAME_LITTLE_ENDIAN
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_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.
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.
uint32_t ni_ai_network_layer_size(ni_network_layer_params_t *p_param)
ni_quadra_split_context_t split_ctx
int ni_quadra_get_seiset_size()
Recycle a frame buffer on card.
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_PIXEL_PLANAR_FORMAT_PLANAR
void ni_hw_device_info_free_quadra(ni_hw_device_info_quadra_t *p_hw_device_info)
Free resource in a pointer of ni_hw_device_info_quadra_t This function is used for ni_check_hw_info()
int ni_quadra_ai_config_network_binary(ni_quadra_filter_t *nifilter, ni_quadra_network_data_t *p_network, const char *file)
configure a network context based with the network binary
#define NI_MAX_RESOLUTION_AREA
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.
int ni_quadra_filter_drawtext_prep_frames(void **niframe)
prepare frames for ni_drawtext filter