Merge "Encoder: Added support for configuring VUI parameters." into nyc-mr1-dev
This commit is contained in:
commit
ba8f1f9ef3
7 changed files with 545 additions and 39 deletions
131
encoder/ih264e.h
131
encoder/ih264e.h
|
|
@ -484,6 +484,137 @@ typedef struct
|
|||
}ih264e_video_encode_op_t;
|
||||
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Video usability information */
|
||||
/*****************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Command type : IVE_CMD_VIDEO_CTL */
|
||||
IVE_API_COMMAND_TYPE_T e_cmd;
|
||||
|
||||
/** Sub command type : IVE_CMD_CTL_SET_GOP_PARAMS */
|
||||
IVE_CONTROL_API_COMMAND_TYPE_T e_sub_cmd;
|
||||
|
||||
/** indicates the presence of aspect_ratio */
|
||||
UWORD8 u1_aspect_ratio_info_present_flag;
|
||||
|
||||
/** specifies the aspect ratio of the luma samples */
|
||||
UWORD8 u1_aspect_ratio_idc;
|
||||
|
||||
/** width of the luma samples. user dependent */
|
||||
UWORD16 u2_sar_width;
|
||||
|
||||
/** Height of the luma samples. user dependent */
|
||||
UWORD16 u2_sar_height;
|
||||
|
||||
/** if 1, specifies that the overscan_appropriate_flag is present
|
||||
* if 0, the preferred display method for the video signal is unspecified */
|
||||
UWORD8 u1_overscan_info_present_flag;
|
||||
|
||||
/** if 1,indicates that the cropped decoded pictures output
|
||||
* are suitable for display using overscan */
|
||||
UWORD8 u1_overscan_appropriate_flag;
|
||||
|
||||
/** if 1 specifies that video_format, video_full_range_flag and
|
||||
* colour_description_present_flag are present */
|
||||
UWORD8 u1_video_signal_type_present_flag;
|
||||
|
||||
/** pal, secam, ntsc, ... */
|
||||
UWORD8 u1_video_format;
|
||||
|
||||
/** indicates the black level and range of the luma and chroma signals */
|
||||
UWORD8 u1_video_full_range_flag;
|
||||
|
||||
/** if 1,specifies that colour_primaries, transfer_characteristics
|
||||
* and matrix_coefficients are present */
|
||||
UWORD8 u1_colour_description_present_flag;
|
||||
|
||||
/** indicates the chromaticity coordinates of the source primaries */
|
||||
UWORD8 u1_colour_primaries;
|
||||
|
||||
/** indicates the opto-electronic transfer characteristic of the source picture */
|
||||
UWORD8 u1_transfer_characteristics;
|
||||
|
||||
/** the matrix coefficients used in deriving luma and chroma signals
|
||||
* from the green, blue, and red primaries */
|
||||
UWORD8 u1_matrix_coefficients;
|
||||
|
||||
/** if 1, specifies that chroma_sample_loc_type_top_field and
|
||||
* chroma_sample_loc_type_bottom_field are present */
|
||||
UWORD8 u1_chroma_loc_info_present_flag;
|
||||
|
||||
/** location of chroma samples */
|
||||
UWORD8 u1_chroma_sample_loc_type_top_field;
|
||||
UWORD8 u1_chroma_sample_loc_type_bottom_field;
|
||||
|
||||
/** Indicates the presence of the num_units_in_ticks, time_scale flag */
|
||||
UWORD8 u1_vui_timing_info_present_flag;
|
||||
|
||||
/** Number of units that correspond to one increment of the
|
||||
* clock. Indicates the resolution */
|
||||
UWORD32 u4_vui_num_units_in_tick;
|
||||
|
||||
/** The number of time units that pass in one second */
|
||||
UWORD32 u4_vui_time_scale;
|
||||
|
||||
/** Flag indicating that time difference between two frames is a constant */
|
||||
UWORD8 u1_fixed_frame_rate_flag;
|
||||
|
||||
/** Indicates the presence of NAL HRD parameters */
|
||||
UWORD8 u1_nal_hrd_parameters_present_flag;
|
||||
|
||||
/** Indicates the presence of VCL HRD parameters */
|
||||
UWORD8 u1_vcl_hrd_parameters_present_flag;
|
||||
|
||||
/** Specifies the HRD operational mode */
|
||||
UWORD8 u1_low_delay_hrd_flag;
|
||||
|
||||
/** Indicates presence of SEI messages which include pic_struct syntax element */
|
||||
UWORD8 u1_pic_struct_present_flag;
|
||||
|
||||
/** 1, specifies that the following cvs bitstream restriction parameters are present */
|
||||
UWORD8 u1_bitstream_restriction_flag;
|
||||
|
||||
/** if 0, indicates that no pel outside the pic boundaries and
|
||||
* no sub-pels derived using pels outside the pic boundaries is used for inter prediction */
|
||||
UWORD8 u1_motion_vectors_over_pic_boundaries_flag;
|
||||
|
||||
/** Indicates a number of bytes not exceeded by the sum of the sizes of the VCL NAL units
|
||||
* associated with any coded picture */
|
||||
UWORD8 u1_max_bytes_per_pic_denom;
|
||||
|
||||
/** Indicates an upper bound for the number of bits of coding_unit() data */
|
||||
UWORD8 u1_max_bits_per_mb_denom;
|
||||
|
||||
/** Indicate the maximum absolute value of a decoded horizontal MV component
|
||||
* in quarter-pel luma units */
|
||||
UWORD8 u1_log2_max_mv_length_horizontal;
|
||||
|
||||
/** Indicate the maximum absolute value of a decoded vertical MV component
|
||||
* in quarter-pel luma units */
|
||||
UWORD8 u1_log2_max_mv_length_vertical;
|
||||
|
||||
/** Max number of frames that are not synchronized in display and decode order */
|
||||
UWORD8 u1_num_reorder_frames;
|
||||
|
||||
/** specifies required size of the HRD DPB in units of frame buffers */
|
||||
UWORD8 u1_max_dec_frame_buffering;
|
||||
|
||||
}ih264e_vui_ip_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
/** size of the structure */
|
||||
UWORD32 u4_size;
|
||||
|
||||
/** Return error code */
|
||||
UWORD32 u4_error_code;
|
||||
}ih264e_vui_op_t;
|
||||
|
||||
|
||||
/* The enum values should not have greater than 8 bits as this is assigned to WORD8 */
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1609,6 +1609,30 @@ static IV_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
|
|||
break;
|
||||
}
|
||||
|
||||
case IVE_CMD_CTL_SET_VUI_PARAMS:
|
||||
{
|
||||
ih264e_vui_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_vui_op_t *ps_op = pv_api_op;
|
||||
|
||||
if(ps_ip->u4_size != sizeof(ih264e_vui_ip_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_IP_CTL_SET_VUI_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
if(ps_op->u4_size != sizeof(ih264e_vui_op_t))
|
||||
{
|
||||
ps_op->u4_error_code |= 1 << IVE_UNSUPPORTEDPARAM;
|
||||
ps_op->u4_error_code |=
|
||||
IVE_ERR_OP_CTL_SET_VUI_STRUCT_SIZE_INCORRECT;
|
||||
return IV_FAIL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case IVE_CMD_CTL_SET_ENC_MODE:
|
||||
{
|
||||
ih264e_ctl_set_enc_mode_ip_t *ps_ip = pv_api_ip;
|
||||
|
|
@ -2210,7 +2234,10 @@ IH264E_ERROR_T ih264e_codec_update_config(codec_t *ps_codec,
|
|||
{
|
||||
ps_codec->s_cfg.u4_num_cores = ps_cfg->u4_num_cores;
|
||||
}
|
||||
|
||||
else if (ps_cfg->e_cmd == IVE_CMD_CTL_SET_VUI_PARAMS)
|
||||
{
|
||||
ps_codec->s_cfg.s_vui = ps_cfg->s_vui;
|
||||
}
|
||||
/* reset RC model */
|
||||
if (u4_init_rc)
|
||||
{
|
||||
|
|
@ -5217,7 +5244,90 @@ static WORD32 ih264_set_deblock_params(void *pv_api_ip,
|
|||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
/**
|
||||
*******************************************************************************
|
||||
*
|
||||
* @brief
|
||||
* Sets vui params
|
||||
*
|
||||
* @par Description:
|
||||
* Video usability information
|
||||
*
|
||||
* @param[in] pv_api_ip
|
||||
* Pointer to input argument structure
|
||||
*
|
||||
* @param[out] pv_api_op
|
||||
* Pointer to output argument structure
|
||||
*
|
||||
* @param[out] ps_cfg
|
||||
* Pointer to config structure to be updated
|
||||
*
|
||||
* @returns error status
|
||||
*
|
||||
* @remarks none
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
static WORD32 ih264e_set_vui_params(void *pv_api_ip,
|
||||
void *pv_api_op,
|
||||
cfg_params_t *ps_cfg)
|
||||
{
|
||||
/* ctrl call I/O structures */
|
||||
ih264e_vui_ip_t *ps_ip = pv_api_ip;
|
||||
ih264e_vui_op_t *ps_op = pv_api_op;
|
||||
vui_t *ps_vui = &ps_cfg->s_vui;
|
||||
|
||||
ps_op->u4_error_code = 0;
|
||||
|
||||
ps_vui->u1_aspect_ratio_info_present_flag =
|
||||
ps_ip->u1_aspect_ratio_info_present_flag;
|
||||
ps_vui->u1_aspect_ratio_idc = ps_ip->u1_aspect_ratio_idc;
|
||||
ps_vui->u2_sar_width = ps_ip->u2_sar_width;
|
||||
ps_vui->u2_sar_height = ps_ip->u2_sar_height;
|
||||
ps_vui->u1_overscan_info_present_flag =
|
||||
ps_ip->u1_overscan_info_present_flag;
|
||||
ps_vui->u1_overscan_appropriate_flag = ps_ip->u1_overscan_appropriate_flag;
|
||||
ps_vui->u1_video_signal_type_present_flag =
|
||||
ps_ip->u1_video_signal_type_present_flag;
|
||||
ps_vui->u1_video_format = ps_ip->u1_video_format;
|
||||
ps_vui->u1_video_full_range_flag = ps_ip->u1_video_full_range_flag;
|
||||
ps_vui->u1_colour_description_present_flag =
|
||||
ps_ip->u1_colour_description_present_flag;
|
||||
ps_vui->u1_colour_primaries = ps_ip->u1_colour_primaries;
|
||||
ps_vui->u1_transfer_characteristics = ps_ip->u1_transfer_characteristics;
|
||||
ps_vui->u1_matrix_coefficients = ps_ip->u1_matrix_coefficients;
|
||||
ps_vui->u1_chroma_loc_info_present_flag =
|
||||
ps_ip->u1_chroma_loc_info_present_flag;
|
||||
ps_vui->u1_chroma_sample_loc_type_top_field =
|
||||
ps_ip->u1_chroma_sample_loc_type_top_field;
|
||||
ps_vui->u1_chroma_sample_loc_type_bottom_field =
|
||||
ps_ip->u1_chroma_sample_loc_type_bottom_field;
|
||||
ps_vui->u1_vui_timing_info_present_flag =
|
||||
ps_ip->u1_vui_timing_info_present_flag;
|
||||
ps_vui->u4_vui_num_units_in_tick = ps_ip->u4_vui_num_units_in_tick;
|
||||
ps_vui->u4_vui_time_scale = ps_ip->u4_vui_time_scale;
|
||||
ps_vui->u1_fixed_frame_rate_flag = ps_ip->u1_fixed_frame_rate_flag;
|
||||
ps_vui->u1_nal_hrd_parameters_present_flag =
|
||||
ps_ip->u1_nal_hrd_parameters_present_flag;
|
||||
ps_vui->u1_vcl_hrd_parameters_present_flag =
|
||||
ps_ip->u1_vcl_hrd_parameters_present_flag;
|
||||
ps_vui->u1_low_delay_hrd_flag = ps_ip->u1_low_delay_hrd_flag;
|
||||
ps_vui->u1_pic_struct_present_flag = ps_ip->u1_pic_struct_present_flag;
|
||||
ps_vui->u1_bitstream_restriction_flag =
|
||||
ps_ip->u1_bitstream_restriction_flag;
|
||||
ps_vui->u1_motion_vectors_over_pic_boundaries_flag =
|
||||
ps_ip->u1_motion_vectors_over_pic_boundaries_flag;
|
||||
ps_vui->u1_max_bytes_per_pic_denom = ps_ip->u1_max_bytes_per_pic_denom;
|
||||
ps_vui->u1_max_bits_per_mb_denom = ps_ip->u1_max_bits_per_mb_denom;
|
||||
ps_vui->u1_log2_max_mv_length_horizontal =
|
||||
ps_ip->u1_log2_max_mv_length_horizontal;
|
||||
ps_vui->u1_log2_max_mv_length_vertical =
|
||||
ps_ip->u1_log2_max_mv_length_vertical;
|
||||
ps_vui->u1_num_reorder_frames = ps_ip->u1_num_reorder_frames;
|
||||
ps_vui->u1_max_dec_frame_buffering = ps_ip->u1_max_dec_frame_buffering;
|
||||
|
||||
return IV_SUCCESS;
|
||||
}
|
||||
/**
|
||||
*******************************************************************************
|
||||
*
|
||||
|
|
@ -5441,6 +5551,10 @@ static WORD32 ih264e_ctl(iv_obj_t *ps_codec_obj,
|
|||
ret = ih264_set_deblock_params(pv_api_ip, pv_api_op, ps_cfg);
|
||||
break;
|
||||
|
||||
case IVE_CMD_CTL_SET_VUI_PARAMS:
|
||||
ret = ih264e_set_vui_params(pv_api_ip, pv_api_op, ps_cfg);
|
||||
break;
|
||||
|
||||
case IVE_CMD_CTL_RESET:
|
||||
|
||||
/* invalidate config param struct as it is being served right away */
|
||||
|
|
|
|||
|
|
@ -160,54 +160,255 @@ WORD32 ih264e_generate_vui(bitstrm_t *ps_bitstrm, vui_t *ps_vui)
|
|||
WORD32 return_status = IH264E_SUCCESS;
|
||||
|
||||
/* aspect_ratio_info_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_aspect_ratio_info_present_flag, 1, return_status, "aspect_ratio_info_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_aspect_ratio_info_present_flag, 1,
|
||||
return_status, "aspect_ratio_info_present_flag");
|
||||
|
||||
if(ps_vui->u1_aspect_ratio_info_present_flag)
|
||||
{ /* aspect_ratio_idc */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_aspect_ratio_idc, 8, return_status,
|
||||
"aspect_ratio_idc");
|
||||
if(255 == ps_vui->u1_aspect_ratio_idc) /* Extended_SAR */
|
||||
{ /* sar_width */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u2_sar_width, 16, return_status,
|
||||
"sar_width");
|
||||
/* sar_height */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u2_sar_height, 16, return_status,
|
||||
"sar_height");
|
||||
}
|
||||
|
||||
}
|
||||
/* overscan_info_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_overscan_info_present_flag, 1, return_status, "overscan_info_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_overscan_info_present_flag, 1,
|
||||
return_status, "overscan_info_present_flag");
|
||||
|
||||
if(ps_vui->u1_overscan_info_present_flag)
|
||||
{
|
||||
/* overscan_appropriate_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_overscan_appropriate_flag, 1,
|
||||
return_status, "overscan_appropriate_flag");
|
||||
|
||||
}
|
||||
/* video_signal_type_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_video_signal_type_present_flag, 1, return_status, "video_signal_type_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_video_signal_type_present_flag, 1,
|
||||
return_status, "video_signal_type_present_flag");
|
||||
|
||||
if(ps_vui->u1_video_signal_type_present_flag)
|
||||
{ /* video_format */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_video_format, 3, return_status,
|
||||
"video_format");
|
||||
|
||||
/* video_full_range_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_video_full_range_flag, 1, return_status,
|
||||
"video_full_range_flag");
|
||||
|
||||
/* colour_description_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_colour_description_present_flag, 1,
|
||||
return_status, "colour_description_present_flag");
|
||||
|
||||
if(ps_vui->u1_colour_description_present_flag)
|
||||
{
|
||||
/* colour_primaries */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_colour_primaries, 8, return_status,
|
||||
"colour_primaries");
|
||||
|
||||
/* transfer_characteristics */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_transfer_characteristics, 8,
|
||||
return_status, "transfer_characteristics");
|
||||
|
||||
/* matrix_coefficients */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_matrix_coefficients, 8,
|
||||
return_status, "matrix_coefficients");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* chroma_loc_info_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_chroma_loc_info_present_flag, 1, return_status, "chroma_loc_info_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_chroma_loc_info_present_flag, 1,
|
||||
return_status, "chroma_loc_info_present_flag");
|
||||
|
||||
if(ps_vui->u1_chroma_loc_info_present_flag)
|
||||
{
|
||||
/* chroma_sample_loc_type_top_field */
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_chroma_sample_loc_type_top_field,
|
||||
return_status, "chroma_sample_loc_type_top_field");
|
||||
|
||||
/* chroma_sample_loc_type_bottom_field */
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_chroma_sample_loc_type_bottom_field,
|
||||
return_status, "chroma_sample_loc_type_bottom_field");
|
||||
}
|
||||
|
||||
/* timing_info_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_vui_timing_info_present_flag, 1, return_status, "timing_info_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_vui_timing_info_present_flag, 1,
|
||||
return_status, "timing_info_present_flag");
|
||||
|
||||
if(ps_vui->u1_vui_timing_info_present_flag)
|
||||
{
|
||||
/* num_units_in_tick */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u4_vui_num_units_in_tick, 32,
|
||||
return_status, "num_units_in_tick");
|
||||
|
||||
/* time_scale */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u4_vui_time_scale, 32, return_status,
|
||||
"time_scale");
|
||||
|
||||
/* fixed_frame_rate_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_fixed_frame_rate_flag, 1, return_status,
|
||||
"fixed_frame_rate_flag");
|
||||
|
||||
}
|
||||
|
||||
/* nal_hrd_parameters_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_nal_hrd_parameters_present_flag, 1, return_status, "nal_hrd_parameters_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_nal_hrd_parameters_present_flag, 1,
|
||||
return_status, "nal_hrd_parameters_present_flag");
|
||||
|
||||
if(ps_vui->u1_nal_hrd_parameters_present_flag)
|
||||
{
|
||||
hrd_params_t * ps_hrd_params = &ps_vui->s_nal_hrd_parameters;
|
||||
WORD32 i;
|
||||
/* cpb_cnt_minus1 */
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_hrd_params->u1_cpb_cnt_minus1,
|
||||
return_status, "cpb_cnt_minus1");
|
||||
|
||||
/* bit_rate_scale */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u4_bit_rate_scale, 4, return_status,
|
||||
"bit_rate_scale");
|
||||
|
||||
/* cpb_size_scale */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u4_cpb_size_scale, 4, return_status,
|
||||
"cpb_size_scale");
|
||||
for(i = 0; i < ps_hrd_params->u1_cpb_cnt_minus1; i++)
|
||||
{
|
||||
/* bit_rate_value_minus1[SchedSelIdx] */
|
||||
PUT_BITS_UEV(ps_bitstrm,
|
||||
ps_hrd_params->au4_bit_rate_value_minus1[i],
|
||||
return_status, "bit_rate_value_minus1[SchedSelIdx]");
|
||||
|
||||
/* cpb_size_value_minus1[SchedSelIdx] */
|
||||
PUT_BITS_UEV(ps_bitstrm,
|
||||
ps_hrd_params->au4_cpb_size_value_minus1[i],
|
||||
return_status, "cpb_size_value_minus1[SchedSelIdx]");
|
||||
|
||||
/* cbr_flag[SchedSelIdx] */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->au1_cbr_flag[i], 1,
|
||||
return_status, "cbr_flag[SchedSelIdx]");
|
||||
}
|
||||
|
||||
/* initial_cpb_removal_delay_length_minus1 */
|
||||
PUT_BITS(ps_bitstrm,
|
||||
ps_hrd_params->u1_initial_cpb_removal_delay_length_minus1, 5,
|
||||
return_status, "initial_cpb_removal_delay_length_minus1");
|
||||
|
||||
/* cpb_removal_delay_length_minus1 */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u1_cpb_removal_delay_length_minus1,
|
||||
5, return_status, "cpb_removal_delay_length_minus1");
|
||||
|
||||
/* dpb_output_delay_length_minus1 */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u1_dpb_output_delay_length_minus1,
|
||||
5, return_status, "dpb_output_delay_length_minus1");
|
||||
|
||||
/* time_offset_length */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u1_time_offset_length, 5,
|
||||
return_status, "time_offset_length");
|
||||
}
|
||||
|
||||
/* vcl_hrd_parameters_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_vcl_hrd_parameters_present_flag, 1, return_status, "vcl_hrd_parameters_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_vcl_hrd_parameters_present_flag, 1,
|
||||
return_status, "vcl_hrd_parameters_present_flag");
|
||||
|
||||
if(ps_vui->u1_vcl_hrd_parameters_present_flag)
|
||||
{
|
||||
hrd_params_t * ps_hrd_params = &ps_vui->s_vcl_hrd_parameters;
|
||||
WORD32 i;
|
||||
/* cpb_cnt_minus1 */
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_hrd_params->u1_cpb_cnt_minus1,
|
||||
return_status, "cpb_cnt_minus1");
|
||||
|
||||
/* bit_rate_scale */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u4_bit_rate_scale, 4, return_status,
|
||||
"bit_rate_scale");
|
||||
|
||||
/* cpb_size_scale */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u4_cpb_size_scale, 4, return_status,
|
||||
"cpb_size_scale");
|
||||
for(i = 0; i < ps_hrd_params->u1_cpb_cnt_minus1; i++)
|
||||
{
|
||||
/* bit_rate_value_minus1[SchedSelIdx] */
|
||||
PUT_BITS_UEV(ps_bitstrm,
|
||||
ps_hrd_params->au4_bit_rate_value_minus1[i],
|
||||
return_status, "bit_rate_value_minus1[SchedSelIdx]");
|
||||
|
||||
/* cpb_size_value_minus1[SchedSelIdx] */
|
||||
PUT_BITS_UEV(ps_bitstrm,
|
||||
ps_hrd_params->au4_cpb_size_value_minus1[i],
|
||||
return_status, "cpb_size_value_minus1[SchedSelIdx]");
|
||||
|
||||
/* cbr_flag[SchedSelIdx] */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->au1_cbr_flag[i], 1,
|
||||
return_status, "cbr_flag[SchedSelIdx]");
|
||||
}
|
||||
|
||||
/* initial_cpb_removal_delay_length_minus1 */
|
||||
PUT_BITS(ps_bitstrm,
|
||||
ps_hrd_params->u1_initial_cpb_removal_delay_length_minus1, 5,
|
||||
return_status, "initial_cpb_removal_delay_length_minus1");
|
||||
|
||||
/* cpb_removal_delay_length_minus1 */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u1_cpb_removal_delay_length_minus1,
|
||||
5, return_status, "cpb_removal_delay_length_minus1");
|
||||
|
||||
/* dpb_output_delay_length_minus1 */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u1_dpb_output_delay_length_minus1,
|
||||
5, return_status, "dpb_output_delay_length_minus1");
|
||||
|
||||
/* time_offset_length */
|
||||
PUT_BITS(ps_bitstrm, ps_hrd_params->u1_time_offset_length, 5,
|
||||
return_status, "time_offset_length");
|
||||
}
|
||||
|
||||
if(ps_vui->u1_nal_hrd_parameters_present_flag
|
||||
|| ps_vui->u1_vcl_hrd_parameters_present_flag)
|
||||
{
|
||||
/* low_delay_hrd_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_low_delay_hrd_flag, 1, return_status,
|
||||
"low_delay_hrd_flag");
|
||||
}
|
||||
/* pic_struct_present_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_pic_struct_present_flag, 1, return_status, "pic_struct_present_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_pic_struct_present_flag, 1, return_status,
|
||||
"pic_struct_present_flag");
|
||||
|
||||
/* bitstream_restriction_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_bitstream_restriction_flag, 1, return_status, "bitstream_restriction_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_bitstream_restriction_flag, 1,
|
||||
return_status, "bitstream_restriction_flag");
|
||||
|
||||
if(ps_vui->u1_bitstream_restriction_flag == 1)
|
||||
{
|
||||
/* motion_vectors_over_pic_boundaries_flag */
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_motion_vectors_over_pic_boundaries_flag, 1, return_status, "motion_vectors_over_pic_boundaries_flag");
|
||||
PUT_BITS(ps_bitstrm, ps_vui->u1_motion_vectors_over_pic_boundaries_flag,
|
||||
1, return_status, "motion_vectors_over_pic_boundaries_flag");
|
||||
|
||||
/* max_bytes_per_pic_denom */
|
||||
PUT_BITS_UEV(ps_bitstrm,ps_vui->u1_max_bytes_per_pic_denom,return_status,"max_bytes_per_pic_denom");
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_max_bytes_per_pic_denom,
|
||||
return_status, "max_bytes_per_pic_denom");
|
||||
|
||||
/* max_bits_per_mb_denom */
|
||||
PUT_BITS_UEV(ps_bitstrm,ps_vui->u1_max_bits_per_mb_denom,return_status,"max_bits_per_mb_denom");
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_max_bits_per_mb_denom,
|
||||
return_status, "max_bits_per_mb_denom");
|
||||
|
||||
/* log2_max_mv_length_horizontal */
|
||||
PUT_BITS_UEV(ps_bitstrm,ps_vui->u1_log2_max_mv_length_horizontal,return_status,"log2_max_mv_length_horizontal");
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_log2_max_mv_length_horizontal,
|
||||
return_status, "log2_max_mv_length_horizontal");
|
||||
|
||||
/* log2_max_mv_length_vertical */
|
||||
PUT_BITS_UEV(ps_bitstrm,ps_vui->u1_log2_max_mv_length_vertical,return_status,"log2_max_mv_length_vertical");
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_log2_max_mv_length_vertical,
|
||||
return_status, "log2_max_mv_length_vertical");
|
||||
|
||||
/* max_num_reorder_frames */
|
||||
PUT_BITS_UEV(ps_bitstrm,ps_vui->u1_num_reorder_frames,return_status,"max_num_reorder_frames");
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_num_reorder_frames, return_status,
|
||||
"max_num_reorder_frames");
|
||||
|
||||
/* max_dec_frame_buffering */
|
||||
PUT_BITS_UEV(ps_bitstrm,ps_vui->u1_max_dec_frame_buffering,return_status,"max_dec_frame_buffering");
|
||||
PUT_BITS_UEV(ps_bitstrm, ps_vui->u1_max_dec_frame_buffering,
|
||||
return_status, "max_dec_frame_buffering");
|
||||
}
|
||||
|
||||
return return_status;
|
||||
|
|
@ -728,26 +929,20 @@ WORD32 ih264e_generate_slice_header(bitstrm_t *ps_bitstrm,
|
|||
* @param[in] ps_codec
|
||||
* pointer to encoder context
|
||||
*
|
||||
* @param[out] ps_vui
|
||||
* pointer to vui params that needs to be populated
|
||||
*
|
||||
* @return success or failure error code
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
IH264E_ERROR_T ih264e_populate_vui(codec_t *ps_codec, vui_t *ps_vui)
|
||||
IH264E_ERROR_T ih264e_populate_vui(codec_t *ps_codec)
|
||||
{
|
||||
sps_t *ps_sps;
|
||||
|
||||
ps_sps = ps_codec->ps_sps_base + ps_codec->i4_sps_id;
|
||||
ps_vui->u1_aspect_ratio_info_present_flag = 0;
|
||||
ps_vui->u1_overscan_info_present_flag = 0;
|
||||
ps_vui->u1_video_signal_type_present_flag = 0;
|
||||
ps_vui->u1_chroma_loc_info_present_flag = 0;
|
||||
ps_vui->u1_vui_timing_info_present_flag = 0;
|
||||
vui_t *ps_vui = &ps_codec->s_cfg.s_vui;
|
||||
sps_t *ps_sps = ps_codec->ps_sps_base + ps_codec->i4_sps_id;
|
||||
|
||||
|
||||
ps_vui->u1_nal_hrd_parameters_present_flag = 0;
|
||||
ps_vui->u1_vcl_hrd_parameters_present_flag = 0;
|
||||
ps_vui->u1_pic_struct_present_flag = 0;
|
||||
|
||||
ps_vui->u1_bitstream_restriction_flag = 1;
|
||||
ps_vui->u1_motion_vectors_over_pic_boundaries_flag = 1;
|
||||
ps_vui->u1_max_bytes_per_pic_denom = 0;
|
||||
|
|
@ -766,6 +961,7 @@ IH264E_ERROR_T ih264e_populate_vui(codec_t *ps_codec, vui_t *ps_vui)
|
|||
|
||||
ps_vui->u1_max_dec_frame_buffering = ps_sps->u1_max_num_ref_frames;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -961,7 +1157,7 @@ IH264E_ERROR_T ih264e_populate_sps(codec_t *ps_codec, sps_t *ps_sps)
|
|||
if (ps_sps->i1_vui_parameters_present_flag)
|
||||
{
|
||||
/* populate vui params */
|
||||
ih264e_populate_vui(ps_codec,&(ps_codec->s_vui));
|
||||
ih264e_populate_vui(ps_codec);
|
||||
}
|
||||
|
||||
return i4_err_code;
|
||||
|
|
|
|||
|
|
@ -181,7 +181,8 @@ IH264E_ERROR_T ih264e_generate_sps_pps(codec_t *ps_codec)
|
|||
ps_entropy->i4_error_code = IH264E_SUCCESS;
|
||||
|
||||
/* generate sps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_sps(ps_bitstrm, ps_sps, &ps_codec->s_vui);
|
||||
ps_entropy->i4_error_code |= ih264e_generate_sps(ps_bitstrm, ps_sps,
|
||||
&ps_codec->s_cfg.s_vui);
|
||||
|
||||
/* generate pps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_pps(ps_bitstrm, ps_pps, ps_sps);
|
||||
|
|
@ -371,8 +372,8 @@ IH264E_ERROR_T ih264e_entropy(process_ctxt_t *ps_proc)
|
|||
if (1 == ps_entropy->i4_gen_header)
|
||||
{
|
||||
/* generate sps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_sps(ps_bitstrm, ps_sps, &ps_codec->s_vui);
|
||||
|
||||
ps_entropy->i4_error_code |= ih264e_generate_sps(ps_bitstrm, ps_sps,
|
||||
&ps_codec->s_cfg.s_vui);
|
||||
/* generate pps */
|
||||
ps_entropy->i4_error_code |= ih264e_generate_pps(ps_bitstrm, ps_pps, ps_sps);
|
||||
|
||||
|
|
|
|||
|
|
@ -563,6 +563,9 @@ typedef struct
|
|||
*/
|
||||
UWORD32 u4_mb_info_type;
|
||||
|
||||
/** VUI structure */
|
||||
vui_t s_vui;
|
||||
|
||||
}cfg_params_t;
|
||||
|
||||
|
||||
|
|
@ -2617,11 +2620,6 @@ struct _codec_t
|
|||
*/
|
||||
rate_control_ctxt_t s_rate_control;
|
||||
|
||||
/**
|
||||
* VUI structure
|
||||
*/
|
||||
vui_t s_vui;
|
||||
|
||||
/**
|
||||
* input buffer queue
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -139,6 +139,7 @@ typedef enum
|
|||
IVE_CMD_CTL_SET_PROFILE_PARAMS = 0XB,
|
||||
IVE_CMD_CTL_SET_DEBLOCK_PARAMS = 0XC,
|
||||
IVE_CMD_CTL_SET_IPE_PARAMS = 0XD,
|
||||
IVE_CMD_CTL_SET_VUI_PARAMS = 0XE,
|
||||
IVE_CMD_CTL_SET_NUM_CORES = 0x30,
|
||||
IVE_CMD_CTL_RESET = 0xA0,
|
||||
IVE_CMD_CTL_FLUSH = 0xB0,
|
||||
|
|
@ -235,7 +236,8 @@ typedef enum
|
|||
IVE_ERR_OP_CTL_SETVBVPARAMS_API_STRUCT_SIZE_INCORRECT = 0x3D,
|
||||
IVE_ERR_IP_CTL_SETPROFILE_API_STRUCT_SIZE_INCORRECT = 0x3E,
|
||||
IVE_ERR_OP_CTL_SETPROFILE_API_STRUCT_SIZE_INCORRECT = 0x3F,
|
||||
|
||||
IVE_ERR_IP_CTL_SET_VUI_STRUCT_SIZE_INCORRECT = 0x40,
|
||||
IVE_ERR_OP_CTL_SET_VUI_STRUCT_SIZE_INCORRECT = 0x41,
|
||||
}IVE_ERROR_CODES_T;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1445,6 +1445,65 @@ void set_deblock_params(app_ctxt_t *ps_app_ctxt,
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
void set_vui_params(app_ctxt_t *ps_app_ctxt)
|
||||
{
|
||||
IV_STATUS_T status;
|
||||
|
||||
ih264e_vui_ip_t s_vui_params_ip;
|
||||
ih264e_vui_op_t s_vui_params_op;
|
||||
|
||||
s_vui_params_ip.e_cmd = IVE_CMD_VIDEO_CTL;
|
||||
s_vui_params_ip.e_sub_cmd = IVE_CMD_CTL_SET_VUI_PARAMS;
|
||||
|
||||
s_vui_params_ip.u1_aspect_ratio_info_present_flag = 0;
|
||||
s_vui_params_ip.u1_aspect_ratio_idc = 0;
|
||||
s_vui_params_ip.u2_sar_width = 0;
|
||||
s_vui_params_ip.u2_sar_height = 0;
|
||||
s_vui_params_ip.u1_overscan_info_present_flag = 0;
|
||||
s_vui_params_ip.u1_overscan_appropriate_flag = 0;
|
||||
s_vui_params_ip.u1_video_signal_type_present_flag = 0;
|
||||
s_vui_params_ip.u1_video_format = 0;
|
||||
s_vui_params_ip.u1_video_full_range_flag = 0;
|
||||
s_vui_params_ip.u1_colour_description_present_flag = 0;
|
||||
s_vui_params_ip.u1_colour_primaries = 0;
|
||||
s_vui_params_ip.u1_transfer_characteristics = 0;
|
||||
s_vui_params_ip.u1_matrix_coefficients = 0;
|
||||
s_vui_params_ip.u1_chroma_loc_info_present_flag = 0;
|
||||
s_vui_params_ip.u1_chroma_sample_loc_type_top_field = 0;
|
||||
s_vui_params_ip.u1_chroma_sample_loc_type_bottom_field = 0;
|
||||
s_vui_params_ip.u1_vui_timing_info_present_flag = 0;
|
||||
s_vui_params_ip.u4_vui_num_units_in_tick = 0;
|
||||
s_vui_params_ip.u4_vui_time_scale = 0;
|
||||
s_vui_params_ip.u1_fixed_frame_rate_flag = 0;
|
||||
s_vui_params_ip.u1_nal_hrd_parameters_present_flag = 0;
|
||||
s_vui_params_ip.u1_vcl_hrd_parameters_present_flag = 0;
|
||||
s_vui_params_ip.u1_low_delay_hrd_flag = 0;
|
||||
s_vui_params_ip.u1_pic_struct_present_flag = 0;
|
||||
s_vui_params_ip.u1_bitstream_restriction_flag = 0;
|
||||
s_vui_params_ip.u1_motion_vectors_over_pic_boundaries_flag = 0;
|
||||
s_vui_params_ip.u1_max_bytes_per_pic_denom = 0;
|
||||
s_vui_params_ip.u1_max_bits_per_mb_denom = 0;
|
||||
s_vui_params_ip.u1_log2_max_mv_length_horizontal = 0;
|
||||
s_vui_params_ip.u1_log2_max_mv_length_vertical = 0;
|
||||
s_vui_params_ip.u1_num_reorder_frames = 0;
|
||||
s_vui_params_ip.u1_max_dec_frame_buffering = 0;
|
||||
|
||||
|
||||
s_vui_params_ip.u4_size = sizeof(ih264e_vui_ip_t);
|
||||
s_vui_params_op.u4_size = sizeof(ih264e_vui_op_t);
|
||||
|
||||
status = ih264e_api_function(ps_app_ctxt->ps_enc, &s_vui_params_ip,
|
||||
&s_vui_params_op);
|
||||
if(status != IV_SUCCESS)
|
||||
{
|
||||
CHAR ac_error[STRLENGTH];
|
||||
sprintf(ac_error, "Unable to set vui params = 0x%x\n",
|
||||
s_vui_params_op.u4_error_code);
|
||||
codec_exit(ac_error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#define PEAK_WINDOW_SIZE 8
|
||||
|
||||
void synchronous_encode(iv_obj_t *ps_enc, app_ctxt_t *ps_app_ctxt)
|
||||
|
|
@ -2477,6 +2536,11 @@ int main(int argc, char *argv[])
|
|||
/*****************************************************************************/
|
||||
set_enc_mode(&s_app_ctxt, 0, 0, IVE_ENC_MODE_PICTURE);
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Video usability information */
|
||||
/*****************************************************************************/
|
||||
set_vui_params(&s_app_ctxt);
|
||||
|
||||
#ifdef IOS
|
||||
/* Correct file paths */
|
||||
sprintf(filename_with_path, "%s/%s", documentdir, s_app_ctxt.ac_ip_fname);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue