From patchwork Mon Jan 24 20:09: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: 33820 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6602:2c4e:0:0:0:0 with SMTP id x14csp15362iov; Mon, 24 Jan 2022 12:10:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwn5q2HNZmWrmuQXx2HYxLST0ML/dl16USZPVSTByr9znCWo3vWyobAQRyVzroZKpBcETzq X-Received: by 2002:a17:906:f85:: with SMTP id q5mr14347443ejj.232.1643055044428; Mon, 24 Jan 2022 12:10:44 -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 o8si1065296ejy.37.2022.01.24.12.10.44; Mon, 24 Jan 2022 12:10:44 -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=U1P3FK6O; 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 19CB768B1A8; Mon, 24 Jan 2022 22:10:05 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-oln040092065021.outbound.protection.outlook.com [40.92.65.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9664368B15C for ; Mon, 24 Jan 2022 22:10:00 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CNPj1Zl3Q5n1tLjO81t43CFSVasg7+7rCCjU0+auPFvKKFgtCdNzT5PN0U5K5tM3KAf3IphG6K4pooy89cc/kmf50SkmcPv+wpzWbMndl62J9xgfH2rL8zZV5tOb9QXCVFnAZN5K03ZL4bSja/vvT5+RZA25OS88g2bAadH5QiSxde4yChewKqeV4wERZTljTgngHuwFtpohjc6Vfvmxj80Pgv0hPq51aEJy+xWnL5HJTls/9LCAgpk3uzwU04VLDrskRt+nHsD+A5BWkrWpRYDyRqWNUVVR/bM0Wcpr4g+WHsMx1JcyUESOTajd8PG/PaPTBEs1QKK1+PuSwAtf8Q== 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=MiEB1IEnoO1x/gDBB6fFSFjihnm47KtzcYo/DVQUaaw=; b=OCYCGyeLu1J3/hslINEr04pETe3HhPvR32Dj6UQzo2veaR4kVeEyPzFIIgJaX4R6SbzUpCXoMfgEm6XoIgoGRt7kfAuWTAvIgav8hdbe4Ov2onT5qwx4592XHfn9II7Ort57hYZLdnJJ5yi71lIcZs8d/qo0rbxLGVDYJvBFaURp1J52gTCMY3JGmz1gKQG/yyhI8PSzNFCKgqN40kKv11hI1QpwdbGiVv6e3sDXEo1G8TbVz92T4qA2FI8AfUzv/wg42oorSQn81xHYSDBl2TxYGnVKxq9zqZsjYSd5/SOPqvmKKQ7SR8ic2N6kFFBJWPUNGK5+QtifoFHaVVQ2HA== 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=MiEB1IEnoO1x/gDBB6fFSFjihnm47KtzcYo/DVQUaaw=; b=U1P3FK6OgP7wHKimHdeIIuk5cJX3TlUNAmm+tI9tJ1WPDt5/wGlYcCkRbar/xj/vUUAfwYoOnGN3Phajlj/qgnVsnnlNDFgy1SYBjPFuZXKDCmK5Co0QoBHiuVX47b7gHpxB3QcSmlCEB/GFlP4xNsgL3JDfU0lcNhH6qcGJfX4w8B8lIgmW7Ehf8UOwuQ3M61iO0v68Q8OftTsKo5VSFnsJQVgH8fzoEFt8nxaFlMRHHbBt7AsfZwd+K/a1v1+DvAb5luBXrS4xh+69qlajlycr89pKKH114FIPSE0b/hl3FBaGUXN2i2Kk6elpDV3CTG5wCWOQD8Y5THgbwmSm6Q== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by VI1PR0301MB2557.eurprd03.prod.outlook.com (2603:10a6:800:64::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4909.17; Mon, 24 Jan 2022 20:09:53 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::ac56:2ff4:d304:ab22%4]) with mapi id 15.20.4909.017; Mon, 24 Jan 2022 20:09:53 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 24 Jan 2022 21:09:21 +0100 Message-ID: X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220124200931.593079-1-andreas.rheinhardt@outlook.com> References: <20220124200931.593079-1-andreas.rheinhardt@outlook.com> X-TMN: [EeqELdoeyLxTWJVAv+Omqc+ANQ5yH0p5] X-ClientProxiedBy: AS8PR04CA0012.eurprd04.prod.outlook.com (2603:10a6:20b:310::17) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20220124200931.593079-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0b19d7d1-1fc6-4f6b-7261-08d9df757bb4 X-MS-TrafficTypeDiagnostic: VI1PR0301MB2557:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hJx4OfYP7Gx5LPGhR2ar8rzAKIwr61SvkCq6Gl2kVScvH3IeLn0ZrPkm8rwVCZBu/+iIGBRUSX1q/3WxRq285WLTB4yaxNqU7/LlUblPGzo2xZ9fxvPdNZuvkOKk8dErI56snHJhBvCqk643B+kpfVm8xTJrf+rOE7bQnZfuO4/33AHGCa9OFdJ/p+PYmiigxOdaYVlnumyQOiRsKavAs6e1aE3uEO2lUHSu3lS1i0/7yTMBWYXnOQDEJfIziKd9WI6Fzbgr1klBrBEikG2+RotXW202saMg34QLhlmep49EyuhBDLZRw62k4adQzG4fxh26hGWwbfJgbQNRY8JGdBjB8vovEjaMNMaBu3j6X6XLrJF5+J5+HRTbbjzqHrharJinToZSHuneyCqXaWsgndAlbX/NEjrnY9BN2FK6diQZrGX4klvIeMB9Csr25EacvCGR1wi1r2dSKevssSF1PW4b1SieGwyzovq6KbnkQMGAncpRFsKNHCtoPHp20puU4kATx46/atsZ6YvHV5AF/vp4htNPKv6IkkkVt3qYgsRN9tKtXBFtNnII4PzwJDgDfVJ6GNTRQouMEes6Y5AJXQ== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yoZW7sycQuwGf00RMtULTp5M1PP8ByTNdCwY1M5RC+wsQXlNiqzhDbECRGB0xDQt1uuDfBXs4M+mFvtiZpm5t7e2b8tZK3T/R4qjRzaKl0QK8A3FCOL1XQ9bwYur8KpkbbeSB/AcIsth4nDDLCHqyMmJVo1GCQaUs61vSyRxnGtT5MuuI4BjyF/7F/BX7cxeq291Py8LTlIit2GYiDmz4mQK5I0eWTamjrhJte7mlRSHj7SrOLObjQqG0gpQySyBf5/qgwRBhzChyizcgn2nUOvQaGkVdOt+XZKvWelkkNdm9ySrDDAWfovpXZgHmAFk7qlrJ/j6zAm3AXggTdub3m4B3+Yi39NhCyiBzisX8hrWo2j1fXA4kKgT5TAvRcqDimsBx+LnW4OqDMVoMeUPRC+IB0HdfJFjDYFlWYHPNLoMI4E4Mn9SoUrsL+8xLj5RiMaRhUy4Z8cS2JXS7hX4LztVoiUShSrMXaEOMoyUmG5hMWVLzLo870HYBTJd7oxoqFZ7tG5Gi1nCivBgoQyk6sW/b/Ev8nyEUgRpgZpOTEOGq52NkVjVdV59q+EzZoF9R2BqY4tjmq5rEfu+/rARwhpvE+akQUBl5jga3t51xv4CGCKs4RMRzQWYTntODRkDlBbUXLSuWTWFuT/6GhtdlKwnvFxZN72mcM8UsB5J5Kht/12thvtEYEeuOgsCMt5gJ1IttLH6A9NxirndFywW/CMFa6koy7DydUkxL5Nr9DmVrppwBMEPzEOCKo2lnZrxm07Gc229ThHhC29ifvbWWq6ByuTugxoJBVbpQh1IjsU+OesMqoMysjqeaosywXhpQSLf7E1Oy+hK3jFs03QKTQMwX6AYrJJEpdHBxW8IT22jdAI0JqJCjZWJTVPgkzipTKD1S0ArTHpDN9UuSrEXBu+FVKPiMRg2vIo7qeCBKGtDnGz+G3ylEBs52tZU8ZpOOzaQXBqvs14kYUeV/7Wi5g== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b19d7d1-1fc6-4f6b-7261-08d9df757bb4 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jan 2022 20:09:53.0936 (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: VI1PR0301MB2557 Subject: [FFmpeg-devel] [PATCH v2 08/18] lavc/h264: move some shared code from h264dec to h264_parse 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: Anton Khirnov Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 6pnjUYENigI/ From: Anton Khirnov --- libavcodec/h264_parse.h | 32 ++++++++++++++++++++++++++++++++ libavcodec/h264dec.h | 26 -------------------------- tests/checkasm/h264dsp.c | 1 + 3 files changed, 33 insertions(+), 26 deletions(-) diff --git a/libavcodec/h264_parse.h b/libavcodec/h264_parse.h index 05732326d3..52b224f4c5 100644 --- a/libavcodec/h264_parse.h +++ b/libavcodec/h264_parse.h @@ -24,9 +24,32 @@ #ifndef AVCODEC_H264_PARSE_H #define AVCODEC_H264_PARSE_H +#include "config.h" + +#include + +#include "libavutil/attributes.h" + #include "get_bits.h" #include "h264_ps.h" +// This table must be here because scan8[constant] must be known at compiletime +static const uint8_t scan8[16 * 3 + 3] = { + 4 + 1 * 8, 5 + 1 * 8, 4 + 2 * 8, 5 + 2 * 8, + 6 + 1 * 8, 7 + 1 * 8, 6 + 2 * 8, 7 + 2 * 8, + 4 + 3 * 8, 5 + 3 * 8, 4 + 4 * 8, 5 + 4 * 8, + 6 + 3 * 8, 7 + 3 * 8, 6 + 4 * 8, 7 + 4 * 8, + 4 + 6 * 8, 5 + 6 * 8, 4 + 7 * 8, 5 + 7 * 8, + 6 + 6 * 8, 7 + 6 * 8, 6 + 7 * 8, 7 + 7 * 8, + 4 + 8 * 8, 5 + 8 * 8, 4 + 9 * 8, 5 + 9 * 8, + 6 + 8 * 8, 7 + 8 * 8, 6 + 9 * 8, 7 + 9 * 8, + 4 + 11 * 8, 5 + 11 * 8, 4 + 12 * 8, 5 + 12 * 8, + 6 + 11 * 8, 7 + 11 * 8, 6 + 12 * 8, 7 + 12 * 8, + 4 + 13 * 8, 5 + 13 * 8, 4 + 14 * 8, 5 + 14 * 8, + 6 + 13 * 8, 7 + 13 * 8, 6 + 14 * 8, 7 + 14 * 8, + 0 + 0 * 8, 0 + 5 * 8, 0 + 10 * 8 +}; + /** * Memory management control operation opcode. */ @@ -103,4 +126,13 @@ int ff_h264_decode_extradata(const uint8_t *data, int size, H264ParamSets *ps, */ int ff_h264_get_profile(const SPS *sps); +static av_always_inline uint32_t pack16to32(unsigned a, unsigned b) +{ +#if HAVE_BIGENDIAN + return (b & 0xFFFF) + (a << 16); +#else + return (a & 0xFFFF) + (b << 16); +#endif +} + #endif /* AVCODEC_H264_PARSE_H */ diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index 7553dd808c..5266420fa1 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -642,32 +642,6 @@ void ff_h264_filter_mb(const H264Context *h, H264SliceContext *sl, int mb_x, int #define LUMA_DC_BLOCK_INDEX 48 #define CHROMA_DC_BLOCK_INDEX 49 -// This table must be here because scan8[constant] must be known at compiletime -static const uint8_t scan8[16 * 3 + 3] = { - 4 + 1 * 8, 5 + 1 * 8, 4 + 2 * 8, 5 + 2 * 8, - 6 + 1 * 8, 7 + 1 * 8, 6 + 2 * 8, 7 + 2 * 8, - 4 + 3 * 8, 5 + 3 * 8, 4 + 4 * 8, 5 + 4 * 8, - 6 + 3 * 8, 7 + 3 * 8, 6 + 4 * 8, 7 + 4 * 8, - 4 + 6 * 8, 5 + 6 * 8, 4 + 7 * 8, 5 + 7 * 8, - 6 + 6 * 8, 7 + 6 * 8, 6 + 7 * 8, 7 + 7 * 8, - 4 + 8 * 8, 5 + 8 * 8, 4 + 9 * 8, 5 + 9 * 8, - 6 + 8 * 8, 7 + 8 * 8, 6 + 9 * 8, 7 + 9 * 8, - 4 + 11 * 8, 5 + 11 * 8, 4 + 12 * 8, 5 + 12 * 8, - 6 + 11 * 8, 7 + 11 * 8, 6 + 12 * 8, 7 + 12 * 8, - 4 + 13 * 8, 5 + 13 * 8, 4 + 14 * 8, 5 + 14 * 8, - 6 + 13 * 8, 7 + 13 * 8, 6 + 14 * 8, 7 + 14 * 8, - 0 + 0 * 8, 0 + 5 * 8, 0 + 10 * 8 -}; - -static av_always_inline uint32_t pack16to32(unsigned a, unsigned b) -{ -#if HAVE_BIGENDIAN - return (b & 0xFFFF) + (a << 16); -#else - return (a & 0xFFFF) + (b << 16); -#endif -} - /** * Get the chroma qp. */ diff --git a/tests/checkasm/h264dsp.c b/tests/checkasm/h264dsp.c index 7392452957..3c95f9d74d 100644 --- a/tests/checkasm/h264dsp.c +++ b/tests/checkasm/h264dsp.c @@ -23,6 +23,7 @@ #include "libavcodec/avcodec.h" #include "libavcodec/h264dsp.h" #include "libavcodec/h264data.h" +#include "libavcodec/h264_parse.h" #include "libavutil/common.h" #include "libavutil/internal.h" #include "libavutil/intreadwrite.h"