diff options
author | Harinarayanan K K <harinarayanan.kk@ittiam.com> | 2015-06-26 15:20:33 +0530 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2015-07-31 18:51:20 +0000 |
commit | dbe9ac8936d115b59bbf37ee593e0fad83e3bf5e (patch) | |
tree | 104f921d2472383295594b36019ab9909bb0dc69 /encoder | |
parent | 860f75203e35283c03d6cd75dfddec88db12a51b (diff) | |
download | android_external_libavc-dbe9ac8936d115b59bbf37ee593e0fad83e3bf5e.tar.gz android_external_libavc-dbe9ac8936d115b59bbf37ee593e0fad83e3bf5e.tar.bz2 android_external_libavc-dbe9ac8936d115b59bbf37ee593e0fad83e3bf5e.zip |
Made gops closed
Now no picture in a gop will depend on any picture in the previous gop
All calls to force an IDR are respected as soon as possible
Bug: 22860270
Change-Id: Id2bcd5687c3fb786336a01894c1b9228d67a87a6
Diffstat (limited to 'encoder')
-rw-r--r-- | encoder/ih264e_rate_control.c | 2 | ||||
-rw-r--r-- | encoder/ih264e_structs.h | 4 | ||||
-rw-r--r-- | encoder/ih264e_utils.c | 17 |
3 files changed, 13 insertions, 10 deletions
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 @@ void ih264e_rc_init(void *pv_rc_api, // 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 @@ struct _codec_t 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 @@ WORD32 ih264e_input_queue_update(codec_t *ps_codec, 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 @@ WORD32 ih264e_input_queue_update(codec_t *ps_codec, 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 @@ IH264E_ERROR_T ih264e_codec_init(codec_t *ps_codec) /* 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; } |