diff --git a/mpp/codec/dec/jpeg/jpegd_parser.c b/mpp/codec/dec/jpeg/jpegd_parser.c index 3834ce77..bb45ac00 100644 --- a/mpp/codec/dec/jpeg/jpegd_parser.c +++ b/mpp/codec/dec/jpeg/jpegd_parser.c @@ -780,6 +780,7 @@ static MPP_RET jpegd_decode_frame(JpegdCtx *ctx) /* nothing to do on SOI */ syntax->dht_found = 0; syntax->eoi_found = 0; + syntax->sof0_found = 0; syntax->qtable_cnt = 0; syntax->qtbl_entry = 0; syntax->htbl_entry = 0; @@ -807,6 +808,8 @@ static MPP_RET jpegd_decode_frame(JpegdCtx *ctx) For baseline, it should be 8\n", ctx->syntax->sample_precision); goto fail; } + + syntax->sof0_found = 1; break; case EOI: syntax->eoi_found = 1; @@ -815,6 +818,11 @@ static MPP_RET jpegd_decode_frame(JpegdCtx *ctx) goto done; break; case SOS: + if (!syntax->sof0_found) { + mpp_err_f("Warning: only support baseline type\n"); + goto fail; + } + if ((ret = jpegd_decode_sos(ctx)) != MPP_OK) { mpp_err_f("sos decode error\n"); goto fail; diff --git a/mpp/common/jpegd_syntax.h b/mpp/common/jpegd_syntax.h index a49b15f9..9599a7f9 100644 --- a/mpp/common/jpegd_syntax.h +++ b/mpp/common/jpegd_syntax.h @@ -133,6 +133,7 @@ typedef struct JpegdSyntax { /* 0 - not found; 1 - found */ RK_U8 dht_found; RK_U8 eoi_found; + RK_U8 sof0_found; /* amount of quantize tables: 1 or 3 */ RK_U8 qtable_cnt;