From patchwork Wed Sep 7 15:06:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37741 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:139a:b0:8f:1db5:eae2 with SMTP id w26csp3967115pzh; Wed, 7 Sep 2022 08:06:53 -0700 (PDT) X-Google-Smtp-Source: AA6agR5+UmayguON6uz28UBoAbmn131HBbJfFD39yMfj4Nh1Z+fZNQToHEmphKVpN2Gx/8xQedrp X-Received: by 2002:a17:907:94c2:b0:73d:c534:1ac0 with SMTP id dn2-20020a17090794c200b0073dc5341ac0mr2683828ejc.461.1662563212785; Wed, 07 Sep 2022 08:06:52 -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 ne25-20020a1709077b9900b007317756bc04si14415290ejc.1006.2022.09.07.08.06.31; Wed, 07 Sep 2022 08:06:52 -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=rc+nbyey; 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 AF27668BB9B; Wed, 7 Sep 2022 18:06:28 +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-oln040092074023.outbound.protection.outlook.com [40.92.74.23]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 26BC968BA1A for ; Wed, 7 Sep 2022 18:06:22 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e8QgLPvp0wNAMtV1skX71KhdPzAj53gJVTA2icfMEirRdNnkI452bNH/tqLtB+CJQYEeBae4EHNB4a3niFsmZ2Qen5BP7zw002Kekks7uhzuq0D86IymfBZbtj+xIjq/ZHp4cMDrwqMdmHmMUbQRO9/2hUeVcApFL2FbshKpWhx68n3b68oIl2Z/8bc51vms2D8elHuQ6GArROqH/SST4ir1NaAuv23/i4IYHnie7OvtF+MmOV7k7JevLNOLSpTb4dKRgErJUcogohe/NbKR9teYaMIJtA/44G6ubX6w7NZ4wDXidvShGHAt+K0jOxnDi6z4xZEbvx057boF90W+BA== 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=X8PtyTLvMa6nVWnG0vvquB/9r6+t5Wg+jXk3XAfQCtY=; b=HKShWLhsN2Rt9I0DcLNAoCYGwIp5f7jRYd3TrJMg+9g/YB67ATlUgdfUOyEdFRbwcs0EYa51PRLqNZbvFlMVUq9xPIuC3ODIPIw57CBpPJbuRw85YOOyCiAFFEZj/KY2CpOjgoCL91a9HE4hnTF7kFHUC/DSaliweR/CHKCWSF6etrFqSSNApXc+3PRi93kpGL8HFYAv42p9P7qTOEbyEguo87mfJlgF2BWKpMy0TMSgzUz48jH9IPxHBMGN1W3iEGK+0zv3BuKZfOEfnhBzKy9qv6jXeQUkOj85mNOo25TsOtGhAoAPbI0pWj30tuvjTatle4a6BjiWI8ZFxbPl/Q== 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=X8PtyTLvMa6nVWnG0vvquB/9r6+t5Wg+jXk3XAfQCtY=; b=rc+nbyeyy3NtDyxCsgE1lzOgUjzg1vKnfbyd5u9wUiaQCfMPTv1KWSRtuqiTB8DYLw8l5WZkfq4Lze537g20FELTNz3miBrVU3rWgHrpcy4pTS7vSAmIznxOGb7hhNA8FvsYNNXd0Y3drIGsQ618i7ACcBXH6+2XCORZqfL1Rmq8iVePsyFpenZt0he4lWJBMPUp/YqH9CgToIU5WO4zCjudX3t5/8WpWbyUnyx3AHI1T32lo/tlsgb6iUowObQ5H2ZrVzU1mmI3KB+dhgKjLu/D2ewQArF/2OmklShbuFtFjMfIlmGGspbIkZjl7IvRNFM7tgaEUqdgwqE/RCBTIw== 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:06:20 +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:06:20 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Wed, 7 Sep 2022 17:06:14 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [TRxyFJnn4sgmxz0xZCXYTqqrMtpbnee79T649f1slCQ=] X-ClientProxiedBy: ZR2P278CA0011.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:50::16) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220907150615.1883270-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b58ca33-8a0d-4ea1-a883-08da90e285a9 X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHWbkhKm98zMtUqB+9m+adBbeB1fi5e7m6mi6eXUgsO1gAY8dG3C7UIW9WWP3TFS/IX9DPBoRzFz7qUoiata4ifkSU4tuxnLN6DwPT2TEMvJrlxRtKuXfs4e32h29Rq+iYzZySYwoymCtbOJIzBJl3oTeEz+97GoaHDNLEljBHPXpXVw3TFDKKU78V3qa37OR1F0z9Be80Ggm3JE2Tb2Le2Aky/tcIhVoz4d5Kxf+JuBGlrDBdo1C9tzMqpZ+haSxvcc7BsvXPzp5gODQv3YhmfnVH5KEVs5aBPy3gKE3+wR/lv6hDp5FEwLK5BOFp9ej18d7yZqJ/UvfZShgsZoS67A8hNejehNbu3WyRfAiLq+c6kgtsqszcxeuAmBrfpWjdIzbusV0yRL6Tibwa+w4qCzq07+wmAGPbViuK4v6MDcBUbQjYSD3D+kEWiwVdhIUA0VxZGQmaug8kPTWWiCJIAgHl10QUmquSQkBHCPO7sF2M8wnxN4WZVrrLJ4SztekzEy8wbCMBH5IAoSA4fKfDhTUp26BfyyQNOipVoS1gKOA15ErN3qf/OcWOF2CPujBHPEiJKMiogazz7+intNtjIC9du6XJGUvdZEyXXo4ESbrSjs5aptmxuuLOkazw7o39EGVxv6G4y6pYJj7ChJPyR7stmzAHHRdPjxD6HdJDoIKEnKxIq6SRN1FbRBg+0zeLDPW179jvSQxA== X-MS-TrafficTypeDiagnostic: AS2P250MB0990:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LRZTDuTOEpUVgMjl+U8YoZS1p4MQoXyZZdbMnAPSCKgwbku0dPtM15lokgI69NAO4TWgattjNIOrW9ffxuUnqZzXSW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ud+X+m1vjuYr72TsqbacRNviQU4GDXYmBijDPTsYaDqNVIEdPdGretvosaVsKvFVA6MGks1+tkPOoNn5wGw1fd94CdTUTnwBJpeqmNtHNLNKlejDguYaoYfoE4jyxJR91qqVdi1TjCRDAvu07VH1Cxh7n5Cyk4Jtjnx1g7qbb51GkxuU40Pd87nCc1OvDNdJjgQQOBz3GNqGfFbVEqY0IBzuuLhdo1cBskJtTFjqBlY1NH0GNRXGtjYUI62swwJP+nqifjSHuiaBf/iloxxNLTN7sVCSYzwouaeLMB8PVfR2Xjgzr6yJaMtSWm9WLNRwOFNX2cQQOjVNbjOGiAiMdbBHkAA4aFtPol27USPvW2IeVNn/13Bn/6Nwocb/x/vp8sAABO8lDTBcGmf7HLDtJa1L+pl4axTgvGT6trcv9J3M7fgExCwX5MuDDD/uXR23GeJ00z6ebTtbxX/mERlv0bL2mNf7+An9nySVwNjBdUc1BZoJkfWTfdA9CnzABP/vJrRJrAqKnW2jvRL5xg8/bXQDAwy9awdyquQMSflAE/NXa1nlcRmnoDIqXr+7Fo31yRbONNShJ47vO/7/KCgP7txDfX+ugBS2AysYukKvUVDrIevN55umNKLqDf66l4voUe5wFf1RyfhDHLFF4Np/yaXN+Ji6bR/myMm8KlYzmpvmCkX1GQK2jEzK5mJf70nfpQ2jlYvRUCfhdBzK+gHt1fCA4WReZHxyEQG+lliA+iy7n2+aQeOhUNaeqnLMJ/DB3jIf+c3hrJBtYyzAwGyppzo4N7PxDeDHni41mESW+o9p0GVwesD9LpeNPpLb3xSyAnM6dvcNs5dQOs2lozKpaZ7EU7rUUpTiiiuKzKFiv8+LMeCzPxNZsQRdq8 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b58ca33-8a0d-4ea1-a883-08da90e285a9 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2022 15:06:20.8498 (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 1/2] avcodec/ralf: Move frame allocation after error checks 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: fa88I19oUpW9 Signed-off-by: Andreas Rheinhardt --- libavcodec/ralf.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index 20c5f060d0..8f8e49f535 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -451,12 +451,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, src_size = avpkt->size; } - frame->nb_samples = ctx->max_frame_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) - return ret; - samples0 = (int16_t *)frame->data[0]; - samples1 = (int16_t *)frame->data[1]; - if (src_size < 5) { av_log(avctx, AV_LOG_ERROR, "too short packets are too short!\n"); return AVERROR_INVALIDDATA; @@ -481,6 +475,11 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame, ctx->num_blocks++; } + frame->nb_samples = ctx->max_frame_size; + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) + return ret; + samples0 = (int16_t *)frame->data[0]; + samples1 = (int16_t *)frame->data[1]; block_pointer = src + table_bytes + 2; bytes_left = src_size - table_bytes - 2; ctx->sample_offset = 0; 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: tmkDBrHdJe8ZR8L+DpN+0/5zokj+D4q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250MB0737.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;