[jpegd]: Disable SOF markers but baseline DCT.

Signed-off-by: xueman.ruan <xueman.ruan@rock-chips.com>
Change-Id: I1479fca1722c69b38d09a3c05a21a4fb10ed7e22
This commit is contained in:
xueman.ruan
2022-12-08 11:39:43 +08:00
committed by Herman Chen
parent 2434aa83de
commit c055b55e91
2 changed files with 9 additions and 0 deletions

View File

@@ -780,6 +780,7 @@ static MPP_RET jpegd_decode_frame(JpegdCtx *ctx)
/* nothing to do on SOI */ /* nothing to do on SOI */
syntax->dht_found = 0; syntax->dht_found = 0;
syntax->eoi_found = 0; syntax->eoi_found = 0;
syntax->sof0_found = 0;
syntax->qtable_cnt = 0; syntax->qtable_cnt = 0;
syntax->qtbl_entry = 0; syntax->qtbl_entry = 0;
syntax->htbl_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); For baseline, it should be 8\n", ctx->syntax->sample_precision);
goto fail; goto fail;
} }
syntax->sof0_found = 1;
break; break;
case EOI: case EOI:
syntax->eoi_found = 1; syntax->eoi_found = 1;
@@ -815,6 +818,11 @@ static MPP_RET jpegd_decode_frame(JpegdCtx *ctx)
goto done; goto done;
break; break;
case SOS: 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) { if ((ret = jpegd_decode_sos(ctx)) != MPP_OK) {
mpp_err_f("sos decode error\n"); mpp_err_f("sos decode error\n");
goto fail; goto fail;

View File

@@ -133,6 +133,7 @@ typedef struct JpegdSyntax {
/* 0 - not found; 1 - found */ /* 0 - not found; 1 - found */
RK_U8 dht_found; RK_U8 dht_found;
RK_U8 eoi_found; RK_U8 eoi_found;
RK_U8 sof0_found;
/* amount of quantize tables: 1 or 3 */ /* amount of quantize tables: 1 or 3 */
RK_U8 qtable_cnt; RK_U8 qtable_cnt;