From patchwork Mon Oct 3 22:45:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38550 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1575985pzh; Mon, 3 Oct 2022 15:47:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6tNYqIsDr00+TpBmE7Cxkvtu7UEEYTxjJ4ndJo/JhwLu0v5TFKqPpqM4XvsHZZuGQzC7GC X-Received: by 2002:a05:6402:190f:b0:452:d6ba:a150 with SMTP id e15-20020a056402190f00b00452d6baa150mr20478846edz.126.1664837242980; Mon, 03 Oct 2022 15:47:22 -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 u4-20020a50eac4000000b0045154775089si8697501edp.625.2022.10.03.15.47.22; Mon, 03 Oct 2022 15:47:22 -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=ZsCjTidp; 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 1E63968BC2F; Tue, 4 Oct 2022 01:47:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03olkn2036.outbound.protection.outlook.com [40.92.58.36]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 182E968BC07 for ; Tue, 4 Oct 2022 01:47:10 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QeHH8/avFFeZHis6gG2yvOTi1woWGg1BONnvJ8I3k3AtPqjSYdfURJ5gDwgXKJf1E9NW7Tnk03OSwlJW2GnjsOqEFezQTMHgONoePG4WcVEfmAdcMcCHNALTNre2TmypIhP6bK7vBETMntq8IIHxrasMnwOmP5n4roKlkXCUi053Ekusjd5QzJRDtRYgzytPrPS7HnpaV2q0zFZLEl7IXxCb3GJx6ZfBuB9HSH2+SNf6+vSBPKR4EthauvDz+qwOC5fxsyln2g3ypPehTErmPgUwXrl9chkLuTT9YX27vhP+7jV2xQL4oEOBkTRU/fJx4aCFVWIKwS6H1vBzJUXEXw== 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=KkM6hNk8K5pGQjV9F9mMXIIUUR7ciLotMn4e7tYZiFg=; b=amNyRyjnTOqGNxlfT3iIcbfDRaLUmp9hGIsEIcu5D4P1tI4319TdPCMiplQgyGWX80Wxvo2vybS87H2ZJdUXChJMzRGRhDw3Uo+93V9x8JQm7ArfeAIlLpV4xcvEgNP0RdaDhM9YXN/U/d8q3lbcK0yupER9QURNbTR44UTqfw/rN0voL8GT6X4S9hejWGhBkpov793VDmoTdZWJQOTojsi0d9csE1LzQTUuuMG8e/yUuzVPEgwV0K45KyxSuL8JuMT63ummZZ3oxGLijcMgbsgrl0PXgho8h5q+pW13yF0G2Jq+VDDQja7+h3VNIJU8Ai/fwE7VxQaD5iGBUnHRaw== 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=KkM6hNk8K5pGQjV9F9mMXIIUUR7ciLotMn4e7tYZiFg=; b=ZsCjTidp98Vd4fry4oMF/WTZrOKaSp9v93smJ/c+KxOpCnkYgIR9P1v+V0gF7jd1gjP92OLvcpZBL930BmAAbYG8vuUpb04Q4NM9yT6d5TWDhXSGfoUa22Zp4MLSdPCQoUkJtsX6KDfbum3o1Ov/OPEj9tWR6O1rjxZOff7ipjgOTyPgZSBguAJgRbDvqwH0IQqsN/lKdqBc89S9YMW7dtIU6GHtp9c/TDMxiUSzOiwzceiO+89JSuBABFGcukRnOfXYXZ+WFfmEGlBgy4i1LyUU+NOOMBM6/I+x5Fo3MctqxNDvKiXH1qzp83hCTZSvwy16jhUAqW33kM+/64CBaQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by PAXP250MB0470.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:283::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.23; Mon, 3 Oct 2022 22:47:08 +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.023; Mon, 3 Oct 2022 22:47:08 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 4 Oct 2022 00:45:05 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [4R2uXVppTfbukj3zRP384mockHW6WSMzPd0C6c7JqUQ=] X-ClientProxiedBy: ZR0P278CA0056.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:21::7) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221003224505.1846824-8-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|PAXP250MB0470:EE_ X-MS-Office365-Filtering-Correlation-Id: acafd0e5-8c24-4fea-9a98-08daa591331a X-MS-Exchange-SLBlob-MailProps: AZnQBsB9Xmpi4YQjBH3ret4WDK5HTi62pMFsuxwuzHuy6x0vEvxQzzpdBBJ7Kb/FGtB9kTgvIXNVhBzlJIePQ4H56tZYuE2azczcE74SN4NPQhQeJOWxntoIlEHP/21qe2ISdKe4Se9vRtMo8y3jtzPFB/w7o5ZFI4UgJKC/kxZGbixrfBHiRYzpMb15qrxrNT32Zkt3gaOHeO0VjU5NgD+ndVTr8KDuhM4TjkZKFWQ72wkfEt97LGVrrEFm+8gSRK3K0tAsdB1tQdhn7dVLzER540aw5w63o8udl5GNBwXkT4gt8Bf+03W57hCXwUixLSTwx7I0S4FKq3vwCDmAxjlXnxVWS8S39mkpmVhO+ole7a/eaV/GKV5BMheowpHbTRucdA83zNwBlzI+mEu963I9vharjBcR2FZZnLK2Besp8cJqiFUicnJG6ZUXB4QoSVa0tWSDYqDfQXfJebe3TCKqvVBVmY9YkisPxoU8o+kbPnq46Mn8CeBnPKFR/OX0Q6ks1TISkBdpJTKXCZX0ff4PQt0B5v+oBdfMite5nV37METByc+8tXyLp1J9FF/OVF//hz/wIpD14Sjnsjq56c2zVQvDQsyAHitte3mnTkYQBo36L/U6d9iAk9v4+XfejUANZLT56HGhnKcxdUs8Y/4f28wAPYf8mt/AnK4dXl7GMjPoYpAiVpyiZEJWLHctciN6jCxZyTyUOVajJGTDt9WSYwnY1bAO6MRHYUINJB+qsVpzJnXjOoNhGICqcwJR0WI8ETe9B/4= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-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ange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Oct 2022 22:47:07.4287 (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: PAXP250MB0470 Subject: [FFmpeg-devel] [PATCH 9/9] avcodec/opus: Move Silk declarations to a new header, opus_silk.h 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: FSO6zUFH2vUu Signed-off-by: Andreas Rheinhardt --- libavcodec/opus.h | 21 ----------------- libavcodec/opus_silk.c | 2 ++ libavcodec/opus_silk.h | 48 ++++++++++++++++++++++++++++++++++++++ libavcodec/opusdec.c | 2 ++ libavcodec/opusenc_utils.h | 3 +++ 5 files changed, 55 insertions(+), 21 deletions(-) create mode 100644 libavcodec/opus_silk.h diff --git a/libavcodec/opus.h b/libavcodec/opus.h index 283d9d9f7a..80d685d47c 100644 --- a/libavcodec/opus.h +++ b/libavcodec/opus.h @@ -25,16 +25,10 @@ #include -#include "avcodec.h" -#include "opus_rc.h" - #define MAX_FRAME_SIZE 1275 #define MAX_FRAMES 48 #define MAX_PACKET_DUR 5760 -#define SILK_HISTORY 322 -#define SILK_MAX_LPC 16 - #define OPUS_TS_HEADER 0x7FE0 // 0x3ff (11 bits) #define OPUS_TS_MASK 0xFFE0 // top 11 bits @@ -62,19 +56,4 @@ enum OpusBandwidth { OPUS_BANDWITH_NB }; -typedef struct SilkContext SilkContext; - -int ff_silk_init(AVCodecContext *avctx, SilkContext **ps, int output_channels); -void ff_silk_free(SilkContext **ps); -void ff_silk_flush(SilkContext *s); - -/** - * Decode the LP layer of one Opus frame (which may correspond to several SILK - * frames). - */ -int ff_silk_decode_superframe(SilkContext *s, OpusRangeCoder *rc, - float *output[2], - enum OpusBandwidth bandwidth, int coded_channels, - int duration_ms); - #endif /* AVCODEC_OPUS_H */ diff --git a/libavcodec/opus_silk.c b/libavcodec/opus_silk.c index fd1e83659c..cf8b16acff 100644 --- a/libavcodec/opus_silk.c +++ b/libavcodec/opus_silk.c @@ -28,6 +28,8 @@ #include "mathops.h" #include "opus.h" +#include "opus_rc.h" +#include "opus_silk.h" #include "opustab.h" #define ROUND_MULL(a,b,s) (((MUL64(a, b) >> ((s) - 1)) + 1) >> 1) diff --git a/libavcodec/opus_silk.h b/libavcodec/opus_silk.h new file mode 100644 index 0000000000..6552c166a4 --- /dev/null +++ b/libavcodec/opus_silk.h @@ -0,0 +1,48 @@ +/* + * Opus Silk functions/definitions + * Copyright (c) 2012 Andrew D'Addesio + * Copyright (c) 2013-2014 Mozilla Corporation + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_OPUS_SILK_H +#define AVCODEC_OPUS_SILK_H + +#include "avcodec.h" +#include "opus.h" +#include "opus_rc.h" + +#define SILK_HISTORY 322 +#define SILK_MAX_LPC 16 + +typedef struct SilkContext SilkContext; + +int ff_silk_init(AVCodecContext *avctx, SilkContext **ps, int output_channels); +void ff_silk_free(SilkContext **ps); +void ff_silk_flush(SilkContext *s); + +/** + * Decode the LP layer of one Opus frame (which may correspond to several SILK + * frames). + */ +int ff_silk_decode_superframe(SilkContext *s, OpusRangeCoder *rc, + float *output[2], + enum OpusBandwidth bandwidth, int coded_channels, + int duration_ms); + +#endif /* AVCODEC_OPUS_SILK_H */ diff --git a/libavcodec/opusdec.c b/libavcodec/opusdec.c index e26ca0b2c3..c5f06e0600 100644 --- a/libavcodec/opusdec.c +++ b/libavcodec/opusdec.c @@ -53,6 +53,8 @@ #include "opustab.h" #include "opus_celt.h" #include "opus_parse.h" +#include "opus_rc.h" +#include "opus_silk.h" static const uint16_t silk_frame_duration_ms[16] = { 10, 20, 40, 60, diff --git a/libavcodec/opusenc_utils.h b/libavcodec/opusenc_utils.h index be82e13767..c76295979a 100644 --- a/libavcodec/opusenc_utils.h +++ b/libavcodec/opusenc_utils.h @@ -22,6 +22,9 @@ #ifndef AVCODEC_OPUSENC_UTILS_H #define AVCODEC_OPUSENC_UTILS_H +#include +#include + #include "opus.h" typedef struct FFBesselFilter {