summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2017-06-15 19:04:18 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2017-06-15 19:04:18 +0000
commit2ccdc697b344e4eef33defb41b6f343a1d54c759 (patch)
tree2a6ff35b68b77286a32b3b789801a3d5c9be2407
parentaa861e202bdc301112d7bacf1be9a1ba635448f7 (diff)
parent2c25f447caa8a605031ce917b55d68d647fdcc6f (diff)
downloadandroid_external_libavc-2ccdc697b344e4eef33defb41b6f343a1d54c759.tar.gz
android_external_libavc-2ccdc697b344e4eef33defb41b6f343a1d54c759.tar.bz2
android_external_libavc-2ccdc697b344e4eef33defb41b6f343a1d54c759.zip
Merge cherrypicks of [2413849, 2413760, 2413901, 2413776, 2413658, 2413792, 2413850, 2413851, 2413793, 2413866, 2413738, 2413659, 2413660, 2413867, 2413868, 2413885, 2413829, 2413814, 2413886, 2413921, 2413777, 2413887, 2413854, 2413889, 2413890, 2413855, 2413869, 2413740, 2413816, 2413831, 2413832, 2413817, 2413892, 2413797, 2413779] into nyc-mr2-pixel-monthly-release
Change-Id: I5b48a135366c1b3e5171eddfb634362a240dc234
-rw-r--r--decoder/ih264d_api.c3
-rw-r--r--decoder/ih264d_dpb_mgr.c21
-rw-r--r--decoder/ih264d_parse_bslice.c17
-rw-r--r--decoder/ih264d_parse_headers.c58
-rw-r--r--decoder/ih264d_parse_pslice.c18
-rw-r--r--decoder/ih264d_parse_slice.c8
-rw-r--r--decoder/ih264d_structs.h3
-rw-r--r--decoder/ih264d_utils.c5
8 files changed, 60 insertions, 73 deletions
diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c
index 6940788..2cde456 100644
--- a/decoder/ih264d_api.c
+++ b/decoder/ih264d_api.c
@@ -1002,7 +1002,6 @@ void ih264d_init_decoder(void * ps_dec_params)
ps_dec->ps_cur_sps = NULL;
ps_dec->u1_init_dec_flag = 0;
ps_dec->u1_first_slice_in_stream = 1;
- ps_dec->u1_first_pb_nal_in_pic = 1;
ps_dec->u1_last_pic_not_decoded = 0;
ps_dec->u4_app_disp_width = 0;
ps_dec->i4_header_decoded = 0;
@@ -1919,7 +1918,6 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
ps_dec->cur_dec_mb_num = 0;
ps_dec->cur_recon_mb_num = 0;
ps_dec->u4_first_slice_in_pic = 1;
- ps_dec->u1_first_pb_nal_in_pic = 1;
ps_dec->u1_slice_header_done = 0;
ps_dec->u1_dangling_field = 0;
@@ -1927,6 +1925,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
ps_dec->u4_bs_deblk_thread_created = 0;
ps_dec->u4_cur_bs_mb_num = 0;
ps_dec->u4_start_recon_deblk = 0;
+ ps_dec->u4_sps_cnt_in_process = 0;
DEBUG_THREADS_PRINTF(" Starting process call\n");
diff --git a/decoder/ih264d_dpb_mgr.c b/decoder/ih264d_dpb_mgr.c
index e02cc90..0a61ffd 100644
--- a/decoder/ih264d_dpb_mgr.c
+++ b/decoder/ih264d_dpb_mgr.c
@@ -1289,11 +1289,22 @@ WORD32 ih264d_do_mmco_buffer(dpb_commands_t *ps_dpb_cmds,
u4_cur_pic_num);
if(ret != OK)
return ret;
- ret = ih264d_delete_st_node_or_make_lt(ps_dpb_mgr,
- u4_cur_pic_num, u4_lt_idx,
- u1_fld_pic_flag);
- if(ret != OK)
- return ret;
+
+ if(ps_dpb_mgr->u1_num_st_ref_bufs > 0)
+
+ {
+ ret = ih264d_delete_st_node_or_make_lt(ps_dpb_mgr,
+ u4_cur_pic_num,
+ u4_lt_idx,
+ u1_fld_pic_flag);
+ if(ret != OK)
+ return ret;
+ }
+ else
+ {
+ return ERROR_DBP_MANAGER_T;
+ }
+
u1_marked_lt = 1;
break;
}
diff --git a/decoder/ih264d_parse_bslice.c b/decoder/ih264d_parse_bslice.c
index 85b0d0f..772964a 100644
--- a/decoder/ih264d_parse_bslice.c
+++ b/decoder/ih264d_parse_bslice.c
@@ -1405,22 +1405,9 @@ WORD32 ih264d_parse_bslice(dec_struct_t * ps_dec, UWORD16 u2_first_mb_in_slice)
ps_slice->u1_num_ref_idx_lx_active[0] = u4_temp;
ps_slice->u1_num_ref_idx_lx_active[1] = ui_temp1;
}
- /* Initialize the Reference list once in Picture if the slice type */
- /* of first slice is between 5 to 9 defined in table 7.3 of standard */
- /* If picture contains both P & B slices then Initialize the Reference*/
- /* List only when it switches from P to B and B to P */
- {
- UWORD8 init_idx_flg = (ps_dec->u1_pr_sl_type
- != ps_dec->ps_cur_slice->u1_slice_type);
- if(ps_dec->u1_first_pb_nal_in_pic
- || (init_idx_flg & !ps_dec->u1_sl_typ_5_9)
- || ps_dec->u1_num_ref_idx_lx_active_prev
- != ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0])
- ih264d_init_ref_idx_lx_b(ps_dec);
- if(ps_dec->u1_first_pb_nal_in_pic & ps_dec->u1_sl_typ_5_9)
- ps_dec->u1_first_pb_nal_in_pic = 0;
- }
+
+ ih264d_init_ref_idx_lx_b(ps_dec);
/* Store the value for future slices in the same picture */
ps_dec->u1_num_ref_idx_lx_active_prev =
ps_dec->ps_cur_slice->u1_num_ref_idx_lx_active[0];
diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c
index 3807a14..d8c37a6 100644
--- a/decoder/ih264d_parse_headers.c
+++ b/decoder/ih264d_parse_headers.c
@@ -484,7 +484,7 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer;
UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst;
UWORD8 u1_frm, uc_constraint_set0_flag, uc_constraint_set1_flag;
-
+ WORD32 i4_cropped_ht, i4_cropped_wd;
UWORD32 u4_temp;
WORD32 pic_height_in_map_units_minus1 = 0;
UWORD32 u2_pic_wd = 0;
@@ -564,18 +564,19 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
/*--------------------------------------------------------------------*/
ps_seq = ps_dec->pv_scratch_sps_pps;
- *ps_seq = ps_dec->ps_sps[u1_seq_parameter_set_id];
+ if(ps_dec->i4_header_decoded & 1)
+ {
+ *ps_seq = *ps_dec->ps_cur_sps;
+ }
- if(NULL == ps_dec->ps_cur_sps)
- ps_dec->ps_cur_sps = ps_seq;
- if((3 == ps_dec->i4_header_decoded) && (ps_seq->u1_profile_idc != u1_profile_idc))
+ if((ps_dec->i4_header_decoded & 1) && (ps_seq->u1_profile_idc != u1_profile_idc))
{
ps_dec->u1_res_changed = 1;
return IVD_RES_CHANGED;
}
- if((3 == ps_dec->i4_header_decoded) && (ps_seq->u1_level_idc != u1_level_idc))
+ if((ps_dec->i4_header_decoded & 1) && (ps_seq->u1_level_idc != u1_level_idc))
{
ps_dec->u1_res_changed = 1;
return IVD_RES_CHANGED;
@@ -749,7 +750,7 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
}
/* Compare with older num_ref_frames is header is already once */
- if((3 == ps_dec->i4_header_decoded) && (ps_seq->u1_num_ref_frames != u4_temp))
+ if((ps_dec->i4_header_decoded & 1) && (ps_seq->u1_num_ref_frames != u4_temp))
{
ps_dec->u1_res_changed = 1;
return IVD_RES_CHANGED;
@@ -863,7 +864,6 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
UWORD16 u2_btm_ofst = 0;
UWORD8 u1_frm_mbs_flag;
UWORD8 u1_vert_mult_factor;
- WORD32 i4_cropped_ht, i4_cropped_wd;
if(u1_frame_cropping_flag)
{
@@ -899,12 +899,12 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
return ERROR_INV_SPS_PPS_T;
}
- if((3 == ps_dec->i4_header_decoded) && (ps_dec->u2_pic_wd != u2_pic_wd))
+ if((ps_dec->i4_header_decoded & 1) && (ps_dec->u2_pic_wd != u2_pic_wd))
{
ps_dec->u1_res_changed = 1;
return IVD_RES_CHANGED;
}
- if((3 == ps_dec->i4_header_decoded) && (ps_dec->u2_pic_ht != u2_pic_ht))
+ if((ps_dec->i4_header_decoded & 1) && (ps_dec->u2_pic_ht != u2_pic_ht))
{
ps_dec->u1_res_changed = 1;
return IVD_RES_CHANGED;
@@ -925,14 +925,10 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
}
- ps_dec->u2_disp_height = i4_cropped_ht;
-
- ps_dec->u2_disp_width = i4_cropped_wd;
-
}
/* Backup u4_num_reorder_frames if header is already decoded */
- if((3 == ps_dec->i4_header_decoded) &&
+ if((ps_dec->i4_header_decoded & 1) &&
(1 == ps_seq->u1_vui_parameters_present_flag) &&
(1 == ps_seq->s_vui.u1_bitstream_restriction_flag))
{
@@ -950,7 +946,7 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
}
/* Compare older u4_num_reorder_frames with the new one if header is already decoded */
- if((3 == ps_dec->i4_header_decoded) &&
+ if((ps_dec->i4_header_decoded & 1) &&
(-1 != (WORD32)u4_num_reorder_frames) &&
(1 == ps_seq->u1_vui_parameters_present_flag) &&
(1 == ps_seq->s_vui.u1_bitstream_restriction_flag) &&
@@ -960,6 +956,19 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
return IVD_RES_CHANGED;
}
+ /* In case bitstream read has exceeded the filled size, then
+ return an error */
+ if (ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
+ {
+ return ERROR_INV_SPS_PPS_T;
+ }
+
+ /*--------------------------------------------------------------------*/
+ /* All initializations to ps_dec are beyond this point */
+ /*--------------------------------------------------------------------*/
+ ps_dec->u2_disp_height = i4_cropped_ht;
+ ps_dec->u2_disp_width = i4_cropped_wd;
+
ps_dec->u2_pic_wd = u2_pic_wd;
ps_dec->u2_pic_ht = u2_pic_ht;
@@ -978,14 +987,9 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
ps_dec->u2_crop_offset_y = u2_crop_offset_y;
ps_dec->u2_crop_offset_uv = u2_crop_offset_uv;
- /* In case bitstream read has exceeded the filled size, then
- return an error */
- if(ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst)
- {
- return ERROR_INV_SPS_PPS_T;
- }
ps_seq->u1_is_valid = TRUE;
ps_dec->ps_sps[u1_seq_parameter_set_id] = *ps_seq;
+ ps_dec->ps_cur_sps = &ps_dec->ps_sps[u1_seq_parameter_set_id];
return OK;
}
@@ -1154,6 +1158,16 @@ WORD32 ih264d_parse_nal_unit(iv_obj_t *dec_hdl,
/* ! */
ih264d_rbsp_to_sodb(ps_dec->ps_bitstrm);
i_status = ih264d_parse_sps(ps_dec, ps_bitstrm);
+ ps_dec->u4_sps_cnt_in_process++;
+ /*If a resolution change happens within a process call, due to multiple sps
+ * we will not support it.
+ */
+ if((ps_dec->u4_sps_cnt_in_process > 1 ) &&
+ (i_status == IVD_RES_CHANGED))
+ {
+ i_status = ERROR_INV_SPS_PPS_T;
+ ps_dec->u1_res_changed = 0;
+ }
if(i_status == ERROR_INV_SPS_PPS_T)
return i_status;
if(!i_status)
diff --git a/decoder/ih264d_parse_pslice.c b/decoder/ih264d_parse_pslice.c
index 97ea27c..bcfbe05 100644
--- a/decoder/ih264d_parse_pslice.c
+++ b/decoder/ih264d_parse_pslice.c
@@ -1977,23 +1977,7 @@ WORD32 ih264d_parse_pslice(dec_struct_t *ps_dec, UWORD16 u2_first_mb_in_slice)
UWORD8 uc_refIdxReFlagL0 = ih264d_get_bit_h264(ps_bitstrm);
COPYTHECONTEXT("SH: ref_pic_list_reordering_flag_l0",uc_refIdxReFlagL0);
- /* Initialize the Reference list once in Picture if the slice type */
- /* of first slice is between 5 to 9 defined in table 7.3 of standard */
- /* If picture contains both P & B slices then Initialize the Reference*/
- /* List only when it switches from P to B and B to P */
- {
- UWORD8 init_idx_flg = (ps_dec->u1_pr_sl_type
- != ps_dec->ps_cur_slice->u1_slice_type);
- if(ps_dec->u1_first_pb_nal_in_pic
- || (init_idx_flg & !ps_dec->u1_sl_typ_5_9)
- || ps_dec->u1_num_ref_idx_lx_active_prev
- != ps_cur_slice->u1_num_ref_idx_lx_active[0])
- {
- ih264d_init_ref_idx_lx_p(ps_dec);
- }
- if(ps_dec->u1_first_pb_nal_in_pic & ps_dec->u1_sl_typ_5_9)
- ps_dec->u1_first_pb_nal_in_pic = 0;
- }
+ ih264d_init_ref_idx_lx_p(ps_dec);
/* Store the value for future slices in the same picture */
ps_dec->u1_num_ref_idx_lx_active_prev =
ps_cur_slice->u1_num_ref_idx_lx_active[0];
diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c
index 7e0815f..fad2dff 100644
--- a/decoder/ih264d_parse_slice.c
+++ b/decoder/ih264d_parse_slice.c
@@ -284,10 +284,8 @@ WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec,
{
dec_err_status_t * ps_err = ps_dec->ps_dec_err_status;
- if(ps_dec->u1_sl_typ_5_9
- && ((ps_cur_slice->u1_slice_type == I_SLICE)
- || (ps_cur_slice->u1_slice_type
- == SI_SLICE)))
+ if((ps_cur_slice->u1_slice_type == I_SLICE)
+ || (ps_cur_slice->u1_slice_type == SI_SLICE))
ps_err->u1_cur_pic_type = PIC_TYPE_I;
else
ps_err->u1_cur_pic_type = PIC_TYPE_UNKNOWN;
@@ -1034,14 +1032,12 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice,
u1_slice_type = u4_temp;
COPYTHECONTEXT("SH: slice_type",(u1_slice_type));
- ps_dec->u1_sl_typ_5_9 = 0;
/* Find Out the Slice Type is 5 to 9 or not then Set the Flag */
/* u1_sl_typ_5_9 = 1 .Which tells that all the slices in the Pic*/
/* will be of same type of current */
if(u1_slice_type > 4)
{
u1_slice_type -= 5;
- ps_dec->u1_sl_typ_5_9 = 1;
}
{
diff --git a/decoder/ih264d_structs.h b/decoder/ih264d_structs.h
index 4260393..c83c34e 100644
--- a/decoder/ih264d_structs.h
+++ b/decoder/ih264d_structs.h
@@ -897,11 +897,9 @@ typedef struct _DecStruct
/* slice Header Simplification */
UWORD8 u1_pr_sl_type;
- UWORD8 u1_sl_typ_5_9;
WORD32 i4_frametype;
UWORD32 u4_app_disp_width;
WORD32 i4_error_code;
- UWORD8 u1_first_pb_nal_in_pic;
UWORD32 u4_bitoffset;
/* Variables added to handle field pics */
@@ -1249,6 +1247,7 @@ typedef struct _DecStruct
UWORD32 u4_cur_bs_mb_num;
UWORD32 u4_bs_cur_slice_num_mbs;
UWORD32 u4_cur_deblk_mb_num;
+ UWORD32 u4_sps_cnt_in_process;
volatile UWORD16 u2_cur_slice_num_bs;
UWORD32 u4_deblk_mb_x;
diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c
index c64ee8a..4f6deca 100644
--- a/decoder/ih264d_utils.c
+++ b/decoder/ih264d_utils.c
@@ -1999,10 +1999,7 @@ WORD16 ih264d_allocate_dynamic_bufs(dec_struct_t * ps_dec)
/* Allocate memory for packed pred info */
num_entries = u4_total_mbs;
- if(1 == ps_dec->ps_cur_sps->u1_num_ref_frames)
- num_entries *= 16;
- else
- num_entries *= 16 * 2;
+ num_entries *= 16 * 2;
size = sizeof(pred_info_pkd_t) * num_entries;
pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size);