From patchwork Fri Oct 21 20:12:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38894 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp957165pzb; Fri, 21 Oct 2022 13:15:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7McqW1+V9yUxeaQTui/7OW3bERWObmfUB9PGWkLWHQzJpInTrxwHfGqVY7fFzWsNstfQTi X-Received: by 2002:a17:907:980e:b0:78d:b6d5:661e with SMTP id ji14-20020a170907980e00b0078db6d5661emr17241398ejc.46.1666383333787; Fri, 21 Oct 2022 13:15:33 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id gn28-20020a1709070d1c00b0078db6b965c7si21890397ejc.782.2022.10.21.13.15.33; Fri, 21 Oct 2022 13:15:33 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@outlook.com header.s=selector1 header.b=D9t+e85G; arc=fail (body hash mismatch); spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 849D868BF52; Fri, 21 Oct 2022 23:14:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075058.outbound.protection.outlook.com [40.92.75.58]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B49A968BF3B for ; Fri, 21 Oct 2022 23:13:56 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OMWtFUm87GqOqcZv6PRQyOxwzcrkgSRgwfXlJjmUk3S4UmvYrVStni0Ew1jn30EiPVu0M6WBX9/iWTAbGDg2VjA1FcOtuCVsEE79kX860mUP8x19uFpIUqIK6e1Z6xeOihnSWvKG27XwTI+6Jjq+Db2WECh8Ip/LX/3BmIorvWqvvIYSZGSZY6P49x9O+wfbk0CwmnZanm8m639IeiZqdYL6CrM5V46cO/ib5Qy+lxJTyd725fnCIWnBJ73xE2LxNYNx2K3FDbuGQ9RAtjXRXp86yJ1M83kjGI8IR9a1EE7E6isWbLqmr2WBoLlUlhMqbq5xMVj60hmI1Voo5eeV7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0Deyd8wsaIFhFVknxOn9UCpeDILkkCkYUz17I0Hp6bo=; b=VjU5rjzS/T1L/10r/BRzWIOBqwLKaDLE4dKd6KZCA75o/pLtVya/4R2in3GDehksDIUz0KkT5Fe67ZTY9LBxLw/gm9SkdYXB0Q/NPOyfzdm7EkmCwyS02d6oaU7jv7HH1EDqB9y3oxvgWLGhYFQXAQ3iaBeoHlN10k0NsN8E4cGlN/koCnnbIsFWcEIhFwG6OVbfcuRy8sus7tpWC21Dv2A/+ikHv4C4/RApRQcjnLTocrdBIlDjcLoBxKjWTwQfC7usrnQiZmcwwojC9ESbSOBmX4sTpxGTNFFtdlhiuHG/JWafIR2amxDzygaZVz8V0J9sPWIL39nV1HbPyRIimw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0Deyd8wsaIFhFVknxOn9UCpeDILkkCkYUz17I0Hp6bo=; b=D9t+e85GbtHRheHJ1t8X/2HOSGKBaEBZ0Q1htH2K/wya/tYzrnG8wEsuKg79+xz6OE1cOAfKll/YfAuscmb4O1z+hd8gkE634wFlTxWfVMQLzEpJR2tPNGoMPVJ4NPCuAEziM4BFs8qNi9ReswNnlvIeKw1zT86iARN410SkyPZJR1kQUZqZlmo5LHxQHueirG9EU/6hbtd0CWwXcDfqmbHm+EsW/T7EKCrYEpTFX5DaDepUb4gxc3oaAoM+ylguLsrGLd3b1DI1N2sGL9+57zGqXUvTqko2qNZZMR0Dyvq1D5s++V2qfuqgOT8s3pkQcdpxoiRzPdhZrLm02RkIAw== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DB4P250MB1007.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:3f1::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Fri, 21 Oct 2022 20:13:51 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Fri, 21 Oct 2022 20:13:51 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 21 Oct 2022 22:12:53 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [kNdHOQJNS5wlwenAh2BAmbgQqondMfGaSqHr+yrMllM=] X-ClientProxiedBy: AM5PR0101CA0027.eurprd01.prod.exchangelabs.com (2603:10a6:206:16::40) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221021201300.3565913-16-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DB4P250MB1007:EE_ X-MS-Office365-Filtering-Correlation-Id: d7d407c1-0113-42a7-de3d-08dab3a0c54f X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3nnHDnbJ910YUAai4EXr73266XZnnKr8kwpin7mcA6O29w20ZknCt0ETmtnLGY7nn8LblMO67plIA+sf9YVNhtlFl2Mu3pPVbQsPP2p1Kzzgzlg2le9VC3pWuzgEKFF1vVrzlH8JdL9TD1ItQ/9XM5S1efc+1DCiAgHmt4OU7upgRCt/i7rl+QjdgUuTlvJwHN5I33Ajg9Mg79Z5UwWwSPhcxOxr3MJd5dHkiChrCIc8pLxwFTls0cdFdOfYuXZQ/CNuuUwqCgt/5/qKWwXyiKL0ynol/ohzeGKdtrEz+orAO9oWFQpH7l42ZU/uyeK/clpyuzQXKkFpPJVRL03BTQ2gUwXv+WVa8UZ8SqcsQ+sVvxjqas4vJLPROzjg2pBDo68Huwi45SsmzRAaWGcBnrydiOUwe5+n94EaT+Uy3XOW7VP3OzlLFhKodbpLhdsX7AXhae4XcRGzRWzuMsRxpZT98wrSWjD2+MseJa9Fbch9Ndus7EY+rrxoCd0OO/e2JRkK/AspopOEOW1ve2MT9FCDkwi3Z2LYwhyZ6E2P1kw+Po9g5cD+Exmv7z2tV6518WkjShz1Uc/O0DCtsI9BBb33V8EU9R4csXOO6HXuq3LLj57id85V6i8v09+p8pNumnvnW4kAfVoHJ2ZhC4dK0LssvA1SGDEifNo0vvZeEW9n10d+rH4wOKQGtF6uiC87BixQ85aH3vZR0+EERc2+4UbDw1sbZx8lIXZ4x0ekh2uWynP7pI0L+yk5cBpt2St7HnqYwcbFa0/qTEXAC+3mKX2 X-Microsoft-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m9 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: d7d407c1-0113-42a7-de3d-08dab3a0c54f X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2022 20:13:51.4549 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB4P250MB1007 Subject: [FFmpeg-devel] [PATCH v2 17/24] avcodec/mjpegdec: Only keep what is used from ScanTable X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: SMg6CRaRZkej Namely ScanTable.permutated. Signed-off-by: Andreas Rheinhardt --- libavcodec/mjpegdec.c | 16 ++++++++-------- libavcodec/mjpegdec.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 3374ae71bd..9b7465abe7 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -115,8 +115,8 @@ static void init_idct(AVCodecContext *avctx) MJpegDecodeContext *s = avctx->priv_data; ff_idctdsp_init(&s->idsp, avctx); - ff_init_scantable(s->idsp.idct_permutation, &s->scantable, - ff_zigzag_direct); + ff_permute_scantable(s->permutated_scantable, ff_zigzag_direct, + s->idsp.idct_permutation); } av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx) @@ -846,7 +846,7 @@ static int decode_block(MJpegDecodeContext *s, int16_t *block, int component, av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return AVERROR_INVALIDDATA; } - j = s->scantable.permutated[i]; + j = s->permutated_scantable[i]; block[j] = level * quant_matrix[i]; } } while (i < 63); @@ -909,14 +909,14 @@ static int decode_block_progressive(MJpegDecodeContext *s, int16_t *block, if (i >= se) { if (i == se) { - j = s->scantable.permutated[se]; + j = s->permutated_scantable[se]; block[j] = level * (quant_matrix[se] << Al); break; } av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return AVERROR_INVALIDDATA; } - j = s->scantable.permutated[i]; + j = s->permutated_scantable[i]; block[j] = level * (quant_matrix[i] << Al); } else { if (run == 0xF) {// ZRL - skip 15 coefficients @@ -964,7 +964,7 @@ for (; ; i++) { \ } \ break; \ } \ - j = s->scantable.permutated[i]; \ + j = s->permutated_scantable[i]; \ if (block[j]) \ REFINE_BIT(j) \ else if (run-- == 0) \ @@ -994,7 +994,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block, val = SHOW_UBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); ZERO_RUN; - j = s->scantable.permutated[i]; + j = s->permutated_scantable[i]; val--; block[j] = ((quant_matrix[i] << Al) ^ val) - val; if (i == se) { @@ -1026,7 +1026,7 @@ static int decode_block_refinement(MJpegDecodeContext *s, int16_t *block, } for (; i <= last; i++) { - j = s->scantable.permutated[i]; + j = s->permutated_scantable[i]; if (block[j]) REFINE_BIT(j) } diff --git a/libavcodec/mjpegdec.h b/libavcodec/mjpegdec.h index 648dd714e1..2cb218902c 100644 --- a/libavcodec/mjpegdec.h +++ b/libavcodec/mjpegdec.h @@ -118,7 +118,7 @@ typedef struct MJpegDecodeContext { uint64_t coefs_finished[MAX_COMPONENTS]; ///< bitmask of which coefs have been completely decoded (progressive mode) int palette_index; int force_pal8; - ScanTable scantable; + uint8_t permutated_scantable[64]; BlockDSPContext bdsp; HpelDSPContext hdsp; IDCTDSPContext idsp;