From 9d60a0c5da96c4bbbad11266f4d88133284836b4 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Tue, 6 Oct 2015 09:03:25 +0530 Subject: [PATCH 1/2] Decoder: Added a check for unsupported resolutions Decoder now returns an error for resolutions greater than 3840x2176 Bug: 24542936 Change-Id: I38be0e4c5cf2a980bfd4c781f3b49171f73b5ccb --- decoder/ih264d_parse_headers.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c index 7b0bdcb..3116d16 100644 --- a/decoder/ih264d_parse_headers.c +++ b/decoder/ih264d_parse_headers.c @@ -933,6 +933,12 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm) return IVD_RES_CHANGED; } + /* Check for unsupported resolutions */ + if((u2_pic_wd > H264_MAX_FRAME_WIDTH) || (u2_pic_ht > H264_MAX_FRAME_HEIGHT)) + { + return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED; + } + ps_dec->u2_disp_height = i4_cropped_ht; ps_dec->u2_disp_width = i4_cropped_wd; From 69b5191865a9395947dfc70c00bf8824eb33b8c1 Mon Sep 17 00:00:00 2001 From: Harish Mahendrakar Date: Tue, 17 Jan 2017 13:13:41 +0530 Subject: [PATCH 2/2] Decoder: Add supported width check for MBaff streams In case of MBAff streams, decoder processes two rows at a time, this limits maximum supported width to 1920 for MBAff streams. Bug: 33818508 Bug: 34013472 Change-Id: Iec2941f116cf3c36b63013a930319960023a3b42 --- decoder/ih264d_parse_headers.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/decoder/ih264d_parse_headers.c b/decoder/ih264d_parse_headers.c index 3116d16..622eb26 100644 --- a/decoder/ih264d_parse_headers.c +++ b/decoder/ih264d_parse_headers.c @@ -939,6 +939,15 @@ WORD32 ih264d_parse_sps(dec_struct_t *ps_dec, dec_bit_stream_t *ps_bitstrm) return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED; } + /* If MBAff is enabled, decoder support is limited to streams with + * width less than half of H264_MAX_FRAME_WIDTH. + * In case of MBAff decoder processes two rows at a time + */ + if((u2_pic_wd << ps_seq->u1_mb_aff_flag) > H264_MAX_FRAME_WIDTH) + { + return IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED; + } + ps_dec->u2_disp_height = i4_cropped_ht; ps_dec->u2_disp_width = i4_cropped_wd;