am 860f7520: Always do recon of 4x4 intra blocks
* commit '860f75203e35283c03d6cd75dfddec88db12a51b':
Always do recon of 4x4 intra blocks
diff --git a/common/ih264_common_tables.c b/common/ih264_common_tables.c
index 7d15440..df09f5a 100644
--- a/common/ih264_common_tables.c
+++ b/common/ih264_common_tables.c
@@ -128,7 +128,7 @@
414720,
/* Level 3.1 */
921600,
- /* Level 3.1 */
+ /* Level 3.2 */
1310720,
/* Level 4 */
2097152,
diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c
index 6ea75c6..6fbd834 100644
--- a/decoder/ih264d_api.c
+++ b/decoder/ih264d_api.c
@@ -2589,7 +2589,7 @@
UWORD32 cur_slice_is_nonref = 0;
UWORD32 u4_next_is_aud;
UWORD32 u4_first_start_code_found = 0;
- WORD32 ret,api_ret_value = IV_SUCCESS;
+ WORD32 ret = 0,api_ret_value = IV_SUCCESS;
WORD32 header_data_left = 0,frame_data_left = 0;
UWORD8 *pu1_bitstrm_buf;
ivd_video_decode_ip_t *ps_dec_ip;
@@ -3019,24 +3019,12 @@
ps_dec_op->u4_error_code = error | ret;
api_ret_value = IV_FAIL;
- if((ret == IVD_RES_CHANGED) || (ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED))
+ if((ret == IVD_RES_CHANGED)
+ || (ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED)
+ || (ret == ERROR_UNAVAIL_PICBUF_T)
+ || (ret == ERROR_UNAVAIL_MVBUF_T))
{
- /*dont consume the SPS*/
- ps_dec_op->u4_num_bytes_consumed -= bytes_consumed;
- return IV_FAIL;
- }
-
- if((ret == IVD_RES_CHANGED) || (ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED))
- {
- /*dont consume the SPS*/
- ps_dec_op->u4_num_bytes_consumed -= bytes_consumed;
- return IV_FAIL;
- }
-
- if((ret == ERROR_UNAVAIL_PICBUF_T) || (ret == ERROR_UNAVAIL_MVBUF_T))
- {
- ps_dec_op->u4_num_bytes_consumed -= bytes_consumed;
- return IV_FAIL;
+ break;
}
if((ret == ERROR_INCOMPLETE_FRAME) || (ret == ERROR_DANGLING_FIELD_IN_PIC))
@@ -3094,6 +3082,7 @@
WORD32 num_mb_skipped;
WORD32 prev_slice_err;
pocstruct_t temp_poc;
+ WORD32 ret1;
num_mb_skipped = (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)
- ps_dec->u2_total_mbs_coded;
@@ -3103,15 +3092,33 @@
else
prev_slice_err = 2;
- ret = ih264d_mark_err_slice_skip(ps_dec, num_mb_skipped, ps_dec->u1_nal_unit_type == IDR_SLICE_NAL, ps_dec->ps_cur_slice->u2_frame_num,
+ ret1 = ih264d_mark_err_slice_skip(ps_dec, num_mb_skipped, ps_dec->u1_nal_unit_type == IDR_SLICE_NAL, ps_dec->ps_cur_slice->u2_frame_num,
&temp_poc, prev_slice_err);
- if((ret == ERROR_UNAVAIL_PICBUF_T) || (ret == ERROR_UNAVAIL_MVBUF_T))
+ if((ret1 == ERROR_UNAVAIL_PICBUF_T) || (ret1 == ERROR_UNAVAIL_MVBUF_T))
{
return IV_FAIL;
}
}
+ if((ret == IVD_RES_CHANGED)
+ || (ret == IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED)
+ || (ret == ERROR_UNAVAIL_PICBUF_T)
+ || (ret == ERROR_UNAVAIL_MVBUF_T))
+ {
+
+ /* signal the decode thread */
+ ih264d_signal_decode_thread(ps_dec);
+ /* close deblock thread if it is not closed yet */
+ if(ps_dec->u4_num_cores == 3)
+ {
+ ih264d_signal_bs_deblk_thread(ps_dec);
+ }
+ /* dont consume bitstream */
+ ps_dec_op->u4_num_bytes_consumed -= bytes_consumed;
+ return IV_FAIL;
+ }
+
if(ps_dec->u1_separate_parse)
{
diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c
index 1581bd6..84909ea 100644
--- a/decoder/ih264d_utils.c
+++ b/decoder/ih264d_utils.c
@@ -2080,6 +2080,8 @@
ps_dec->ps_mem_tab[MEM_REC_SLICE_NUM_MAP].pv_base;
ps_dec->ps_dec_slice_buf = ps_dec->ps_mem_tab[MEM_REC_SLICE_HDR].pv_base;
+ memset(ps_dec->ps_mem_tab[MEM_REC_SLICE_HDR].pv_base, 0,
+ ps_dec->ps_mem_tab[MEM_REC_SLICE_HDR].u4_mem_size);
pu1_buf = (UWORD8 *)ps_dec->ps_dec_slice_buf;
pu1_buf += sizeof(dec_slice_struct_t) * u4_total_mbs;
ps_dec->pv_map_ref_idx_to_poc_buf = (void *)pu1_buf;
diff --git a/encoder/ih264e_cavlc.c b/encoder/ih264e_cavlc.c
index 5d819d9..7491480 100644
--- a/encoder/ih264e_cavlc.c
+++ b/encoder/ih264e_cavlc.c
@@ -1718,13 +1718,17 @@
{
if (i4_mb_part_pred_mode != PRED_L1)/* || PRED_BI */
{
- PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr++, error_status, "mv l0 x");
- PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr++, error_status, "mv l0 y");
+ PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr, error_status, "mv l0 x");
+ pi2_mvd_ptr++;
+ PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr, error_status, "mv l0 y");
+ pi2_mvd_ptr++;
}
if (i4_mb_part_pred_mode != PRED_L0)/* || PRED_BI */
{
- PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr++, error_status, "mv l1 x");
- PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr++, error_status, "mv l1 y");
+ PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr, error_status, "mv l1 x");
+ pi2_mvd_ptr++;
+ PUT_BITS_SEV(ps_bitstream, *pi2_mvd_ptr, error_status, "mv l1 y");
+ pi2_mvd_ptr++;
}
}
diff --git a/encoder/ih264e_rate_control.c b/encoder/ih264e_rate_control.c
index 1da2f03..b81d916 100644
--- a/encoder/ih264e_rate_control.c
+++ b/encoder/ih264e_rate_control.c
@@ -198,7 +198,7 @@
// UWORD8 u1_is_mb_level_rc_on = 0;
UWORD32 au4_peak_bit_rate[2] = {0,0};
UWORD32 u4_min_bit_rate = 0;
- WORD32 i4_is_gop_closed = 0;
+ WORD32 i4_is_gop_closed = 1;
// WORD32 i4_use_est_intra_sad = 1;
UWORD32 u4_src_ticks = 0;
UWORD32 u4_tgt_ticks = 0;
diff --git a/encoder/ih264e_structs.h b/encoder/ih264e_structs.h
index fc61277..fdf0e0a 100644
--- a/encoder/ih264e_structs.h
+++ b/encoder/ih264e_structs.h
@@ -2623,9 +2623,9 @@
inp_buf_t as_inp_list[MAX_NUM_BFRAMES];
/**
- * IDR flags for each input
+ * Flag to indicate if any IDR requests are pending
*/
- WORD32 i4_idr_inp_list[MAX_NUM_BFRAMES];
+ WORD32 i4_pending_idr_flag;
/*
*Flag to indicate if we have recived the last input frame
diff --git a/encoder/ih264e_utils.c b/encoder/ih264e_utils.c
index 82a96d0..455aa9e 100644
--- a/encoder/ih264e_utils.c
+++ b/encoder/ih264e_utils.c
@@ -265,9 +265,9 @@
i4_force_i = (ps_codec->force_curr_frame_type == IV_I_FRAME);
- ps_codec->i4_idr_inp_list[ps_codec->i4_pic_cnt % MAX_NUM_BFRAMES] = i4_force_idr;
+ ps_codec->i4_pending_idr_flag |= i4_force_idr;
- if ((ps_codec->i4_frame_num > 0) && (i4_force_idr || i4_force_i))
+ if ((ps_codec->i4_pic_cnt > 0) && (i4_force_idr || i4_force_i))
{
irc_force_I_frame(ps_codec->s_rate_control.pps_rate_control_api);
}
@@ -312,12 +312,13 @@
return 0;
}
- /* Set IDR if it has been requested or its the IDR interval */
- ps_codec->pic_type = ps_codec->i4_idr_inp_list[u4_pic_id % MAX_NUM_BFRAMES] ?
+ /* Set IDR if it has been requested */
+ if (ps_codec->pic_type == PIC_I)
+ {
+ ps_codec->pic_type = ps_codec->i4_pending_idr_flag ?
PIC_IDR : ps_codec->pic_type;
- ps_codec->i4_idr_inp_list[u4_pic_id % MAX_NUM_BFRAMES] = 0;
-
-
+ ps_codec->i4_pending_idr_flag = 0;
+ }
/* Get current frame Qp */
u1_frame_qp = (UWORD8)irc_get_frame_level_qp(
@@ -1354,6 +1355,8 @@
/* Init dependecy vars */
ps_codec->i4_last_inp_buff_received = 0;
+ /* At codec start no IDR is pending */
+ ps_codec->i4_pending_idr_flag = 0;
return IH264E_SUCCESS;
}