From patchwork Mon Nov 7 01:48:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39218 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1848585pzb; Sun, 6 Nov 2022 17:48:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf4n5gia/bIPBxtW4X7hT/b4008aTp3XdMFD1OqxJLX7G+Gp7Z2QLqSKlQGQJ4scuqoTZUGa X-Received: by 2002:a17:907:728a:b0:78d:2b4b:e7f7 with SMTP id dt10-20020a170907728a00b0078d2b4be7f7mr229883ejc.269.1667785694157; Sun, 06 Nov 2022 17:48:14 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id g13-20020a1709065d0d00b007313312730esi8478024ejt.85.2022.11.06.17.48.13; Sun, 06 Nov 2022 17:48:14 -0800 (PST) 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="o/Spa5Ej"; 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 895EB68B9AC; Mon, 7 Nov 2022 03:48:09 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-VE1-obe.outbound.protection.outlook.com (mail-oln040092069088.outbound.protection.outlook.com [40.92.69.88]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 792F0689CE2 for ; Mon, 7 Nov 2022 03:48:03 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FqltpHduiqLt+jocUmgcutdzHDZP4LmF9UhkJ2gZdX2n1D73IlddGmI4B8ZXKakToA0rCtyVjfOV5beeMsPHBv2SUgBvD53/f5OrHo+VZQFXZHXhvfINFLRA1ZnRMs76TEDiEqHMCVI/vk2fsiIb2POUFRPiCNmYS8jGoxkUOnuscpNmKJ0FkTq1xxWP8peT4/AlRG4BYq4hcEQNrYBXrZ23TZcxPkx0vNUnivGJ6WWMZzi+dd/9SAVIdYG/zziTmZVZ8D4WYehXrpIzySVw3kQsYaJMFl3HpZGL7Dp420xmprZX4VNGU6MwJbk1+vHgana+jWUgRb8X+92t4JJE+A== 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=leVdo+Epml6Sf5FEI4RrgOF+xYTshpYpAI7rW5vtZKI=; b=juaiLGlkx9A4BZAUBBVYlcylZWkAkpg78d4DOoOQ3bGebSOTjk+lsdqk5ihGBRW+HAzBsGUlj/9AVD8J9Y8mXNJZnGF9eTPe5/C/DOc1sYq9fFwNPF9bJfpzfwvV70uLxQo6uhAi5jOlhzVYPfxhTJz5oCz8/MpkV3PGXN0j+eQTcgMG00XrgSojT2w+dV3PH1yNEAIfB9Q58Wn7hpINH8CtY328ubi2SZDl1EcIPEtuNFpnSW1/bRYgtCmtUXQa7JMxIh61ZgOvsA0bK0ixt+877BjkNhMCjKz+XgqfXLB/2+0l/zXYx8Yb2KOY/gFn27CiCdMx771H7yLdIrInlw== 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=leVdo+Epml6Sf5FEI4RrgOF+xYTshpYpAI7rW5vtZKI=; b=o/Spa5EjKpfXfvHUjoJFl+bbhP6ELZkvZLROSIEa83z87fG+EbIEpKsR+1L985f0oP5nbn30i5iF0WobK/jU0bnYluwdbB2+uZLOhgmSZ4NHC2rjfYJbCQXAqVwBAw0cvWLWhsVrmMhiNsUMxW7xNb2b8QUJZifTtinKSRAvIJLBCnWyknvn4s09HXnVHlqf3TwQWyzaBZmF98/cD+4KJDXrnG+yA6wV2qoUlTbVM8dimzXhBQWV6QpoMammvlzL/eVZmlMHW/2RQ4KkaeypAgBO/uh2l2AxXABlR8Or6LsIc1MksfYW+fctJAAAHEG276V4brrNYy3cAs4c4VWN6Q== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by GV2P250MB0923.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:7a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.25; Mon, 7 Nov 2022 01:48:01 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe%4]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 01:48:01 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Nov 2022 02:48:02 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 X-TMN: [v8f2aZl+dhOENgBXNL2ui3DiI3ijQVUNktvIT3gDs/Y=] X-ClientProxiedBy: FR3P281CA0110.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a3::7) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221107014806.1503393-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|GV2P250MB0923:EE_ X-MS-Office365-Filtering-Correlation-Id: a36f655d-2071-4aa7-70a3-08dac0621a9e X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmqxUC2t/XAH2K/2kJg/kN5yVfmQufslg2ZC9t8ur6Yi9m5FKJnTOkCcNLj4pmInBu0VzT+aPoXEyTADyIIITmyDEDhF993r2xOhAGPNzBknQdlPGwZUnhLbgpErUMY/NxB7oP5tNCob18d9Mg1IHWJOzgqSb3RfiI5vgkfjs1YF17OP7UXJiDG3iIo8Q8NauFBButJgaaN/kjPocj+4uqddf1csxAa0uK5tDKKW0EllYninqnOR84M6BMo/dQkYi6aRp6l2n7/XNHNl1Kjewh1LNdVWJOlkw6LoDE13oEU2o5CPKn7bMs2IQKBp8eo5XzqQTSz24+G+FUFw0tWxrUfIcgCqK1+7K+5CXanLuwPl8NePCuD3ZsnoFQy+SX301Iwf8m1uYKDMeaKscDEnH2UfqcUMWbK+cYWqWAdTA04mHkQ1gt67DS0W/NgomK61A7oP3sGb9pp0APAO0eHP4iA505sQdJR/VOeWfWY6Ct4JTrBJkV+g+5AdOEW3l0NAKo7u2Vhy9osO3zZmiV2utS8uo0Fp2hC9ubJh8DmGGWtRImx1gla4KcflHsH3mFnZOt8X2Ox/2tauAvonOu42wWyF6PBHDHDU+6RrX1tqnuIIfBdXS7k67aY6ZIQ8qSxnVXtUG0V+wgtodH4ri/IktLSAYgJIrk2iEA3QcXSNu5OS1vV1pf1QcD7ADXW+E9c8pJn5AQRDvSAU7G9fBSXdqn5AvrjyC93vWrjUVJFgmnJAibxfCpOFtcqVjeCh6kWlNy4= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-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36f655d-2071-4aa7-70a3-08dac0621a9e X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 01:48:01.4778 (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: GV2P250MB0923 Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/clearvideo: Remove unnecessary level parameter 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: q0CsP+bbpZpf Signed-off-by: Andreas Rheinhardt --- libavcodec/clearvideo.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index 4d6549560b..82311bc645 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -362,19 +362,18 @@ static void mvi_update_row(MVInfo *mvi) } } -static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc, int level) +static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc) { TileInfo *ti; int i, flags = 0; int16_t bias = 0; MV mv = { 0 }; - if (lc[level].flags_cb.table) { - flags = get_vlc2(gb, lc[level].flags_cb.table, CLV_VLC_BITS, 2); - } + if (lc->flags_cb.table) + flags = get_vlc2(gb, lc->flags_cb.table, CLV_VLC_BITS, 2); - if (lc[level].mv_cb.table) { - uint16_t mv_code = get_vlc2(gb, lc[level].mv_cb.table, CLV_VLC_BITS, 2); + if (lc->mv_cb.table) { + uint16_t mv_code = get_vlc2(gb, lc->mv_cb.table, CLV_VLC_BITS, 2); if (mv_code != MV_ESC) { mv.x = (int8_t)(mv_code & 0xff); @@ -385,8 +384,8 @@ static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc, int l } } - if (lc[level].bias_cb.table) { - uint16_t bias_val = get_vlc2(gb, lc[level].bias_cb.table, CLV_VLC_BITS, 2); + if (lc->bias_cb.table) { + uint16_t bias_val = get_vlc2(gb, lc->bias_cb.table, CLV_VLC_BITS, 2); if (bias_val != BIAS_ESC) { bias = (int16_t)(bias_val); @@ -406,7 +405,7 @@ static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc, int l if (ti->flags) { for (i = 0; i < 4; i++) { if (ti->flags & (1 << i)) { - TileInfo *subti = decode_tile_info(gb, lc, level + 1); + TileInfo *subti = decode_tile_info(gb, lc + 1); ti->child[i] = subti; } } @@ -599,7 +598,7 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, TileInfo *tile; MV mv, cmv; - tile = decode_tile_info(&c->gb, &lev[0], 0); // Y + tile = decode_tile_info(&c->gb, &lev[0]); // Y if (!tile) return AVERROR(ENOMEM); mv = mvi_predict(&c->mvi, i, j, tile->mv); @@ -614,14 +613,14 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, cmv.x /= 2; cmv.y /= 2; av_freep(&tile); - tile = decode_tile_info(&c->gb, &lev[4], 0); // U + tile = decode_tile_info(&c->gb, &lev[4]); // U if (!tile) return AVERROR(ENOMEM); ret = restore_tree(avctx, c->pic, c->prev, 1, x, y, size, tile, cmv); if (ret < 0) mb_ret = ret; av_freep(&tile); - tile = decode_tile_info(&c->gb, &lev[7], 0); // V + tile = decode_tile_info(&c->gb, &lev[7]); // V if (!tile) return AVERROR(ENOMEM); ret = restore_tree(avctx, c->pic, c->prev, 2, x, y, size, tile, cmv); From patchwork Mon Nov 7 01:49:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39220 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1848952pzb; Sun, 6 Nov 2022 17:49:27 -0800 (PST) X-Google-Smtp-Source: AMsMyM5UAbZyDxmSkgS0+5iO4fJeBguy0yCiN9SKG+45tf2cf0stbZq+IsvH8P/686soDlBmQdUh X-Received: by 2002:a05:6402:5248:b0:461:f0fa:864e with SMTP id t8-20020a056402524800b00461f0fa864emr46544974edd.81.1667785766885; Sun, 06 Nov 2022 17:49:26 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bw1-20020a170906c1c100b007833cbbb747si6306224ejb.578.2022.11.06.17.49.25; Sun, 06 Nov 2022 17:49:26 -0800 (PST) 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=DJvFNI9E; 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 A3D92689CE2; Mon, 7 Nov 2022 03:49:23 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066087.outbound.protection.outlook.com [40.92.66.87]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D9CB0689CE2 for ; Mon, 7 Nov 2022 03:49:17 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nvwAYKJS9NDK0OJ3cdBDDWoOiR/FMR3HEUK8jrgWYgf4Hx5ui20wSeuAAy+oqEZV1R3aj+zNQuSz73uvhb95uS2WAs8gJZSqYVh2mC5B66TCKH6nS+Ulz2lL8AoukfgqytVIhMf16z+WcGeuDJ32CNRTk0PN80jf17JRtBUnkns3sjKRR1C1QShLhKkfy7ovNUby2D3qoDGB3RU+Y4qlkVm7GUFeuqYi9E3Y4HjpEIXflvo4WlY3Wjiq9JouvitvjMew631exZawknWT38SGEOUy5TMW/jhrJQSSGZ3E+tQVvmCZ47ZymOH2tuHzmlFrHrUOe4cydAeZMWdlwQv/xg== 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=/EA/rxCn8TrDv6NAnPMbreziyDvvnsW6aEKtDLkqlNY=; b=GzzU1sqQSwivLP4jsTwHGTOIPU+ZKqZyj5bUMOhDIMYFLCtr3uSNKHx5lPJH4srMddmZ+mVBiFvnWr17u0Ibcr7w3VI+qaGTg5v9BW7S7AzI0xE01qib3zVg6FTPSzWwv6juK/vyD5ndSOzxQR/8mwx+gwk8RSSg7GsDdvbpv3kzSWzDo2bXju7IoEjc3DBHZWyct5i2tV/50MJ8neceQE6u/OfuSoNv6wSfJnlDIm4jDL+8U/EiWpD73mDJ2HEsy3/rHMGv/R+/vA2myx55U61WDVm6FfLsPZlQvPG1AjHEYmbK5ES7SByQqm7rqee0B0/C80Ogkivu2QBIj69JLg== 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=/EA/rxCn8TrDv6NAnPMbreziyDvvnsW6aEKtDLkqlNY=; b=DJvFNI9EpX0y0XFMnAslKQdEdbfLKDEbtCd3c8Sy4CCrJc2/TCGKRWznlSr/bP5rY6MvbRyoJ4yvwvTU/ohGrDk/pyio9KtHJuCbqGl45faysB1WUBLo3MAZn7pU9rZuzl9CcYYUQk7owHwnIC+QgxzDtl1k5spXWCPSErfgtfigo2I1iCdexGG7u2mL1Xj6PPRZw/bixxRyuTnyG1sN0vcrCpxhjC8ExJrIWeajyirysJsFeslQXcehHXScZSOKrPODhwHbMmxffGUUesIQldV986C9QIg0nJ1VrTTB8F3BM72AIuKMP+xLBBMWmQDZmWZ0FbQchQmEgIRCFe7R6A== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by GV2P250MB0923.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:7a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.25; Mon, 7 Nov 2022 01:49:16 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe%4]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 01:49:16 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Nov 2022 02:49:19 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [TK7pAefp0xImY2LakO3X7amfOelgKqOZAt0Gsi2zSVY=] X-ClientProxiedBy: FR0P281CA0009.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::14) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221107014922.1503434-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|GV2P250MB0923:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ec4f022-d4c0-437a-bd05-08dac062476b X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmqxUC2t/XAH2K/2kJg/kN5ybze9213Rdg9o40MSu55nFAq5q0LSaYPxSyiRYVxUwLTf+coYwSXh7ONzpMqsBiq9EMDhuAwdtGbi1+emTW5d5gBhm4SUdLGKDNYSeRV1wFCdKTRTdLFTU83JSS97xKvxqOEBrtAWZ8iBMgyNi9vIhWnYEjbCKl75pJAz7f8H4OjQCN/H3hXTEoUZ3hgg/iBZ29f46qS0s/MAGn31JIPgiIg+IAd5rkNxGdm+bydD7vn8h7XsJ1JwW/Q0isfpT9dDg2Hdn/uI4A6o1ijzbNbMNEgm6Qu3BwbrrfwkSaQlRLvLZLORVf3kcuATpMyommfklM0H8OsZ+29nToyPVXt+KblC7HUt+pF7uuo91GyZg1Nc8PSzVTprYsIIoDQUX95MB+ca5Lmol7SerThMU3sq9kvcsAQb9FgNiRcZ8Tc0I+CPXXR1sKXnwFsbJ+BzImQFiC2YoA+dly0CE6N/w73PA0RFuUKVeFKv1EgISTaLlkZ2V60soXKAzsWFllIJxZYe97rnh2Fjy+2tYZES2276RHSlFrlA36l0tN6UxCQ7qq6HGNOwZvxNpUYU2ZxUac1r75SbS/WNUuhO2/nBETJb5YbN/KOUy7Z1ga0mnrnJt0eRLQMwY0e6jJ2MYwqs+gZ6s/w3rxkIIfnDUIuZlIp/6y404Qd4mHAVVZRB/+AhNyzuK6EF4HqbHWvD6Awm1dJPMvESKPrnmW6cKtaxWgDNfESSZzP6T63VPbu2eyv3WzU= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Dqv1BnjOlsHLyh8McwOcdj1O7/zW5Q7MnUeQFExRlNwbY2+grCZ+EqU4RyL+bx9K7wV8vI8I8OI2ldYE9HQ3v37/ytleSWoX1ifAo2FitrbQqmke7yNceR+kQOPNh5k0H8ynkihw9eqaQWxRCNwUSRWdqi4UQcE9rARzhPEOvlPxRjcXqHAMHSKr4Fr/CdihPpBTIhssrKxqlH0hVen91Ug47BIZbeRAfEAhSixG0jQDjKLnR8qvdv3UKBm31L/k3F887UKhve21Ys61g53gzNiR/ULHptpuRh2UybkrngtjgM+wkIwf6u9uIxV82bStetFbl4EEbpR/LfEj1oM7xm2BhNGiGJkiFb9soReaPRyHzGgJZKwbUOw90KtRM8DYhx7p99I9TCuk0X1Hrf847+bCdhFiWq/X4lH8MMH9L4Id5NYeET+1r2INfa30bRa85JqfC5/Zaompfv65ElMoTkv10cn4HASbY/n+CpFrdnovgpk2Kn5mRymWHhMaNQBH+Ww4mlatP8tKJy7SD6EP9g6PYjYejHrL5/XKVgVxyRHr2PZgdwtb6AQFmarLcYihAIrgKA+4DCmf5L0AvUoLTx4ghejECvYezPl9MQ9N95sOQWjs3zUo5PnRum7IaU8ZVdrXdGS2Ii7J+DTovt2zuk8SnPdaCy7YBKq0w9k4poUu6ocbVccV2YCW2pMYGHzK X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IqAxAkscv/VUEMlIlusNK/7r/xsbQTg5FHjFc6DyskyguAidA4pFmEVydOG+2LzilJH3XWM1HVt77UGJ3GZuQHpICWypYgAoeVxULmEru41dpEC0lGSHk/b0QcXnLwuUXdJGrbMc7PmIlNkaaV7vVW44BiJGa4i4yfrO1Z8akluigWjPVdpUROP07SJlYc6/VfTUgGEcRRUqTP2ZWCaky0IgGkjYAT3QR4OkNpwz74K2i3lZBtCqLCGDDkDG2Km5POL7HYNFcE4wV++5wyWiYQ6dYlHz/uX72ptyVefybJTrWJJIaD2AXGI6XwYgyWS7v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 0ec4f022-d4c0-437a-bd05-08dac062476b X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 01:49:16.5635 (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: GV2P250MB0923 Subject: [FFmpeg-devel] [PATCH 2/5] avcodec/clearvideo: Move tile_do_block() upwards 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: QGWUndBWHMTN Will avoid a forward-declaration later. Signed-off-by: Andreas Rheinhardt --- libavcodec/clearvideo.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index 82311bc645..6ea3d7b6a2 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -362,6 +362,20 @@ static void mvi_update_row(MVInfo *mvi) } } +static int tile_do_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, + int plane, int x, int y, int dx, int dy, int size, int bias) +{ + int ret; + + if (!bias) { + ret = copy_block(avctx, dst, src, plane, x, y, dx, dy, size); + } else { + ret = copyadd_block(avctx, dst, src, plane, x, y, dx, dy, size, bias); + } + + return ret; +} + static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc) { TileInfo *ti; @@ -414,20 +428,6 @@ static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc) return ti; } -static int tile_do_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, - int plane, int x, int y, int dx, int dy, int size, int bias) -{ - int ret; - - if (!bias) { - ret = copy_block(avctx, dst, src, plane, x, y, dx, dy, size); - } else { - ret = copyadd_block(avctx, dst, src, plane, x, y, dx, dy, size, bias); - } - - return ret; -} - static int restore_tree(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, int plane, int x, int y, int size, TileInfo *tile, MV root_mv) From patchwork Mon Nov 7 01:49:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39221 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1849025pzb; Sun, 6 Nov 2022 17:49:41 -0800 (PST) X-Google-Smtp-Source: AMsMyM56MJJjN1SMbqdLklBb4H6cxFYfAbRvOND6Tg0AqVKWwIZn9GIX9QeohOgGNnPDVUU1yD3b X-Received: by 2002:aa7:c054:0:b0:453:98c6:f6c4 with SMTP id k20-20020aa7c054000000b0045398c6f6c4mr48012584edo.2.1667785781329; Sun, 06 Nov 2022 17:49:41 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id tz14-20020a170907c78e00b0078d8f2658e3si5684548ejc.833.2022.11.06.17.49.36; Sun, 06 Nov 2022 17:49:41 -0800 (PST) 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=mu8n1Fxu; 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 B0B8268BA14; Mon, 7 Nov 2022 03:49:34 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066039.outbound.protection.outlook.com [40.92.66.39]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 234C268BA0F for ; Mon, 7 Nov 2022 03:49:28 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TkVs6Id8VaVCDmq+9TXXgwfuTH/ni9l5t+mcVGVp5AH4yL34f91kYMjeD7AnOGJ5jAzcNe2M7xAJ3lsZjqB5vk9pZYgJRNE3cgMcek8PA/QzXorU3DDZUevfZk4243cqDuiHtbmKIzIuIEpD8oiXat4E/kcouqTaLs27u1RdNI/n/XIXKutLyiKg3PzayglHEWh54fd0+OGX6mtgjBzDctnYkRw0vAO9Kt+fy8n/mjnRMYeVTv/OJiZiDxCxu5veTrtdZC/55Yhm/CKNK86f1N3J9e7sr4Wll715zUlNUtnzzGozomf2U2RuvQpcbchMYRu5PFdfP3vPyMwCNNB9jQ== 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=Nr7S3Xassax7oWQL0c7ClXh/MsCDtRiJYYMQtrAL11g=; b=fbJjti0LE07fggP/lSUSgW096yAwTmKwMyP6RLc2KHh0Eh7Potff5HnSLdpECfc4u3oFb1WayVmcF5CNpKjciYdZIfS5OtQEKPWFndmZX4IxVFHEa4Daur3TlQhK8/7RB8+Fl5T9mulvrPSV4Rl63a3UKNhR3aEL5NoSZLngXJ+nVjIvRDvr67ORniFdBXlSOJb40xgiwNKQrg013WoUcN89n5f+XhrOlKQNtZlOHTlzUc3nY1GN7P90bmwGjpzT1Z5OU61ryOsKHb0qgvgvXE/NvgrUnpMFLjZlEUmVZ2jxi8ERRgVlPXPyexZb7lj0owdvPKUoI03Oso+mvDbaCg== 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=Nr7S3Xassax7oWQL0c7ClXh/MsCDtRiJYYMQtrAL11g=; b=mu8n1Fxu5L5Wsd4M45EkQXVXfzGFmsUsq7VT3dZU3rECccfcplsNp7XlhEw+KpU7s7SYG4A6ERPIaqdFmNS5vwLrhXccX75p3oSDKErSC+fp+2DgR7fFiKWr4fGnfXLtnOJDLDJecGFLNzE+tOcKYgmht58J0hEeSQ+q9xZnsofkqa4Yx4ZGOWSfqaDFBIapBt3q8UbZHK2Q+9TRVTl669dXABMFBmoWLL72sdlyZhXq4betKiA+vYTVODslniu1DDHKvgZa7B4F72rViItv/QkbXeWRWlZS1aSeNre27HmIeaQuP0dQTbj150FYd7SGEyDyA294XZ1TLu6AZfxvKQ== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by GV2P250MB0923.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:7a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.25; Mon, 7 Nov 2022 01:49:26 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe%4]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 01:49:26 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Nov 2022 02:49:20 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [+5dtojCKkGMl+wZOtz7VEBvnKH8MI9xNOQ7SllvNx/M=] X-ClientProxiedBy: FR0P281CA0009.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::14) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221107014922.1503434-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|GV2P250MB0923:EE_ X-MS-Office365-Filtering-Correlation-Id: 0c573c07-eeae-48db-80f0-08dac0624d13 X-MS-Exchange-SLBlob-MailProps: EgT5Wr3QDKzGUuNZsc+Ci/JW2wubyroTFKoQbCd1YdZfgAuemnp4cNydgmdioeBi0HD0pLplRJYKacppsGgCsztPtFE2iHcb1gbp69y7MfE0zPUpQhXV3MIhWu6zdqIm2iT69nif3afCRZ5g6liewhhchPPTINTsJVsde9kDrF0PxzckSCkeeyvSag6uTU0AEwHCiwjOOC1jPSXgYDgJYEZqOs8+7ghYcemTlIxexQvK2N6JWVz30jlmvqQMSL1AXbpeE8Gk55TI3jmOQQ+XxujsglTJxl0OhhHvuKHCG3vWEVvQ2W/nT85E46O49LYPcyaTuQs4n5W3lPFw1jVSZoyBh7jf6daPugatqfF8RIJM3c2UIfx88fGsX/TSkp6V0m87ADf5TnGl4BIQleXjSkFq4kjjiC5ljbwyVyqqnNtKfaVlgJpN7JvDHGVfjQ/jkKoCQHr2L5BGEm5U50aY+Q1SdrqmAMPxAmDHR2qGP+m680O+UkYY/9zQ3GpJ3cJH/cLUvIRKT4cRpETme4y3svzvrvj7prVndwMYlNzxeqSSgl68UTbijFCliLhawllKo15LScFOJh0/oN1n4T1mVwiJXm8iFl/nqT/c5oqmBuLrC1NtcraNbSXgAQmOX8G4nSQn9ihL2vxFCaupTjw9yeToVtgboeP+LpMFjldMfC/8ND6JFm6QZwY/3pcx+MCh4zkrene+Ps9dlQDKhJwJpibTJb6boHgthvRB1HffrQ4= X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zfk+7yUFmmGoi0VyW1PjbiylJwiD6p7CYwx9EDILKL5ZIkXctS1dkK0lUF/t2X+PLNf3HyPm7Lyf5wwju51icxKxcPQ2ddo3PSpP7myxlyzFqpTWqY0mzIYEDgzZdsjW+9ZIvy6Oi68KTxpHwuWuehB4mdx1Tf1DPK+tayj48muPEMu1VGii0dQCtGY7gDQpg3lh9KKHEcWRH9O5vcZj4wBsDkOwHKuhQUySHtmd/yM3uBwQWQYrpnAr6pRA4Uz3O9aC1TYGIUE31ZIb6ZhDmONx0giabeNZEPJiFDIS52hZ453By2sL2QrYzoEO2n4EQsBYkKBvbdUO3J9/z8VqcT4boFTVl8oBTMuOSQHfFDxZk21/XxBmMNsNhss5k2k3yh3JmZ9hAPiizUgezMWEx5WGnB4UvM9S8j0C8Dng+I7ywLWCLAFEodrjNfdiJ4TtE5toK8edA+N7dKU6JlbOdEqS//x7kWHv5tPquB1yjwYtNv7fNSkr/+jdphOSryNt0QLGpNx+riS7eylZytPJZEq4Sd0MPhfhy+RW8JbgteUli5nPTR0fj9nh8EJHlNPTo6v28j7s7mpP8ZR5c+Q0N6gXDrFIGtySAUT0yxlo9YtsCoWQftUULToCXSg4JeD9QPgtLCpncrm832oO4W6kFTVF+SmKWPUhu7+ugP6zgVJX3mJpCeZtQEsXrt3l3jbF X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GviF/KiStpJbnE4pbEfqXCp7uSAz+gwzPpzpb7MtygthxPxUXe8IHXLkycd0D5XXAHLKGFzeVB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I3+iuyRia23gSKCEvPaC8RH11X+25IrijyQ1YPXbd0IabXggm0JLb0Fl82/HMcqXZ6xqXlxtUPZYz45k/BD6KG5ANiVtcxYv8u/FYuvb6oZyJOXherbitFwbTzNZ+sD09kOkRXAgKXMlc69aPaRDFzUJJubWeZBvglZjcNtQqH4INsmKCMTnhrOBTqfx+tsOc3 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0c573c07-eeae-48db-80f0-08dac0624d13 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 01:49:26.0360 (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: GV2P250MB0923 Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/clearvideo: Redo updating predicition 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: x/YTdpN4Z0Sf This is in preparation for further commits. Signed-off-by: Andreas Rheinhardt --- libavcodec/clearvideo.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index 6ea3d7b6a2..11ae6ca9ad 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -296,7 +296,7 @@ static int copyadd_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, return 0; } -static MV mvi_predict(MVInfo *mvi, int mb_x, int mb_y, MV diff) +static MV *mvi_predict(MVInfo *mvi, int mb_x, int mb_y) { MV res, pred_mv; int left_mv, right_mv, top_mv, bot_mv; @@ -336,10 +336,16 @@ static MV mvi_predict(MVInfo *mvi, int mb_x, int mb_y, MV diff) res.y = bot_mv; } - mvi->mv[mvi->mb_stride + mb_x].x = res.x + diff.x; - mvi->mv[mvi->mb_stride + mb_x].y = res.y + diff.y; + mvi->mv[mvi->mb_stride + mb_x].x = res.x; + mvi->mv[mvi->mb_stride + mb_x].y = res.y; - return res; + return &mvi->mv[mvi->mb_stride + mb_x]; +} + +static void mvi_update_prediction(MV *mv, MV diff) +{ + mv->x += diff.x; + mv->y += diff.y; } static void mvi_reset(MVInfo *mvi, int mb_w, int mb_h, int mb_size) @@ -575,11 +581,13 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, for (j = 0; j < c->pmb_height; j++) { for (i = 0; i < c->pmb_width; i++) { + MV *mvp, mv; if (get_bits_left(&c->gb) <= 0) return AVERROR_INVALIDDATA; - if (get_bits1(&c->gb)) { - MV mv = mvi_predict(&c->mvi, i, j, zero_mv); + mvp = mvi_predict(&c->mvi, i, j); + mv = *mvp; + if (get_bits1(&c->gb)) { for (plane = 0; plane < 3; plane++) { int16_t x = plane == 0 ? i << c->tile_shift : i << (c->tile_shift - 1); int16_t y = plane == 0 ? j << c->tile_shift : j << (c->tile_shift - 1); @@ -596,15 +604,15 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int y = j << c->tile_shift; int size = 1 << c->tile_shift; TileInfo *tile; - MV mv, cmv; + MV cmv; tile = decode_tile_info(&c->gb, &lev[0]); // Y if (!tile) return AVERROR(ENOMEM); - mv = mvi_predict(&c->mvi, i, j, tile->mv); ret = restore_tree(avctx, c->pic, c->prev, 0, x, y, size, tile, mv); if (ret < 0) mb_ret = ret; + mvi_update_prediction(mvp, tile->mv); x = i << (c->tile_shift - 1); y = j << (c->tile_shift - 1); size = 1 << (c->tile_shift - 1); From patchwork Mon Nov 7 01:49:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39219 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1849049pzb; Sun, 6 Nov 2022 17:49:47 -0800 (PST) X-Google-Smtp-Source: AMsMyM5IRiVCm+5zXe/e9Sp+EoZBO3zAY0OZmjYMhIcBz/aNyRvR5iOI3T+FosrA/rVf1brs8SfH X-Received: by 2002:a17:906:9bd5:b0:7ad:939d:79a9 with SMTP id de21-20020a1709069bd500b007ad939d79a9mr44963541ejc.479.1667785786888; Sun, 06 Nov 2022 17:49:46 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y9-20020a50e609000000b00457e9f88b90si7733328edm.246.2022.11.06.17.49.45; Sun, 06 Nov 2022 17:49:46 -0800 (PST) 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=Vm12lpv6; 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 B8C6268BA6F; Mon, 7 Nov 2022 03:49:42 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066071.outbound.protection.outlook.com [40.92.66.71]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 314CF68B9F2 for ; Mon, 7 Nov 2022 03:49:40 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S9YarOTPLVo+0XddPewH/ALDevnkX5gaF709v/B4U0Dr+67T2boV3KOXTwWcPkJTaGN/N2/eWcsi5e8CKQcfceITB3rtVGGCo56Rs3stPHEgKiYf9ykA4DKAV6j1/fBXzYDjOgBqUKOmCU2MxZgDjZQHFWb5YXdYbloxTNH0JHLpJbhg46q4nlEJ+eZ5Chj4RnRKTqKVzvM6wiA9O8almU/rxiHuzRs1Fy+Xai3Fs8aND5ZYVNrfo7aLNZl5nhrcFdtd2ccKCyaggTGLcXuov7dJnMk6+Ke5+e56vtX1aszEnbwLE+M8UbVeNgBdPaLp9ePXGXlr+zzjP/LDWKc1ew== 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=iVLp76V+6WGYBtZf9wtlaTHdQg0MZkeAo+Dz5X/Jf44=; b=WSQqE/uHu4byr6R8iQ7WiReYO1RDSLOOcNddAnO136fXrjIWHPvmn55uO8YS3Y9YgrMJyDEZN/0sRLmGREqu3ADqdo5HHtBMBHncfU71x9/qfcK/qKEwqGv3vB8J3fta/V6Nt4Cd3whjaD9nGOhDgJJMGQuZ0evkkENbTWvgnGP+ZgN5z1V+SnxQeEm5RwJTMrest7unAnAD0iEq9o1kxKvQFi8KgnS944Ex1JWaOVrLskFukeYLY4NAzZlnSMSu/ulGgX92hUNR63/nwcmSTnZHdsfiJgyy2EL+0hTPHx+tABMa7yA1ohWYmiAo9uoPMoKlF0jLbanp+7S6Ow69uQ== 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=iVLp76V+6WGYBtZf9wtlaTHdQg0MZkeAo+Dz5X/Jf44=; b=Vm12lpv6vKtbF7WT7DntqY+ldJQL6W/WO/lZ7Xns9IZOiCaoyt6wU0hG34D73inV3pRWCUxFI/f1fOATYlsldqcLpMMI4r+2L9oBRuX2uUWIUIF2hsOqIboDDlPujmmBrqN4F34qVwLkaTGO/YXcIL4FtnmBkRT6WW7kJ0h9MoTgAnu6vjJGEC3MQhQwlXS3icnUuNWWo9b/QWi/jhrUX91z0127l4OmdaGj6yRDrlwTBlDpKzp4uf6BiPr1rHFRbPKvGZJ5UgQEgUc/+nJBn2ZRuMCGvB2qWU14YriWg4qhIQW5qJg06JCZQfL/z/BLOZop+Zn1T/EuNezhdi7fig== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by GV2P250MB0923.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:7a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.25; Mon, 7 Nov 2022 01:49:39 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe%4]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 01:49:39 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Nov 2022 02:49:21 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [g7+CfqQAXKjrvpCM1LhRZxv9N07qJTfCd8HPunHpx6c=] X-ClientProxiedBy: FR0P281CA0009.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::14) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221107014922.1503434-3-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|GV2P250MB0923:EE_ X-MS-Office365-Filtering-Correlation-Id: e6cd9a97-e064-487d-72f3-08dac0625541 X-MS-Exchange-SLBlob-MailProps: AZnQBsB9XmqxUC2t/XAH2K/2kJg/kN5yyay+y0EZg60xdXKPjsBQ7X2iR67xNTwY6p1EcOdQp/ohfngmpo1M+yn/4S6l/LUeRq8qmmIjeljx+P9iaoQD240v/b7qXgl4G/oa9XizvV6wDNOgd5+Wk+pyaOCiq7b1TFaNy25ZGv2EnvGOAoYmzljRfDVEcqgSul21IZirHkQOgL2qne5z1hcLgYdgcR8/Cno5YAdYYdPPxolQiItt+BEpKGf7MCZGk670f8zoJD85bkBW3aSwzbjiaxLcivcJbf1Sdq6tcn9Wgc3L1gY2CPftpCJ30nTuj2UoWKBY4cr5ewc3+t5rNQ+jxd0BOwjXbghMW/6tQi9+GABXKusMQ9ZN46UB63gyfAWJBi380k7GbH9gMUE9P7GpDFbncYpfamBDeF831VBHKWsNxf2p3vCQhOax5B9MhB0hO5P6L3+2KtPkBkqCPgT9ZnjCjtGUg7ZRavmG3tJm3zMSsJ6UB6LfU3uTbzmRd7pXucI0OSg1m/jAQyOCQMMqIxS58Xl7TrexjsQ50v47ohlbuf1avT24oHYZpOSwTWH0/2xA11ZEDnfXuzmFyjUixm6/rcEPDn6l/a4vAULyLj2ab8Ll2YxiW4MjJn0ekAxsl92IjnjYWaG4V+VLvgD6QovIPONLB7m5c4PuTTDicLvbBx9OjTQL3iytltkmX1EbEJHGq9Xw9neRyHy6mYZplA+WZmYukBQX/l1wLXeYHbaGgTWzh6apeWtZ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sGMrs33CF3fDRieah9Lgcl X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6cd9a97-e064-487d-72f3-08dac0625541 X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 01:49:39.8239 (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: GV2P250MB0923 Subject: [FFmpeg-devel] [PATCH 4/5] avcodec/clearvideo: Use const where appropriate 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: 0Oen7zsbRiV/ Signed-off-by: Andreas Rheinhardt --- libavcodec/clearvideo.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index 11ae6ca9ad..d3cbd71f72 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -222,14 +222,15 @@ static int decode_mb(CLVContext *c, int x, int y) return 0; } -static int copy_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, +static int copy_block(AVCodecContext *avctx, AVFrame *dst, const AVFrame *src, int plane, int x, int y, int dx, int dy, int size) { int shift = plane > 0; int sx = x + dx; int sy = y + dy; int sstride, dstride, soff, doff; - uint8_t *sbuf, *dbuf; + uint8_t *dbuf; + const uint8_t *sbuf; int i; if (x < 0 || sx < 0 || y < 0 || sy < 0 || @@ -248,7 +249,7 @@ static int copy_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, for (i = 0; i < size; i++) { uint8_t *dptr = &dbuf[doff]; - uint8_t *sptr = &sbuf[soff]; + const uint8_t *sptr = &sbuf[soff]; memcpy(dptr, sptr, size); doff += dstride; @@ -258,7 +259,7 @@ static int copy_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, return 0; } -static int copyadd_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, +static int copyadd_block(AVCodecContext *avctx, AVFrame *dst, const AVFrame *src, int plane, int x, int y, int dx, int dy, int size, int bias) { int shift = plane > 0; @@ -267,7 +268,7 @@ static int copyadd_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, int sstride = src->linesize[plane]; int dstride = dst->linesize[plane]; int soff = sx + sy * sstride; - uint8_t *sbuf = src->data[plane]; + const uint8_t *sbuf = src->data[plane]; int doff = x + y * dstride; uint8_t *dbuf = dst->data[plane]; int i, j; @@ -281,7 +282,7 @@ static int copyadd_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, for (j = 0; j < size; j++) { uint8_t *dptr = &dbuf[doff]; - uint8_t *sptr = &sbuf[soff]; + const uint8_t *sptr = &sbuf[soff]; for (i = 0; i < size; i++) { int val = sptr[i] + bias; @@ -368,7 +369,7 @@ static void mvi_update_row(MVInfo *mvi) } } -static int tile_do_block(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, +static int tile_do_block(AVCodecContext *avctx, AVFrame *dst, const AVFrame *src, int plane, int x, int y, int dx, int dy, int size, int bias) { int ret; From patchwork Mon Nov 7 01:49:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 39222 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:999a:b0:a4:2148:650a with SMTP id ve26csp1849120pzb; Sun, 6 Nov 2022 17:50:02 -0800 (PST) X-Google-Smtp-Source: AMsMyM50SJZGaBJ9Z81qpkdEo1hKIFeaCnd8hPEWAGIHPA/6EdqvjgFR+XIz9CgoZJPVjDHTaWDA X-Received: by 2002:a17:906:66ce:b0:7ad:d178:c252 with SMTP id k14-20020a17090666ce00b007add178c252mr37610840ejp.158.1667785802041; Sun, 06 Nov 2022 17:50:02 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id hb33-20020a170907162100b0078d027ceb41si7653111ejc.857.2022.11.06.17.50.01; Sun, 06 Nov 2022 17:50:02 -0800 (PST) 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=tTNdcu0H; 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 DE6E668BA98; Mon, 7 Nov 2022 03:49:58 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-oln040092066101.outbound.protection.outlook.com [40.92.66.101]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D049068BA05 for ; Mon, 7 Nov 2022 03:49:51 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Nd2wegddSuJ3U7cZsskj4a+DqS4hKc/EZx/ui7BeYu+CjIn9blh7PT4zjzvb7NYK05VasXP1XWoYGDg3kh7BoCLdf3Gu5vejnMpb4qzFMXS9iTwpl8LnpD+ammOEoF5rLJ6hi+dxI1hw0HjbqmYzWD0LOCAXnulhamunKLf3CknfoP1Fa9O28C87sUVM/layEFLS6Nb46nfn2ZVY81eQQOg5VyysEnz2b0VozSFrr07PSk5eogDH7E9NDaU5xfoC+wJgIvLvAwJeO+LN9KrZMrDJYpfl5jWz12p/bHBpZSffrwxFsygq/gTdfkvnOpGB19Qcn23Yog5hVPFo42x/vQ== 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=Xn8iPLiNZ9LgA8BFnDq2BJ3/DDEgFQr2+vEpTWRIL7s=; b=AAIg6fKwPQSqMTUcSXKixUuB/bEzXkQFFdF1UFafQ/ZL5Y0u7ebLp7zM4wQl0veTdUzuvH764IewQ8gcamlONvy1NLacEeY0iv5dqfWwCYeY14zPHsXIhr79EhbwYcJSWxudpgBaTdrWMW0L9vdkTbbJIv/ZrOMXwFUyvgo5VkgWcMHdBmAnzNA7mQPSnlGFMBgM1VIWWdUcFR3DTZeXVhi5jP4DivhwuRLbE9g1KPcrauQPw9AGavSbsXG5hEi0WZq4nBvzW2sVoFmIxtRNWMxhE39gRhhzGN+IDOVFVyMeNWLa4ozemCLj9ErspiIQUQdABrGGFoWW604nX6VPCw== 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=Xn8iPLiNZ9LgA8BFnDq2BJ3/DDEgFQr2+vEpTWRIL7s=; b=tTNdcu0HKLyLa0gR/Amu+bP4ukKfNzdiV9hd/Uw/iXyyoE7RDGzK64teRBSJVrwBDhCXVODQecC1c7ZAmqozCnMFp/WjpCVS8+1ZVKb+Kb9T5VX1m9isK/Lu3cC/H1SNISP3wFMjlO7NiuytSj88mUO6i/gn5d/Kzsky2OG50h4sYW5muKZY06gtcV8PtD9H5/+I4kz+UzLfnHls98OJgh4+T/WjpONCJJ7dblK6TRoXv2wxwb096aNm4IirZUKqTgikFMgUdDMxFsUuLyOp8vA9YdwNvZDwRKVnpeIcHhZYLsdepIBXqK5IIy0FaeNHWAELMi53uigS5uST22Fp7w== Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) by GV2P250MB0923.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:7a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.25; Mon, 7 Nov 2022 01:49:50 +0000 Received: from GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe]) by GV1P250MB0737.EURP250.PROD.OUTLOOK.COM ([fe80::c323:d08c:85d0:dafe%4]) with mapi id 15.20.5791.026; Mon, 7 Nov 2022 01:49:50 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 7 Nov 2022 02:49:22 +0100 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [HD1yJvUvWxPE0IpGnLwEOhZvAbD3Ltr+a7bUn8scO0o=] X-ClientProxiedBy: FR0P281CA0009.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::14) To GV1P250MB0737.EURP250.PROD.OUTLOOK.COM (2603:10a6:150:8e::17) X-Microsoft-Original-Message-ID: <20221107014922.1503434-4-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1P250MB0737:EE_|GV2P250MB0923:EE_ X-MS-Office365-Filtering-Correlation-Id: 5f8f931a-ac2b-42c1-ce11-08dac0625bbb X-MS-Exchange-SLBlob-MailProps: ZILSnhm0P3lImNjLdz2HENqjqsZBpuhvuFMP0UFAcUUobC4GCXenGkNrQpO8TvSaMCuTQvVbLtkLb1osGuWjEv1Q6FkzB+pJLuJwQtwuE0nnOLXa5EIH+qJEaZGnxKO+ecoKjrRMA7Tzohah+f1wg3ILWTe+F0gEzVgcTUUE0QTNRmwoKx6lcyx7nCl41XipDLNZySxAREkMdkK28o/UYT92vrRezcLUewVcxTXAupl8JxA0rS2T4dCuWDSa8CYRgoUopFGdSmrmWZ+wU8ch8c5Wg/hY3I5ectwSV1dZ9vQuct8BpelIqUvdD34ePO7ZcdoqhOWjZto+K1VihjPPOvjz/E41OdUIFeTv94JuZJFZ6/wFnP1zMBHBtpnuXidwLD6cvdXjzqlxuf1NetRS0R71/2gDKYU0LAu7/LsY9Vj8g7wbr/a1v0jEtqp4Xb+tNG4+etKuLxz1S4JKkYlc3RNf+dgUfmXfX1L2Ott6hvbpQOpgMIjqkgl+b+GrZjydKo0AaM17LzQl75Y4kRXK9s5t9OpdE6oQV731glwYELgVEsGz/EvVaDvHKmzemo3lqh1zzIUhQ5JFLKUeLPnXHaEsJNp7dxKVKKUcTSS3ZmcRw6NP4g9HMnvS8hUZW1TSwoL+yR8sI1ocNCOIgzeul+HIdzhKVc2Eb983jmSPUgl95yq+eqQeLIKWA9j7ksO82Yh+GiqLbEgaICFkW+EfnOr+j08n/ArCPI0KbRz/RB8OWU4DISgmWQJZvoMkI8kpLRjA21vA3jMktuqAPn25GBDuj0Ir9M1R X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YDne9jYMD/GITjIIjHxWZFU6K8ukFxZU3taCYoWfQQ6gohTZ/d/IJ7wr7kPc9dt/znbupk3erljjAUOQ7kl0SR5sfGc9F8B1NIZRya4xm6DeLwl17Kj3aiR+EsNSYHJQMw15xkXV1L+2bEPtymRe//9c/5EjNQ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U8Xy7HwQqtqQbBNhxi9I73ieErn4Xo7bDvyHF9NbRgv6gxuqsHcLClzz3wuc12fOux7CJC9/LdWCy2wCBHw6uxGWFsPaqC6rpq8fBhUTVaA9lk4OcyF/Lrj03g7SaZOnlDKqafnSBIgjZmscgwghN4DiVSa9WA6y8m+9UdD8P99SlVACx0H3J6/RnfzUJFH+82iguvw0LGIugWV/hcnuXGom0W/esPP0Pm9WKs5FNj4ah4aw90UG86CP+IwXA/gNUGIcyM7wWxMO644J6xdICvSjvyXKZ3vjHNKznz79Kgdztcod7y8msTNL2Dq9qO4LGywjW+dGVOj0HrGGSeArLI7LEz0gcXp2u8TUEKF/oFmsocj/O9obK2VBIQTnfRVuk3tEfv2mbguNV2TyjKP6fwvtIF3uPQyBKl4fL8TbVSmCHwa7dNLP5ChmCFRv58JhWiWFGjy4b5w4ghrImw3gnh17C2vRkhdTpmpabuaIQe7xRg9b9wrbr0WgeBArT6PpNAQ5jzyBNryxnggtL5eNfwwBZY4h0NgN5pMtJ70F/sisvuqsV4RyMIzWBBCxi3TgvwFive5zHwVRrkJ897vYWOlk+cueYhnGquPfC+iz9lO90UjXOwTxpw5SQp5A92qvHldAk3KPislQZODFF54TllwK9nQEhX0XMY+iAI5+C0PRkd/8MG2wUzi+VojPFCkp1geKRzvfToKp+GJa8qpusQFzB42aVJ9+ancJahgLqYwH5zUKpk8AeXTF+hnwpYW5wPnEDF7YJGM/Ize5as4vcVOYe1ksJIeqt5C3CriLvIekw54G5qRAjnKoZpqBS0iKpxTVJOVCTyEvLl8zMzhx/6NEFOwhQFl789 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5f8f931a-ac2b-42c1-ce11-08dac0625bbb X-MS-Exchange-CrossTenant-AuthSource: GV1P250MB0737.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2022 01:49:50.6427 (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: GV2P250MB0923 Subject: [FFmpeg-devel] [PATCH 5/5] avcodec/clearvideo: Avoid allocations when decoding tiles 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: 2VQ2kTEGVhzn Up until now, the ClearVideo decoder separates parsing tiles and actually using the parsed information: The information is instead stored in structures which are constantly allocated and freed. This commit changes this to use the information immediately, avoiding said allocations. This e.g. reduced the amount of allocations for [1] from 2,866,462 to 24,720. For said sample decoding speed improved by 143%. [1]: https://samples.ffmpeg.org/V-codecs/UCOD/AccordianDance-300.avi Signed-off-by: Andreas Rheinhardt --- libavcodec/clearvideo.c | 99 +++++++++++++---------------------------- 1 file changed, 31 insertions(+), 68 deletions(-) diff --git a/libavcodec/clearvideo.c b/libavcodec/clearvideo.c index d3cbd71f72..e77661d187 100644 --- a/libavcodec/clearvideo.c +++ b/libavcodec/clearvideo.c @@ -59,13 +59,6 @@ typedef struct MVInfo { MV *mv; } MVInfo; -typedef struct TileInfo { - uint16_t flags; - int16_t bias; - MV mv; - struct TileInfo *child[4]; -} TileInfo; - typedef struct CLVContext { AVCodecContext *avctx; IDCTDSPContext idsp; @@ -383,12 +376,16 @@ static int tile_do_block(AVCodecContext *avctx, AVFrame *dst, const AVFrame *src return ret; } -static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc) +static int decode_tile(AVCodecContext *avctx, GetBitContext *gb, + const LevelCodes *lc, + AVFrame *dst, const AVFrame *src, + int plane, int x, int y, int size, + MV root_mv, MV *pred) { - TileInfo *ti; int i, flags = 0; int16_t bias = 0; MV mv = { 0 }; + int err; if (lc->flags_cb.table) flags = get_vlc2(gb, lc->flags_cb.table, CLV_VLC_BITS, 2); @@ -403,7 +400,11 @@ static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc) mv.x = get_sbits(gb, 8); mv.y = get_sbits(gb, 8); } + if (pred) + mvi_update_prediction(pred, mv); } + mv.x += root_mv.x; + mv.y += root_mv.y; if (lc->bias_cb.table) { uint16_t bias_val = get_vlc2(gb, lc->bias_cb.table, CLV_VLC_BITS, 2); @@ -415,55 +416,29 @@ static TileInfo *decode_tile_info(GetBitContext *gb, const LevelCodes *lc) } } - ti = av_calloc(1, sizeof(*ti)); - if (!ti) - return NULL; - - ti->flags = flags; - ti->mv = mv; - ti->bias = bias; - - if (ti->flags) { - for (i = 0; i < 4; i++) { - if (ti->flags & (1 << i)) { - TileInfo *subti = decode_tile_info(gb, lc + 1); - ti->child[i] = subti; - } - } - } - - return ti; -} - -static int restore_tree(AVCodecContext *avctx, AVFrame *dst, AVFrame *src, - int plane, int x, int y, int size, - TileInfo *tile, MV root_mv) -{ - int ret; - MV mv; - - mv.x = root_mv.x + tile->mv.x; - mv.y = root_mv.y + tile->mv.y; - - if (!tile->flags) { - ret = tile_do_block(avctx, dst, src, plane, x, y, mv.x, mv.y, size, tile->bias); - } else { - int i, hsize = size >> 1; - + if (flags) { + int hsize = size >> 1; for (i = 0; i < 4; i++) { int xoff = (i & 2) == 0 ? 0 : hsize; int yoff = (i & 1) == 0 ? 0 : hsize; - if (tile->child[i]) { - ret = restore_tree(avctx, dst, src, plane, x + xoff, y + yoff, hsize, tile->child[i], root_mv); - av_freep(&tile->child[i]); + if (flags & (1 << i)) { + err = decode_tile(avctx, gb, lc + 1, dst, src, plane, + x + xoff, y + yoff, hsize, root_mv, NULL); } else { - ret = tile_do_block(avctx, dst, src, plane, x + xoff, y + yoff, mv.x, mv.y, hsize, tile->bias); + err = tile_do_block(avctx, dst, src, plane, x + xoff, y + yoff, + mv.x, mv.y, hsize, bias); } + if (err < 0) + return err; } + } else { + err = tile_do_block(avctx, dst, src, plane, x, y, mv.x, mv.y, size, bias); + if (err < 0) + return err; } - return ret; + return 0; } static void extend_edges(AVFrame *buf, int tile_size) @@ -604,38 +579,26 @@ static int clv_decode_frame(AVCodecContext *avctx, AVFrame *rframe, int x = i << c->tile_shift; int y = j << c->tile_shift; int size = 1 << c->tile_shift; - TileInfo *tile; MV cmv; - tile = decode_tile_info(&c->gb, &lev[0]); // Y - if (!tile) - return AVERROR(ENOMEM); - ret = restore_tree(avctx, c->pic, c->prev, 0, x, y, size, tile, mv); + ret = decode_tile(avctx, &c->gb, &lev[0], c->pic, c->prev, // Y + 0, x, y, size, mv, mvp); if (ret < 0) mb_ret = ret; - mvi_update_prediction(mvp, tile->mv); x = i << (c->tile_shift - 1); y = j << (c->tile_shift - 1); size = 1 << (c->tile_shift - 1); - cmv.x = mv.x + tile->mv.x; - cmv.y = mv.y + tile->mv.y; + cmv = *mvp; cmv.x /= 2; cmv.y /= 2; - av_freep(&tile); - tile = decode_tile_info(&c->gb, &lev[4]); // U - if (!tile) - return AVERROR(ENOMEM); - ret = restore_tree(avctx, c->pic, c->prev, 1, x, y, size, tile, cmv); + ret = decode_tile(avctx, &c->gb, &lev[4], c->pic, c->prev, // U + 1, x, y, size, cmv, NULL); if (ret < 0) mb_ret = ret; - av_freep(&tile); - tile = decode_tile_info(&c->gb, &lev[7]); // V - if (!tile) - return AVERROR(ENOMEM); - ret = restore_tree(avctx, c->pic, c->prev, 2, x, y, size, tile, cmv); + ret = decode_tile(avctx, &c->gb, &lev[7], c->pic, c->prev, // U + 2, x, y, size, cmv, NULL); if (ret < 0) mb_ret = ret; - av_freep(&tile); } } mvi_update_row(&c->mvi);