From a1d76b96cee2a6298ef113c9a5f0b001548d17f2 Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Wed, 2 May 2018 16:15:11 +0800 Subject: [PATCH] [h263d]: Add error check for h263 decoder Hardware only support baseline H.263 stream. The stream with mv_outside_frame flag will be blocky if force hardware decoding. So we do not use hardware to decode this kind of stream. Change-Id: I679f37c1d7f248f89b2338a887d4a1e2dea68bf2 Signed-off-by: Herman Chen --- mpp/codec/dec/h263/h263d_parser.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mpp/codec/dec/h263/h263d_parser.c b/mpp/codec/dec/h263/h263d_parser.c index 00f44cff..790101f3 100644 --- a/mpp/codec/dec/h263/h263d_parser.c +++ b/mpp/codec/dec/h263/h263d_parser.c @@ -162,6 +162,7 @@ static MPP_RET h263_parse_picture_header(H263dParserImpl *p, BitReadCtx_t *gb) /* time reference */ READ_BITS(gb, 8, &hdr_curr->TR); + /* first 5 bit of PTYPE */ SKIP_BITS(gb, 5); /* source format */ @@ -173,10 +174,16 @@ static MPP_RET h263_parse_picture_header(H263dParserImpl *p, BitReadCtx_t *gb) return MPP_NOK; } + /* picture coding type: 0 - INTRA, 1 - INTER */ READ_BITS(gb, 1, &val); pict_type = val; - SKIP_BITS(gb, 4); + /* last 4 bit for PTYPE: UMV, AP mode, PB frame */ + READ_BITS(gb, 4, &val); + if (val) { + mpp_err_f("unsupport PTYPE mode %x\n", val); + return MPP_NOK; + } READ_BITS(gb, 5, &val); hdr_curr->quant = val;