From f15bb32866ccd413090594aa364b54d259099534 Mon Sep 17 00:00:00 2001 From: Hamsalekha S Date: Thu, 22 Jun 2017 17:08:44 +0530 Subject: [PATCH 01/12] Decoder : Fix memory leak when sps changes. ih264d_allocate_dynamic_bufs is now called only once after every ih264d_init_decoder call. This is possible since we support only identical( all the critical parameters will be same) sps in our sps array. Signal resolution change when u1_frame_mbs_only_flag in SPS changes. Bug: 62897300 Test: compilation, boot Change-Id: I0cf71fe9de72b5dadca2d1daf881d821786f94e3 --- decoder/ih264d_parse_headers.c | 6 ++++++ decoder/ih264d_utils.c | 24 +----------------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c index d8c37a6..c8a7954 100644 --- a/decoder/ih264d_parse_headers.c +++ b/decoder/ih264d_parse_headers.c @@ -791,6 +791,12 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm) u1_level_idc, ps_seq->u2_total_num_of_mbs); u1_frm = ih264d_get_bit_h264(ps_bitstrm); + if((ps_dec->i4_header_decoded & 1) && (ps_seq->u1_frame_mbs_only_flag != u1_frm)) + { + ps_dec->u1_res_changed = 1; + return IVD_RES_CHANGED; + } + ps_seq->u1_frame_mbs_only_flag = u1_frm; COPYTHECONTEXT("SPS: frame_mbs_only_flag", u1_frm); diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c index 4437832..31b3e8c 100644 --- a/decoder/ih264d_utils.c +++ b/decoder/ih264d_utils.c @@ -641,27 +641,6 @@ WORD32 ih264d_get_dpb_size(dec_seq_params_t *ps_seq) return (i4_size); } -/***************************************************************************/ -/* If change in Level or the required PicBuffers i4_size is more than the */ -/* current one FREE the current PicBuffers and allocate affresh */ -/***************************************************************************/ -UWORD8 ih264d_is_sps_changed(prev_seq_params_t * ps_prv, - dec_seq_params_t * ps_cur) -{ - - if((ps_prv->u2_frm_wd_in_mbs != ps_cur->u2_frm_wd_in_mbs) - || (ps_prv->u1_level_idc != ps_cur->u1_level_idc) - || (ps_prv->u1_profile_idc != ps_cur->u1_profile_idc) - || (ps_cur->u2_frm_ht_in_mbs != ps_prv->u2_frm_ht_in_mbs) - || (ps_cur->u1_frame_mbs_only_flag - != ps_prv->u1_frame_mbs_only_flag) - || (ps_cur->u1_direct_8x8_inference_flag - != ps_prv->u1_direct_8x8_inference_flag)) - return 1; - - return 0; -} - /**************************************************************************/ /* This function initialises the value of ps_dec->u1_recon_mb_grp */ /* ps_dec->u1_recon_mb_grp must satisfy the following criteria */ @@ -747,8 +726,7 @@ WORD32 ih264d_init_pic(dec_struct_t *ps_dec, /* If change in Level or the required PicBuffers i4_size is more than the */ /* current one FREE the current PicBuffers and allocate affresh */ /***************************************************************************/ - if(!ps_dec->u1_init_dec_flag - || ih264d_is_sps_changed(ps_prev_seq_params, ps_seq)) + if(!ps_dec->u1_init_dec_flag) { ps_dec->u1_max_dec_frame_buffering = ih264d_get_dpb_size(ps_seq); From 4bd04b1b0c7085b1eb735b5aa225a53aeb1ad33a Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Mon, 7 Aug 2017 13:14:45 +0900 Subject: [PATCH 02/12] Make software codecs as VNDK Software codecs and their dependencies are marked as VNDK (or just vendor_available:true for static/header libs). Bug: 37343418 Test: build the software codecs with BOARD_VNDK_VERSION=current Change-Id: I84a07188fda0e89e422caee634cb12ec82568028 --- Android.bp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Android.bp b/Android.bp index ac7d304..464f768 100644 --- a/Android.bp +++ b/Android.bp @@ -1,5 +1,7 @@ cc_library_static { name: "libavcdec", + vendor_available: true, + shared_libs: ["liblog", "libcutils",], cflags: [ "-fPIC", @@ -230,6 +232,8 @@ cc_library_static { cc_library_static { name: "libavcenc", + vendor_available: true, + shared_libs: ["liblog", "libcutils",], cflags: [ "-DNDEBUG", From aa11ab9fdbb63766703a6280f4fc778f2f2c91ed Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Fri, 16 Jun 2017 15:37:48 +0530 Subject: [PATCH 03/12] Added an out of bound check on u4_num_bufs in input argument ps_dec_ip->s_out_buffer.u4_num_bufs was missing out of bound checks Bug: 62688399 Change-Id: Ic5e5c002d29fcb18064550d5a5f9289bb68b448e --- decoder/ih264d_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index f244f4c..93d6002 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -2754,7 +2754,8 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) && ps_dec->i4_decode_header == 0) { UWORD32 i; - if(ps_dec->ps_out_buffer->u4_num_bufs == 0) + if((ps_dec->ps_out_buffer->u4_num_bufs == 0) || + (ps_dec->ps_out_buffer->u4_num_bufs > IVD_VIDDEC_MAX_IO_BUFFERS)) { ps_dec_op->u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM; ps_dec_op->u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUFS; From 5df744afde273bc4d0f7a499581dd2fb2ae6cb45 Mon Sep 17 00:00:00 2001 From: Hamsalekha S Date: Thu, 22 Jun 2017 16:55:28 +0530 Subject: [PATCH 04/12] Decoder: Conceal picture only if valid picture buffer is obtained. If all the slices in the current pic were invalid, then the decoder would not have received a valid picture buffer in the current call. In such cases there is no need to conceal or deblock the picture. Bug: 62896384 Test: run ASAN-enabled PoC before/after the patch Change-Id: I3cf6e871592826f93b0dcd2b06fff80677bc8338 --- decoder/ih264d_api.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index b6288b4..b34b6f5 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -2206,7 +2206,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) } while(( header_data_left == 1)||(frame_data_left == 1)); - if((ps_dec->u4_slice_start_code_found == 1) + if((ps_dec->u4_pic_buf_got == 1) && (ret != IVD_MEM_ALLOC_FAILED) && ps_dec->u2_total_mbs_coded < ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) { @@ -2348,7 +2348,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) } - if((ps_dec->u4_slice_start_code_found == 1) + if((ps_dec->u4_pic_buf_got == 1) && (ERROR_DANGLING_FIELD_IN_PIC != i4_err_status)) { /* @@ -2374,8 +2374,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) /* if new frame in not found (if we are still getting slices from previous frame) * ih264d_deblock_display is not called. Such frames will not be added to reference /display */ - if (((ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) == 0) - && (ps_dec->u4_pic_buf_got == 1)) + if ((ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) == 0) { /* Calling Function to deblock Picture and Display */ ret = ih264d_deblock_display(ps_dec); From 8a7f15c3d40ee9eebed26c2bc2b1e4f2fd2875cd Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Thu, 24 Aug 2017 17:19:29 -0700 Subject: [PATCH 05/12] support 4K max dimension This is required for handling 4K thumbnails that may be rotated. Bug: 64939294 Change-Id: Ia33d8e1ce7fb07b5ec6bf604d30cd8f75c3228ae --- decoder/ih264d_defs.h | 5 +++-- decoder/ih264d_parse_headers.c | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/decoder/ih264d_defs.h b/decoder/ih264d_defs.h index 0682339..3dd5508 100644 --- a/decoder/ih264d_defs.h +++ b/decoder/ih264d_defs.h @@ -34,8 +34,9 @@ * ************************************************************************ */ -#define H264_MAX_FRAME_WIDTH 3840 -#define H264_MAX_FRAME_HEIGHT 2176 +#define H264_MAX_FRAME_WIDTH 4096 +#define H264_MAX_FRAME_HEIGHT 4096 +#define H264_MAX_FRAME_SIZE (4096 * 2048) #define H264_MIN_FRAME_WIDTH 16 #define H264_MIN_FRAME_HEIGHT 16 diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c index c8a7954..4f3136f 100644 --- a/decoder/ih264d_parse_headers.c +++ b/decoder/ih264d_parse_headers.c @@ -917,7 +917,9 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm) } /* Check for unsupported resolutions */ - if((u2_pic_wd > H264_MAX_FRAME_WIDTH) || (u2_pic_ht > H264_MAX_FRAME_HEIGHT)) + if((u2_pic_wd > H264_MAX_FRAME_WIDTH) || (u2_pic_ht > H264_MAX_FRAME_HEIGHT) + || (u2_pic_wd < H264_MIN_FRAME_WIDTH) || (u2_pic_ht < H264_MIN_FRAME_HEIGHT) + || (u2_pic_wd * (UWORD32)u2_pic_ht > H264_MAX_FRAME_SIZE)) { return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED; } From 45aa4ac86d72a1783eb6d54bdf4b3a58fa1da08d Mon Sep 17 00:00:00 2001 From: Ray Essick Date: Wed, 6 Sep 2017 15:26:09 -0700 Subject: [PATCH 06/12] DO NOT MERGE: Decoder: Conceal picture only if valid picture buffer is obtained. If all the slices in the current pic were invalid, then the decoder would not have received a valid picture buffer in the current call. In such cases there is no need to conceal or deblock the picture. Bug: 62896384 Test: run ASAN-enabled PoC before/after the patch Change-Id: Ia7d979a78ae3f4fb443a1759c8e6cf8780565ad8 Merged-In: I3cf6e871592826f93b0dcd2b06fff80677bc8338 --- decoder/ih264d_api.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index f244f4c..b46767a 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -3191,7 +3191,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) } while(( header_data_left == 1)||(frame_data_left == 1)); - if((ps_dec->u4_slice_start_code_found == 1) + if((ps_dec->u4_pic_buf_got == 1) && ps_dec->u2_total_mbs_coded < ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) { // last slice - missing/corruption @@ -3332,7 +3332,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) } - if((ps_dec->u4_slice_start_code_found == 1) + if((ps_dec->u4_pic_buf_got == 1) && (ERROR_DANGLING_FIELD_IN_PIC != i4_err_status)) { /* @@ -3358,8 +3358,7 @@ WORD32 ih264d_video_decode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) /* if new frame in not found (if we are still getting slices from previous frame) * ih264d_deblock_display is not called. Such frames will not be added to reference /display */ - if (((ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) == 0) - && (ps_dec->u4_pic_buf_got == 1)) + if ((ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) == 0) { /* Calling Function to deblock Picture and Display */ ret = ih264d_deblock_display(ps_dec); From 09c8cb1b30d7b3a4de90a5a13fe54393c878f43c Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Fri, 8 Sep 2017 12:41:15 -0700 Subject: [PATCH 07/12] support 4080 max dimension 4096 is 256 macroblocks which does not fit on 8-bits, and 8-bits are used for some variables that contain the size. Bug: 65438670 Change-Id: Id977303054841c458cbd21c1538a9035d178fbef --- decoder/ih264d_defs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/decoder/ih264d_defs.h b/decoder/ih264d_defs.h index 3dd5508..4622775 100644 --- a/decoder/ih264d_defs.h +++ b/decoder/ih264d_defs.h @@ -34,8 +34,8 @@ * ************************************************************************ */ -#define H264_MAX_FRAME_WIDTH 4096 -#define H264_MAX_FRAME_HEIGHT 4096 +#define H264_MAX_FRAME_WIDTH 4080 +#define H264_MAX_FRAME_HEIGHT 4080 #define H264_MAX_FRAME_SIZE (4096 * 2048) #define H264_MIN_FRAME_WIDTH 16 From 3eb692de916c3576a18990e3e4193fce93c016dc Mon Sep 17 00:00:00 2001 From: Hamsalekha S Date: Fri, 8 Sep 2017 13:52:05 +0530 Subject: [PATCH 08/12] Decoder: Corrected variable datatypes in ih264d_get_implicit_weights. The difference between two 32 signed numbers was getting assigned to 16 bits, leading to a divide by zero arithmetic execption. Modified variable names to match their datatypes. Bug: 65122447 Change-Id: I45ade1945f10b4d7660bd09fb564e60fd29d40dc --- decoder/ih264d_parse_bslice.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/decoder/ih264d_parse_bslice.c b/decoder/ih264d_parse_bslice.c index 443dec2..1a3d0e8 100644 --- a/decoder/ih264d_parse_bslice.c +++ b/decoder/ih264d_parse_bslice.c @@ -1197,7 +1197,8 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) struct pic_buffer_t *ps_pic_buff0, *ps_pic_buff1; WORD16 i2_dist_scale_factor; WORD16 i16_tb, i16_td, i16_tx; - UWORD32 u4_poc0, u4_poc1; + WORD32 i4_tb, i4_td; + WORD32 i4_poc0, i4_poc1; UWORD32 ui_temp0, ui_temp1; UWORD8 uc_num_ref_idx_l0_active, uc_num_ref_idx_l1_active; @@ -1210,18 +1211,18 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) for(i = 0; i < uc_num_ref_idx_l0_active; i++) { ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][i]; - u4_poc0 = ps_pic_buff0->i4_avg_poc; + i4_poc0 = ps_pic_buff0->i4_avg_poc; for(j = 0; j < uc_num_ref_idx_l1_active; j++) { ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][j]; - u4_poc1 = ps_pic_buff1->i4_avg_poc; + i4_poc1 = ps_pic_buff1->i4_avg_poc; - if(u4_poc1 != u4_poc0) + if(i4_poc1 != i4_poc0) { - i16_tb = ps_dec->ps_cur_pic->i4_poc - u4_poc0; - i16_tb = CLIP3(-128, 127, i16_tb); - i16_td = u4_poc1 - u4_poc0; - i16_td = CLIP3(-128, 127, i16_td); + i4_tb = ps_dec->ps_cur_pic->i4_poc - i4_poc0; + i16_tb = CLIP3(-128, 127, i4_tb); + i4_td = i4_poc1 - i4_poc0; + i16_td = CLIP3(-128, 127, i4_td); i16_tx = (16384 + ABS(SIGN_POW2_DIV(i16_td, 1))) / i16_td; i2_dist_scale_factor = CLIP3(-1024, 1023, (((i16_tb * i16_tx) + 32) >> 6)); @@ -1272,7 +1273,7 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) u2_l0_idx += MAX_REF_BUFS; } ps_pic_buff0 = ps_dec->ps_ref_pic_buf_lx[0][u2_l0_idx]; - u4_poc0 = ps_pic_buff0->i4_poc; + i4_poc0 = ps_pic_buff0->i4_poc; for(j = 0; j < (uc_num_ref_idx_l1_active << 1); j++) { UWORD16 u2_l1_idx; @@ -1285,13 +1286,13 @@ void ih264d_get_implicit_weights(dec_struct_t *ps_dec) u2_l1_idx += MAX_REF_BUFS; } ps_pic_buff1 = ps_dec->ps_ref_pic_buf_lx[1][u2_l1_idx]; - u4_poc1 = ps_pic_buff1->i4_poc; - if(u4_poc1 != u4_poc0) + i4_poc1 = ps_pic_buff1->i4_poc; + if(i4_poc1 != i4_poc0) { - i16_tb = i4_cur_poc - u4_poc0; - i16_tb = CLIP3(-128, 127, i16_tb); - i16_td = u4_poc1 - u4_poc0; - i16_td = CLIP3(-128, 127, i16_td); + i4_tb = i4_cur_poc - i4_poc0; + i16_tb = CLIP3(-128, 127, i4_tb); + i4_td = i4_poc1 - i4_poc0; + i16_td = CLIP3(-128, 127, i4_td); i16_tx = (16384 + ABS(SIGN_POW2_DIV(i16_td, 1))) / i16_td; i2_dist_scale_factor = CLIP3( From 208c74d62a3e1039dc87818306e057877760fbaa Mon Sep 17 00:00:00 2001 From: Hamsalekha S Date: Fri, 8 Sep 2017 14:22:22 +0530 Subject: [PATCH 09/12] Decoder: Updated error check while parsing num_ref_idx_lx_active. Added an error check on the lower limit of u1_num_ref_idx_lx_active, while parsing slice header. The minimum possible value is 1. Bug: 64836894 Change-Id: I57056851fc135ed00f7a10af5c81eb560e9e12de --- decoder/ih264d_parse_bslice.c | 3 ++- decoder/ih264d_parse_pslice.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/decoder/ih264d_parse_bslice.c b/decoder/ih264d_parse_bslice.c index 443dec2..f2a1b01 100644 --- a/decoder/ih264d_parse_bslice.c +++ b/decoder/ih264d_parse_bslice.c @@ -1398,7 +1398,8 @@ WORD32 ih264d_parse_bslice(dec_struct_t * ps_dec, UWORD16 u2_first_mb_in_slice) { u1_max_ref_idx = MAX_FRAMES << 1; } - if((u4_temp > u1_max_ref_idx) || (ui_temp1 > u1_max_ref_idx)) + if((u4_temp > u1_max_ref_idx) || (ui_temp1 > u1_max_ref_idx) + || (u4_temp < 1) || (ui_temp1 < 1)) { return ERROR_NUM_REF; } diff --git a/decoder/ih264d_parse_pslice.c b/decoder/ih264d_parse_pslice.c index db71b6a..c6ce916 100644 --- a/decoder/ih264d_parse_pslice.c +++ b/decoder/ih264d_parse_pslice.c @@ -1957,7 +1957,7 @@ WORD32 ih264d_parse_pslice(dec_struct_t *ps_dec, UWORD16 u2_first_mb_in_slice) UWORD8 u1_max_ref_idx = MAX_FRAMES << u1_field_pic_flag; - if(u4_temp > u1_max_ref_idx) + if(u4_temp > u1_max_ref_idx || u4_temp < 1) { return ERROR_NUM_REF; } From 252628cffba8702e36b98c193bcd2fe67d8237ee Mon Sep 17 00:00:00 2001 From: Hamsalekha S Date: Tue, 1 Aug 2017 14:51:55 +0530 Subject: [PATCH 10/12] Decoder: Fixed hang in the case of dangling field The u1_top_bottom_decoded flag in the decoder context has been fixed to be updated correctly in the case of dangling field Bug: 63315932 Test: ran POC after patching Change-Id: I8db4ebeb94fba735ba45f365c37e52a202ea84cd --- decoder/ih264d_parse_slice.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/decoder/ih264d_parse_slice.c b/decoder/ih264d_parse_slice.c index 1dfd11f..6b3cb65 100644 --- a/decoder/ih264d_parse_slice.c +++ b/decoder/ih264d_parse_slice.c @@ -1396,9 +1396,8 @@ WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice, if(ps_dec->u1_dangling_field == 1) { ps_dec->u1_second_field = 1 - ps_dec->u1_second_field; - ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag; - ps_dec->u2_prv_frame_num = u2_frame_num; ps_dec->u1_first_slice_in_stream = 0; + ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY; return ERROR_DANGLING_FIELD_IN_PIC; } From ed7a63fbcc157acb68d7ac127c94ff03fb6ee2d4 Mon Sep 17 00:00:00 2001 From: Ritu Baldwa Date: Wed, 20 Sep 2017 11:28:55 +0530 Subject: [PATCH 11/12] DO NOT MERGE Decoder: Increased memory allocation. ps_dec->u1_recon_mb_grp is twice the width in case of mbaff, increasing relevant allocations accordingly. Increased allocation of intra-prediction buffer to include padding. Bug: 64964675 Test: POC from bug report Change-Id: Ic4a6151bb12ac1122c228220b9150b2a372aae21 --- decoder/ih264d_api.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index 118de0d..140aa96 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -2197,9 +2197,10 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op) u4_mem_size = ALIGN64(u4_mem_size); u4_mem_size += sizeof(UWORD8) * (MB_LUM_SIZE); u4_mem_size = ALIGN64(u4_mem_size); - u4_mem_size += sizeof(parse_pmbarams_t) * luma_width_in_mbs; //Max recon mb group*/ + u4_mem_size += sizeof(parse_pmbarams_t) * luma_width_in_mbs * 2; /*Max recon mb group*/ u4_mem_size = ALIGN64(u4_mem_size); - u4_mem_size += (sizeof(parse_part_params_t) * luma_width_in_mbs) << 4; //Max recon mb group*/ + u4_mem_size += (sizeof(parse_part_params_t) * luma_width_in_mbs * 2) + << 4; /*Max recon mb group*/ u4_mem_size = ALIGN64(u4_mem_size); u4_mem_size += 2 * MAX_REF_BUFS * sizeof(struct pic_buffer_t); @@ -2224,7 +2225,7 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op) UWORD32 u4_mem_used; UWORD32 u4_numRows = MB_SIZE << 1; - UWORD32 u4_blk_wd = ((luma_width_in_mbs << 4) >> 1) + 8; + UWORD32 u4_blk_wd = (((luma_width_in_mbs * 2) << 4) >> 1) + 8; u4_mem_used = 0; u4_mem_used += ((luma_width_in_mbs * sizeof(deblkmb_neighbour_t)) << 1); @@ -2235,11 +2236,11 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op) * (((luma_width_in_mbs + 1) << 1) + 1)); u4_mem_used = ALIGN64(u4_mem_used); - u4_mem_used += (sizeof(mv_pred_t) * luma_width_in_mbs * 16); + u4_mem_used += (sizeof(mv_pred_t) * luma_width_in_mbs * 2 * 16); u4_mem_used = ALIGN64(u4_mem_used); - u4_mem_used += (sizeof(mv_pred_t) * luma_width_in_mbs * 16); + u4_mem_used += (sizeof(mv_pred_t) * luma_width_in_mbs * 2 * 16); u4_mem_used = ALIGN64(u4_mem_used); - u4_mem_used += (sizeof(mv_pred_t) * luma_width_in_mbs * 4 + u4_mem_used += (sizeof(mv_pred_t) * luma_width_in_mbs * 2 * 4 * MV_SCRATCH_BUFS); u4_mem_used = ALIGN64(u4_mem_used); u4_mem_used += sizeof(UWORD8) * u4_numRows * u4_blk_wd; @@ -2248,7 +2249,7 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op) u4_mem_used = ALIGN64(u4_mem_used); u4_numRows = BLK8x8SIZE << 1; - u4_blk_wd = ((luma_width_in_mbs << 3) >> 1) + 8; + u4_blk_wd = (((luma_width_in_mbs * 2) << 3) >> 1) + 8; u4_mem_used += sizeof(UWORD8) * u4_numRows * u4_blk_wd; u4_mem_used = ALIGN64(u4_mem_used); @@ -2267,11 +2268,11 @@ WORD32 ih264d_fill_num_mem_rec(void *pv_api_ip, void *pv_api_op) u4_mem_used = ALIGN64(u4_mem_used); u4_mem_used += sizeof(mb_neigbour_params_t) * (luma_width_in_mbs + 1) * luma_height_in_mbs; - u4_mem_used += luma_width; + u4_mem_used += luma_width + (PAD_LEN_Y_H << 1); u4_mem_used = ALIGN64(u4_mem_used); - u4_mem_used += luma_width; + u4_mem_used += luma_width + (PAD_LEN_UV_H << 2); u4_mem_used = ALIGN64(u4_mem_used); - u4_mem_used += luma_width; + u4_mem_used += luma_width + (PAD_LEN_UV_H << 2); u4_mem_used = ALIGN64(u4_mem_used); u4_mem_used += ((MB_SIZE + 4) << 1) * PAD_LEN_Y_H; From 1541dcc79cfd648a64e27735e4d6c7d2b1e4d345 Mon Sep 17 00:00:00 2001 From: Ritu Baldwa Date: Thu, 21 Sep 2017 14:21:33 +0530 Subject: [PATCH 12/12] DO NOT MERGE Decoder: Modified setting of error code in set flush api. Fixed incorrect use of ps_dec->pv_dec_out to set error code. Bug: 66372937 Test: at vendor Merged-In: Ib04e0b15573b2482c9d5b43c8bc7dd30d8f8efdd Change-Id: I7b66ee010089399c050a75d6d67feb03da0b8b3e --- decoder/ih264d_api.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index 118de0d..7cf3f6b 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -3713,7 +3713,6 @@ WORD32 ih264d_set_flush_mode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op dec_struct_t * ps_dec; ivd_ctl_flush_op_t *ps_ctl_op = (ivd_ctl_flush_op_t*)pv_api_op; - ps_ctl_op->u4_error_code = 0; ps_dec = (dec_struct_t *)(dec_hdl->pv_codec_handle); UNUSED(pv_api_ip); @@ -3729,8 +3728,7 @@ WORD32 ih264d_set_flush_mode(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op ih264d_release_display_bufs(ps_dec); } - ps_ctl_op->u4_error_code = - ((ivd_ctl_flush_op_t*)ps_dec->pv_dec_out)->u4_error_code; //verify the value + ps_ctl_op->u4_error_code = 0; return IV_SUCCESS;