aboutsummaryrefslogtreecommitdiff
path: root/decoder/ih264d_parse_headers.c
diff options
context:
space:
mode:
authorHarish Mahendrakar <harish.mahendrakar@ittiam.com>2015-08-04 09:55:15 +0530
committerRachad Alao <rachad@google.com>2015-09-23 18:35:27 +0000
commit251b007eccf5a0ddac897ce27de88d3901bc5d00 (patch)
treeaed2bbcfabe3895b38492754a28fcc0ffcda7938 /decoder/ih264d_parse_headers.c
parent2ee0c1bced131ffb06d1b430b08a202cd3a52005 (diff)
downloadlibavc-251b007eccf5a0ddac897ce27de88d3901bc5d00.tar.gz
Decoder: Reduced memory requirements
Memory allocations are now done based on contents of SPS API changed to move allocations inside the library Also changed strlen to strnlen Bug: 24221026 Change-Id: I9130457f564cddb4da7ec6399cc9fe88ee871217
Diffstat (limited to 'decoder/ih264d_parse_headers.c')
-rw-r--r--decoder/ih264d_parse_headers.c91
1 files changed, 4 insertions, 87 deletions
diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c
index 21ebfa8..e97f457 100644
--- a/decoder/ih264d_parse_headers.c
+++ b/decoder/ih264d_parse_headers.c
@@ -567,6 +567,10 @@ 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(NULL == ps_dec->ps_cur_sps)
+ ps_dec->ps_cur_sps = ps_seq;
+
ps_seq->u1_profile_idc = u1_profile_idc;
ps_seq->u1_level_idc = u1_level_idc;
ps_seq->u1_seq_parameter_set_id = u1_seq_parameter_set_id;
@@ -734,12 +738,6 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
return ERROR_NUM_REF;
}
ps_seq->u1_num_ref_frames = u4_temp;
-
- if(ps_seq->u1_num_ref_frames > ps_dec->u4_num_ref_frames_at_init)
- {
- return IH264D_UNSUPPORTED_NUM_REF_FRAMES;
- }
-
COPYTHECONTEXT("SPS: num_ref_frames",ps_seq->u1_num_ref_frames);
ps_seq->u1_gaps_in_frame_num_value_allowed_flag = ih264d_get_bit_h264(
@@ -789,49 +787,6 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
else
ps_seq->u1_mb_aff_flag = 0;
- {
- WORD32 frame_height_in_mbs = (2 - ps_seq->u1_frame_mbs_only_flag)
- * (pic_height_in_map_units_minus1 + 1);
- UWORD32 wdth = (ps_seq->u2_frm_wd_in_mbs) << 4;
- UWORD32 hght = (frame_height_in_mbs) << 4;
-
- if((u2_pic_wd < H264_MIN_FRAME_WIDTH)
- || (u2_pic_wd > ps_dec->u4_width_at_init))
- {
- ivd_video_decode_op_t *ps_out;
- /*set width and height in decode output structure*/
- ps_out = (ivd_video_decode_op_t *)ps_dec->pv_dec_out;
- ps_out->u4_pic_wd = u2_pic_wd;
- ps_out->u4_pic_ht = u2_pic_ht;
-
- return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
- }
-
- if((u2_pic_ht < H264_MIN_FRAME_HEIGHT)
- || (((0 != ps_seq->u1_frame_mbs_only_flag)
- && (u2_pic_ht * u2_pic_wd
- > ps_dec->u4_height_at_init
- * ps_dec->u4_width_at_init))
- || ((0 == ps_seq->u1_frame_mbs_only_flag)
- && (ALIGN32(u2_pic_ht)
- * u2_pic_wd
- > ALIGN32(ps_dec->u4_height_at_init)
- * ps_dec->u4_width_at_init))))
- {
- ivd_video_decode_op_t *ps_out;
- /*set width and height in decode output structure*/
- ps_out = (ivd_video_decode_op_t *)ps_dec->pv_dec_out;
- ps_out->u4_pic_wd = u2_pic_wd;
- ps_out->u4_pic_ht = u2_pic_ht;
-
- return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED;
- }
-
-
-
-
- }
-
ps_seq->u1_direct_8x8_inference_flag = ih264d_get_bit_h264(ps_bitstrm);
COPYTHECONTEXT("SPS: direct_8x8_inference_flag",
@@ -950,44 +905,6 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm)
return ret;
}
- if(ps_dec->u4_level_at_init < u1_level_idc)
- {
- UWORD32 u4_num_pic_bufs_reqd, u4_num_reorder_frames,
- u4_num_mv_bufs_reqd;
- UWORD32 u4_num_pic_bufs_memory, u4_num_mv_bufs_memory;
- UWORD32 u4_num_ref_frames;
-
- u4_num_ref_frames = ps_seq->u1_num_ref_frames;
- if(1 == ps_seq->u1_vui_parameters_present_flag)
- {
- u4_num_reorder_frames = ps_seq->s_vui.u4_num_reorder_frames;
- }
- else
- {
- u4_num_reorder_frames = ps_dec->u4_num_reorder_frames_at_init;
- }
-
- u4_num_pic_bufs_reqd = u4_num_ref_frames + u4_num_reorder_frames + 1;
-
- u4_num_pic_bufs_memory = ih264d_get_numbuf_dpb_bank(ps_dec, u2_frm_wd_y,
- u2_frm_ht_y);
-
- u4_num_mv_bufs_reqd = u4_num_ref_frames + 1;
-
- if(u4_num_mv_bufs_reqd < 2)
- u4_num_mv_bufs_reqd = 2;
-
- u4_num_mv_bufs_memory = ih264d_get_numbuf_mv_bank(ps_dec, u2_pic_wd,
- u2_pic_ht);
-
- if((u4_num_pic_bufs_reqd > u4_num_pic_bufs_memory)
- || (u4_num_mv_bufs_reqd > u4_num_mv_bufs_memory))
- {
- return IH264D_UNSUPPORTED_LEVEL;
- }
-
- }
-
ps_dec->u2_pic_wd = u2_pic_wd;
ps_dec->u2_pic_ht = u2_pic_ht;