From patchwork Sun Sep 18 14:01:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38000 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp706336pzh; Sun, 18 Sep 2022 07:02:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5AQWzGiXpKGOMH7sZPnuucJZdrQ37TAMWz6U830G9YMPSbDPNfd57Mux2E1iA+mNGIR+KJ X-Received: by 2002:a05:6402:1d8c:b0:44e:dec5:512b with SMTP id dk12-20020a0564021d8c00b0044edec5512bmr11596277edb.408.1663509739465; Sun, 18 Sep 2022 07:02:19 -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 dd11-20020a1709069b8b00b007803b10cc5bsi13668674ejc.614.2022.09.18.07.02.01; Sun, 18 Sep 2022 07:02:19 -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="WCir/SvM"; 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 7DD8268BB08; Sun, 18 Sep 2022 17:01:54 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05olkn2109.outbound.protection.outlook.com [40.92.91.109]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0D87468BACA for ; Sun, 18 Sep 2022 17:01:48 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JLD01XYNdRwvliRhGDBk97z/PvWxh4iBUk8s5UllfwKcxVVJYK2vLKVUEt7HV3gaFDeUvKWuERWut18/nfSJ/2MQthir2Zq6MyLcd12uApK+cIsqgK0QfcR5/WcXSP/QuFBIk3nmP0ytFEhhdXjg3tJU7w6tjnw0wIsvR5VSH2/ciCKe4wCURPmBww3hmrbiwlGCh5e+JHCNkyl7yqN2YmW9SbWr8tUFIh4sHp21l8cXu1/pf9ycHrcvviAatfC0XTZahO3xE79XqvcGFMJO413/HzkMV4bdiJHnZ/naeSgSAn+oaxXBsEPZkZgcIU4p1j/c+CqRZ2eDCWs4EYsGCA== 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=p3KT8B64piFr311t3hqIU6xWd5TawY7U1e4juw3SgoI=; b=gTFxWPpZgMgCLjD+OdVo2RxdvFy1c+x8arXpXYOCo4aspYdbXwbSGEOoYkjdb4zsqy5AZsdvlZ7ULU+byy4F7oBvhlJ/VHJfTXybgYdscsSI315VMBFmWAK5koimrhh/EcQFMjXIWHsoZTdds3crMQbXR3nCu+TBQZ8axpkrDi2IgFoY5KOBoUK7nWc7AyT36f8wacgU/KT/4fQinWmaJOrIzLmYdjF43afNmU+T9wIHjCo6iZzu7cDbDSiYx/Smle+iGOrm/VGD5IUdut0J0ti//XhrifBIuogBVWKZlABGpZx0gv+lB8o0oW3usPLPjgbpN31sXPlHgWWaCPHKYQ== 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=p3KT8B64piFr311t3hqIU6xWd5TawY7U1e4juw3SgoI=; b=WCir/SvM7xRVNTtMUuTUaNZoDMB6xiLwP2Wxg41BhSjS3g59hHFMjeoFz7Ng9ojaq6aXjCsDGsMuIKJ0g95ZRGULqyJozS/ej/5ij7F5nX74g93ADbPzLw6bFO/lnN0kbnAJYrYhTUfebEprfQCyMWbjUMU/qa3/un8Co2yl+bAYoGkHIMcnB/JwrOUIVK3NcAS123PxGoH9SA1WSgD/Jgyz9tGlhMk7jikoZCwmrf8q/T5JsKRSu4McYU8DjwbB32zIIE77hUQppmDufCsi08M4vH0xBP5ivDEeyvZ2NaH5aaXuRMPQfbdWD43rfEcejOAJlbwnFNOEqgayGCkJog== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DB4P250MB0830.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:38d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.17; Sun, 18 Sep 2022 14:01:42 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::f3f2:4362:56:4785]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::f3f2:4362:56:4785%7]) with mapi id 15.20.5632.019; Sun, 18 Sep 2022 14:01:42 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 18 Sep 2022 16:01:32 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [eWPN8FBkq5v2IHSvWQyKqCVWswOSigp54E8Mo71GPhs=] X-ClientProxiedBy: AS9PR06CA0205.eurprd06.prod.outlook.com (2603:10a6:20b:45d::31) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220918140135.1678847-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DB4P250MB0830:EE_ X-MS-Office365-Filtering-Correlation-Id: 871aaae7-2bb6-45a1-b27c-08da997e50af X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3nf+gHZRpQ9KX70v/w8zI6rm79ansa5Cn9mrP0cXBbJ7qn3duuWESOFh0gQmGiB7ZcWi2lHmBtsNAvHFOy/gNQJ+eqcwQOh6bWyHqqBi91Dz0lxpcOUGSc406VMfEGoZvf3Fi4s5lvP39D10jmsyLGuHk0seD4GKdTVfj9ShYfN+r0ARElZB514eTKquuU2787HG0aBmwJZ+n+c3f+abDEzVC4QLuEWOgHRUpuciJsa2nb0CnDw7czTHffyP89UZMZ055v0xNXh3z9uL2HtW6jo4LfO/17nF2si9lYvQE2RZJiAwPbut97drbD5CeX1Q16ICS1wdBGVw8K8dCv5nCJztI3k56PFv3lXKBxG5ZlArujacr+cyzGIwp34UY8GNzMfaJEREa2MnKn3cKY9SeOQybQWZ+BxZ8BWKCQ6CvlxPKfPOuZOm/0RnmRs78Xcnfmn6eoqz7JmKQRwL5ENDEIxeE30y5iRZMlmj822/i2fWYqDlv4YxMofZd3jLX2h/F6qAXaztgvRYB5JF3zqZBdGUiJ44RNY8zE0Tl4iP1fv/ZkYrf1pprr5yqO1TEjnV0TliBBTYcl8DGbhpvE2w8FZOLGtc5q457Hv7LCFLPQhc+RSwqMltsL3/ib0UqW+KF5Amjjc9uBG72tOT9XUWAWb8U1cQTLOidTRTd6l1htICYn9AYY8AqRjDECbVunzzBpkO2ASybmLmGKI5IPwQYeBOW+xeCoPJIxRQw9twIizup5yG2oGl5EuyER8TlGg9uvP5HPsH+7XJsHPaW74tUOE X-Microsoft-Antispam: BCL:0; X-Microso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-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2022 14:01:42.6841 (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: DB4P250MB0830 Subject: [FFmpeg-devel] [PATCH 3/6] avcodec/smc: Move transient GetByteContext from context to stack 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: vKWfZWmPIf2h Signed-off-by: Andreas Rheinhardt --- libavcodec/smc.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/smc.c b/libavcodec/smc.c index e6d01791c2..2b10e74386 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -46,8 +46,6 @@ typedef struct SmcContext { AVCodecContext *avctx; AVFrame *frame; - GetByteContext gb; - /* SMC color tables */ uint8_t color_pairs[COLORS_PER_TABLE * CPAIR]; uint8_t color_quads[COLORS_PER_TABLE * CQUAD]; @@ -75,9 +73,8 @@ typedef struct SmcContext { } \ } -static int smc_decode_stream(SmcContext *s) +static int smc_decode_stream(SmcContext *s, GetByteContext *gb) { - GetByteContext *gb = &s->gb; int width = s->avctx->width; int height = s->avctx->height; int stride = s->frame->linesize[0]; @@ -430,20 +427,20 @@ static int smc_decode_frame(AVCodecContext *avctx, AVFrame *rframe, const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SmcContext *s = avctx->priv_data; + GetByteContext gb; int ret; int total_blocks = ((s->avctx->width + 3) / 4) * ((s->avctx->height + 3) / 4); if (total_blocks / 1024 > avpkt->size) return AVERROR_INVALIDDATA; - bytestream2_init(&s->gb, buf, buf_size); - if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0) return ret; s->frame->palette_has_changed = ff_copy_palette(s->pal, avpkt, avctx); - ret = smc_decode_stream(s); + bytestream2_init(&gb, buf, buf_size); + ret = smc_decode_stream(s, &gb); if (ret < 0) return ret;