79static const int32_t LT_GOP_PRESET_I_1[6] = {
SLICE_TYPE_I, 1, 0, 0, 0, 0};
80static const int32_t LT_GOP_PRESET_P_1[6] = {
SLICE_TYPE_MP, 1, 1, 0, 0, -1};
81static const int32_t LT_GOP_PRESET_B_1[6] = {
SLICE_TYPE_B, 1, 1, 0, 0, -1};
83static const int32_t LT_GOP_PRESET_BP_2[12] = {
84 SLICE_TYPE_MP, 2, 1, 0, 0, -2,
SLICE_TYPE_B, 1, 3, 0, 0, 2,
87static const int32_t LT_GOP_PRESET_BBBP_4[24] = {
88 SLICE_TYPE_MP, 4, 1, 0, 0, -4,
SLICE_TYPE_B, 2, 3, 0, 0, 4,
89 SLICE_TYPE_B, 1, 5, 0, 0, 2,
SLICE_TYPE_B, 3, 5, 0, 2, 4,
92static const int32_t LT_GOP_PRESET_LP_4[24] = {
93 SLICE_TYPE_MP, 1, 5, 0, 0, -4,
SLICE_TYPE_MP, 2, 3, 0, 1, 0,
94 SLICE_TYPE_MP, 3, 5, 0, 2, 0,
SLICE_TYPE_MP, 4, 1, 0, 3, 0,
96static const int32_t LT_GOP_PRESET_LD_4[24] = {
97 SLICE_TYPE_B, 1, 5, 0, 0, -4,
SLICE_TYPE_B, 2, 3, 0, 1, 0,
98 SLICE_TYPE_B, 3, 5, 0, 2, 0,
SLICE_TYPE_B, 4, 1, 0, 3, 0,
102static const int32_t LT_GOP_PRESET_RA_8[48] = {
103 SLICE_TYPE_B, 8, 1, 0, 0, -8,
SLICE_TYPE_B, 4, 3, 0, 0, 8,
104 SLICE_TYPE_B, 2, 5, 0, 0, 4,
SLICE_TYPE_B, 1, 8, 0, 0, 2,
105 SLICE_TYPE_B, 3, 8, 0, 2, 4,
SLICE_TYPE_B, 6, 5, 0, 4, 8,
106 SLICE_TYPE_B, 5, 8, 0, 4, 6,
SLICE_TYPE_B, 7, 8, 0, 6, 8,
109static const int32_t LT_GOP_PRESET_SP_1[6] = {
SLICE_TYPE_P, 1, 1, 0, 0, -1};
111static const int32_t LT_GOP_PRESET_BSP_2[12] = {
112 SLICE_TYPE_P, 2, 1, 0, 0, -2,
SLICE_TYPE_B, 1, 3, 0, 0, 2,
114static const int32_t LT_GOP_PRESET_BBBSP_4[24] = {
115 SLICE_TYPE_P, 4, 1, 0, 0, -4,
SLICE_TYPE_B, 2, 3, 0, 0, 4,
116 SLICE_TYPE_B, 1, 5, 0, 0, 2,
SLICE_TYPE_B, 3, 5, 0, 2, 4,
118static const int32_t LT_GOP_PRESET_LSP_4[24] = {
119 SLICE_TYPE_P, 1, 5, 0, 0, -4,
SLICE_TYPE_P, 2, 3, 0, 1, 0,
120 SLICE_TYPE_P, 3, 5, 0, 2, 0,
SLICE_TYPE_P, 4, 1, 0, 3, 0,
123static const int32_t LT_GOP_PRESET_BBP_3[18] = {
124 SLICE_TYPE_MP, 3, 1, 0, 0, -3,
SLICE_TYPE_B, 1, 3, 0, 0, 3,
128static const int32_t LT_GOP_PRESET_BBSP_3[18] = {
129 SLICE_TYPE_P, 3, 1, 0, 0, 0,
SLICE_TYPE_B, 1, 3, 0, 0, 3,
133static const int32_t LT_GOP_PRESET_BBBBBBBP_8[48] = {
134 SLICE_TYPE_MP, 8, 1, 0, 0, -8,
SLICE_TYPE_B, 4, 3, 0, 0, 8,
135 SLICE_TYPE_B, 2, 5, 0, 0, 4,
SLICE_TYPE_B, 1, 8, 0, 0, 2,
136 SLICE_TYPE_B, 3, 8, 0, 2, 4,
SLICE_TYPE_B, 6, 5, 0, 4, 8,
137 SLICE_TYPE_B, 5, 8, 0, 4, 6,
SLICE_TYPE_B, 7, 8, 0, 6, 8,
140static const int32_t LT_GOP_PRESET_BBBBBBBSP_8[48] = {
141 SLICE_TYPE_P, 8, 1, 0, 0, 0,
SLICE_TYPE_B, 4, 3, 0, 0, 8,
142 SLICE_TYPE_B, 2, 5, 0, 0, 4,
SLICE_TYPE_B, 1, 8, 0, 0, 2,
143 SLICE_TYPE_B, 3, 8, 0, 2, 4,
SLICE_TYPE_B, 6, 5, 0, 4, 8,
144 SLICE_TYPE_B, 5, 8, 0, 4, 6,
SLICE_TYPE_B, 7, 8, 0, 6, 8,
153 LT_GOP_PRESET_BBBP_4,
160 LT_GOP_PRESET_BBBSP_4,
164 LT_GOP_PRESET_BBSP_3,
165 LT_GOP_PRESET_BBBBBBBP_8,
166 LT_GOP_PRESET_BBBBBBBSP_8,
172#define SAMPLE_SPS_MAX_SUB_LAYERS_MINUS1 0
173#define MAX_VPS_MAX_SUB_LAYERS 16
174#define MAX_CPB_COUNT 16
175#define MAX_DURATION 0.5
239 uint8_t *sei_buf = NULL;
241 int start_offset = 0;
250 sei_buf = (uint8_t *)frame->
p_data[start_offset] +
257 "unregisted SEI!\n");
287 "mastering display color SEI!\n");
296 *)((uint8_t *)frame->
p_data[start_offset] +
346 "content light level SEI !\n");
353 *)((uint8_t *)frame->
p_data[start_offset] +
373 int w, i, j, i_limit, j_limit;
378 sei_buf = (uint8_t *)frame->
p_data[start_offset] +
437 "hdr10+ targeted_system_display_maximum_luminance "
441 "hdr10+ targeted_system_display_actual_peak_lumi"
456 "hdr10+ num_rows_targeted_system_display_actual"
458 "num_cols_targeted_system_display_actual_"
459 "peak_luminance %d x %d\n",
462 i_limit = i_limit > 25 ? 25 : i_limit;
463 j_limit = j_limit > 25 ? 25 : j_limit;
464 for (i = 0; i < i_limit; i++)
465 for (j = 0; j < j_limit; j++)
474 "hdr10+ targeted_system_display_actual_peak"
475 "_luminance[%d][%d] %d\n",
485 for (i = 0; i < 3; i++)
503 "hdr10+ num_distribution_maxrgb_percentiles[%d] %d\n",
506 i_limit = i_limit > 15 ? 15 : i_limit;
507 for (i = 0; i < i_limit; i++)
516 "hdr10+ distribution_maxrgb_percentage[%d][%d] "
521 "hdr10+ distribution_maxrgb_percentile[%d][%d] "
539 "hdr10+ mastering_display_actual_peak_luminance_flag %u\n",
550 "hdr10+ num_rows_mastering_display_actual_peak_"
552 "num_cols_mastering_display_actual_peak_luminance "
556 i_limit = i_limit > 25 ? 25 : i_limit;
557 j_limit = j_limit > 25 ? 25 : j_limit;
558 for (i = 0; i < i_limit; i++)
559 for (j = 0; j < j_limit; j++)
566 "hdr10+ mastering_display_actual_peak_lumi"
567 "nance[%d][%d] %d\n",
570 ->mastering_display_actual_peak_luminance[i]
599 "hdr10+ num_bezier_curve_anchors[%d] %u\n", w,
608 "hdr10+ bezier_curve_anchors[%d][%d] %d\n", w,
616 "hdr10+ color_saturation_mapping_flag[%d] %u\n", w,
624 "hdr10+ color_saturation_weight[%d] %d\n", w,
658 "ni_dec_retrieve_aux_data VUI "
659 "aspect_ratio_idc %u "
660 "sar_width %u sar_height %u "
661 "video_full_range_flag %d "
662 "color-pri %u color-trc %u color-space %u "
663 "vui_num_units_in_tick %u "
664 "vui_time_scale %u\n",
675 sei_buf = (uint8_t *)frame->
p_data[start_offset] +
680 "writting VUI color-trc value %u\n",
692 int height,
int intra_qp)
698 uint32_t self_size = roi->self_size;
701 uint8_t isAbsQp_flag = 0;
710 width = (width / 8) * 8;
711 height = (height / 8) * 8;
716 uint32_t roiMapBlockUnitSize =
718 uint32_t mbWidth = ((width + max_cu_size - 1) & (~(max_cu_size - 1))) /
720 uint32_t mbHeight = ((height + max_cu_size - 1) & (~(max_cu_size - 1))) /
722 uint32_t numMbs = mbWidth * mbHeight;
723 uint32_t subMbWidth = roiMapBlockUnitSize / 8;
724 uint32_t subMbHeight = subMbWidth;
725 uint32_t subNumMbs = subMbWidth * subMbHeight;
729 uint32_t block_size = ((width + max_cu_size - 1) & (~(max_cu_size - 1))) *
730 ((height + max_cu_size - 1) & (~(max_cu_size - 1))) / (8 * 8);
733 uint32_t customMapSize = ((block_size + 63) & (~63));
734 if (!p_enc_ctx->roi_map)
738 if (!p_enc_ctx->roi_map)
745 memset(p_enc_ctx->roi_map, 0, customMapSize);
749 for (r = nb_roi - 1; r >= 0; r--)
752 if (!roi->qoffset.den)
763 set_qp = (int32_t)((
float)roi->qoffset.num * 1.0f /
771 set_qp = (int32_t)((
float)roi->qoffset.num * 1.0f /
780 "set_roi_map: left %d right %d top %d bottom %d num %d den"
782 roi->left, roi->right, roi->top, roi->bottom, roi->qoffset.num,
783 roi->qoffset.den, set_qp);
786 for (j = 0; j < mbHeight; j++)
788 for (i = 0; i < mbWidth; i++)
790 k = j * (int)mbWidth + i;
792 for (m = 0; m < subNumMbs; m++)
794 if (((
int)(i % mbWidth) >=
795 (
int)((roi->left + roiMapBlockUnitSize - 1) /
796 roiMapBlockUnitSize) -
798 ((int)(i % mbWidth) <=
799 (int)((roi->right + roiMapBlockUnitSize - 1) /
800 roiMapBlockUnitSize) -
802 ((int)(j % mbHeight) >=
803 (int)((roi->top + roiMapBlockUnitSize - 1) /
804 roiMapBlockUnitSize) -
806 ((int)(j % mbHeight) <=
807 (int)((roi->bottom + roiMapBlockUnitSize - 1) /
808 roiMapBlockUnitSize) -
811 p_enc_ctx->roi_map[k * subNumMbs + m].field.ipcm_flag =
813 p_enc_ctx->roi_map[k * subNumMbs + m]
814 .field.roiAbsQp_flag = isAbsQp_flag;
815 p_enc_ctx->roi_map[k * subNumMbs + m].field.qp_info =
821 sumQp += p_enc_ctx->roi_map[k * subNumMbs].field.qp_info;
826 p_enc_ctx->roi_len = customMapSize;
827 p_enc_ctx->roi_avg_qp = (numMbs != 0 ? (sumQp + (numMbs >> 1)) / numMbs : 0) +
NI_DEFAULT_INTRA_QP;
860 int should_send_sei_with_frame, uint8_t *mdcv_data,
861 uint8_t *cll_data, uint8_t *cc_data,
862 uint8_t *udu_data, uint8_t *hdrp_data)
891 intraprd = *((int32_t *)aux_data->
data);
892 if (intraprd < 0 || intraprd > 1024)
913 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): NOT allowed to reconfig intraPeriod %d in intra_mb_refresh_mode %d or gop_preset_index %d\n",
922 should_send_sei_with_frame = 1;
928 intraprd - (p_enc_ctx->
frame_num % intraprd);
938 ni_log(
NI_LOG_INFO,
"%s(): set intraPeriod %d on frame %u, update intra offset %u\n", __func__,
951 8 + 6 * 2 + 2 * 2 + 2 * 4 + 1;
975 uint32_t uint32_t_tmp = htonl(
979 uint32_t_tmp = htonl(
998 dst[0] = dst[1] = dst[2] = 0;
1025 uint16_t dp00 = 0, dp01 = 0, dp10 = 0, dp11 = 0, dp20 = 0, dp21 = 0,
1030 dp00 = (uint16_t)lrint(chroma_den *
1033 dp01 = (uint16_t)lrint(chroma_den *
1036 dp10 = (uint16_t)lrint(chroma_den *
1039 dp11 = (uint16_t)lrint(chroma_den *
1042 dp20 = (uint16_t)lrint(chroma_den *
1045 dp21 = (uint16_t)lrint(chroma_den *
1049 wpx = (uint16_t)lrint(chroma_den * ni_q2d(p_src->
white_point[0]));
1051 wpy = (uint16_t)lrint(chroma_den * ni_q2d(p_src->
white_point[1]));
1055 "mastering display color volume, primaries "
1056 "%u/%u/%u/%u/%u/%u white_point_x/y %u/%u max/min_lumi %u/%u\n",
1057 (uint16_t)dp00, (uint16_t)dp01, (uint16_t)dp10, (uint16_t)dp11,
1058 (uint16_t)dp20, (uint16_t)dp21, (uint16_t)wpx, (uint16_t)wpy,
1062 dst += 6 * 2 + 2 * 2;
1090 uint16_t max_content_light_level =
1092 uint16_t max_pic_average_light_level =
1102 &max_pic_average_light_level,
sizeof(uint16_t));
1113 should_send_sei_with_frame)
1116 dst[0] = dst[1] = dst[2] = 0;
1153 int cc_size = aux_data->
size;
1160 memcpy(cc_data_emu_prevent, aux_data->
data, cc_size);
1161 int cc_size_emu_prevent = cc_size +
1163 if (cc_size_emu_prevent != cc_size)
1166 "emulation prevention bytes added: %d\n",
1167 cc_size_emu_prevent - cc_size);
1184 memcpy(dst, cc_data_emu_prevent, cc_size_emu_prevent);
1185 dst += cc_size_emu_prevent;
1199 memcpy(dst, cc_data_emu_prevent, cc_size_emu_prevent);
1200 dst += cc_size_emu_prevent;
1257 ui_tmp = lrint(10000 *
1266 "hdr10+ targeted_system_display_actual_peak_luminance_"
1281 "hdr10+ num_rows_targeted_system_display_actual_peak_luminance "
1282 "x num_cols_targeted_system_display_actual_peak_luminance %u x "
1302 "luminance[%d][%d] %u\n",
1309 for (i = 0; i < 3; i++)
1311 ui_tmp = lrint(100000 * ni_q2d(hdrp->
params[w].
maxscl[i]));
1322 "hdr10+ num_distribution_maxrgb_percentiles[%d] %d\n", w,
1335 "hdr10+ distribution_maxrgb_percentage[%d][%d] %u\n", w, i,
1338 "hdr10+ distribution_maxrgb_percentile[%d][%d] %u\n", w, i,
1351 "hdr10+ mastering_display_actual_peak_luminance_flag %u\n",
1360 "hdr10+ num_rows_mastering_display_actual_peak_luminance x "
1361 "num_cols_mastering_display_actual_peak_luminance %u x %u\n",
1380 "mastering_display_actual_peak_luminance[%d][%d] %u\n",
1437 int emu_bytes_inserted;
1450 emu_bytes_inserted =
1452 dst += hdr10p_num_bytes + emu_bytes_inserted;
1457 (uint32_t)hdr10p_num_bytes + emu_bytes_inserted +
1470 emu_bytes_inserted =
1472 dst += hdr10p_num_bytes + emu_bytes_inserted;
1477 (uint8_t)hdr10p_num_bytes + emu_bytes_inserted +
1483 "ni_enc_prep_aux_data: codec %d not supported for HDR10+ "
1501 int udu_sei_size = aux_data->
size;
1502 int ext_udu_sei_size, sei_len;
1504 uint8_t *sei_data = malloc(udu_sei_size * 3 / 2);
1507 memcpy(sei_data, (uint8_t *)aux_data->
data, udu_sei_size);
1508 int emu_bytes_inserted =
1511 ext_udu_sei_size = udu_sei_size + emu_bytes_inserted;
1518 6 + ((udu_sei_size + 0xFE) / 0xFF) + ext_udu_sei_size + 1;
1524 7 + ((udu_sei_size + 0xFE) / 0xFF) + ext_udu_sei_size + 1;
1531 "ni_enc_prep_aux_data sei total length %u + sei_len %d "
1532 "exceeds maximum sei size %u, discarding it !\n",
1537 int payload_size = udu_sei_size;
1556 while (payload_size > 0)
1559 (payload_size > 0xFF ? 0xFF : (uint8_t)payload_size);
1560 payload_size -= 0xFF;
1564 memcpy(dst, sei_data, ext_udu_sei_size);
1565 dst += ext_udu_sei_size;
1586 int is_new_rois = 1;
1588 uint32_t self_size = 0;
1592 if (!self_size || aux_data->
size % self_size)
1595 "aux_data size %d self_size %u\n",
1596 aux_data->
size, self_size);
1599 int nb_roi = aux_data->
size / (int)self_size;
1627 if (set_roi_map(p_enc_ctx, codec_format, aux_data, nb_roi,
1651 if (aux_data && p_enc_ctx->
roi_map)
1669 "aux_data %d ctx->roi_map %d frame->roi_len %u ctx->roi_len %u\n",
1670 api_params->
cacheRoi, aux_data != NULL,
1683 "%s(): frame aux data LTR use_cur_src_as_ltr %u "
1696 "%s(): frame API set LTR use_cur_src_as_ltr %u "
1717 "%s(): frame aux data qp info max/min I qp <%d %d> maxDeltaQp <%d> max/min PB qp <%d %d>",
1734 int32_t bitrate = -1;
1738 bitrate = *((int32_t *)aux_data->
data);
1760 ni_log2(p_enc_ctx,
NI_LOG_INFO,
"%s: bitrate %d updated for reconfig\n", __func__, bitrate);
1783 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): invalid colorDescPresent in aux data %d\n",
1819 vui = p_enc_ctx->
vui;
1828 "colorDescPresent %d colorPrimaries %d "
1829 "colorTrc %d colorSpace %d aspectRatioWidth %d "
1830 "aspectRatioHeight %d videoFullRange %d\n",
1854 int32_t ltr_interval = -1;
1859 ltr_interval = *((int32_t *)aux_data->
data);
1872 if (ltr_interval > 0)
1890 if ((framerate_num <= 0) || (framerate_denom <= 0))
1893 "ERROR: %s(): invalid framerate in aux data (%d/%d)\n",
1894 __func__, framerate_num, framerate_denom);
1897 if ((framerate_num % framerate_denom) != 0)
1899 uint32_t numUnitsInTick = 1000;
1900 framerate_num = framerate_num / framerate_denom;
1901 framerate_denom = numUnitsInTick + 1;
1903 framerate_num *= numUnitsInTick;
1906 framerate_num = framerate_num / framerate_denom;
1907 framerate_denom = 1;
1909 if (((framerate_num + framerate_denom - 1) / framerate_denom) >
1913 "ERROR: %s(): invalid framerate in aux data (%d/%d)\n",
1921 __func__, framerate_num, framerate_denom);
1948 ni_log2(p_enc_ctx,
NI_LOG_INFO,
"%s: framerate num %d denom %d updated for reconfig\n",
1954 int32_t frame_num = -1;
1959 frame_num = *((int32_t *)aux_data->
data);
1961 __func__, frame_num);
1983 should_send_sei_with_frame)
2002 int32_t max_frame_size = 0;
2006 max_frame_size = *((int32_t *)aux_data->
data);
2007 uint32_t maxFrameSize = (uint32_t)max_frame_size / 2000;
2008 uint32_t min_maxFrameSize;
2014 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): max_frame_size %d is valid only when lowDelay mode is enabled\n",
2015 __func__, max_frame_size);
2020 int32_t tmp_bitrate, tmp_framerate_num, tmp_framerate_denom;
2030 tmp_framerate_num = (int32_t)api_params->
fps_number;
2034 min_maxFrameSize = (((uint32_t)tmp_bitrate / tmp_framerate_num * tmp_framerate_denom) / 8) / 2000;
2036 if (maxFrameSize < min_maxFrameSize)
2038 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): max_frame_size %d is too small (invalid)\n",
2039 __func__, max_frame_size);
2053 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s(): API set max_frame_size %d\n", __func__, max_frame_size);
2056 if (max_frame_size > 0)
2071 crf = (float)(*((int32_t *)aux_data->
data));
2077 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): reconfigure crf value %d is valid only in CRF mode\n",
2083 if (crf < 0 || crf > 51)
2085 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): crf value %d is invalid (valid range in [0..51])\n",
2094 crf = *((
float *)aux_data->
data);
2100 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): reconfigure crf value %f is valid only in CRF mode\n",
2106 if (crf < 0 || crf > 51)
2108 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s(): crf value %f is invalid (valid range in [0..51])\n",
2135 int32_t vbvMaxRate = 0;
2139 vbvMaxRate = *((int32_t *)aux_data->
data);
2148 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s(): API set reconfig_vbv_max_rate %d\n", __func__, vbvMaxRate);
2160 int32_t vbvBufferSize = 0;
2164 vbvBufferSize = *((int32_t *)aux_data->
data);
2165 if ((vbvBufferSize < 10 && vbvBufferSize != 0) || vbvBufferSize > 3000)
2167 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"%s(): invalid frame aux data vbvBufferSize %d\n", __func__,
2182 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s(): API set reconfig_vbv_max_rate %d\n", __func__, vbvBufferSize);
2194 int16_t sliceArg = 0;
2198 sliceArg = *((int16_t *)aux_data->
data);
2202 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"%s():not support to reconfig slice_arg when slice_mode disable.\n",
2213 int max_num_ctu_mb_row = (api_params->
source_height + ctu_mb_size - 1) / ctu_mb_size;
2214 if (sliceArg < 1 || sliceArg > max_num_ctu_mb_row)
2231 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"%s(): API set reconfig_slice_arg %d\n", __func__, sliceArg);
2237 ni_log2(p_enc_ctx,
NI_LOG_INFO,
"%s(): slice arg > NI_MAX_SLICE_SIZE, change from %d to %d\n",
2269 const uint8_t *mdcv_data,
const uint8_t *cll_data,
2270 const uint8_t *cc_data,
const uint8_t *udu_data,
2271 const uint8_t *hdrp_data,
int is_hwframe,
2278 if (is_hwframe != 0 && is_hwframe != 1 && is_semiplanar != 0 &&
2282 "ni_enc_copy_aux_data: error, illegal hwframe or nv12frame\n");
2299 uint8_t *dst = (uint8_t *)p_enc_frame->
p_data[2 + is_hwframe] +
2300 p_enc_frame->
data_len[2 + is_hwframe] + frame_metadata_size;
2304 dst = (uint8_t *)p_enc_frame->
p_data[2 - is_semiplanar] +
2305 p_enc_frame->
data_len[2 - is_semiplanar] +
2306 frame_metadata_size;
2313 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"ni_enc_copy_aux_data: p_metadata_buffer %p frame_metadata_size %u dst %p\n",
2350 memset(dst, 0, p_enc_ctx->
roi_len);
2365 memcpy(dst, mdcv_data,
2376 memcpy(dst, cll_data,
2384 ni_log2(p_enc_ctx,
NI_LOG_DEBUG,
"ni_enc_copy_aux_data: preferred characteristics size: %u to %p\n",
2387 dst[0] = dst[1] = dst[2] = 0;
2415 memcpy(dst, cc_data, p_enc_frame->
sei_cc_len);
2456 uint8_t *dst = timecode_data;
2458 uint32_t header_len, payload_len, total_len;
2459 int emu_bytes_inserted, is_hwframe, is_semiplanar;
2461 if (!p_enc_ctx || !p_enc_frame || !p_timecode) {
2467 ni_log2(p_enc_ctx,
NI_LOG_ERROR,
"ERROR: %s insertion of timecode in SEI is only supported on H264 and H265 encoder\n", __func__);
2558 dst[6] = payload_len;
2560 dst[7] = payload_len;
2566 dst += payload_len + emu_bytes_inserted;
2570 total_len = header_len + payload_len + emu_bytes_inserted + 1;
2575 dst = (uint8_t *)p_enc_frame->
p_data[2 + is_hwframe] +
2579 dst = (uint8_t *)p_enc_frame->
p_data[2 - is_semiplanar] +
2590 memcpy(dst, timecode_data, total_len);
2625 ni_frame_t *p_enc_frame, uint8_t *p_yuv_buffer)
2629 bool need_copy =
true;
2632 bool alignment_2pass_wa =
false;
2635 if (!p_ctx || !p_enc_frame)
2652 __func__, p_yuv_buffer);
2670 "%s: resolution change %dx%d -> %dx%d "
2671 "or pixel format change %d -> %d\n",
2704 int should_send_sei_with_frame =
2716 should_send_sei_with_frame, mdcv_data, cll_data,
2717 cc_data, udu_data, hdrp_data);
2736 is_semiplanar, dst_stride, dst_height_aligned);
2747 src_height[0] = frame_height;
2748 p_src[0] = p_yuv_buffer;
2763 src_stride[1] = is_semiplanar ? src_stride[0] : src_stride[0] / 2;
2764 src_stride[2] = is_semiplanar ? 0 : src_stride[0] / 2;
2766 src_height[1] = src_height[0] / 2;
2767 src_height[2] = is_semiplanar ? 0 : src_height[1];
2769 p_src[1] = p_src[0] + src_stride[0] * src_height[0];
2770 p_src[2] = p_src[1] + src_stride[1] * src_height[1];
2773 alignment_2pass_wa = (
2780 if (alignment_2pass_wa && !is_hwframe) {
2781 if (is_semiplanar) {
2785 dst_height_aligned[1] = (((dst_height_aligned[0] + 31) / 32) * 32) / 2;
2789 dst_height_aligned[2] = (((dst_height_aligned[0] + 31) / 32) * 32) / 2;
2795 p_param, frame_width, frame_height,
2801 p_enc_frame, frame_width,
2802 frame_height, (
const int *)src_stride, (
const uint8_t **)p_src,
2818 dst_height_aligned[0], dst_stride,
2828 "%s: src_stride %d dst_stride "
2829 "%d dst_height_aligned %d src_height %d need_copy %d\n",
2830 __func__, src_stride[0],
2831 dst_stride[0], dst_height_aligned[0],
2832 src_height[0], need_copy);
2840 dst_height_aligned, src_stride, src_height);
2845 "p_dst alloc linesize = %d/%d/%d src height=%d "
2846 "dst height aligned = %d/%d/%d force_key_frame=%d, "
2848 " sei_size=%u (hdr_content_light_level %u hdr_mastering_display_"
2849 "color_vol %u hdr10+ %u hrd %d) reconf_size=%u roi_size=%u "
2850 "force_pic_qp=%u udu_sei_size=%u "
2851 "use_cur_src_as_long_term_pic %u use_long_term_ref %u\n",
2852 dst_stride[0], dst_stride[1], dst_stride[2], frame_height,
2853 dst_height_aligned[0], dst_height_aligned[1], dst_height_aligned[2],
2865 mdcv_data, cll_data, cc_data, udu_data, hdrp_data,
2880 p_enc_frame->
p_data[i] = NULL;
2903 for (i = 0; i < 3; i++) {
2904 uint32_t tmp = *state << 8;
2905 *state = tmp + *(p++);
2906 if (tmp == 0x100 || p == end)
2915 else if (p[-3] | (p[-1] - 1))
2923 p = ((p) < (end) ? (p - 4) : (end - 4));
2925 (((uint32_t) (p)[0] << 24) | ((p)[1] << 16) | ((p)[2] << 8) | (p)[3]);
2944 ni_packet_t *p_packet, uint8_t sei_type,
int vcl_found)
2971 ni_log(
NI_LOG_INFO,
"number of custom sei in current frame is out of limit(%d).\n",
2975 sei_data = &p_custom_sei->
data[0];
2985 while (index < pkt_size && pkt_data[index] == 0xff)
2987 sei_size += pkt_data[index++];
2990 if (index >= pkt_size)
2995 sei_size += pkt_data[index++];
3004 udata = &pkt_data[index];
3007 sei_data[0] = sei_type;
3013 for (i = 0, len = 0; (i < pkt_size - index) && len < sei_size; i++, len++)
3017 if (i >= 2 && udata[i - 2] == 0 && udata[i - 1] == 0 && udata[i] == 3)
3022 sei_data[len] = udata[i];
3025 if (len != sei_size)
3028 "required size:%d, actual size:%d.\n", sei_size, len);
3032 p_custom_sei->
type = sei_type;
3033 p_custom_sei->
size = sei_size;
3039 __FUNCTION__, sei_size, sei_type);
3065 uint8_t *data,
int size,
ni_packet_t *p_packet,
int low_delay,
3066 int codec_format,
int pkt_nal_bitmap,
int custom_sei_type,
3067 int *svct_skip_next_packet,
int *is_lone_sei_pkt)
3069 int pkt_sei_alone = 1;
3077 const uint8_t *ptr = data;
3078 const uint8_t *end = data + size;
3081 uint8_t sei_type = 0;
3086 const uint8_t *next = NULL;
3087 int sei_size = 0, i = 0;
3092 "ni_dec_packet_parse(): already find the header of streams.\n");
3107 if (0 == nalu_count)
3119 nalu_type = (int)stc & 0x1f;
3122 pkt_sei_alone = (pkt_sei_alone && 6 == nalu_type);
3142 "ni_dec_packet_parse(): Detect SPS, PPS and IDR, "
3143 "enable decoder low delay mode.\n");
3154 if (*(next - 5) == 0)
3160 while (next - ptr > 1)
3164 custom_sei_type == sei_type ||
3174 (
long)(ptr + 1 - data), p_packet,
3175 sei_type, vcl_found);
3185 while (ptr < next && *ptr == 0xff)
3190 for (i = 0; i < sei_size; i++)
3192 if (i >= 2 && *(ptr - 2) == 0 && *(ptr - 1) == 0 && *ptr == 3)
3197 }
else if (nalu_type >= 1 &&
3201 }
else if (14 == nalu_type)
3208 if (temporal_id > svct_layer)
3212 *svct_skip_next_packet = 1;
3214 "ni_dec_packet_parse(): temporal_id %d"
3215 " is bigger than decoded layer %d, skip the next "
3217 temporal_id, svct_layer);
3222 nalu_type = (int)(stc >> 1) & 0x3F;
3225 pkt_sei_alone = (pkt_sei_alone &&
3247 if (pkt_nal_bitmap ==
3253 "ni_dec_packet_parse(): Detect VPS, SPS, PPS and "
3254 "IDR enable decoder low delay mode.\n");
3261 if (39 == nalu_type ||
3266 if (*(next - 5) == 0)
3275 while (next - ptr > 1)
3279 custom_sei_type == sei_type ||
3289 sei_type, vcl_found);
3299 while (ptr < next && *ptr == 0xff)
3304 for (i = 0; i < sei_size; i++)
3306 if (i >= 2 && *(ptr - 2) == 0 && *(ptr - 1) == 0 && *ptr == 3)
3311 }
else if (nalu_type >= 0 &&
3318 ni_log2(p_session_ctx,
NI_LOG_DEBUG,
"%s() wrong codec %d !\n", __FUNCTION__, codec_format);
3326 *is_lone_sei_pkt = pkt_sei_alone;
3346 int raw_width,
int raw_height,
int ni_fmt,
int nb_planes)
3348 int i, j, h, tenBit = 0;
3349 int vpad[3], hpad[3], src_height[3], src_width[3], src_stride[3];
3350 uint8_t *src_line, *dst_line, *sample, *dest, YUVsample;
3357 src_width[0] =
NIALIGN(raw_width, 2);
3358 src_width[1] =
NIALIGN(raw_width, 2) / 2;
3359 src_width[2] =
NIALIGN(raw_width, 2) / 2;
3362 src_height[0] =
NIALIGN(raw_height, 2);
3363 src_height[1] =
NIALIGN(raw_height, 2) / 2;
3364 src_height[2] =
NIALIGN(raw_height, 2) / 2;
3367 src_stride[0] =
NIALIGN(src_width[0], 128);
3368 src_stride[1] =
NIALIGN(src_width[1], 128);
3369 src_stride[2] =
NIALIGN(src_width[2], 128);
3374 hpad[0] = dst_stride[0] - src_width[0];
3375 hpad[1] = dst_stride[1] - src_width[1];
3376 hpad[2] = dst_stride[2] - src_width[2];
3387 src_width[0] =
NIALIGN(raw_width, 2);
3388 src_width[1] =
NIALIGN(raw_width, 2) / 2;
3389 src_width[2] =
NIALIGN(raw_width, 2) / 2;
3392 src_height[0] =
NIALIGN(raw_height, 2);
3393 src_height[1] =
NIALIGN(raw_height, 2) / 2;
3394 src_height[2] =
NIALIGN(raw_height, 2) / 2;
3397 src_stride[0] =
NIALIGN(src_width[0] * 2, 128);
3398 src_stride[1] =
NIALIGN(src_width[1] * 2, 128);
3399 src_stride[2] =
NIALIGN(src_width[2] * 2, 128);
3404 hpad[0] = dst_stride[0] - src_width[0] * 2;
3405 hpad[1] = dst_stride[1] - src_width[1] * 2;
3406 hpad[2] = dst_stride[2] - src_width[2] * 2;
3417 src_width[0] =
NIALIGN(raw_width, 2);
3418 src_width[1] =
NIALIGN(raw_width, 2);
3422 src_height[0] =
NIALIGN(raw_height, 2);
3423 src_height[1] =
NIALIGN(raw_height, 2) / 2;
3427 src_stride[0] =
NIALIGN(src_width[0], 128);
3428 src_stride[1] =
NIALIGN(src_width[1], 128);
3434 hpad[0] = dst_stride[0] - src_width[0];
3435 hpad[1] = dst_stride[1] - src_width[1];
3447 src_width[0] =
NIALIGN(raw_width, 2);
3448 src_width[1] =
NIALIGN(raw_width, 2);
3452 src_height[0] =
NIALIGN(raw_height, 2);
3453 src_height[1] =
NIALIGN(raw_height, 2) / 2;
3457 src_stride[0] =
NIALIGN(src_width[0] * 2, 128);
3458 src_stride[1] =
NIALIGN(src_width[1] * 2, 128);
3464 hpad[0] = dst_stride[0] - src_width[0] * 2;
3465 hpad[1] = dst_stride[1] - src_width[1] * 2;
3482 dst_line = dst->
p_data[i];
3483 src_line = src->
p_data[i];
3485 for (h = 0; i < 3 && h < src_height[i]; h++)
3487 memcpy(dst_line, src_line, src_width[i] * (tenBit + 1));
3492 lastidx = src_width[i];
3496 sample = &src_line[(lastidx - 1) * 2];
3497 dest = &dst_line[lastidx * 2];
3500 for (j = 0; j < hpad[i] / 2; j++)
3502 memcpy(dest, sample, 2);
3507 YUVsample = dst_line[lastidx - 1];
3508 memset(&dst_line[lastidx], YUVsample, hpad[i]);
3512 src_line += src_stride[i];
3513 dst_line += dst_stride[i];
3517 src_line = dst_line - dst_stride[i];
3519 for (h = 0; h < vpad[i]; h++)
3521 memcpy(dst_line, src_line, dst_stride[i]);
3522 dst_line += dst_stride[i];
3544 int sei_size, size, len;
3545 int ret = 0, i = 0, j = 0;
3546 uint8_t *p_src_sei_data, *p_dst_sei_data;
3549 if (!p_session_ctx || !p_param || !ppu_config)
3560 ni_log2(p_session_ctx,
NI_LOG_ERROR,
"%s: not supported on device with FW API version < 6rx\n", __func__);
3568 "h264 and h265 decoder\n", __func__);
3573 if (p_dec_input_param->
hwframes != 1)
3576 "So can't reconfig ppu\n", __func__);
3583 "So can't reconfig ppu1\n", __func__);
3590 "So can't reconfig ppu2\n", __func__);
3603 "out of range\n", __func__, ppu_config->
ppu_w[i], ppu_config->
ppu_h[i]);
3607 if ((ppu_config->
ppu_w[i] & 1) || (ppu_config->
ppu_h[i] & 1))
3610 __func__, ppu_config->
ppu_w[i], ppu_config->
ppu_h[i]);
3617 if (p_dst_custom_sei == NULL)
3620 "to allocate memory for custom sei data\n", __func__);
3629 p_src_sei_data = (uint8_t *)ppu_config;
3630 p_dst_sei_data = &p_dst_custom_sei->
data[0];
3634 p_dst_sei_data[size++] = 0x00;
3635 p_dst_sei_data[size++] = 0x00;
3636 p_dst_sei_data[size++] = 0x00;
3637 p_dst_sei_data[size++] = 0x01;
3641 p_dst_sei_data[size++] = 0x06;
3645 p_dst_sei_data[size++] = 0x4e;
3646 p_dst_sei_data[size++] = 0x01;
3656 p_dst_sei_data[size++] = len > 0xff ? 0xff : len;
3663 if (j >= 2 && !p_dst_sei_data[size - 2] && !p_dst_sei_data[size - 1] && p_src_sei_data[j] <= 0x03)
3666 p_dst_sei_data[size++] = 0x03;
3668 p_dst_sei_data[size++] = p_src_sei_data[j];
3674 "idx=%u, size=%d\n", __func__,
3676 free(p_dst_custom_sei);
3681 p_dst_sei_data[size++] = 0x80;
3684 p_dst_sei_data, size);
3686 free(p_dst_custom_sei);
void ni_dec_retrieve_aux_data(ni_frame_t *frame)
Retrieve auxiliary data (close caption, various SEI) associated with this frame that is returned by d...
int ni_extract_custom_sei(uint8_t *pkt_data, int pkt_size, long index, ni_packet_t *p_packet, uint8_t sei_type, int vcl_found)
Extract custom sei payload data from pkt_data, and save it to ni_packet_t.
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.
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...
const uint8_t * ni_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
Find the next start code.
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.
int ni_reconfig_ppu_output(ni_session_context_t *p_session_ctx, ni_xcoder_params_t *p_param, ni_ppu_config_t *ppu_config)
Reset decoder ppu resolution.
LIB_API int ni_enc_insert_timecode(ni_session_context_t *p_enc_ctx, ni_frame_t *p_enc_frame, ni_timecode_t *p_timecode)
Insert timecode data into picture timing SEI (H264) or time code SEI (H265)
int ni_dec_packet_parse(ni_session_context_t *p_session_ctx, ni_xcoder_params_t *p_param, uint8_t *data, int size, ni_packet_t *p_packet, int low_delay, int codec_format, int pkt_nal_bitmap, int custom_sei_type, int *svct_skip_next_packet, int *is_lone_sei_pkt)
Decode parse packet.
int ni_enc_write_from_yuv_buffer(ni_session_context_t *p_ctx, ni_frame_t *p_enc_frame, uint8_t *p_yuv_buffer)
Send an input data frame to the encoder with YUV data given in the inputs.
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.
Audio/video related utility definitions.
#define NI_SEI_TYPE_PPU_RECONFIG
enum _ni_hdr_plus_overlap_process_option ni_hdr_plus_overlap_process_option_t
#define MASTERING_DISP_LUMA_DEN
#define MASTERING_DISP_CHROMA_DEN
#define NI_GENERATE_ALL_NAL_HEADER_BIT
void ni_bitstream_writer_init(ni_bitstream_writer_t *stream)
init a bitstream writer
void ni_bs_writer_copy(uint8_t *dst, const ni_bitstream_writer_t *stream)
copy bitstream data to dst Note: caller must ensure sufficient space in dst
void ni_bs_writer_align_zero(ni_bitstream_writer_t *stream)
align the bitstream with zero
void ni_bitstream_reader_init(ni_bitstream_reader_t *br, const uint8_t *data, int bit_size)
init a bitstream reader Note: bitstream_reader takes reading ownership of the data
uint32_t ni_bs_reader_get_bits(ni_bitstream_reader_t *br, int n)
read bits (up to 32) from the bitstream reader, after reader init
void ni_bs_writer_clear(ni_bitstream_writer_t *stream)
clear and reset bitstream
uint64_t ni_bs_writer_tell(const ni_bitstream_writer_t *const stream)
return the number of bits written to bitstream so far
void ni_bs_writer_put(ni_bitstream_writer_t *stream, uint32_t data, uint8_t bits)
write a specified number (<= 32) of bits to bitstream, buffer individual bits until a full byte is ma...
void ni_bs_reader_skip_bits(ni_bitstream_reader_t *br, int n)
skip a number of bits ahead in the bitstream reader
Utility definitions to operate on bits in a bitstream.
#define NI_INVALID_SEI_TYPE
#define NI_XCODER_REVISION_API_MAJOR_VER_IDX
#define NI_MAX_NUM_DATA_POINTERS
#define NI_APP_ENC_FRAME_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_rc
#define NI_APP_ENC_FRAME_META_DATA_SIZE
#define NI_MAX_CUSTOM_SEI_CNT
#define NI_MAX_NUM_OF_DECODER_OUTPUTS
#define NI_APP_ENC_FRAME_META_DATA_SIZE_UNDER_MAJOR_6_MINOR_Q
#define NI_MEM_PAGE_ALIGNMENT
@ NI_RETCODE_ERROR_UNSUPPORTED_FW_VERSION
@ NI_RETCODE_PARAM_INVALID_VALUE
@ NI_RETCODE_ERROR_MEM_ALOC
@ NI_RETCODE_INVALID_PARAM
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_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_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_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_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_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,...
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...
@ SESSION_RUN_STATE_SEQ_CHANGE_DRAINING
@ NI_CUSTOM_SEI_LOC_AFTER_VCL
@ NI_CUSTOM_SEI_LOC_BEFORE_VCL
#define NI_CC_SEI_TRAILER_LEN
#define NI_CC_SEI_HDR_H264_LEN
#define NI_MAX_CUSTOM_SEI_DATA
#define NI_MAX_FRAME_SIZE
struct _ni_encoder_change_params_t ni_encoder_change_params_t
This is a data structure for encoding parameters that have changed.
@ NI_FRAME_AUX_DATA_MASTERING_DISPLAY_METADATA
@ NI_FRAME_AUX_DATA_BITRATE
@ NI_FRAME_AUX_DATA_SLICE_ARG
@ NI_FRAME_AUX_DATA_CRF_FLOAT
@ NI_FRAME_AUX_DATA_UDU_SEI
@ NI_FRAME_AUX_DATA_MAX_MIN_QP
@ NI_FRAME_AUX_DATA_FRAMERATE
@ NI_FRAME_AUX_DATA_LTR_INTERVAL
@ NI_FRAME_AUX_DATA_HDR_PLUS
@ 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_A53_CC
@ NI_FRAME_AUX_DATA_CONTENT_LIGHT_LEVEL
@ NI_FRAME_AUX_DATA_REGIONS_OF_INTEREST
@ NI_FRAME_AUX_DATA_LONG_TERM_REF
@ NI_FRAME_AUX_DATA_VBV_BUFFER_SIZE
#define NI_MAX_RESOLUTION_WIDTH
#define NI_MAX_SLICE_SIZE
#define NI_ENC_MAX_SEI_BUF_SIZE
struct _ni_ppu_config ni_ppu_config_t
#define NI_HDR10P_SEI_HDR_H264_LEN
#define NI_DEFAULT_INTRA_QP
#define NI_CUSTOMIZE_ROI_QPOFFSET_LEVEL
Max number of lines supported for qpoffset level.
enum _ni_codec_format ni_codec_format_t
This is an enumeration for supported codec formats.
#define NI_MIN_RESOLUTION_WIDTH_SCALER
#define NI_HDR10P_SEI_HDR_HEVC_LEN
#define NI_MAX_ASPECTRATIO
#define NI_MAX_RESOLUTION_HEIGHT
#define NI_INTRA_QP_RANGE
@ NI_SET_CHANGE_PARAM_INVALID_REF_FRAME
@ NI_SET_CHANGE_PARAM_RC_TARGET_RATE
@ NI_SET_CHANGE_PARAM_RC_FRAMERATE
@ NI_SET_CHANGE_PARAM_CRF
@ NI_SET_CHANGE_PARAM_LTR_INTERVAL
@ NI_SET_CHANGE_PARAM_VBV
@ NI_SET_CHANGE_PARAM_VUI_HRD_PARAM
@ NI_SET_CHANGE_PARAM_RC_MIN_MAX_QP
@ NI_SET_CHANGE_PARAM_SLICE_ARG
@ NI_SET_CHANGE_PARAM_INTRA_PERIOD
@ NI_SET_CHANGE_PARAM_MAX_FRAME_SIZE
#define NI_INVALID_SVCT_DECODING_LAYER
#define NI_CC_SEI_HDR_HEVC_LEN
#define NI_RBSP_TRAILING_BITS_LEN
int ni_get_planar_from_pixfmt(int pix_fmt)
Grab planar info from NI_PIX_FMT.
Private definitions used by ni_device_api.c for video processing tasks.
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
Private definitions for interfacing with NETINT video processing devices over NVMe.
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....
int ni_insert_emulation_prevent_bytes(uint8_t *buf, int size)
Insert emulation prevention byte(s) as needed into the data buffer.
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....
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...
payload format of HDR SEI content light level info
uint16_t max_content_light_level
uint16_t max_pic_average_light_level
ni_custom_sei_t custom_sei[NI_MAX_CUSTOM_SEI_CNT]
custom sei payload passthrough
uint8_t data[NI_MAX_CUSTOM_SEI_DATA]
ni_custom_sei_location_t location
decoded payload format of HDR SEI mastering display colour volume
uint32_t min_display_mastering_luminance
uint32_t max_display_mastering_luminance
uint16_t display_primaries[3][2]
uint8_t targeted_system_display_actual_peak_luminance_flag
uint8_t application_version
uint8_t num_cols_targeted_system_display_actual_peak_luminance
uint8_t num_rows_mastering_display_actual_peak_luminance
uint8_t num_rows_targeted_system_display_actual_peak_luminance
uint8_t num_cols_mastering_display_actual_peak_luminance
ni_rational_t targeted_system_display_maximum_luminance
ni_rational_t mastering_display_actual_peak_luminance[25][25]
uint8_t itu_t_t35_country_code
uint8_t mastering_display_actual_peak_luminance_flag
ni_hdr_plus_color_transform_params_t params[3]
ni_rational_t targeted_system_display_actual_peak_luminance[25][25]
encoded payload format of HDR SEI mastering display colour volume
uint16_t display_primaries[3][2]
int intra_mb_refresh_mode
int preferred_transfer_characteristics
struct _ni_encoder_cfg_params::@16 rc
int customize_roi_qp_level
This is a data structure for encoding parameters that have changed.
uint16_t aspectRatioHeight
uint16_t aspectRatioWidth
uint32_t data_len[NI_MAX_NUM_DATA_POINTERS]
unsigned int sei_hdr_mastering_display_color_vol_offset
unsigned int sei_hdr_content_light_level_info_offset
uint8_t preferred_characteristics_data_len
uint32_t vui_num_units_in_tick
uint8_t separate_metadata
unsigned int sei_hdr_plus_len
unsigned int sei_hdr_plus_offset
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
unsigned int extra_data_len
unsigned int sei_total_len
unsigned int sei_cc_offset
unsigned int sei_user_data_unreg_len
ni_pic_type_t ni_pict_type
uint8_t use_cur_src_as_long_term_pic
unsigned int sei_hdr_content_light_level_info_len
uint8_t * p_metadata_buffer
unsigned int sei_hdr_mastering_display_color_vol_len
int video_full_range_flag
unsigned int sei_user_data_unreg_offset
uint8_t use_long_term_ref
unsigned int sei_alt_transfer_characteristics_len
unsigned int sei_alt_transfer_characteristics_offset
uint8_t use_cur_src_as_long_term_pic
uint8_t use_long_term_ref
ni_custom_sei_set_t * p_custom_sei_set
uint16_t ppu_h[NI_MAX_NUM_OF_DECODER_OUTPUTS]
uint16_t ppu_w[NI_MAX_NUM_OF_DECODER_OUTPUTS]
uint8_t itu_t_t35_hdr10p_sei_hdr_hevc[NI_HDR10P_SEI_HDR_HEVC_LEN]
int16_t reconfig_slice_arg
int reconfig_vbv_max_rate
int mdcv_max_min_lum_data_len
int32_t ltr_frame_ref_invalid
uint8_t preferred_characteristics_data
uint8_t ui8_light_level_data[5]
int sei_hdr_content_light_level_info_len
int sei_hdr_mastering_display_color_vol_len
uint32_t actual_video_width
uint8_t sei_trailer[NI_CC_SEI_TRAILER_LEN]
int reconfig_intra_period
uint8_t ui8_mdcv_max_min_lum_data[9]
uint8_t itu_t_t35_cc_sei_hdr_hevc[NI_CC_SEI_HDR_HEVC_LEN]
void * p_master_display_meta_data
uint8_t itu_t_t35_cc_sei_hdr_h264[NI_CC_SEI_HDR_H264_LEN]
ni_framerate_t last_framerate
int reconfig_vbv_buffer_size
uint32_t force_idr_intra_offset
ni_long_term_ref_t ltr_to_set
ni_session_run_state_t session_run_state
ni_encoder_change_params_t * enc_change_params
uint8_t itu_t_t35_hdr10p_sei_hdr_h264[NI_HDR10P_SEI_HDR_H264_LEN]
ni_enc_quad_roi_custom_map * roi_map
ni_region_of_interest_t * av_rois
uint32_t active_video_height
uint32_t time_offset_value
uint8_t full_timestamp_flag
uint8_t nuit_field_based_flag
uint8_t time_offset_length
uint8_t discontinuity_flag
int32_t aspectRatioHeight
ni_encoder_cfg_params_t cfg_enc_params
ni_decoder_input_params_t dec_input_params
encoder AVC ROI custom map (1 MB = 8bits)