From patchwork Sun Oct 23 19:36:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 38929 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:4a86:b0:9d:28a3:170e with SMTP id fn6csp1860192pzb; Sun, 23 Oct 2022 12:37:50 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lkY0lENDZu6Au/Wh00f/+lxPuo39xlRGQFUfEPEUSgkaupAnFH6y23bDwOdP2Hfe37kXy X-Received: by 2002:aa7:ca50:0:b0:461:9845:d9d2 with SMTP id j16-20020aa7ca50000000b004619845d9d2mr5396555edt.163.1666553870289; Sun, 23 Oct 2022 12:37:50 -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 sa28-20020a1709076d1c00b0078d42f9d0ddsi25501962ejc.477.2022.10.23.12.37.49; Sun, 23 Oct 2022 12:37:50 -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=uXjtvZOq; 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 A793168BD60; Sun, 23 Oct 2022 22:36:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02olkn2032.outbound.protection.outlook.com [40.92.50.32]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 5E4A768BD0F for ; Sun, 23 Oct 2022 22:36:30 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aWo3A3QL1Gi3xC6Z3HyZ0Nw6Rvc9EWsDwBc2RHnycfJeIWTYHM2ZvBuDo5XspbnVQmAFP8VX8OjZ3kDJt+x1GooATWGExPd1H9hPgC65boXVJfasSoAI2ErlMPoMjLmOKe+HfcEdVsCuyELHfpYWF72EMTjzYkD0VXDf3UTjKRMHUJx84ST+d6XSO4eGR/h+E4mfGuZ769n8u97KCOjQTNWNoa8jdr+KDZ2wryIWr9jfY1U2KvrMGKsSA1ljpm4m1djB23m9N2FkAFxXGu8CDi5lXix8XWqNwFi750nP8nQvzoUcDMaQZgbSlTVGEYPDZ/S8yu+t1IDPjwnGNRlRvQ== 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=gSCaEFuskE/vYKEWszZu2YRSqg71Hi8+cu7vQcjLnFQ=; b=CcN+uZ8feg6uO41uD8Ut5yRlpYF5M9ujprQNnRxnL+eMvBilrXZgYYp3OrsTAHC9qszWXo6UXvWKhJILOOZyZ0JKRzre8vzuoYrGdXy0XMRz/LtePUt7eT3ZzVQT2PctOGYBVhgGfMEB2S54HguvSrz+33VDJ7mVYjodx1ytSP7DDm9dn9JZTbDHtvSdqmAl4Fw8bNOMHdmDoyz5lJkz+cSaRd+niQRlk3zmd4MzKRowjHF31lsDhiUUE/GBDb67NxuhswkT15lhm8a/pLsw+wMu0vGXV8Lot3RN/FZqYuon2jxwiUVyfjYo1z2ayUfRb6ecUGiYgl03LdxEtA8FDg== 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=gSCaEFuskE/vYKEWszZu2YRSqg71Hi8+cu7vQcjLnFQ=; b=uXjtvZOqgf+dKtoRshLcC3sViyNVITkiZggvc9NmVJf1+KXfsXx/JRxiUKCce09dpEar0RcHIXPjtqYW3kKWVSsj9lKmMtR6niUdxaAFBf3i4qHS6snYjzFh0uNM0wYTVv+mJTiwv/2tMrSbZusou3fBnVw+CkCPL48sjKH3uObD6TIaLuGXAFtAfhqtwXso0D9LdP2FSg1c1+EzM+XabMkm+iWOGTIZMp+wGqq6KOm2WS9Er9C1NzVJLdYXLABrUKAfpDzyqqXv0FcEM+J0r48xbBvO7q/2Su1C3UBaZEb7JSaaFXpzGDtdgx2Qi3j8TnGVNrpuAFopcinQW3FnQQ== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by GV2P250MB0825.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.23; Sun, 23 Oct 2022 19:36:23 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::f9d7:680f:70c4:44fe%7]) with mapi id 15.20.5709.015; Sun, 23 Oct 2022 19:36:23 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 23 Oct 2022 21:36:06 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [MQvb2F4sFNH6mCfQ6LRU9DM8Bz20neHv9wbo7Nm8LJk=] X-ClientProxiedBy: FR3P281CA0032.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::13) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20221023193610.674990-12-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|GV2P250MB0825:EE_ X-MS-Office365-Filtering-Correlation-Id: e4ede7f6-4cfb-4702-5852-08dab52dde1a X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKwtuNlcRaDgURFx8jVPoKbRX2+VFtJ6Rhtxl9Bu+/VQMKwNebEkYNZCDURZuz1rs9Q68rToGyrQWxi/TMJD9hgPPmC1NWANB58LruIetCEUaIk2cGP9znVMG30bsPSQhCC9meKjyFIsO5jCYVMM+QADfo7d23LcYCsk/IquXYzDmXwpsSQf5CTYmLdGRQrhF1kZ9E2UrcPQ2Ngq541zg6CVPWOiBrIga5A5AKPCxlF6sh8ThDFt4G+IPwnNoxmMlfe20WBzupEY0BtwXOJphnvh2emtO8QIBzrTgETiOGILArhUkx3zO65mOYpK54EG5a/aeJqmTy/KSu8Wnvp+bfvgzWN8pBl704IyuM/bHMC6vjZ8h43WaQdxRXmqMNIs9WhzVmsGtubHmZsBE1TdkIfB2SDFHmIvV4VwSA/WPNbucxiF83M/XJXUWgFclcP5cMBGrD6+n1vG2rZuznoB10v72BLPpqPqa2g1IloeOELdyAV+68UNWTy7Akrd/QIw7ffy+nbIgNesCXC8fc1oMHKSVIFEuecOS6baDHX/fNlo67mrhyN93rzXDb+Lcgr7p0XNGmJe5x+uQaz8hwefRvLdCq0elPtdefzc3gqVihYLlGU9hmrNq/vZVU4wsUpmxTkQuRDlN7OC6WST8bjwIzEgYP8x/t5OcF8CxyXnoyUyFsFFqTK+Hj4G+0MSQAkgUKST0mRD8oSqgzhvPNpvGgmqF0PXmFJOLCc= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-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b-4702-5852-08dab52dde1a X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2022 19:36:23.2645 (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: GV2P250MB0825 Subject: [FFmpeg-devel] [PATCH 13/17] avcodec/rl: Add analogue for ff_rl_init() without RLTable 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: dT5XEok21N8O Signed-off-by: Andreas Rheinhardt --- libavcodec/rl.c | 17 +++++++++++++++++ libavcodec/rl.h | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/libavcodec/rl.c b/libavcodec/rl.c index 645a5362f7..3f8271d37e 100644 --- a/libavcodec/rl.c +++ b/libavcodec/rl.c @@ -24,6 +24,23 @@ #include "rl.h" +av_cold void ff_rl_init_level_run(uint8_t max_level[MAX_LEVEL + 1], + uint8_t index_run[MAX_RUN + 1], + const uint8_t table_run[/* n */], + const uint8_t table_level[/* n*/], + int n) +{ + memset(index_run, n, MAX_RUN + 1); + for (int i = 0; i < n; i++) { + int run = table_run[i]; + int level = table_level[i]; + if (index_run[run] == n) + index_run[run] = i; + if (level > max_level[run]) + max_level[run] = level; + } +} + av_cold void ff_rl_init(RLTable *rl, uint8_t static_store[2][2 * MAX_RUN + MAX_LEVEL + 3]) { diff --git a/libavcodec/rl.h b/libavcodec/rl.h index 07e3da5003..4380fda272 100644 --- a/libavcodec/rl.h +++ b/libavcodec/rl.h @@ -48,6 +48,16 @@ typedef struct RLTable { RL_VLC_ELEM *rl_vlc[32]; ///< decoding only } RLTable; +/** + * Initialize max_level and index_run from table_run and table_level; + * this is equivalent to initializing RLTable.max_level[0] and + * RLTable.index_run[0] with ff_rl_init(). + */ +void ff_rl_init_level_run(uint8_t max_level[MAX_LEVEL + 1], + uint8_t index_run[MAX_RUN + 1], + const uint8_t table_run[/* n */], + const uint8_t table_level[/* n*/], int n); + /** * Initialize index_run, max_level and max_run from n, last, table_vlc, * table_run and table_level.