Adding check for min_width and min_height
Add check for min_wd and min_ht. Stride is updated if header
decode is done.
Bug: 74078669
Change-Id: Ided95395e1138335dbb4b05131a8551f6f7bbfcd
(cherry picked from commit 84eba4863dd50083951db83ea3cc81e015bf51da)
diff --git a/decoder/impeg2d_dec_hdr.c b/decoder/impeg2d_dec_hdr.c
index 6bb0a85..3bd5151 100644
--- a/decoder/impeg2d_dec_hdr.c
+++ b/decoder/impeg2d_dec_hdr.c
@@ -166,10 +166,6 @@
/* This is the first time we are reading the resolution */
ps_dec->u2_horizontal_size = u2_width;
ps_dec->u2_vertical_size = u2_height;
- if (0 == ps_dec->u4_frm_buf_stride)
- {
- ps_dec->u4_frm_buf_stride = (UWORD32) (u2_width);
- }
}
else
{
@@ -192,6 +188,11 @@
return e_error;
}
+ else if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
else
{
/* The resolution has changed */
@@ -209,6 +210,11 @@
return e_error;
}
+ if((ps_dec->u2_horizontal_size < MIN_WIDTH)
+ || (ps_dec->u2_vertical_size < MIN_HEIGHT))
+ {
+ return IMPEG2D_UNSUPPORTED_DIMENSIONS;
+ }
/*------------------------------------------------------------------------*/
/* Flush the following as they are not being used */
diff --git a/decoder/impeg2d_decoder.c b/decoder/impeg2d_decoder.c
index bff8c21..726d9cd 100644
--- a/decoder/impeg2d_decoder.c
+++ b/decoder/impeg2d_decoder.c
@@ -155,6 +155,12 @@
ps_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = ps_ip->s_ivd_video_decode_ip_t.u4_num_Bytes;
}
ps_op->s_ivd_video_decode_op_t.u4_frame_decoded_flag = 0;
+
+ /* Set the stride */
+ if (0 == ps_dec->u4_frm_buf_stride)
+ {
+ ps_dec->u4_frm_buf_stride = ps_dec->u2_horizontal_size;
+ }
/* MOD */
ps_dec->u2_header_done = 1;