aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrujan Vandrangi <srujan.vandrangi@ittiam.com>2024-05-08 15:32:27 +0530
committerHarish Mahendrakar <harish.mahendrakar@ittiam.com>2024-05-09 07:40:11 -0700
commitb2b115e9572dbbc43b0ed646d285598b60d1541e (patch)
treed36916178176a084b43512d5b6984966d419dba4
parentdc225332d0238e513f547a514eab1d28e6f60d59 (diff)
downloadlibhevc-upstream-main.tar.gz
libhevc: move encoder SEI related code under a macroupstream-main
Bug: 338446610 Test: ./hevcenc Change-Id: I76fa9371aac6ef5fca3723425e0010cf1f13db1f
-rw-r--r--Android.bp2
-rw-r--r--common/ihevc_structs.h4
-rw-r--r--encoder/ihevce_api.h10
-rw-r--r--encoder/ihevce_enc_structs.h10
-rw-r--r--encoder/ihevce_encode_header_sei_vui.c2
-rw-r--r--encoder/ihevce_encode_header_sei_vui.h24
-rw-r--r--encoder/ihevce_entropy_cod.c15
-rw-r--r--encoder/ihevce_entropy_interface.c8
-rw-r--r--encoder/ihevce_entropy_structs.h2
-rw-r--r--encoder/ihevce_error_check.c8
-rw-r--r--encoder/ihevce_error_codes.h10
-rw-r--r--encoder/ihevce_frame_process.c17
-rw-r--r--encoder/ihevce_frame_process_utils.c2
-rw-r--r--encoder/ihevce_frame_process_utils.h2
-rw-r--r--encoder/ihevce_hle_interface.c2
-rw-r--r--encoder/ihevce_lap_interface.c8
-rw-r--r--encoder/ihevce_memory_init.c11
-rw-r--r--encoder/ihevce_plugin.c2
-rw-r--r--fuzzer/hevc_enc_fuzzer.cpp4
-rw-r--r--test/encoder/app.h2
-rw-r--r--test/encoder/main.c8
21 files changed, 135 insertions, 18 deletions
diff --git a/Android.bp b/Android.bp
index 9c788fa..3faede7 100644
--- a/Android.bp
+++ b/Android.bp
@@ -447,6 +447,7 @@ cc_library_static {
host_supported: true,
cflags: [
"-DENABLE_MAIN_REXT_PROFILE",
+ "-DDISABLE_SEI",
"-fPIC",
"-O3",
"-Wall",
@@ -810,6 +811,7 @@ cc_test {
host_supported: true,
cflags: [
"-DARM",
+ "-DDISABLE_SEI",
"-fPIC",
"-Wall",
"-Werror",
diff --git a/common/ihevc_structs.h b/common/ihevc_structs.h
index 55d746e..1c673a8 100644
--- a/common/ihevc_structs.h
+++ b/common/ihevc_structs.h
@@ -39,6 +39,7 @@
#define _IHEVC_STRUCTS_H_
+#ifndef DISABLE_SEI
/**
* Buffering Period SEI parameters Info
*/
@@ -519,6 +520,7 @@ typedef struct
time_code_t s_time_code;
} sei_params_t;
+#endif
/**
* Sub-layer HRD parameters Info
@@ -952,7 +954,9 @@ typedef struct
// See IV_FLD_TYPE_T for all field types
UWORD32 e4_fld_type;
+#ifndef DISABLE_SEI
sei_params_t s_sei_params;
+#endif
WORD32 i4_vui_present;
diff --git a/encoder/ihevce_api.h b/encoder/ihevce_api.h
index 6a55a1d..b1f3640 100644
--- a/encoder/ihevce_api.h
+++ b/encoder/ihevce_api.h
@@ -76,10 +76,12 @@
/* Maximum number of processor groups supported */
#define MAX_NUMBER_PROC_GRPS 4
+#ifndef DISABLE_SEI
/** @brief maximum length of CC User Data in a single frame */
#define MAX_SEI_PAYLOAD_PER_TLV (0x200)
#define MAX_NUMBER_OF_SEI_PAYLOAD (10)
+#endif
#define IHEVCE_COMMANDS_TAG_MASK (0x0000FFFF)
@@ -179,8 +181,10 @@ typedef enum
IHEVCE_SYNCH_API_END_TAG = 0xFFFF,
IHEVCE_SYNCH_API_FLUSH_TAG = 0x21,
IHEVCE_SYNCH_API_FORCE_IDR_TAG = 0x22,
+#ifndef DISABLE_SEI
IHEVCE_SYNCH_API_REG_KEYFRAME_SEI_TAG = 0x23,
IHEVCE_SYNCH_API_REG_ALLFRAME_SEI_TAG = 0x24,
+#endif
IHEVCE_SYNCH_API_SET_RES_TAG = 0x25
} IHEVCE_SYNCH_API_COMMAND_TAG_T;
@@ -192,7 +196,9 @@ typedef enum
IHEVCE_SYNCH_ERR_NO_PADDING = IHEVCE_SYNCH_ERROR_START + 0x14,
IHEVCE_SYNCH_ERR_WRONG_LENGTH = IHEVCE_SYNCH_ERROR_START + 0x15,
IHEVCE_SYNCH_ERR_FREQ_FORCE_IDR_RECEIVED = IHEVCE_SYNCH_ERROR_START + 0x16,
+#ifndef DISABLE_SEI
IHEVCE_SYNCH_ERR_TOO_MANY_SEI_MSG = IHEVCE_SYNCH_ERROR_START + 0x17,
+#endif
IHEVCE_SYNCH_ERR_SET_RES_NOT_SUPPORTED = IHEVCE_SYNCH_ERROR_START + 0x18
} IHEVCE_SYNCH_ERROR_TAG_T;
@@ -437,6 +443,7 @@ typedef struct
/** Enable VUI output 1: enable 0 : disable */
WORD32 i4_vui_enable;
+#ifndef DISABLE_SEI
/** Enable specific SEI messages in the stream
* 1: enable 0 : disable
*/
@@ -466,6 +473,7 @@ typedef struct
* 1: enable 0 : disable
*/
WORD32 i4_sei_mastering_disp_colour_vol_flags;
+#endif
/**
* Array to store the display_primaries_x values
@@ -497,6 +505,7 @@ typedef struct
*/
UWORD32 u4_min_display_mastering_luminance;
+#ifndef DISABLE_SEI
/**
* Enable Content Level Light Info
*/
@@ -516,6 +525,7 @@ typedef struct
* 3 : Checksum, 2 : CRC, 1 : MD5, 0 : disable
*/
WORD32 i4_decoded_pic_hash_sei_flag;
+#endif
/** Enable specific AUD messages in the stream
* 1: enable 0 : disable
diff --git a/encoder/ihevce_enc_structs.h b/encoder/ihevce_enc_structs.h
index ac39673..bc872b5 100644
--- a/encoder/ihevce_enc_structs.h
+++ b/encoder/ihevce_enc_structs.h
@@ -1589,8 +1589,10 @@ typedef struct
/** Buffer pointer for CTB level information in pre intra pass*/
ihevce_ed_ctb_l1_t *ps_ed_ctb_l1;
+#ifndef DISABLE_SEI
/** vps parameters activated by current slice */
sei_params_t s_sei;
+#endif
/** nal_type for the slice to be encoded */
WORD32 i4_slice_nal_type;
@@ -1826,6 +1828,7 @@ typedef struct
ULWORD64 i8_frame_inter_cost;
} s_pic_level_acc_info_t;
+#ifndef DISABLE_SEI
typedef struct
{
UWORD32 u4_target_bit_rate_sei_entropy;
@@ -1833,6 +1836,7 @@ typedef struct
UWORD32 u4_dbf_entropy;
} s_pic_level_sei_info_t;
+#endif
/**
******************************************************************************
* @brief ME pass and Main enocde pass shared variables and buffers
@@ -1912,12 +1916,14 @@ typedef struct
} me_enc_rdopt_ctxt_t;
+#ifndef DISABLE_SEI
typedef struct
{
UWORD32 u4_payload_type;
UWORD32 u4_payload_length;
UWORD8 *pu1_sei_payload;
} sei_payload_t;
+#endif
typedef struct
{
@@ -1954,8 +1960,10 @@ typedef struct
/** vps parameters activated by current slice */
vps_t *ps_vps;
+#ifndef DISABLE_SEI
/** vps parameters activated by current slice */
sei_params_t s_sei;
+#endif
/* Flag to indicate if AUD NAL is present */
WORD8 i1_aud_present_flag;
@@ -2019,9 +2027,11 @@ typedef struct
WORD32 i4_is_end_of_idr_gop;
+#ifndef DISABLE_SEI
sei_payload_t as_sei_payload[MAX_NUMBER_OF_SEI_PAYLOAD];
UWORD32 u4_num_sei_payload;
+#endif
/* Flag used only in mres single output case to flush out one res and start with next */
WORD32 i4_out_flush_flag;
diff --git a/encoder/ihevce_encode_header_sei_vui.c b/encoder/ihevce_encode_header_sei_vui.c
index 2b294d3..f3de07e 100644
--- a/encoder/ihevce_encode_header_sei_vui.c
+++ b/encoder/ihevce_encode_header_sei_vui.c
@@ -595,6 +595,7 @@ WORD32 ihevce_generate_vui(bitstrm_t *ps_bitstrm, sps_t *ps_sps, vui_t s_vui)
return return_status;
}
+#ifndef DISABLE_SEI
/**
******************************************************************************
*
@@ -2470,6 +2471,7 @@ WORD32 ihevce_populate_hash_sei(
return IHEVCE_SUCCESS;
}
+#endif
/**
******************************************************************************
diff --git a/encoder/ihevce_encode_header_sei_vui.h b/encoder/ihevce_encode_header_sei_vui.h
index cb69456..df21582 100644
--- a/encoder/ihevce_encode_header_sei_vui.h
+++ b/encoder/ihevce_encode_header_sei_vui.h
@@ -40,6 +40,7 @@
/* Function Macros */
/*****************************************************************************/
+#ifndef DISABLE_SEI
/**
******************************************************************************
* @brief Macro to calculate the CRC for a bit index
@@ -93,17 +94,6 @@ typedef enum
/* Extern Function Declarations */
/*****************************************************************************/
-WORD32 ihevce_generate_sub_layer_hrd_params(
- bitstrm_t *ps_bitstrm,
- sub_lyr_hrd_params_t *ps_sub_lyr_hrd_params,
- hrd_params_t *ps_hrd_params,
- WORD32 cpb_cnt_minus1);
-
-WORD32
- ihevce_generate_hrd_params(bitstrm_t *ps_bitstrm, hrd_params_t *ps_hrd_params, sps_t *ps_sps);
-
-WORD32 ihevce_generate_vui(bitstrm_t *ps_bitstrm, sps_t *ps_sps, vui_t s_vui);
-
WORD32 ihevce_put_buf_period_sei_params(
buf_period_sei_params_t *ps_bp_sei, vui_t *ps_vui_params, bitstrm_t *ps_bitstrm);
@@ -163,6 +153,18 @@ WORD32 ihevce_populate_hash_sei(
WORD32 uv_strd,
WORD32 i4_frame_pos_x,
WORD32 i4_frame_pos_y);
+#endif
+
+WORD32 ihevce_generate_sub_layer_hrd_params(
+ bitstrm_t *ps_bitstrm,
+ sub_lyr_hrd_params_t *ps_sub_lyr_hrd_params,
+ hrd_params_t *ps_hrd_params,
+ WORD32 cpb_cnt_minus1);
+
+WORD32
+ ihevce_generate_hrd_params(bitstrm_t *ps_bitstrm, hrd_params_t *ps_hrd_params, sps_t *ps_sps);
+
+WORD32 ihevce_generate_vui(bitstrm_t *ps_bitstrm, sps_t *ps_sps, vui_t s_vui);
WORD32 ihevce_populate_vui(
vui_t *ps_vui,
diff --git a/encoder/ihevce_entropy_cod.c b/encoder/ihevce_entropy_cod.c
index be79699..4605685 100644
--- a/encoder/ihevce_entropy_cod.c
+++ b/encoder/ihevce_entropy_cod.c
@@ -282,6 +282,7 @@ WORD32 ihevce_ent_coding_thrd(void *pv_frm_proc_thrd_ctxt)
PROFILE_START(
&ps_hle_ctxt->profile_entropy[ps_enc_ctxt->i4_resolution_id][i4_bitrate_instance_num]);
+#ifndef DISABLE_SEI
/* Content Light Level Information */
{
ps_curr_inp->s_sei.i1_sei_cll_enable =
@@ -291,6 +292,7 @@ WORD32 ihevce_ent_coding_thrd(void *pv_frm_proc_thrd_ctxt)
ps_curr_inp->s_sei.s_cll_info_sei_params.u2_sei_avg_cll =
ps_enc_ctxt->ps_stat_prms->s_out_strm_prms.u2_sei_avg_cll;
}
+#endif
if((NULL != ps_curr_out) && (NULL != ps_curr_inp))
{
@@ -370,6 +372,7 @@ WORD32 ihevce_ent_coding_thrd(void *pv_frm_proc_thrd_ctxt)
if(1 == ps_curr_inp->i4_frm_proc_valid_flag)
{
+#ifndef DISABLE_SEI
/* --- Init of buffering period and pic timing SEI related params ----*/
{
UWORD32 i4_dbf, i4_buffersize, i4_trgt_bit_rate;
@@ -414,10 +417,12 @@ WORD32 ihevce_ent_coding_thrd(void *pv_frm_proc_thrd_ctxt)
ps_curr_inp->ps_sps->ai1_sps_max_num_reorder_pics[0] +
ps_curr_inp->i4_display_num - u4_encode_frm_num;
}
+#endif
/* call the core entropy coding entry point function */
entropy_error = ihevce_entropy_encode_frame(
pv_entropy_hdl, ps_curr_out, ps_curr_inp, ps_curr_out->i4_bitstream_buf_size);
+#ifndef DISABLE_SEI
/* ----------------- Derivation of u4_au_cpb_removal_delay_minus1 --------------------------------*/
if(ps_curr_inp->s_sei.i1_buf_period_params_present_flag)
{
@@ -438,6 +443,7 @@ WORD32 ihevce_ent_coding_thrd(void *pv_frm_proc_thrd_ctxt)
u4_au_cpb_removal_delay_minus1 = (u4_au_cpb_removal_delay_minus1 + 1) &
u4_max_cpb_removal_delay_val;
}
+#endif
/* Debug prints for entropy error */
if(entropy_error)
{
@@ -449,13 +455,20 @@ WORD32 ihevce_ent_coding_thrd(void *pv_frm_proc_thrd_ctxt)
/* acquire mutex lock for rate control calls */
osal_mutex_lock(ps_enc_ctxt->pv_rc_mutex_lock_hdl);
+ UWORD32 removal_delay_minus1;
+#ifndef DISABLE_SEI
+ removal_delay_minus1 =
+ ps_curr_inp->s_sei.s_pic_timing_sei_params.u4_au_cpb_removal_delay_minus1;
+#else
+ removal_delay_minus1 = 0;
+#endif
/* get frame rate/bit rate/max buffer size */
ihevce_vbv_compliance_frame_level_update(
ps_enc_ctxt->s_module_ctxt.apv_rc_ctxt[i4_bitrate_instance_num],
(ps_curr_out->i4_bytes_generated << 3),
i4_resolution_id,
i4_bitrate_instance_num,
- ps_curr_inp->s_sei.s_pic_timing_sei_params.u4_au_cpb_removal_delay_minus1);
+ removal_delay_minus1);
/* release mutex lock after rate control calls */
osal_mutex_unlock(ps_enc_ctxt->pv_rc_mutex_lock_hdl);
}
diff --git a/encoder/ihevce_entropy_interface.c b/encoder/ihevce_entropy_interface.c
index 729c8e4..6014f8d 100644
--- a/encoder/ihevce_entropy_interface.c
+++ b/encoder/ihevce_entropy_interface.c
@@ -322,7 +322,9 @@ WORD32 ihevce_entropy_encode_frame(
vps_t *ps_vps = ps_curr_inp->ps_vps;
sps_t *ps_sps = ps_curr_inp->ps_sps;
pps_t *ps_pps = ps_curr_inp->ps_pps;
+#ifndef DISABLE_SEI
sei_params_t *ps_sei = &ps_curr_inp->s_sei;
+#endif
ihevce_tile_params_t *ps_tile_params_base;
WORD32 out_buf_size = i4_out_buf_size;
@@ -355,7 +357,9 @@ WORD32 ihevce_entropy_encode_frame(
ps_entropy_ctxt->ps_vps = ps_vps;
ps_entropy_ctxt->ps_sps = ps_sps;
ps_entropy_ctxt->ps_pps = ps_pps;
+#ifndef DISABLE_SEI
ps_entropy_ctxt->ps_sei = ps_sei;
+#endif
ps_entropy_ctxt->ps_slice_hdr = &ps_curr_inp->s_slice_hdr;
ps_entropy_ctxt->i4_is_cu_cbf_zero = 1;
@@ -413,6 +417,7 @@ WORD32 ihevce_entropy_encode_frame(
ret |= ihevce_generate_pps(ps_bitstrm, ps_entropy_ctxt->ps_pps);
}
+#ifndef DISABLE_SEI
/* generate sei */
if(1 == ps_entropy_ctxt->ps_sei->i1_sei_parameters_present_flag)
{
@@ -435,6 +440,7 @@ WORD32 ihevce_entropy_encode_frame(
&ps_curr_inp->as_sei_payload[0]);
}
}
+#endif
/*PIC INFO: Populate slice header bits */
ps_entropy_ctxt->ps_pic_level_info->u8_bits_estimated_slice_header +=
@@ -674,6 +680,7 @@ WORD32 ihevce_entropy_encode_frame(
}
}
+#ifndef DISABLE_SEI
/* generate suffix sei */
if(1 == ps_entropy_ctxt->ps_sei->i1_sei_parameters_present_flag)
{
@@ -693,6 +700,7 @@ WORD32 ihevce_entropy_encode_frame(
/* Updating bytes generated */
ps_curr_out->i4_bytes_generated += ps_bitstrm->u4_strm_buf_offset;
}
+#endif
/* generate end of sequence nal */
if((1 == ps_curr_inp->i1_eos_present_flag) && (ps_curr_inp->i4_is_end_of_idr_gop == 1))
diff --git a/encoder/ihevce_entropy_structs.h b/encoder/ihevce_entropy_structs.h
index 5e69c25..ad880c2 100644
--- a/encoder/ihevce_entropy_structs.h
+++ b/encoder/ihevce_entropy_structs.h
@@ -213,8 +213,10 @@ typedef struct entropy_context
/** pointer to current pps parameters */
pps_t *ps_pps;
+#ifndef DISABLE_SEI
/** pointer to current sei parameters */
sei_params_t *ps_sei;
+#endif
/** pointer to current slice header parameters */
slice_header_t *ps_slice_hdr;
diff --git a/encoder/ihevce_error_check.c b/encoder/ihevce_error_check.c
index 9295b29..c1fb1b9 100644
--- a/encoder/ihevce_error_check.c
+++ b/encoder/ihevce_error_check.c
@@ -350,6 +350,7 @@ WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_c
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_interop_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_interop_flags);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sps_at_cdr_enable %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sps_at_cdr_enable);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_vui_enable %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_vui_enable);
+#ifndef DISABLE_SEI
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_enable_flag %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_payload_enable_flag %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_payload_enable_flag);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_buffer_period_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_buffer_period_flags);
@@ -359,6 +360,7 @@ WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_c
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_sei_max_cll %d \n", ps_static_cfg_prms->s_out_strm_prms.u2_sei_max_cll);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_recovery_point_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_recovery_point_flags);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_mastering_disp_colour_vol_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags);
+#endif
for(i4_i = 0; i4_i < 3; i4_i++)
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_display_primaries_x[i4_i] %d \n", ps_static_cfg_prms->s_out_strm_prms.au2_display_primaries_x[i4_i]);
for(i4_i = 0; i4_i < 3; i4_i++)
@@ -367,7 +369,9 @@ WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_c
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u2_white_point_y %d \n", ps_static_cfg_prms->s_out_strm_prms.u2_white_point_y);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u4_max_display_mastering_luminance %d \n", ps_static_cfg_prms->s_out_strm_prms.u4_max_display_mastering_luminance);
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : u4_min_display_mastering_luminance %d \n", ps_static_cfg_prms->s_out_strm_prms.u4_min_display_mastering_luminance);
+#ifndef DISABLE_SEI
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_sei_hash_flags %d \n", ps_static_cfg_prms->s_out_strm_prms.i4_decoded_pic_hash_sei_flag);
+#endif
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "\nIHEVCE : ps_static_cfg_prms->s_app_tile_params\n");
PRINTF(ps_sys_api->pv_cb_handle, i4_res_id, i4_br_id, "IHEVCE : i4_tiles_enabled_flag %d \n", ps_static_cfg_prms->s_app_tile_params.i4_tiles_enabled_flag);
@@ -644,6 +648,7 @@ WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_c
return IHEVCE_SETUNSUPPORTEDINPUT(error_code);
}
+#ifndef DISABLE_SEI
if((ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag > 1) ||
(ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag < 0))
{
@@ -661,6 +666,7 @@ WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_c
pv_cb_handle, "IHEVCE ERROR: i4_sei_payload_enable_flag should be set to 1 or 0 \n");
return IHEVCE_SETUNSUPPORTEDINPUT(error_code);
}
+#endif
if((ps_static_cfg_prms->s_multi_thrd_prms.i4_max_num_cores > MAX_NUM_CORES) ||
(ps_static_cfg_prms->s_multi_thrd_prms.i4_max_num_cores < 1))
{
@@ -1340,6 +1346,7 @@ WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_c
}
}
+#ifndef DISABLE_SEI
/* Check SEI related error checks */
if(1 == ps_static_cfg_prms->s_out_strm_prms.i4_sei_enable_flag)
{
@@ -1450,6 +1457,7 @@ WORD32 ihevce_hle_validate_static_params(ihevce_static_cfg_params_t *ps_static_c
}
}
}
+#endif
if(1 == ps_static_cfg_prms->s_out_strm_prms.i4_vui_enable)
{
diff --git a/encoder/ihevce_error_codes.h b/encoder/ihevce_error_codes.h
index 4bdd274..9f377a4 100644
--- a/encoder/ihevce_error_codes.h
+++ b/encoder/ihevce_error_codes.h
@@ -94,7 +94,9 @@ typedef enum
IHEVCE_VUI_ENABLE_OUT_OF_RANGE = IHEVCE_API_ERROR_START + 0x09,
+#ifndef DISABLE_SEI
IHEVCE_SEI_ENABLE_OUT_OF_RANGE = IHEVCE_API_ERROR_START + 0x0A,
+#endif
IHEVCE_SPS_AT_CDR_NOT_SUPPORTED = IHEVCE_API_ERROR_START + 0x0B,
@@ -288,13 +290,17 @@ typedef enum
IHEVCE_INVALID_CORE_CONFIG = IHEVCE_API_ERROR_START + 0x67,
+#ifndef DISABLE_SEI
IHEVCE_SEI_MESSAGES_DEPENDENCY = IHEVCE_API_ERROR_START + 0x68,
+#endif
IHEVCE_VUI_DEPENDENCY = IHEVCE_API_ERROR_START + 0x69,
+#ifndef DISABLE_SEI
IHEVCE_SEI_ENABLED_VUI_DISABLED = IHEVCE_API_ERROR_START + 0x6A,
IHEVCE_SEI_HASH_VALUE_NOT_SUPPORTED = IHEVCE_API_ERROR_START + 0x6B,
+#endif
/* Level related error codes */
IHEVCE_PIC_SIZE_NOT_SUPPORTED = IHEVCE_API_ERROR_START + 0x6C,
@@ -385,7 +391,9 @@ typedef enum
IHEVCE_ARCHITECTURE_TYPE_UNSUPPORTED = IHEVCE_API_ERROR_START + 0x95,
+#ifndef DISABLE_SEI
IHEVCE_SEI_PAYLOAD_ENABLE_OUT_OF_RANGE = IHEVCE_API_ERROR_START + 0x96,
+#endif
IHEVCE_BAD_DIST_CFG_PARAMETERS = IHEVCE_API_ERROR_START + 0x97,
@@ -393,7 +401,9 @@ typedef enum
IHEVCE_INVALID_MRES_SINGLE_OUT = IHEVCE_API_ERROR_START + 0x99,
+#ifndef DISABLE_SEI
IHEVCE_SEI_CLL_ENABLE_OUT_OF_RANGE = IHEVCE_API_ERROR_START + 0x9A,
+#endif
/** max failure error code to ensure enum is 32 bits wide */
IHEVCE_FAIL = 0xFFFFFFFF
diff --git a/encoder/ihevce_frame_process.c b/encoder/ihevce_frame_process.c
index ea4952c..5fdc3d7 100644
--- a/encoder/ihevce_frame_process.c
+++ b/encoder/ihevce_frame_process.c
@@ -3097,12 +3097,15 @@ WORD32 ihevce_enc_frm_proc_slave_thrd(void *pv_frm_proc_thrd_ctxt)
ps_curr_inp->s_lap_out.i4_is_ref_pic;
{
- WORD32 sei_hash_enabled =
- (ps_enc_ctxt->ps_stat_prms->s_out_strm_prms
+ WORD32 sei_hash_enabled;
+#ifndef DISABLE_SEI
+ sei_hash_enabled = (ps_enc_ctxt->ps_stat_prms->s_out_strm_prms
.i4_sei_enable_flag == 1) &&
(ps_enc_ctxt->ps_stat_prms->s_out_strm_prms
.i4_decoded_pic_hash_sei_flag != 0);
-
+#else
+ sei_hash_enabled = 0;
+#endif
/* Deblock a picture for all reference frames unconditionally. */
/* Deblock non ref if psnr compute or save recon is enabled */
ps_frm_recon->i4_deblk_pad_hpel_cur_pic =
@@ -3508,6 +3511,7 @@ WORD32 ihevce_enc_frm_proc_slave_thrd(void *pv_frm_proc_thrd_ctxt)
ps_curr_out[i4_enc_frm_id][i4_bitrate_ctr];
//ps_curr_out[i4_enc_frm_id][i4_bitrate_ctr]->i4_enc_order_num = ps_curr_inp->s_lap_out.i4_enc_order_num;
/*registered User Data Call*/
+#ifndef DISABLE_SEI
if(ps_enc_ctxt->ps_stat_prms->s_out_strm_prms.i4_sei_payload_enable_flag)
{
ihevce_fill_sei_payload(
@@ -3516,6 +3520,7 @@ WORD32 ihevce_enc_frm_proc_slave_thrd(void *pv_frm_proc_thrd_ctxt)
ps_curr_out[i4_enc_frm_id][i4_bitrate_ctr]);
}
+#endif
/*derive end flag and input valid flag in output buffer */
if(NULL != ps_enc_ctxt->s_multi_thrd.aps_cur_inp_enc_prms[i4_enc_frm_id])
{
@@ -3568,12 +3573,14 @@ WORD32 ihevce_enc_frm_proc_slave_thrd(void *pv_frm_proc_thrd_ctxt)
ps_curr_out[i4_enc_frm_id][i4_bitrate_ctr]->ps_vps =
&ps_enc_ctxt->as_vps[i4_bitrate_ctr];
+#ifndef DISABLE_SEI
/* SEI header will be populated in pre-enocde stage */
memcpy(
&ps_curr_out[i4_enc_frm_id][i4_bitrate_ctr]->s_sei,
&ps_curr_inp_from_me->s_sei,
sizeof(sei_params_t));
+#endif
/*AUD and EOS presnt flags are populated*/
ps_curr_out[i4_enc_frm_id][i4_bitrate_ctr]->i1_aud_present_flag =
ps_enc_ctxt->ps_stat_prms->s_out_strm_prms.i4_aud_enable_flags;
@@ -4168,6 +4175,7 @@ WORD32 ihevce_enc_frm_proc_slave_thrd(void *pv_frm_proc_thrd_ctxt)
if(1 == ps_enc_ctxt->s_multi_thrd.aps_cur_inp_enc_prms[i4_enc_frm_id]
->i4_frm_proc_valid_flag)
{
+#ifndef DISABLE_SEI
/* Calculate the SEI Hash if enabled */
if(0 !=
ps_enc_ctxt->s_multi_thrd.ps_curr_out_enc_grp[i4_enc_frm_id][i]
@@ -4198,6 +4206,7 @@ WORD32 ihevce_enc_frm_proc_slave_thrd(void *pv_frm_proc_thrd_ctxt)
0,
0);
}
+#endif
/* Sending qp, poc and pic-type to entropy thread for printing on console */
if(ps_enc_ctxt->ps_stat_prms->i4_log_dump_level != 0)
{
@@ -5259,6 +5268,7 @@ void ihevce_pre_enc_init(
ps_curr_out->ps_vps = &ps_enc_ctxt->as_vps[0];
}
+#ifndef DISABLE_SEI
/* By default, Sei messages are set to 0, to avoid unintialised memory access */
memset(&ps_curr_out->s_sei, 0, sizeof(sei_params_t));
@@ -5340,6 +5350,7 @@ void ihevce_pre_enc_init(
ps_enc_ctxt->ps_stat_prms->s_out_strm_prms.i4_decoded_pic_hash_sei_flag;
}
}
+#endif
/* For interlace pictures, first_field depends on topfield_first and bottom field */
if(i4_field_pic)
diff --git a/encoder/ihevce_frame_process_utils.c b/encoder/ihevce_frame_process_utils.c
index ee7eb49..1e867c6 100644
--- a/encoder/ihevce_frame_process_utils.c
+++ b/encoder/ihevce_frame_process_utils.c
@@ -308,6 +308,7 @@ unsigned int calc_block_ssim(
}
}
+#ifndef DISABLE_SEI
/*!
******************************************************************************
* \if Function name : ihevce_fill_sei_payload \endif
@@ -392,6 +393,7 @@ void ihevce_fill_sei_payload(
pu4_tag += 2;
}
}
+#endif
/*!
******************************************************************************
diff --git a/encoder/ihevce_frame_process_utils.h b/encoder/ihevce_frame_process_utils.h
index fef5b44..1f89b0c 100644
--- a/encoder/ihevce_frame_process_utils.h
+++ b/encoder/ihevce_frame_process_utils.h
@@ -76,10 +76,12 @@ WORD32 ihevce_get_cur_frame_qp(
WORD32 max_qp,
rc_quant_t *ps_rc_quant_ctxt);
+#ifndef DISABLE_SEI
void ihevce_fill_sei_payload(
enc_ctxt_t *ps_enc_ctxt,
ihevce_lap_enc_buf_t *ps_curr_inp,
frm_proc_ent_cod_ctxt_t *ps_curr_out);
+#endif
void ihevce_dyn_bitrate(void *pv_hle_ctxt, void *pv_dyn_bitrate_prms);
diff --git a/encoder/ihevce_hle_interface.c b/encoder/ihevce_hle_interface.c
index e67cb9f..1936efc 100644
--- a/encoder/ihevce_hle_interface.c
+++ b/encoder/ihevce_hle_interface.c
@@ -515,11 +515,13 @@ IV_API_CALL_STATUS_T ihevce_query_io_buf_req(
ps_input_bufs_req->i4_yuv_format = ps_src_prms->i4_chr_format;
+#ifndef DISABLE_SEI
ps_input_bufs_req->i4_min_size_synch_ctrl_bufs =
((MAX_SEI_PAYLOAD_PER_TLV + 16) * MAX_NUMBER_OF_SEI_PAYLOAD) + 16;
ps_input_bufs_req->i4_min_size_asynch_ctrl_bufs =
((MAX_SEI_PAYLOAD_PER_TLV + 16) * (MAX_NUMBER_OF_SEI_PAYLOAD - 6)) + 16;
+#endif
for(i4_resolution_id_ctr = 0; i4_resolution_id_ctr < i4_num_resolutions; i4_resolution_id_ctr++)
{
diff --git a/encoder/ihevce_lap_interface.c b/encoder/ihevce_lap_interface.c
index 734c609..b441c47 100644
--- a/encoder/ihevce_lap_interface.c
+++ b/encoder/ihevce_lap_interface.c
@@ -548,7 +548,9 @@ void ihevce_lap_parse_sync_cmd(
WORD32 *pi4_tag_parse = pi4_cmd_buf;
WORD32 i4_cmd_size = ps_lap_inp_buf->s_input_buf.i4_cmd_buf_size;
WORD32 i4_buf_id = ps_lap_inp_buf->s_input_buf.i4_buf_id;
+#ifndef DISABLE_SEI
UWORD32 u4_num_sei = 0;
+#endif
WORD32 i4_end_flag = 0;
while(i4_cmd_size >= 4)
@@ -568,7 +570,9 @@ void ihevce_lap_parse_sync_cmd(
(*pi4_flush_check) = 1;
pi4_tag_parse += 2;
i4_cmd_size -= 8;
+#ifndef DISABLE_SEI
u4_num_sei++;
+#endif
break;
case IHEVCE_SYNCH_API_FORCE_IDR_TAG:
if(i4_cmd_size < 8 || pi4_tag_parse[1])
@@ -583,7 +587,9 @@ void ihevce_lap_parse_sync_cmd(
(*pi4_force_idr_check) = 1;
pi4_tag_parse += 2;
i4_cmd_size -= 8;
+#ifndef DISABLE_SEI
u4_num_sei++;
+#endif
break;
case IHEVCE_SYNCH_API_END_TAG:
i4_end_flag = 1;
@@ -597,9 +603,11 @@ void ihevce_lap_parse_sync_cmd(
if(i4_end_flag)
break;
}
+#ifndef DISABLE_SEI
if(u4_num_sei > MAX_NUMBER_OF_SEI_PAYLOAD) //Checking for max number of SEI messages.
ps_hle_ctxt->ihevce_cmds_error_report(
ps_hle_ctxt->pv_cmd_err_cb_handle, IHEVCE_SYNCH_ERR_TOO_MANY_SEI_MSG, 1, i4_buf_id);
+#endif
if(!i4_end_flag)
ps_hle_ctxt->ihevce_cmds_error_report(
diff --git a/encoder/ihevce_memory_init.c b/encoder/ihevce_memory_init.c
index b6f3b87..74d13eb 100644
--- a/encoder/ihevce_memory_init.c
+++ b/encoder/ihevce_memory_init.c
@@ -1340,6 +1340,7 @@ void ihevce_mem_manager_init(enc_ctxt_t *ps_enc_ctxt, ihevce_hle_ctxt_t *ps_intr
total_memtabs_used++;
total_system_memtabs++;
+#ifndef DISABLE_SEI
/* SEI Payload Data */
buf_size = sizeof(UWORD8) * MAX_NUMBER_OF_SEI_PAYLOAD * MAX_SEI_PAYLOAD_PER_TLV *
NUM_FRMPROC_ENTCOD_BUFS;
@@ -1352,6 +1353,7 @@ void ihevce_mem_manager_init(enc_ctxt_t *ps_enc_ctxt, ihevce_hle_ctxt_t *ps_intr
/* increment the memtab counter */
total_memtabs_used++;
total_system_memtabs++;
+#endif
}
/* ------ Working mem frame level -------*/
@@ -2110,7 +2112,6 @@ void ihevce_mem_manager_init(enc_ctxt_t *ps_enc_ctxt, ihevce_hle_ctxt_t *ps_intr
UWORD8 *pu1_coeffs;
WORD32 num_ctb_in_frm;
WORD32 coeff_size;
- UWORD8 *pu1_sei_payload;
/* frame process/entropy coding buffer pointer array */
pps_frm_proc_ent_cod_bufs[i] = (frm_proc_ent_cod_ctxt_t **)ps_memtab->pv_base;
@@ -2147,9 +2148,12 @@ void ihevce_mem_manager_init(enc_ctxt_t *ps_enc_ctxt, ihevce_hle_ctxt_t *ps_intr
/* increment the memtabs */
ps_memtab++;
+#ifndef DISABLE_SEI
/* CC User Data */
+ UWORD8 *pu1_sei_payload;
pu1_sei_payload = (UWORD8 *)ps_memtab->pv_base;
ps_memtab++;
+#endif
num_ctb_in_frm = num_ctb_horz * num_ctb_vert;
@@ -2162,7 +2166,6 @@ void ihevce_mem_manager_init(enc_ctxt_t *ps_enc_ctxt, ihevce_hle_ctxt_t *ps_intr
/* loop to initialise all the memories */
for(ctr = 0; ctr < NUM_FRMPROC_ENTCOD_BUFS; ctr++)
{
- WORD32 num_sei;
pps_frm_proc_ent_cod_bufs[i][ctr] = ps_frmp_ent_bufs;
ps_frmp_ent_bufs->ps_frm_ctb_data = ps_ctb;
@@ -2184,7 +2187,8 @@ void ihevce_mem_manager_init(enc_ctxt_t *ps_enc_ctxt, ihevce_hle_ctxt_t *ps_intr
pu1_coeffs += coeff_size;
- for(num_sei = 0; num_sei < MAX_NUMBER_OF_SEI_PAYLOAD; num_sei++)
+#ifndef DISABLE_SEI
+ for(WORD32 num_sei = 0; num_sei < MAX_NUMBER_OF_SEI_PAYLOAD; num_sei++)
{
ps_frmp_ent_bufs->as_sei_payload[num_sei].pu1_sei_payload = pu1_sei_payload;
ps_frmp_ent_bufs->as_sei_payload[num_sei].u4_payload_type = 0;
@@ -2192,6 +2196,7 @@ void ihevce_mem_manager_init(enc_ctxt_t *ps_enc_ctxt, ihevce_hle_ctxt_t *ps_intr
pu1_sei_payload += MAX_SEI_PAYLOAD_PER_TLV;
}
+#endif
ps_frmp_ent_bufs++;
}
}
diff --git a/encoder/ihevce_plugin.c b/encoder/ihevce_plugin.c
index 26f3ba4..5013927 100644
--- a/encoder/ihevce_plugin.c
+++ b/encoder/ihevce_plugin.c
@@ -354,6 +354,7 @@ IHEVCE_PLUGIN_STATUS_T ihevce_set_def_params(ihevce_static_cfg_params_t *ps_para
ps_params->s_out_strm_prms.i4_codec_profile = 1;
ps_params->s_out_strm_prms.i4_codec_tier = 0;
ps_params->s_out_strm_prms.i4_codec_type = 0;
+#ifndef DISABLE_SEI
ps_params->s_out_strm_prms.i4_sei_buffer_period_flags = 0;
ps_params->s_out_strm_prms.i4_sei_enable_flag = 0;
ps_params->s_out_strm_prms.i4_sei_payload_enable_flag = 0;
@@ -364,6 +365,7 @@ IHEVCE_PLUGIN_STATUS_T ihevce_set_def_params(ihevce_static_cfg_params_t *ps_para
ps_params->s_out_strm_prms.i4_sei_recovery_point_flags = 0;
ps_params->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags = 0;
ps_params->s_out_strm_prms.i4_decoded_pic_hash_sei_flag = 0;
+#endif
ps_params->s_out_strm_prms.i4_sps_at_cdr_enable = 1;
ps_params->s_out_strm_prms.i4_vui_enable = 0;
/*Set the interoperability flag to 0*/
diff --git a/fuzzer/hevc_enc_fuzzer.cpp b/fuzzer/hevc_enc_fuzzer.cpp
index 3dc2f4d..a4308a7 100644
--- a/fuzzer/hevc_enc_fuzzer.cpp
+++ b/fuzzer/hevc_enc_fuzzer.cpp
@@ -64,7 +64,9 @@ enum {
IDX_MAX_CRA_OPEN_GOP,
IDX_ENABLE_SPS_AT_CDR,
IDX_ENABLE_VUI,
+#ifndef DISABLE_SEI
IDX_ENABLE_SEI,
+#endif
IDX_ARCH_TYPE,
IDX_ENABLE_FORCE_IDR,
IDX_ENABLE_DYNAMIC_BITRATE,
@@ -132,8 +134,10 @@ bool Codec::initEncoder(const uint8_t *data) {
mEncParams.s_out_strm_prms.i4_sps_at_cdr_enable = data[IDX_ENABLE_SPS_AT_CDR] & 0x01;
mEncParams.s_out_strm_prms.i4_vui_enable = data[IDX_ENABLE_VUI] & 0x01;
+#ifndef DISABLE_SEI
mEncParams.s_out_strm_prms.i4_sei_enable_flag = data[IDX_ENABLE_SEI] & 0x01;
+#endif
mEncParams.e_arch_type = ((data[IDX_ARCH_TYPE] & 0x03) == 0x00) ? ARCH_ARM_NONEON : ARCH_NA;
mIsForceIdrEnabled = data[IDX_ENABLE_FORCE_IDR] & 0x01;
mIsDynamicBitrateChangeEnabled = data[IDX_ENABLE_DYNAMIC_BITRATE] & 0x01;
diff --git a/test/encoder/app.h b/test/encoder/app.h
index 26959a9..3e4e4d4 100644
--- a/test/encoder/app.h
+++ b/test/encoder/app.h
@@ -203,7 +203,9 @@ typedef struct
ihevce_static_cfg_params_t s_static_cfg_prms;
+#ifndef DISABLE_SEI
char ai1_sei_payload_path[STR_LEN];
+#endif
} appl_ctxt_t;
diff --git a/test/encoder/main.c b/test/encoder/main.c
index 49d1aec..d40c3cf 100644
--- a/test/encoder/main.c
+++ b/test/encoder/main.c
@@ -466,6 +466,7 @@ IHEVCE_PLUGIN_STATUS_T parse_argument(appl_ctxt_t *ps_ctxt, CHAR *argument, CHAR
ps_static_prms->s_out_strm_prms.i4_vui_enable = i4_value;
break;
+#ifndef DISABLE_SEI
case SEI_ENABLE_FLAGS:
sscanf(value, "%d", &i4_value);
ps_static_prms->s_out_strm_prms.i4_sei_enable_flag = i4_value;
@@ -505,6 +506,7 @@ IHEVCE_PLUGIN_STATUS_T parse_argument(appl_ctxt_t *ps_ctxt, CHAR *argument, CHAR
sscanf(value, "%d", &i4_value);
ps_static_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags = i4_value;
break;
+#endif
case DISPLAY_PRIMARIES_X:
{
@@ -513,10 +515,12 @@ IHEVCE_PLUGIN_STATUS_T parse_argument(appl_ctxt_t *ps_ctxt, CHAR *argument, CHAR
const char s[2] = ",";
WORD32 i;
+#ifndef DISABLE_SEI
if(0 == ps_static_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags)
{
break;
}
+#endif
sscanf(value, "%s", pu1_keywd_str);
str = (char *)pu1_keywd_str;
@@ -547,10 +551,12 @@ IHEVCE_PLUGIN_STATUS_T parse_argument(appl_ctxt_t *ps_ctxt, CHAR *argument, CHAR
const char s[2] = ",";
WORD32 i;
+#ifndef DISABLE_SEI
if(0 == ps_static_prms->s_out_strm_prms.i4_sei_mastering_disp_colour_vol_flags)
{
break;
}
+#endif
sscanf(value, "%s", pu1_keywd_str);
str = (char *)pu1_keywd_str;
@@ -594,6 +600,7 @@ IHEVCE_PLUGIN_STATUS_T parse_argument(appl_ctxt_t *ps_ctxt, CHAR *argument, CHAR
ps_static_prms->s_out_strm_prms.u4_min_display_mastering_luminance = i4_value;
break;
+#ifndef DISABLE_SEI
case SEI_CLL_INFO_ENABLE:
sscanf(value, "%d", &i4_value);
ps_static_prms->s_out_strm_prms.i4_sei_cll_enable = i4_value;
@@ -608,6 +615,7 @@ IHEVCE_PLUGIN_STATUS_T parse_argument(appl_ctxt_t *ps_ctxt, CHAR *argument, CHAR
sscanf(value, "%d", &i4_value);
ps_static_prms->s_out_strm_prms.u2_sei_avg_cll = i4_value;
break;
+#endif
case TILES_ENABLED_FLAG:
sscanf(value, "%d", &i4_value);