From patchwork Wed Sep 7 15:06:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37744 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3967673pzh; Wed, 7 Sep 2022 08:07:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR5dP6WSOetEKgZxkVdPrCi7hFNxan1C/CVwEv2lKW/zPAUUtOfdj2b0VZmKAnIiHX9tJjPN X-Received: by 2002:a50:baea:0:b0:448:182d:9bc2 with SMTP id x97-20020a50baea000000b00448182d9bc2mr3510179ede.341.1662563255558; Wed, 07 Sep 2022 08:07:35 -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 a9-20020a056402168900b0044ec0f9e8aasi4133694edv.563.2022.09.07.08.07.10; Wed, 07 Sep 2022 08:07:35 -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=DQ1Qsccp; 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 C095D68BBA3; Wed, 7 Sep 2022 18:07:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074057.outbound.protection.outlook.com [40.92.74.57]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7659E68B9B0 for ; Wed, 7 Sep 2022 18:07:02 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PZHCa9Hv8/D+6IVnfSuK4G/mM5WuA4QX7LngZFGCkA+W+2MxuRxG3pCHKM0KWeHX59HLVKWdahNZW+M5aSIRxiY7ztGQew3PRDfhi7lSHTR5L/AgZFILZldsW7i51+DOP3dVZP1P34gZ5ex5+1jcHj7B6KX+mzJBOCNZeD6B9d5clI4SMKyWkskj0MvwenxquxEHa1IrbrCkCZjrPvVc5ysoKdUs5PnMXDmocUF5FRQjSQWTG+SGNVwfDdk7N308t2MvhxK6Cdl1ZPgHXCsLCHK4hHI5/cFktshAFff3VWw1q0hU59JkAMQX+oERKuLDvK4mjjsupLgptM7g2vgMSA== 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=kTA7JcGowJd3iwbbazYC5MDf+imcMP9c8w6GaU55Dh8=; b=FW9mH4Lp2MCXz5+IleEdZc96Qf7jkY/Bc7Sn5F4p9QJqze4nppkCmqFsbWCJi8nhJkziR/+AB3LgViq42xxpmtxT5M0YFFXki5sQvQ/eOG2qWCazOLjUBVNVSKAdX9KvcdkVq1XsLiKi64qS4+coqKe2QeT4dEa4Kq02CK4MlbfvGHDA/hiLCaPclDH6CwIYMP9TzK1pJmUKyjgpBE6RMhXbLUr4asZ8g/SExbDntNFWsreVnWrl03DdxJ8EH0nQWYwn3eqxWJ9Jzy7LS556CKMO3/sQCZbcW37lu/NHk4DRSDXhz9VfVKVQPFXU5f1BvlXMDaNle+FJPEBoH77Spg== 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=kTA7JcGowJd3iwbbazYC5MDf+imcMP9c8w6GaU55Dh8=; b=DQ1QsccpSL7YG3447/m/zm9IlsbDUDs1UcQPTAfn3Dkc5eDcq8DLhQrH2oPcPXPdIqm1v5O24apMI08oAxTImsawkoI/LvTO5Ahu7h0EFi2ypY1WS4VrkeEw/6deZOIzFzO08vgiGL1UvkmgJBw4V9hAVMv5NI3LoYev0NJLQ0I9d1H5k/seoXnWHLbh2MGQ+jqA3LrAIaSfjw3FeBoS0XJGBZhZc0g/zSL01P2PUSk9KGKRe6jHnCrKqQV4CY1inZBnJoftv1pJ8X5rc15w4eENoQmGYpZiyjEinhNFt/iUAVjbIx2lgMsda4QfK8k7ID26AV/IpGzvDALEijX5Iw== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS2P250MB0990.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:59a::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14; Wed, 7 Sep 2022 15:07:01 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c3af:c609:301f:beab]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c3af:c609:301f:beab%9]) with mapi id 15.20.5588.018; Wed, 7 Sep 2022 15:07:01 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 7 Sep 2022 17:06:56 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [chdbCwpmYnT7VLexhG5Qw+UoFKoAEGRug83E3CCm8dE=] X-ClientProxiedBy: ZR0P278CA0124.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:20::21) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220907150656.1883298-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fc00054c-42ac-45cf-ea71-08da90e29db3 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmp16suNY6DpRBw8YnpohPBwqK86HJZC+3jg2fhozCfDMsx54LN6jlGkKTe/96ouPHJeI3XpIuTgacHRU1NptVoT1z0whTww1Dph5qlGua+FNIgFIOV3X6YJwcBzz/8yx7hX/ec1n+yXaK4SzOMUDecYrxkf+0WOxA9eHT9SMabrTG9QpR9U7VXsDqJ6+MwsGvmX5/BI9as+lMUmn/bBlO3uxRs/Sc9COrG8sfsAP2TBvl1ggj7MX4FFaCEtnts6fc50+i+Rxg0Z9SvyWWGQ8lnDACDNH0rKO/sPo1GX6Tu1FhA5rvGkvd44ai0b6i4Mn5wkLqlNgW8ysjTe5Bb/82sXyVwBru+ZCbxbAD4QmSULrggFGUcpy1pAFST+Pk2VlqzrG1KAvPtYhY0SpFjyC0B+GH8AuNN9C8Dc2G4MFK9XPNWyB7QIMyjCZ2nfKYEdOjjM8grmCa9NnBzDroXXkya25RcrhugMpGSes7RKDuoCpYNXzArk/YmGktDl5RLbe617Dp4pednkb/se7QO53uzfpZ5Msg4nXdwvhrVjUoXqcBER7Q1uB81fN0NE5yj57UTQBY3V+WVA30a5lLPG7SLLgrdYzUbmXvkLigSZGiVguyrZVpe8s1YBpns/vpImrXJtuL39RZVMp525glpJZSHewIvVr8fMYczIrFljRtDxx9BiaTvniswCSKCY0dRpk6RkmoIKGbhIRNrhZnqDiGexTv6DRDQ64xmvb3rqQoRGk7mFGeMj2W7spru8/qNH6kQ= X-MS-TrafficTypeDiagnostic: AS2P250MB0990:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tmkDBrHdJ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Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 15:07:01.0887 (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: AS2P250MB0990 Subject: [FFmpeg-devel] [PATCH 2/2] avcodec/ralf: Move variable 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: yI+9OROX2w0s Signed-off-by: Andreas Rheinhardt --- libavcodec/ralf.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index 8f8e49f535..591598d8fc 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -63,7 +63,6 @@ typedef struct RALFContext { unsigned bias[2]; ///< a constant value added to channel data after filtering - int num_blocks; ///< number of blocks inside the frame int sample_offset; int block_size[1 << 12]; ///< size of the blocks int block_pts[1 << 12]; ///< block start time (in milliseconds) @@ -418,7 +417,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, int16_t *samples1; int ret; GetBitContext gb; - int table_size, table_bytes, i; + int table_size, table_bytes, num_blocks; const uint8_t *src, *block_pointer; int src_size; int bytes_left; @@ -462,17 +461,17 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, return AVERROR_INVALIDDATA; } init_get_bits(&gb, src + 2, table_size); - ctx->num_blocks = 0; + num_blocks = 0; while (get_bits_left(&gb) > 0) { - if (ctx->num_blocks >= FF_ARRAY_ELEMS(ctx->block_size)) + if (num_blocks >= FF_ARRAY_ELEMS(ctx->block_size)) return AVERROR_INVALIDDATA; - ctx->block_size[ctx->num_blocks] = get_bits(&gb, 13 + avctx->ch_layout.nb_channels); + ctx->block_size[num_blocks] = get_bits(&gb, 13 + avctx->ch_layout.nb_channels); if (get_bits1(&gb)) { - ctx->block_pts[ctx->num_blocks] = get_bits(&gb, 9); + ctx->block_pts[num_blocks] = get_bits(&gb, 9); } else { - ctx->block_pts[ctx->num_blocks] = 0; + ctx->block_pts[num_blocks] = 0; } - ctx->num_blocks++; + num_blocks++; } frame->nb_samples = ctx->max_frame_size; @@ -483,7 +482,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, block_pointer = src + table_bytes + 2; bytes_left = src_size - table_bytes - 2; ctx->sample_offset = 0; - for (i = 0; i < ctx->num_blocks; i++) { + for (int i = 0; i < num_blocks; i++) { if (bytes_left < ctx->block_size[i]) { av_log(avctx, AV_LOG_ERROR, "I'm pedaling backwards\n"); break;