Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfixes #63

Merged
merged 5 commits into from
Sep 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions encoder/ih264e_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1613,6 +1613,16 @@ static IV_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
return IV_FAIL;
}

if((ps_ip->s_ive_ip.u4_idr_frm_interval > ps_ip->s_ive_ip.u4_i_frm_interval) &&
(ps_ip->s_ive_ip.u4_idr_frm_interval % ps_ip->s_ive_ip.u4_i_frm_interval != 0))
{
ps_op->s_ive_op.u4_error_code |= 1
<< IVE_UNSUPPORTEDPARAM;
ps_op->s_ive_op.u4_error_code |=
IH264E_INVALID_INTRA_FRAME_INTERVAL;
return IV_FAIL;
}

break;
}

Expand Down Expand Up @@ -2301,7 +2311,8 @@ static IV_STATUS_T api_check_struct_sanity(iv_obj_t *ps_handle,
return IV_FAIL;
}

if (ps_ip->s_ive_ip.u4_air_refresh_period == 0)
if (ps_ip->s_ive_ip.e_air_mode != IVE_AIR_MODE_NONE &&
ps_ip->s_ive_ip.u4_air_refresh_period == 0)
{
ps_op->s_ive_op.u4_error_code |= 1
<< IVE_UNSUPPORTEDPARAM;
Expand Down Expand Up @@ -3328,7 +3339,7 @@ static WORD32 ih264e_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op)
max_mb_cnt = max_mb_rows * max_mb_cols;

/* profile / level info */
level = ih264e_get_min_level(max_ht_luma, max_wd_luma);
level = ih264e_get_min_level(max_wd_luma, max_ht_luma);

/* validate params */
if ((level < MIN_LEVEL) || (level > MAX_LEVEL))
Expand Down Expand Up @@ -5756,6 +5767,9 @@ static IV_STATUS_T ih264_set_gop_params(void *pv_api_ip,
ps_cfg->u4_i_frm_interval = ps_ip->s_ive_ip.u4_i_frm_interval;
ps_cfg->u4_idr_frm_interval = ps_ip->s_ive_ip.u4_idr_frm_interval;

if(ps_cfg->u4_idr_frm_interval < ps_cfg->u4_i_frm_interval)
ps_cfg->u4_i_frm_interval = ps_cfg->u4_idr_frm_interval;

ps_cfg->u4_timestamp_high = ps_ip->s_ive_ip.u4_timestamp_high;
ps_cfg->u4_timestamp_low = ps_ip->s_ive_ip.u4_timestamp_low;

Expand Down
6 changes: 6 additions & 0 deletions encoder/ih264e_process.c
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,12 @@ WORD32 ih264e_update_rc_post_enc(codec_t *ps_codec, WORD32 ctxt_sel, WORD32 i4_i
if (ps_codec->s_rate_control.post_encode_skip[ctxt_sel])
{
ps_entropy->ps_bitstrm->u4_strm_buf_offset = 0;
// If an IDR frame was skipped, restore frame num and IDR pic id
if (ps_codec->u4_is_idr == 1)
{
ps_codec->i4_frame_num = ps_codec->i4_restore_frame_num;
ps_codec->i4_idr_pic_id--;
}
}
else if (i4_stuffing_byte)
{
Expand Down
3 changes: 1 addition & 2 deletions encoder/ih264e_rate_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,7 @@ WORD32 ih264e_rc_post_enc(void * ps_rate_control_api,
pi4_is_post_encode_skip[0]= 0;

/* For NLDRC, get the buffer status for stuffing or skipping */
/* Default NLDRC to CBR with no frame drops. */
/* FIX ME: In frame drop mode, the bitstream generated is non-compliant */
/* Default NLDRC to CBR with no frame drops so the '0 &&'. */
if (0 && irc_get_rc_type(ps_rate_control_api) == CBR_NLDRC)
{
WORD32 i4_get_num_bit_to_prevent_vbv_overflow;
Expand Down
5 changes: 5 additions & 0 deletions encoder/ih264e_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2253,6 +2253,11 @@ struct _codec_t
*/
WORD32 i4_frame_num;

/**
* frame num backup (used in post enc skip case)
*/
WORD32 i4_restore_frame_num;

/**
* slice_type
*/
Expand Down
2 changes: 2 additions & 0 deletions encoder/ih264e_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,8 @@ IH264E_ERROR_T ih264e_pic_init(codec_t *ps_codec, inp_buf_t *ps_inp_buf)
/* set idr flag */
ps_codec->u4_is_idr = 1;

ps_codec->i4_restore_frame_num = ps_codec->i4_frame_num;

/* reset frame num */
ps_codec->i4_frame_num = 0;

Expand Down
2 changes: 1 addition & 1 deletion examples/avcenc/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void allocate_input(app_ctxt_t *ps_app_ctxt)
/* Size of buffer */
luma_size = ps_app_ctxt->u4_wd * ps_app_ctxt->u4_ht;
chroma_size = luma_size >> 1;
pic_size = luma_size + chroma_size;
pic_size = luma_size + chroma_size * 2;

num_mbs = ALIGN16(ps_app_ctxt->u4_max_wd) * ALIGN16(ps_app_ctxt->u4_max_ht);
num_mbs /= 256;
Expand Down