 |
libxcoder
5.2.0
|
Go to the documentation of this file.
79 "Generic failure during xcoder-params setting for %s\n",
112 "Invalid custom GOP parameters: %s too big\n", name);
116 "Invalid custom GOP parameters: %s too small\n", name);
120 "Invalid custom GOP parameters: %s out of range \n",
125 "Invalid custom GOP paramaters: Error setting option %s "
135 "Generic failure during xcoder-params setting for %s\n",
162 "dolbyVisionProfile is not supported on FFmpeg version 4.2.1 "
176 "XCoder HDR color info color_primaries: %d "
177 "color_trc: %d color_space %d\n",
201 int orig_conf_win_right;
202 int orig_conf_win_bottom;
203 int linesize_aligned, height_aligned;
204 int ret = 0, recv = 0, saved_ret = 0;
212 linesize_aligned = p_enc_ctx->
width;
226 (linesize_aligned - p_enc_ctx->
width) / 2 * 2;
231 (linesize_aligned - p_enc_ctx->
width) / 2 * 2;
236 height_aligned = p_enc_ctx->
height;
249 (height_aligned - p_enc_ctx->
height) / 4 * 4;
254 (height_aligned - p_enc_ctx->
height) / 2 * 2;
274 "Failed to open encoder (status = %d), "
275 "critical error or resource unavailable\n",
282 "XCoder %s Index %d (inst: %d) opened successfully\n",
302 "ERROR %d:%s() line %d, alloc extradata failed\n",
332 ret = (ret < 0) ? ret : saved_ret;
347 p_enc_ctx->
api_ctx = p_orig_session_ctx;
348 return (recv < 0 ? recv : ret);
398 uint32_t xcoder_timeout;
417 #ifdef MEASURE_LATENCY
423 ret = ni_quadra_to_ni_pix_fmt(p_enc_ctx);
496 bool has_b_frame =
false;
497 for (
int idx = 0; idx <
504 dts_offset = (idx + 1) -
565 "Invalid Picture Height or Width: too small\n");
633 if (ni_xcoder_encoder_header_check_set(p_enc_ctx) < 0)
646 "ni_quadra_setup_encoder "
647 "sw_pix_fmt %d ori_pix_fmt %d\n",
662 #define NI_CODEC_ID_MJPEG 8
668 #undef NI_CODEC_ID_MJPEG
689 if (!p_session_data_fme)
692 "ERROR %d:%s() line %d, alloc p_session_data frame failed\n",
698 p_enc_ctx->
api_fme = p_session_data_fme;
701 if (!p_session_data_pkt)
704 "ERROR %d:%s() line %d, alloc p_session_data pkt failed\n",
710 p_enc_ctx->
api_pkt = p_session_data_pkt;
716 "ERROR %d:%s() line %d, alloc p_input_frame failed\n",
NI_ERRNO,
717 __FUNCTION__, __LINE__);
729 "ERROR %d:%s() line %d, alloc session context failed\n",
736 p_enc_ctx->
api_ctx = p_session_ctx;
743 "ERROR %d:%s() line %d, alloc session context failed\n",
755 p_session_ctx = p_enc_ctx->
api_ctx;
844 free(p_session_data_fme);
848 free(p_session_data_pkt);
886 "XCoder encode close: close blk_io_handle %d device_handle %d\n",
902 p_session_ctx = NULL;
927 int width,
int height,
928 int bit_depth_factor)
937 "ni_quadra_encode_sequence_change encode sequence change: "
938 "session_run_state: %d\n",
946 "Failed to send Sequence Change to Encoder "
947 "Session (status = %d)\n",
962 p_session_ctx->
src_bit_depth = (bit_depth_factor == 1) ? 8 : 10;
974 ni_packet->data.packet.end_of_stream = 0;
994 int frame_width,
int frame_height,
995 const int *frame_linesize,
997 bool hw_frames_ctx,
int frame_queqe,
1023 int linesize_aligned = frame_width;
1031 linesize_aligned =
NIALIGN(frame_width, 2);
1033 (linesize_aligned - frame_width) / 2 * 2;
1037 int height_aligned = frame_height;
1045 height_aligned =
NIALIGN(frame_height, 2);
1047 (height_aligned - frame_height) / 2 * 2;
1050 ret = ni_quadra_to_ni_pix_fmt(p_enc_ctx);
1057 if (ni_xcoder_encoder_header_check_set(p_enc_ctx) < 0)
1063 "width/height %dx%d conf_win_right %d conf_win_bottom %d , "
1064 "color primaries %u trc %u space %u\n",
1099 if (hw_frames_ctx && p_session_ctx->
hw_id == -1 &&
1102 p_session_ctx->
hw_id = frame_queqe;
1105 "xcoder_send_frame: hw_id -1, empty blk_dev_name, collocated "
1107 p_session_ctx->
hw_id);
1127 (
const int *)frame_linesize,
true);
1138 "XCoder %s.%d (inst: %d) opened successfully\n",
1145 "Failed to open encoder (status = %d), invalid parameter "
1146 "values given: %s\n",
1155 "Failed to open encoder (status = %d), "
1156 "resource unavailable\n",
1212 int frame_width,
int frame_height)
1220 memset(p_input_frame, 0,
sizeof(
ni_frame_t));
1227 int8_t bit_depth = 1;
1257 if ((frame_height && frame_width) &&
1258 (frame_height != p_enc_ctx->
height ||
1259 frame_width != p_enc_ctx->
width) ||
1264 "xcoder_send_frame resolution change %dx%d "
1265 "-> %dx%d or bit depth change %d -> %d "
1266 "or color changed 0 -> %d\n",
1303 uint32_t cur_fps, pre_fps;
1322 (pre_fps != cur_fps) &&
1374 }
else if (p_session_ctx->
frame_num >= 200)
1498 void *side_data,
int data_size,
int type)
1518 aux_size =
sizeof(int32_t);
1521 aux_size =
sizeof(float);
1524 aux_size = data_size;
1542 memcpy(aux_data->
data, side_data, data_size);
1552 void *side_data,
int data_size)
1582 "xcoder_send_frame: #%" PRIu64
" ni_pict_type %d"
1583 " forced_header_enable %d intraPeriod %d\n",
1595 if (side_data && data_size > 0)
1597 int64_t local_pts = p_enc_ctx->
frame_pts;
1598 uint8_t *p_src_sei_data, *p_dst_sei_data;
1609 dst_custom_sei_set =
1611 if (dst_custom_sei_set)
1613 free(dst_custom_sei_set);
1619 if (dst_custom_sei_set == NULL)
1622 "%s failed to allocate memory for custom sei data\n",
1630 for (i = 0; i < src_custom_sei_set->
count; i++)
1633 p_src_custom_sei = &src_custom_sei_set->
custom_sei[i];
1634 sei_size = p_src_custom_sei->
size;
1635 sei_type = p_src_custom_sei->
type;
1636 p_src_sei_data = &p_src_custom_sei->
data[0];
1638 p_dst_custom_sei = &dst_custom_sei_set->
custom_sei[i];
1639 p_dst_sei_data = &p_dst_custom_sei->
data[0];
1643 p_dst_sei_data[size++] = 0x00;
1644 p_dst_sei_data[size++] = 0x00;
1645 p_dst_sei_data[size++] = 0x00;
1646 p_dst_sei_data[size++] = 0x01;
1650 p_dst_sei_data[size++] = 0x06;
1653 p_dst_sei_data[size++] = 0x4e;
1654 p_dst_sei_data[size++] = 0x01;
1658 p_dst_sei_data[size++] = sei_type;
1664 p_dst_sei_data[size++] = len > 0xff ? 0xff : len;
1671 if (j >= 2 && !p_dst_sei_data[size - 2] &&
1672 !p_dst_sei_data[size - 1] && p_src_sei_data[j] <= 0x03)
1675 p_dst_sei_data[size++] = 0x03;
1677 p_dst_sei_data[size++] = p_src_sei_data[j];
1683 "%s: sei RBSP size exceeds limit "
1684 "(%d), idx=%u, type=%u, size=%d, custom_sei_loc=%d.\n",
1687 free(dst_custom_sei_set);
1692 p_dst_sei_data[size++] = 0x80;
1694 p_dst_custom_sei->
size = size;
1695 p_dst_custom_sei->
type = sei_type;
1698 "%s: custom sei idx %d type %u len %d "
1700 __FUNCTION__, i, sei_type, size, p_dst_custom_sei->
location);
1703 dst_custom_sei_set->
count = src_custom_sei_set->
count;
1707 dst_custom_sei_set->
count, local_pts);
1713 "xcoder_send_frame: sei total length %u exceeds maximum sei "
1753 uint8_t **data, uint8_t *nidata,
int *linesize,
1754 int frame_width,
int frame_height,
1762 int need_to_copy = 1;
1773 src_height[0] = frame_height;
1774 src_height[1] = frame_height / 2;
1775 src_height[2] = (isnv12frame) ? 0 : (frame_height / 2);
1781 src_height[0] = frame_height;
1784 alignment_2pass_wa = 0;
1788 dst_stride, height_aligned);
1791 "xcoder_send_frame frame->width %d "
1792 "p_session_ctx->bit_depth_factor %d dst_stride[0/1/2] %d/%d/%d\n",
1794 dst_stride[1], dst_stride[2]);
1809 alignment_2pass_wa =
false;
1812 if (alignment_2pass_wa && !p_enc_ctx->
ishwframe)
1819 height_aligned[1] =
NIALIGN(height_aligned[0], 32) / 2;
1824 height_aligned[2] =
NIALIGN(height_aligned[0], 32) / 2;
1832 const uint8_t *srchw;
1842 srchw = (
const uint8_t *)nidata;
1850 "%s %s %d buffered_fme.data[0] %p data[3] %p wxh %u %u "
1851 "dst_stride[0] %d %d linesize[0] %d %d data[1] %p %p data[2] "
1852 "%p %p data[3] %p avctx(w:h:cw:ch) %u:%u\n",
1853 __FILE__, __FUNCTION__, __LINE__, data[0], data[3], frame_width,
1854 frame_height, dst_stride[0], dst_stride[1], linesize[0],
1855 linesize[1], data[1], data[0] + dst_stride[0] * frame_height,
1856 data[2], data[1] + dst_stride[1] * frame_height / 2, data[3],
1861 frame_height, linesize,
1867 &(p_niframe->
data.
frame), frame_width, frame_height, linesize,
1868 (
const uint8_t **)data,
1883 !isnv12frame, &(p_niframe->
data.
frame), frame_width,
1884 height_aligned[0], dst_stride,
1902 "xcoder_send_frame: fme.data_len[0]=%d, "
1903 "buf_fme->linesize=%d/%d/%d, dst alloc linesize = %d/%d/%d, "
1904 "src height = %d/%d/%d, dst height aligned = %d/%d/%d, "
1905 "force_key_frame=%d, extra_data_len=%d sei_size=%d "
1906 "(hdr_content_light_level %u hdr_mastering_display_color_vol "
1908 "hdr10+ %u cc %u udu %u prefC %u) roi_size=%u reconf_size=%u "
1910 "use_cur_src_as_long_term_pic %u use_long_term_ref %u\n",
1912 linesize[2], dst_stride[0], dst_stride[1], dst_stride[2],
1913 src_height[0], src_height[1], src_height[2], height_aligned[0],
1914 height_aligned[1], height_aligned[2],
1938 dst_stride, height_aligned, linesize, src_height);
1946 "xcoder_send_frame:Autodownload to be run: hdl: %d w: %d h: "
1960 p_session_data = &niframe;
1961 memset(&niframe, 0,
sizeof(niframe));
1979 p_session_data = p_niframe;
1988 "nienc.c:ni_hwdl_frame() failed to retrieve frame\n");
1996 &p_session_data->
data.
frame, dst_stride,
2021 "ni_quadra_enc_send_frame: pts %lld dts %lld "
2022 "size %d sent to xcoder\n",
2051 int frame_height,
const int *linesize)
2057 int stride, ori_stride;
2058 bool bIsSmallPicture =
false;
2077 frame_height, linesize,
2100 stride = frame_width;
2109 "ni_quadra_encode_reinit 2-pass lookaheadDepth %d "
2110 "and/or CRF %d and/or CRFFloat %f\n",
2117 bIsSmallPicture =
true;
2123 bIsSmallPicture =
true;
2130 "ni_quadra_encode_reinit multicore "
2132 if ((frame_width < 256) || (frame_height < 256))
2134 bIsSmallPicture =
true;
2138 if ((ori_stride * p_session_ctx->
ori_height < stride * frame_height) ||
2179 "XCoder receive packet: xpkt.end_of_stream=%d, xpkt.data_len=%d, "
2180 "recv=%d, encoder_flushing=%d, encoder_eof=%d\n",
2196 "xcoder_receive_packet 1: sequence "
2197 "change completed, return AVERROR(EAGAIN) and will "
2203 "xcoder_receive_packet: got encoder_eof, "
2204 "return AVERROR_EOF\n");
2212 }
else if (recv < 0)
2230 "XCoder receive packet: low delay mode,"
2231 " keep reading until pkt arrives\n");
2242 "xcoder_receive_packet: NOT "
2243 "encoder_flushing, return AVERROR(EAGAIN)\n");
2251 int meta_size = p_session_ctx->
meta_size;
2278 (uint8_t *)xpkt->
p_data + meta_size,
2288 "XCoder receive packet: low delay mode,"
2289 " keep reading until 1st pkt arrives\n");
2308 int64_t bframes_delay = 0;
2311 ni_log(
NI_LOG_INFO,
"%s xcoder_bframes_delay=%"PRId64
"\n", __func__, bframes_delay);
2334 "xcoder_receive_packet: skip"
2335 " picture output, return AVERROR(EAGAIN)\n");
2344 uint32_t nalu_type = 0;
2345 const uint8_t *p_start_code;
2348 uint8_t *p_src = (uint8_t *)xpkt->
p_data + meta_size;
2349 uint8_t *p_end = p_src + (xpkt->
data_len - meta_size);
2358 if (p_custom_sei_set != NULL)
2361 for (i = 0; i < p_custom_sei_set->
count; i++)
2373 p_start_code = p_src;
2381 nalu_type = (stc >> 1) & 0x3F;
2382 }
while (nalu_type > 31 );
2385 p_enc_ctx->
copy_len = p_start_code - 5 - p_src;
2393 nalu_type = stc & 0x1F;
2394 }
while (nalu_type > 5 );
2397 p_enc_ctx->
copy_len = p_start_code - 5 - p_src;
2401 "%s: codec %d not supported for "
2406 #define NI_CODEC_ID_MJPEG 8
2414 #undef NI_CODEC_ID_MJPEG
2441 memcpy(p_dst, p_src, p_enc_ctx->
copy_len);
2452 memcpy(p_dst, &p_custom_sei->
data[0], p_custom_sei->
size);
2453 p_dst += p_custom_sei->
size;
2457 memcpy(p_dst, p_src + p_enc_ctx->
copy_len,
2466 memcpy(p_dst, &p_custom_sei->
data[0], p_custom_sei->
size);
2467 p_dst += p_custom_sei->
size;
2478 int is_pkt, int64_t *pkt_pts,
2479 int64_t *pkt_dts,
int *pkt_flag)
2490 free(p_custom_sei_set);
2499 *pkt_flag |= 0x0001;
2501 *pkt_pts = xpkt->
pts;
2513 int64_t bframes_delay = 0;
2516 ni_log(
NI_LOG_INFO,
"%s xcoder_bframes_delay=%"PRId64
"\n", __func__, bframes_delay);
2530 if (*pkt_dts < p_enc_ctx->latest_dts)
2537 if (*pkt_pts < p_enc_ctx->first_frame_pts)
2539 ni_log(
NI_LOG_INFO,
"pts %ld less than first frame pts %ld. Force it to first frame pts\n",
2543 if (*pkt_dts > *pkt_pts)
2546 *pkt_dts, *pkt_pts);
2547 *pkt_dts = *pkt_pts;
2552 "XCoder recv pkt #%" PRId64
""
2553 " pts %" PRId64
" dts %" PRId64
" frame_type %u avg qp %u\n",
2585 "ni_quadra_packet_buffer_alloc: packet buffer size %d allocation failed\n",
ni_retcode_t ni_set_demo_roi_map(ni_session_context_t *p_enc_ctx)
Set up hard coded demo ROI map.
@ NI_RETCODE_ERROR_VPU_RECOVERY
int sei_hdr_mastering_display_color_vol_len
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.
ni_log_level_t ff_to_ni_log_level(int fflog_level)
Convert ffmpeg log level integer to appropriate ni_log_level_t.
const char *const g_xcoder_log_names[NI_XCODER_LOG_NAMES_ARRAY_LEN]
#define MASTERING_DISP_CHROMA_DEN
ni_device_handle_t auto_dl_handle
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_quadra_enc_init(ni_quadra_enc_context_t *p_enc_ctx)
Initialize malloc device session_context and malloc params including ni_quadra_enc_context_t,...
unsigned int sei_hdr_content_light_level_info_offset
@ NI_QUADRA_ERROR_VPU_RECOVERY
#define NI_CODEC_FLAG_GLOBAL_HEADER
int mdcv_max_min_lum_data_len
@ NI_QUADRA_PIX_FMT_8_TILED4X4
int ni_quadra_encoder_receive_packet(ni_quadra_enc_context_t *p_enc_ctx)
Recive packet frome encode.
uint32_t prev_fps
Params used in VFR mode Start///.
char dev_xcoder_name[MAX_CHAR_IN_DEVICE_NAME]
#define NI_ENC_MAX_SEI_BUF_SIZE
struct _ni_encoder_change_params_t ni_encoder_change_params_t
This is a data structure for encoding parameters that have changed.
uint32_t metadata_buffer_size
void ni_enc_copy_aux_data(ni_session_context_t *p_enc_ctx, ni_frame_t *p_enc_frame, ni_frame_t *p_dec_frame, ni_codec_format_t codec_format, const uint8_t *mdcv_data, const uint8_t *cll_data, const uint8_t *cc_data, const uint8_t *udu_data, const uint8_t *hdrp_data, int is_hwframe, int is_semiplanar)
Copy auxiliary data that should be sent together with this frame to encoder.
void ni_device_close(ni_device_handle_t device_handle)
Close device and release resources.
uint8_t cll_data[NI_MAX_SEI_DATA]
int ni_quadra_enc_get_extra_data(ni_quadra_enc_context_t *p_enc_ctx, uint8_t *p_dst)
Copy niframe to make avframe.
ni_custom_sei_location_t location
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_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_PARAM_ERROR_PIC_WIDTH
int ni_quadra_enc_make_niframe(ni_quadra_enc_context_t *p_enc_ctx, uint8_t **data, uint8_t *nidata, int *linesize, int frame_width, int frame_height, NIFramesContext *nif_src_ctx)
Copy avframe to niframe.
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,...
#define NI_2PASS_ENCODE_MIN_WIDTH
void ni_log_set_level(ni_log_level_t level)
Set ni_log_level.
int ni_quadra_setup_encoder(ni_quadra_enc_context_t *p_enc_ctx)
Initialize init device session_context and init default params including ni_quadra_enc_context_t,...
uint8_t data[NI_MAX_CUSTOM_SEI_DATA]
Public definitions for managing NETINT video processing devices.
int ni_quadra_encode_close(ni_quadra_enc_context_t *p_enc_ctx)
Close device session_context including ni_quadra_enc_context_t,.
Audio/video related utility definitions.
#define NI_2PASS_ENCODE_MIN_HEIGHT
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_PARAM_ERROR_AREA_TOO_BIG
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.
unsigned int sei_user_data_unreg_len
bool ni_quadra_enc_gop_params_check(ni_quadra_enc_context_t *p_enc_ctx)
Check gop_params.
unsigned int sei_total_len
uint64_t xcode_load_pixel
@ NI_RETCODE_INVALID_PARAM
#define NI_FRAME_BIG_ENDIAN
struct _ni_encoder_cfg_params::@16 rc
#define NI_DEFAULT_KEEP_ALIVE_TIMEOUT
uint8_t preferred_characteristics_data_len
@ NI_QUADRA_PIX_FMT_P010LE
void ni_quadra_frame_new_aux_data(ni_quadra_enc_context_t *p_enc_ctx, void *side_data, int data_size, int type)
Add a new auxiliary data to a frame.
#define NI_ENABLE_AUD_FOR_GLOBAL_HEADER
void ni_copy_hw_yuv420p(uint8_t *p_dst[NI_MAX_NUM_DATA_POINTERS], uint8_t *p_src[NI_MAX_NUM_DATA_POINTERS], int frame_width, int frame_height, int factor, int is_semiplanar, int conf_win_right, int dst_stride[NI_MAX_NUM_DATA_POINTERS], int dst_height[NI_MAX_NUM_DATA_POINTERS], int src_stride[NI_MAX_NUM_DATA_POINTERS], int src_height[NI_MAX_NUM_DATA_POINTERS])
Copy YUV data to Netint HW YUV420p frame layout to be sent to encoder for encoding....
@ NI_FRAME_AUX_DATA_VBV_BUFFER_SIZE
@ NI_FRAME_AUX_DATA_VBV_MAX_RATE
@ NI_QUADRA_PIX_FMT_10_TILED4X4
@ NI_QUADRA_PIX_FMT_YUV420P
@ NI_RETCODE_PARAM_ERROR_HEIGHT_TOO_BIG
@ NI_RETCODE_ERROR_MEM_ALOC
int ni_quadra_encoder_xcoder_opts_params_set_value(ni_quadra_enc_context_t *p_enc_ctx, const char *name, const char *value)
Set value referenced by name in encode parameters structure.
@ SESSION_RUN_STATE_SEQ_CHANGE_DRAINING
uint64_t total_frames_received
void ni_enc_prep_aux_data(ni_session_context_t *p_enc_ctx, ni_frame_t *p_enc_frame, ni_frame_t *p_dec_frame, ni_codec_format_t codec_format, int should_send_sei_with_frame, uint8_t *mdcv_data, uint8_t *cll_data, uint8_t *cc_data, uint8_t *udu_data, uint8_t *hdrp_data)
Prepare auxiliary data that should be sent together with this frame to encoder based on the auxiliary...
int ni_quadra_encode_reinit(ni_quadra_enc_context_t *p_enc_ctx, int frame_width, int frame_height, const int *linesize)
Reinit encode context.
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_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.
@ NI_RETCODE_PARAM_INVALID_VALUE
unsigned int sei_hdr_mastering_display_color_vol_offset
unsigned int sei_cc_offset
int ni_quadra_enc_send_frame(ni_quadra_enc_context_t *p_enc_ctx)
Send niframe to do encoder.
uint8_t udu_data[NI_MAX_SEI_DATA]
@ NI_QUADRA_PIX_FMT_YUV420P10LE
#define MASTERING_DISP_LUMA_DEN
#define NI_APP_ENC_FRAME_META_DATA_SIZE
ni_pic_type_t ni_pict_type
int ni_quadra_get_pkt_info_size(void)
Get struct ni_pkt_info size.
ni_encoder_cfg_params_t cfg_enc_params
struct _ni_pkt_info ni_pkt_info
Common NETINT definitions used by all modules.
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.
uint32_t data_len[NI_MAX_NUM_DATA_POINTERS]
unsigned int extra_data_len
int ni_quadra_packet_buffer_alloc(ni_quadra_enc_context_t *p_enc_ctx)
Allocate memory for the packet buffer based on provided packet size.
void ni_gop_params_check_set(ni_xcoder_params_t *p_param, char *value)
Set custom gop and prepare to check if success.
uint32_t passed_time_in_timebase_unit
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_FRAME_AUX_DATA_FRAMERATE
int32_t tmp_device_handle
int total_custom_sei_size
NI_DEPRECATED int generate_enc_hdrs
int ni_quadra_encoder_xcoder_gop_params_set_value(ni_quadra_enc_context_t *p_enc_ctx, const char *name, const char *value)
Set value referenced by name in encode parameters structure.
ni_device_handle_t device_handle
unsigned int sei_hdr_plus_len
uint8_t cc_data[NI_MAX_SEI_DATA]
int ni_quadra_encode_sequence_change(ni_quadra_enc_context_t *p_enc_ctx, int width, int height, int bit_depth_factor)
Set encode sequence change.
void ni_quadra_set_session_wh(void *session_ctx, int width, int height)
Set width and height to session context.
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 ...
const uint8_t * ni_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
Find the next start code.
uint32_t last_change_framenum
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
ni_device_handle_t sender_handle
@ NI_FRAME_AUX_DATA_REGIONS_OF_INTEREST
struct _ni_content_light_level ni_content_light_level_t
uint32_t keep_alive_timeout
void ni_quadra_filter_session_dl_set(void *session_ctx, bool value)
Set download filter session context.
#define NI_GET_MAX_HWDESC_FRAME_INDEX(x)
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
int ni_expand_frame(ni_frame_t *dst, ni_frame_t *src, int dst_stride[], int raw_width, int raw_height, int ni_fmt, int nb_planes)
Expand frame form src frame.
@ NI_RETCODE_PARAM_WARNING_DEPRECATED
@ NI_QUADRA_SEQ_CHANGE_DRAINING
int ni_quadra_enc_device_session_flush(ni_quadra_enc_context_t *p_enc_ctx)
Flush encode session context.
void ni_device_session_context_clear(ni_session_context_t *p_ctx)
Clear already allocated session context.
char tmp_blk_dev_name[32]
#define NI_MAX_CUSTOM_SEI_DATA
@ NI_RETCODE_PARAM_ERROR_TOO_BIG
#define NI_CODEC_ID_MJPEG
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
ni_custom_gop_params_t custom_gop_params
uint32_t fps_change_detect_count
int ni_quadra_encoder_prepare_avpkt(ni_quadra_enc_context_t *p_enc_ctx, int is_pkt, int64_t *pkt_pts, int64_t *pkt_dts, int *pkt_flag)
Make avpkt from encode.
bool enable_all_sei_passthru
bool disable_adaptive_buffers
@ NI_RETCODE_PARAM_ERROR_WIDTH_TOO_BIG
unsigned int sei_hdr_plus_offset
int ni_quadra_encode_send_prepare(ni_quadra_enc_context_t *p_enc_ctx, niquadraFrameSurface1_t *p_surface, int frame_width, int frame_height)
Prepare a niframe which to send to encoder.
void ni_quadra_get_pkt_info(void *session_ctx, void *data)
Get ni_pkt_info psnr info.
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 ...
struct _ni_long_term_ref ni_long_term_ref_t
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...
#define NI_MAX_NUM_DATA_POINTERS
#define NI_MAX_DEVICE_NAME_LEN
union _ni_session_data_io::@19 data
char blk_xcoder_name[MAX_CHAR_IN_DEVICE_NAME]
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_QUADRA_PIX_FMT_YUVJ420P
int force_pic_qp_demo_mode
@ NI_RETCODE_ERROR_INVALID_SESSION
@ NI_QUADRA_ERROR_INVALID_SESSION
enum _ni_session_run_state ni_session_run_state_t
Session running state type.
unsigned int sei_hdr_content_light_level_info_len
@ NI_RETCODE_PARAM_ERROR_WIDTH_TOO_SMALL
unsigned int sei_hdr_mastering_display_color_vol_len
NETINT encoder API header file.
int ni_quadra_encode_after_reinit(ni_quadra_enc_context_t *p_enc_ctx)
Reinit after need to sync context.
int ni_quadra_xcoder_encoder_headers(ni_quadra_enc_context_t *p_enc_ctx)
@ NI_RETCODE_PARAM_ERROR_PIC_HEIGHT
int ni_quadra_enc_prep_aux_data(ni_quadra_enc_context_t *p_enc_ctx, void *side_data, int data_size)
Prepare auxiliary data that should be sent together with this frame to encoder based on the auxiliary...
uint8_t mdcv_data[NI_MAX_SEI_DATA]
@ NI_QUADRA_PIX_FMT_YUV420P10BE
int enable_all_sei_passthru
@ NI_QUADRA_PARAM_WARNING_DEPRECATED
@ NI_RETCODE_PARAM_INVALID_NAME
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....
void ni_quadra_enc_gop_params_set(ni_quadra_enc_context_t *p_enc_ctx, char *key)
Set gop_params.
@ NI_FRAME_AUX_DATA_LONG_TERM_REF
custom sei payload passthrough
uint32_t count_frame_num_in_sec
bool ni_gop_params_check(ni_xcoder_params_t *p_param)
Check custom gop params set.
char blk_dev_name[NI_MAX_DEVICE_NAME_LEN]
ni_session_run_state_t session_run_state
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.
uint32_t meta_size
Params used in VFR mode Done///.
uint32_t max_nvme_io_size
@ NI_FRAME_AUX_DATA_MASTERING_DISPLAY_METADATA
@ NI_RETCODE_PARAM_ERROR_HEIGHT_TOO_SMALL
@ NI_CUSTOM_SEI_LOC_AFTER_VCL
@ NI_RETCODE_PARAM_ERROR_TOO_SMALL
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_quadra_retcode_t retstatus
int64_t enc_pts_list[NI_FIFO_SZ]
ni_custom_sei_t custom_sei[NI_MAX_CUSTOM_SEI_CNT]
@ SESSION_RUN_STATE_SEQ_CHANGE_OPENING
@ NI_FRAME_AUX_DATA_CRF_FLOAT
ni_gop_params_t pic_param[NI_MAX_GOP_NUM]
@ NI_FRAME_AUX_DATA_CONTENT_LIGHT_LEVEL
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_RETCODE_PARAM_ERROR_ZERO
struct _ni_mastering_display_metadata ni_mastering_display_metadata_t
int ni_quadra_encode_session_open(ni_quadra_enc_context_t *p_enc_ctx, int frame_width, int frame_height, const int *frame_linesize, niquadraFrameSurface1_t *p_surface, bool hw_frames_ctx, int frame_queqe, int avctx_flags)
Set encode session open and set niframe default info.
uint8_t use_cur_src_as_long_term_pic
uint32_t start_buffer_size
@ NI_RETCODE_PARAM_ERROR_OOR
int ni_should_send_sei_with_frame(ni_session_context_t *p_enc_ctx, ni_pic_type_t pic_type, ni_xcoder_params_t *p_param)
Whether SEI (HDR) should be sent together with this frame to encoder.
#define NI_FRAME_LITTLE_ENDIAN
int sei_hdr_content_light_level_info_len
ni_retcode_t ni_device_session_context_init(ni_session_context_t *p_ctx)
Initialize already allocated session context to a known state.
uint8_t hdrp_data[NI_MAX_SEI_DATA]
const char *const g_xcoder_preset_names[NI_XCODER_PRESET_NAMES_ARRAY_LEN]
#define MAX_CHAR_IN_DEVICE_NAME
ni_custom_sei_set_t * pkt_custom_sei_set[NI_FIFO_SZ]
@ NI_PIXEL_PLANAR_FORMAT_TILED4X4
void * g_enc_change_params
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
#define NI_MAX_RESOLUTION_AREA
void * p_master_display_meta_data
@ NI_FRAME_AUX_DATA_BITRATE
uint8_t use_long_term_ref
int32_t tmp_blk_io_handle