summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-01-18 22:44:17 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-01-18 22:44:17 +0000
commit81d2ac706fc04de2d2a4123b7f75494540947947 (patch)
tree434d09f5d9401963be9f298ae5f2b024481d6f5c
parentcd1f8ac4769a1a45479003339484a5d521301c4c (diff)
parenta6db459ae63e32a20ada2aab6ac5c13bf5d7efcd (diff)
downloadandroid_external_libavc-81d2ac706fc04de2d2a4123b7f75494540947947.tar.gz
android_external_libavc-81d2ac706fc04de2d2a4123b7f75494540947947.tar.bz2
android_external_libavc-81d2ac706fc04de2d2a4123b7f75494540947947.zip
Merge cherrypicks of [3478238, 3478653, 3478239, 3478580, 3478612, 3478240, 3478654, 3478655, 3478656, 3479494, 3479495, 3478933, 3478934, 3479496, 3479497, 3479498, 3478160, 3478161, 3478162, 3478876, 3478877, 3478878, 3478241, 3478163, 3478164, 3478165, 3478166, 3478167, 3478168, 3478169, 3479990, 3479991, 3479992, 3480010, 3480011, 3480012] into oc-m2-release
Change-Id: I8c38068be410e0733acf7b47e7b72eecc94ad463
-rw-r--r--decoder/ih264d_api.c65
-rw-r--r--decoder/ih264d_utils.c7
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);
+
}
}
}