diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-18 19:08:40 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-01-18 19:08:40 +0000 |
commit | 12703a2404209f2b079f837c6b94fc37482f53bd (patch) | |
tree | 434d09f5d9401963be9f298ae5f2b024481d6f5c | |
parent | 7c95c8c1c8273af0dc0c3f481f263c2a35650abb (diff) | |
parent | 4b58c8f3db9fdfd64230afac3e790c2053cb9cf7 (diff) | |
download | android_external_libavc-12703a2404209f2b079f837c6b94fc37482f53bd.tar.gz android_external_libavc-12703a2404209f2b079f837c6b94fc37482f53bd.tar.bz2 android_external_libavc-12703a2404209f2b079f837c6b94fc37482f53bd.zip |
Merge cherrypicks of [3478311, 3478390, 3478133, 3478175, 3478391, 3478392, 3478393, 3478134, 3478135, 3478213, 3478214, 3478215, 3478233, 3478234, 3478235, 3478251, 3478252, 3478253, 3478254, 3478394, 3478395, 3478396, 3478397, 3478398, 3478399, 3478400, 3478401, 3478402, 3478403, 3478292, 3478293, 3478312, 3478136, 3477911] into oc-mr1-release
Change-Id: I1dbb4215694209fcf2dee7df2c464468978942fc
-rw-r--r-- | decoder/ih264d_api.c | 65 | ||||
-rw-r--r-- | decoder/ih264d_utils.c | 7 |
2 files changed, 62 insertions, 10 deletions
diff --git a/decoder/ih264d_api.c b/decoder/ih264d_api.c index 804fdb7..c6999a6 100644 --- a/decoder/ih264d_api.c +++ b/decoder/ih264d_api.c @@ -1698,8 +1698,8 @@ WORD32 check_app_out_buf_size(dec_struct_t *ps_dec) } else { - /* In case of shared mode, do not check validity of ps_dec->ps_out_buffer */ - return (IV_SUCCESS); + pic_wd = ps_dec->u2_frm_wd_y; + pic_ht = ps_dec->u2_frm_ht_y; } if(ps_dec->u4_app_disp_width > pic_wd) @@ -1709,14 +1709,34 @@ WORD32 check_app_out_buf_size(dec_struct_t *ps_dec) ps_dec->u1_chroma_format, &au4_min_out_buf_size[0]); - if(ps_dec->ps_out_buffer->u4_num_bufs < u4_min_num_out_bufs) - return IV_FAIL; - for(i = 0; i < u4_min_num_out_bufs; i++) + if(0 == ps_dec->u4_share_disp_buf) { - if(ps_dec->ps_out_buffer->u4_min_out_buf_size[i] - < au4_min_out_buf_size[i]) - return (IV_FAIL); + if(ps_dec->ps_out_buffer->u4_num_bufs < u4_min_num_out_bufs) + return IV_FAIL; + + for(i = 0; i < u4_min_num_out_bufs; i++) + { + if(ps_dec->ps_out_buffer->u4_min_out_buf_size[i] + < au4_min_out_buf_size[i]) + return (IV_FAIL); + } + } + else + { + if(ps_dec->disp_bufs[0].u4_num_bufs < u4_min_num_out_bufs) + return IV_FAIL; + + for(i = 0; i < u4_min_num_out_bufs; i++) + { + /* We need to check only with the disp_buffer[0], because we have + * already ensured that all the buffers are of the same size in + * ih264d_set_display_frame. + */ + if(ps_dec->disp_bufs[0].u4_bufsize[i] < au4_min_out_buf_size[i]) + return (IV_FAIL); + } + } return (IV_SUCCESS); @@ -2666,6 +2686,7 @@ WORD32 ih264d_set_display_frame(iv_obj_t *dec_hdl, void *pv_api_op) { + UWORD32 u4_disp_buf_size[3], u4_num_disp_bufs; ivd_set_display_frame_ip_t *dec_disp_ip; ivd_set_display_frame_op_t *dec_disp_op; @@ -2685,8 +2706,36 @@ WORD32 ih264d_set_display_frame(iv_obj_t *dec_hdl, u4_num_bufs = MIN(u4_num_bufs, MAX_DISP_BUFS_NEW); ps_dec->u4_num_disp_bufs = u4_num_bufs; + + /* Get the number and sizes of the first buffer. Compare this with the + * rest to make sure all the buffers are of the same size. + */ + u4_num_disp_bufs = dec_disp_ip->s_disp_buffer[0].u4_num_bufs; + + u4_disp_buf_size[0] = + dec_disp_ip->s_disp_buffer[0].u4_min_out_buf_size[0]; + u4_disp_buf_size[1] = + dec_disp_ip->s_disp_buffer[0].u4_min_out_buf_size[1]; + u4_disp_buf_size[2] = + dec_disp_ip->s_disp_buffer[0].u4_min_out_buf_size[2]; + for(i = 0; i < u4_num_bufs; i++) { + if(dec_disp_ip->s_disp_buffer[i].u4_num_bufs != u4_num_disp_bufs) + { + return IV_FAIL; + } + + if((dec_disp_ip->s_disp_buffer[i].u4_min_out_buf_size[0] + != u4_disp_buf_size[0]) + || (dec_disp_ip->s_disp_buffer[i].u4_min_out_buf_size[1] + != u4_disp_buf_size[1]) + || (dec_disp_ip->s_disp_buffer[i].u4_min_out_buf_size[2] + != u4_disp_buf_size[2])) + { + return IV_FAIL; + } + ps_dec->disp_bufs[i].u4_num_bufs = dec_disp_ip->s_disp_buffer[i].u4_num_bufs; diff --git a/decoder/ih264d_utils.c b/decoder/ih264d_utils.c index e85daba..edfb8f1 100644 --- a/decoder/ih264d_utils.c +++ b/decoder/ih264d_utils.c @@ -1020,12 +1020,15 @@ WORD32 ih264d_get_next_display_field(dec_struct_t * ps_dec, buf = ps_dec->disp_bufs[i].buf[1]; buf += ps_dec->disp_bufs[i].u4_ofst[1]; pv_disp_op->s_disp_frm_buf.pv_u_buf = buf - + pic_buf->u2_crop_offset_uv; + + (pic_buf->u2_crop_offset_uv + / YUV420SP_FACTOR); buf = ps_dec->disp_bufs[i].buf[2]; buf += ps_dec->disp_bufs[i].u4_ofst[2]; pv_disp_op->s_disp_frm_buf.pv_v_buf = buf - + pic_buf->u2_crop_offset_uv; + + (pic_buf->u2_crop_offset_uv + / YUV420SP_FACTOR); + } } } |