From patchwork Fri Oct 7 20:25:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38609 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:789c:b0:9c:c2cd:5584 with SMTP id bf28csp205975pzc; Fri, 7 Oct 2022 13:25:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM76KPNWLJNJuxfj0S+lxdTvDtCrLe0mFNPqLVhZ9oB/RjUzPxizInogwgV8jxZcvkdDgzaZ X-Received: by 2002:a17:906:ef8c:b0:78d:46b7:6847 with SMTP id ze12-20020a170906ef8c00b0078d46b76847mr5400061ejb.241.1665174338000; Fri, 07 Oct 2022 13:25:38 -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 l20-20020a056402255400b00451bc675cc9si3034218edb.335.2022.10.07.13.25.37; Fri, 07 Oct 2022 13:25:37 -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=UIdbxcEv; 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 9715A68BBB0; Fri, 7 Oct 2022 23:25:28 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-oln040092072055.outbound.protection.outlook.com [40.92.72.55]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6276268B580 for ; Fri, 7 Oct 2022 23:25:22 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Lcus1ImfTVNlQiTlY1JCTgtC5aPM6Q9keNkd9BXDrByTQEg+Nk/VX298mwdZqDuUYILEMushwUSPCreapgmZrOejI4YguH4Y1YJNWlDSzm/qrmPx7ekMYpUAyA/OaEDVHvGr5Tnj7i6vMFgAcUg6Rwv6DCjpMwRaEqLhqvTpugwmRWz4AEcVXkkRuIJxQXYZCrpfnYeVLJVcrRvufwaLiVyjhJUpku7ubb16frk8C4X6p7Qm8KyORIVemjMiBTB02PWi/2gSLw0Va30Jllw49l5/xDomRjGe9ePt+Y6dbM6jjgiFd7GqWVPHqzFUmVsgZKttIyj3snxVH8dWdJsHug== 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=Sx2HkIb/sdqnuQCFLF44+DT2KmPQPAfyC/QuiXD6UTk=; b=mkzoB7i8jiIts7QeZeDqTTMJsV9W3dzdnwYc64N36y7Fl8PmMrVqq5MhdMkCpw9OeDA3+zZisdo4P64ydM8eAR1WDHVwaPAVSL06kAfkiPQkGYuJ2KCKzYIXKhel/8BHLX2J1f0wnCyYwF5FgMIHuas8RshGppNjtvsQ+FpUHV1054x0Zndx3EviDIp1f3po8ZXgI5+IxHZ8NO2lqrQFTkrC3pQDy1AsWnoLTMaQbUeNz232KjlMERSIo4w48VNXhLTLmPanlijd4PIKWICo1igdojHEjYP5QKlQXeB7qADXVSZ9KkgmzqY6QM0m9I+uWpniRgE4SqmywjSASDXcuw== 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=Sx2HkIb/sdqnuQCFLF44+DT2KmPQPAfyC/QuiXD6UTk=; b=UIdbxcEvrZ0tokNC0Bzs+0MW++vdOHugofukbUHi6vKWIPGYXfdk3j/FXJjE9JUnDTpfJnYFIZXZlPM50xk41qt4WaAFK4XY365nunhe0WqMUe0HJ7dPRqdMqy7oozXByfAv1A+LYHLiS+ATlM9MW6SU5MorW4dAciEZRDEFaCWQz6yNDVTDJx0hSiHNVUgltOpPiMYxEIX/9Z3xP5uKuyMQG9wbRpb6eRB0d5CeGFNUpg9+gmuHJFeED82EoYMAWCRxSe5Snjxh/ChnQBf9yoDkzptssXkukh+Q8/KGkNJuyyK6yG+8zRdnjesCLfSq9S+uvStmJviokPzfgmXVRQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by DU2P250MB0285.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:27a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15; Fri, 7 Oct 2022 20:25:14 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::68bd:2fc7:ac52:38f8%9]) with mapi id 15.20.5676.028; Fri, 7 Oct 2022 20:25:14 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Oct 2022 22:25:03 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [x62jT1jSLIs7IT6WNCEiIDZOanHRCNQOc2zV4eCV3uw=] X-ClientProxiedBy: ZR0P278CA0106.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:23::21) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221007202508.4188148-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|DU2P250MB0285:EE_ X-MS-Office365-Filtering-Correlation-Id: c59dc403-a205-48d2-5337-08daa8a20aaa X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHVH57rSaMIQaiIXYFvQh5UDsFrg+Pzxrds6e+7DHIMUlTelTqnXCqpJ6XGmhfektvztHYLSngd8iiGeQ91soFKj35TWJIHCzpV410v6M8NL/00eVUepoUAP74lo3Vlu2HmlpTZ2m0UsGncMZ78U0g8qCpVaJA9VCnUgcxlU+Q700Oy5eEAqkmDEVMuHcVODFnKUEjRfqoXF7N8zAqjVBmSBlTCmHQGYTjvYOihFKkV315QmvKpxbrMZrC+NbfDRoOPEl9qlmfqtDB0Oj4mBT/iN05XLPp26n0P3rJxp0BKcHuE0sirjECnFJjJLxgPTKPjbgPMHG1uByWS0pweuplmwwimEqq1JBS+USUVf312lUmuO7VJJihWNby4BZ8sGyOg8X+epZtGdsysJqbse7rsjb0pvXAzAVVTpy+5QTe0Q3aNtdNRY5J3Dxy8gyKJvM+QEKvdJXodW/GXGsG6NNg7mu8HoaV98nk8u9YfX5DdtbZo7e00Jm3tjJOqEKYzo7jsf1+FvHox5x+ioKkyKCtiNa4bNfc5iTSzk97bwWi54DlCI1vxmqi/GntH1/tUZXpjE0Rdxga43rIlqnjP0SUaRTI2DISbISYnBjhOK37unFzeR1LTG1Y/0p/6l9owc08TZrEUWqq9OSY6OHc/s96Illn0NK6xQAv9e7fv26JGfR/eAJFM+rNeftKvT5CV293Hw1p+hD8Icig== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WrhuN97dhDmjKXAM/s93iwq9RcXPASO6rLPmWg6fJK0rFlVEZGG886D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gqMgkY0Do6LTp9q5toubwt3ZMkj8k2dU6PnYgKGXODImklU131ntmFxG7QRUsXh8etI8b6UZssLqUgY3BKX2tWT5GTRNlIG1unNHbOJuUSPKRIXQGsvEWurz1CxrLh/IJmiN1uSwG1NCiTrmTxxLVm4hXjb00lNjQ46qxg31/wkIhULndsIWJ3aH/rx3wdtoIKByNnF7nhCW2iPGQ0OLR1a22FXffBn34IHxRP+JUABh2VS/ol24OxoP2BEsOTXu2cI7Fh/u0TdcikdgVhOhaAqcZ7hOTD1QUcIGVh0xAcH08WhFm+rg7gRcS3gIflXoAPhO/rpxR3IF6yJi4AOj7Mesbod4LzU549abxtZ7QN+bxtG1KKMS16aaNAWzzS9oBUJ++fEfPhhu2dBHCjgvtjScfyCIStImPn/uwjWhgHBalO/hWmYVIsjCWwl06D6hQuL6e6qzkKO6zUrujQnS/z0MF8/6GLr2EXNZlI2kRB6CiMCis3yuLQAMfSaM1WOk/DFxZZMQN9pCIJ9p5uR25hc+cDrQU1e0q2gFjmEgMn+d4mrKVsyLE/Ht1SxCthyJCEk6Lyndr2fk6TJtOR1prGSKY3rsq8RHmZKlUwmASzrN5kCXXEdvppELWlyrnuXFSkvljerYPfGe043wNEu6VSXq2zHKOrDIlp5OVyqRdRvKy1C0YrFH6kvOA660BZgEJmQFOUgB3dpHTl0IdeWbIlccZ9XnYM5kbY5ub0cyw2VhR0EG470t3jD943Sh0B2/vnztobapmGgoaZfr8Orcz9xh2lkY9BJEBz6YtgP2Rpae46TLQf11VgySUy8+kjlBpfmgA2MrMTo53UiDh0Fcn0zSXr2Q1I742Oi3VbYb5oACd99FEEN78GcTf0vhrfxoGEq08ZwqXZ39k8lmY9kQVzJq1r6H1Zqe/dOrD+ERq0dqb/Gh2pL5fShvFA= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c59dc403-a205-48d2-5337-08daa8a20aaa X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Oct 2022 20:25:14.5324 (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: DU2P250MB0285 Subject: [FFmpeg-devel] [PATCH 4/9] avcodec/opus: Use prefix for defines 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: KJPECNAdQlRY Signed-off-by: Andreas Rheinhardt --- libavcodec/opus.h | 6 +++--- libavcodec/opus_parse.c | 12 ++++++------ libavcodec/opus_parse.h | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/libavcodec/opus.h b/libavcodec/opus.h index 4d061cf5f8..f87b63aaca 100644 --- a/libavcodec/opus.h +++ b/libavcodec/opus.h @@ -25,9 +25,9 @@ #include -#define MAX_FRAME_SIZE 1275 -#define MAX_FRAMES 48 -#define MAX_PACKET_DUR 5760 +#define OPUS_MAX_FRAME_SIZE 1275 +#define OPUS_MAX_FRAMES 48 +#define OPUS_MAX_PACKET_DUR 5760 #define OPUS_TS_HEADER 0x7FE0 // 0x3ff (11 bits) #define OPUS_TS_MASK 0xFFE0 // top 11 bits diff --git a/libavcodec/opus_parse.c b/libavcodec/opus_parse.c index 39765c5b79..e922d1f304 100644 --- a/libavcodec/opus_parse.c +++ b/libavcodec/opus_parse.c @@ -128,7 +128,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size, } frame_bytes = end - ptr; - if (frame_bytes > MAX_FRAME_SIZE) + if (frame_bytes > OPUS_MAX_FRAME_SIZE) goto fail; pkt->frame_offset[0] = ptr - buf; pkt->frame_size[0] = frame_bytes; @@ -147,7 +147,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size, } frame_bytes = end - ptr; - if (frame_bytes & 1 || frame_bytes >> 1 > MAX_FRAME_SIZE) + if (frame_bytes & 1 || frame_bytes >> 1 > OPUS_MAX_FRAME_SIZE) goto fail; pkt->frame_offset[0] = ptr - buf; pkt->frame_size[0] = frame_bytes >> 1; @@ -177,7 +177,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size, /* calculate 2nd frame size */ frame_bytes = end - ptr - pkt->frame_size[0]; - if (frame_bytes < 0 || frame_bytes > MAX_FRAME_SIZE) + if (frame_bytes < 0 || frame_bytes > OPUS_MAX_FRAME_SIZE) goto fail; pkt->frame_offset[1] = pkt->frame_offset[0] + pkt->frame_size[0]; pkt->frame_size[1] = frame_bytes; @@ -189,7 +189,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size, padding = (i >> 6) & 0x01; pkt->vbr = (i >> 7) & 0x01; - if (pkt->frame_count == 0 || pkt->frame_count > MAX_FRAMES) + if (pkt->frame_count == 0 || pkt->frame_count > OPUS_MAX_FRAMES) goto fail; /* read padding size */ @@ -239,7 +239,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size, } else { frame_bytes = end - ptr - padding; if (frame_bytes % pkt->frame_count || - frame_bytes / pkt->frame_count > MAX_FRAME_SIZE) + frame_bytes / pkt->frame_count > OPUS_MAX_FRAME_SIZE) goto fail; frame_bytes /= pkt->frame_count; } @@ -258,7 +258,7 @@ int ff_opus_parse_packet(OpusPacket *pkt, const uint8_t *buf, int buf_size, /* total packet duration cannot be larger than 120ms */ pkt->frame_duration = opus_frame_duration[pkt->config]; - if (pkt->frame_duration * pkt->frame_count > MAX_PACKET_DUR) + if (pkt->frame_duration * pkt->frame_count > OPUS_MAX_PACKET_DUR) goto fail; /* set mode and bandwidth */ diff --git a/libavcodec/opus_parse.h b/libavcodec/opus_parse.h index 8e5c6a880c..83ed3c7887 100644 --- a/libavcodec/opus_parse.h +++ b/libavcodec/opus_parse.h @@ -37,8 +37,8 @@ typedef struct OpusPacket { int config; /**< configuration: tells the audio mode, ** bandwidth, and frame duration */ int frame_count; /**< frame count */ - int frame_offset[MAX_FRAMES]; /**< frame offsets */ - int frame_size[MAX_FRAMES]; /**< frame sizes */ + int frame_offset[OPUS_MAX_FRAMES]; /**< frame offsets */ + int frame_size[OPUS_MAX_FRAMES]; /**< frame sizes */ int frame_duration; /**< frame duration, in samples @ 48kHz */ enum OpusMode mode; /**< mode */ enum OpusBandwidth bandwidth; /**< bandwidth */