From patchwork Mon Sep 19 17:16:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38057 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b1c:b0:96:9ee8:5cfd with SMTP id c28csp1375594pzh; Mon, 19 Sep 2022 10:16:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vjaYT36xbzVuXCe9j/opKBxpEyoRT3K8Fe1aS63VqyHaxrfgOafsOHjeaeMbG95v/Cz1g X-Received: by 2002:a05:6402:1943:b0:443:5ffb:b04e with SMTP id f3-20020a056402194300b004435ffbb04emr16256565edz.230.1663607795162; Mon, 19 Sep 2022 10:16: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 q7-20020a056402518700b00450d822cc05si11362614edd.289.2022.09.19.10.16.34; Mon, 19 Sep 2022 10:16: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=posYOju9; 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 7068968BA91; Mon, 19 Sep 2022 20:16:31 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2100.outbound.protection.outlook.com [40.92.89.100]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A90FF68B9DE for ; Mon, 19 Sep 2022 20:16:24 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J3hOPbuR+e2MbwXS4m0ru/OVDEyrFToRVr6s57sZm3/eG1d/w+h8Heru3LWqnmUnH90DeU1W0bavnSmKVmy/0oBlnHGqjKJ/WM/osp4AvPUE/o7hBVGgtZI33xw/zaO4BqG5PZ6+B5BYbui8zaQ0Rc1v7tYOgAPtQtV0rUdWgW/jWuo+sjP9V6A7zMpXz7kXiAlJMPqVLHhFBVroaMJegPajvSf1rNjQ8m5VD4gA7kJjaJYN4EHIikKxgE9aGUeIindthpKksRC+L8Tx7Y3A5idw0F77y38kGKpmD6HbDipyJzRx9YYatukLTPZs3SrJyyrrEZCXT6AK3RXyuQX5jg== 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=7hsiE/l2OH4L9ZPMHPPKiCZZhlTE9mZpFw5Yt2+kRb0=; b=X+NfbftZtrhd0kcpA9CMaX/4DwALIsqAGv77eILgZi3/K0ZJs8CByirqOflKiFKEQh2W6kRJC2tpAHkymf6rLxxngEFxBwUZO1MX6iMj+KOZKo+IK7nQ5k/LQfVSwE+HE7yp9ESoD7JF20wfvfXp+j1AsakxTb+zaAE5ZQtNFnaoqOrtZyz1xB0qkzL8PAIxE/giqn3Fy9lz/LWppwZjaMVL3U4b3pJElrZr5Dc0ZHU9EHEngjS9Yn9ruXsL+R4ewxvwgtsa2IUkpkY1RaeC5oryuiZquWxqTNFs74/R0O/MtPiw8qEfLLPNRd1HwV5CBYMW1i/JhCvT5jiXRapa8Q== 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=7hsiE/l2OH4L9ZPMHPPKiCZZhlTE9mZpFw5Yt2+kRb0=; b=posYOju9jbZuSy2aros8NUgpoThB50kGdyPOcQE00TOKw2U+x7LItscVnDVaGBfdrvh7M0YILeMkabnaO98wKvYKuHZQ31We0jXtXPwXVeSuJ2M/xDTRvMzerR2aQcFaBdSJOd9MnPK0nKd/hI7lTP9toIMdnjVM8EG7/96HXil7a2bh28tbyd7ivDRWWuQrixilyah8sCMs78onKAzdLFs3uIPykxWDpmj174/yVrO7dLqVmJ6FpQZsukxhJmavw3gvTJGzHPWRPRWR1ixX8k6yZ+xH/8RPrs0VzVfk/Amnm+rNRZ2IJb1/Es7rl96+MIDrs8WUTlIp/t/uOvAD2A== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by AS4P250MB0415.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:4c2::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.15; Mon, 19 Sep 2022 17:16:23 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::f3f2:4362:56:4785]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::f3f2:4362:56:4785%8]) with mapi id 15.20.5632.019; Mon, 19 Sep 2022 17:16:22 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 19 Sep 2022 19:16:18 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [hQpmKeTeWSYS9C0EO/9Kf0DQWL3EM8e5kSqbopMWUCY=] X-ClientProxiedBy: ZRAP278CA0006.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:10::16) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20220919171618.2523807-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|AS4P250MB0415:EE_ X-MS-Office365-Filtering-Correlation-Id: f7e8dfbb-473f-462f-c17c-08da9a62ad09 X-MS-Exchange-SLBlob-MailProps: feAVlmA1hHW8Sx0qJbsMRgxka61YY23A04yIECWuf4yRgxI1IAOT63qUParx4WPKEHKMFnOQed8a06Ioo3eVvpbO3ahjMA7sOra4uqbjIxv1h8uHdaC7z82TG6Gj+TYKQe02eUE/+YDr9/lTjb24XGtHe9ZNxGYCn1HrwguvgQMCKklZ7lx5uT/LVfQ4K8dWNgFI4/Jx1SVA0RU0e4sm0vRZyFxLuMnMCCDaFquhLu6/s1004CZjYDqbjnqKd2EuuNSRr7muizseE5msOry9xajiGOQ9Zq6dxtLjAfSEDk89ubH7vrUd37MhPKKHM4qCwRbS1FkcRHh6owJ/wmDgQZ4pnp+wHOFMCWa1bJUIAzpuT06eJhzT3p4ns5y1arO9dygUxCIXFxrZIkMdEK+JAxAj61/SqpL+vk/gkyTa5n6rC9ykWtUKQj1uknZwpzQzGE1RVbV4zDNt1A6+eRYrg169eRlvMxWpyKW2uhtNd28EQIZ2eETyWEZpbY9ccbqRqjFIRNpQsn1W1iFMVeW/E5vJn0ykewUgy9agNRbh+UFgN6MLZv3M7tuChDBtN2mNnZVQkMvLU3apvyQZ1xohMRO1BOfiL0Q9a2Zj6B0TBzDmFjRQcvoY1wgYMuR+fISmpiVADJFJ6lELlTRNYABI7Pe3fRTJMhNW63Zrke5/+fqgDGSnGr84ANF7hyl+mM6ejBrflpwzLCrv1r8izy5HDw== X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lMmBNVSfZHcJf8GeTnhtWYGW9eJkSSttA3KybXJzbIanERH1F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gAFtDbvZSO/854/ApxTVHoboys2UFdlqQ1cNL3jrj6DDhONWhyUcChJaA+FzbnmXNS/lkimyfc+kpYjE64I3hhVdMfbX9oI3j2+lva+FZmaE+oXsCyntVmzC1pZIsQBTbYM3tKFeIFi1SrBTZD75mvWq5lQ0mEtQq4GE/o/5uEF+DwNyGczWWhNRIEc+YQnOJ950pwUMvejnproHejc4v0qrYLBvSOooXJd302TK+F+3uoa4lmxIUW2R30WDF66ioXGRla6F8c5h7MjmQ4nPWQS3UbElTmvNKRctOj36o6JPLZiNhrIDMEAUPGxV9Q9v/UlfJT/deu9soRvrFFBeafq+GOmSzl9BkqNmQR3e2/cQpRHrkCbIkU2DeGrNTrPjVv7SydGv+582PuN1tCVlVxUBUpApsCo599nKIqNYy04t9/h1Blr/HmZebLAVaZcCTYSa0yHw9Nndcb+wgwyzWtSojvK80HiGx1pReJZrO9rZCtMBL57VLAcqFxbZqEaud+ETazLr6LaYTQo0v2TtuML1+YolgC13OUPF1ICFRWT6B8hQQGj/DGFfxWJTfsDOv7Xk6ditjfCKZ0GQWMrpswRkYPtX3zjOZZ5dIkh3RsaBTB4QeM87MROocMtplENqdsN1Ms6gKCMxKP/CPozfChUOx71wIq1dlSuaLGN2JHwPHJvspiXs8pcyJHHqh36QXhdzgdAjW5XoJNUJmB628DutUw4hxh9XcGUbCvgDuWA+ninaSuROvWw+rpNucosCbq8S7I9LdvWkHdTiMjCt8g238//8pgz8vwzeHIdFd2TyFRh6FTRlvuIO368B8IuxIkHTTHcf8bbPRjf95GXz47kN53u5y8ZClXn7Uj7Jn38APPjfNLKD2+VXaB7zIzSHWiIS3jh0oi5NMF09s/5gwoGp9a3Z0kCZddF7zrIzlARZjmA/Or6ZC X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f7e8dfbb-473f-462f-c17c-08da9a62ad09 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2022 17:16:22.8791 (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: AS4P250MB0415 Subject: [FFmpeg-devel] [PATCH] avcodec/vorbisdec: Move ff_vorbis_inverse_coupling() to vorbisdsp.c 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: tpt02MKQYIbS Only used there. Also make it static. Signed-off-by: Andreas Rheinhardt --- libavcodec/vorbis.h | 1 - libavcodec/vorbisdec.c | 23 ----------------------- libavcodec/vorbisdsp.c | 26 ++++++++++++++++++++++++-- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/libavcodec/vorbis.h b/libavcodec/vorbis.h index 270855da04..0dd109dd2e 100644 --- a/libavcodec/vorbis.h +++ b/libavcodec/vorbis.h @@ -45,7 +45,6 @@ int ff_vorbis_len2vlc(uint8_t *bits, uint32_t *codes, unsigned num); void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values, uint16_t *y_list, int *flag, int multiplier, float * out, int samples); -void ff_vorbis_inverse_coupling(float *mag, float *ang, ptrdiff_t blocksize); #define ilog(i) av_log2(2*(i)) diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index 72b8e8e15b..0d04e7c2c4 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -1579,29 +1579,6 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr, } } -void ff_vorbis_inverse_coupling(float *mag, float *ang, ptrdiff_t blocksize) -{ - for (ptrdiff_t i = 0; i < blocksize; i++) { - float angi = ang[i], magi = mag[i]; - - if (magi > 0.f) { - if (angi > 0.f) { - ang[i] = magi - angi; - } else { - ang[i] = magi; - mag[i] = magi + angi; - } - } else { - if (angi > 0.f) { - ang[i] = magi + angi; - } else { - ang[i] = magi; - mag[i] = magi - angi; - } - } - } -} - // Decode the audio packet using the functions above static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr) diff --git a/libavcodec/vorbisdsp.c b/libavcodec/vorbisdsp.c index e94b65cb7b..693c44dfcb 100644 --- a/libavcodec/vorbisdsp.c +++ b/libavcodec/vorbisdsp.c @@ -19,11 +19,33 @@ #include "config.h" #include "libavutil/attributes.h" #include "vorbisdsp.h" -#include "vorbis.h" + +static void vorbis_inverse_coupling_c(float *mag, float *ang, ptrdiff_t blocksize) +{ + for (ptrdiff_t i = 0; i < blocksize; i++) { + float angi = ang[i], magi = mag[i]; + + if (magi > 0.f) { + if (angi > 0.f) { + ang[i] = magi - angi; + } else { + ang[i] = magi; + mag[i] = magi + angi; + } + } else { + if (angi > 0.f) { + ang[i] = magi + angi; + } else { + ang[i] = magi; + mag[i] = magi - angi; + } + } + } +} av_cold void ff_vorbisdsp_init(VorbisDSPContext *dsp) { - dsp->vorbis_inverse_coupling = ff_vorbis_inverse_coupling; + dsp->vorbis_inverse_coupling = vorbis_inverse_coupling_c; #if ARCH_AARCH64 ff_vorbisdsp_init_aarch64(dsp);