From patchwork Wed Mar 22 00:07:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 40776 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp2995400pzb; Tue, 21 Mar 2023 17:07:52 -0700 (PDT) X-Google-Smtp-Source: AK7set/mNfSeXSb5k4eZ5q3Byn7FIr1m1Mh0WprJVzoYJKEjg0yBuzOndH4Jw0clKI82GUvylVwI X-Received: by 2002:a17:906:ca49:b0:934:286:f9 with SMTP id jx9-20020a170906ca4900b00934028600f9mr331077ejb.27.1679443672749; Tue, 21 Mar 2023 17:07:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679443672; cv=none; d=google.com; s=arc-20160816; b=z4/rKBa4siNQH56n9ktKpYz7W++9YSopIw0EkEW7pssdbRTUA8m28yz57qs/zhPzep RZvN56d7pWZNqsCcrSQuCZ2+VTADiX9llhRdYJnh8Tk/MWfhHJVIiDtjko6GfTe6744s or80vkjGY74ZxIJ99Myh69KtjzqNF+qqHnBD0nYhflZF/yI+4D0RWL9A21N3SszKV6t4 Wm5HNlKyttqHpmAiWs6KRQmPLyYp5qLTgdFzWLJ1Pvs2j6DoyZTkfR4FvO7CGR2UU5fW lt2vvlYrjJf8rIEIFOoA5bXNQMYEREVhrcRTbdN9fjeBARG9sD71mR9xDAQD0JS+E5QV YAJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=uhZNf8YximIx0E4wAP/4ATklpRORCH5fnmX+Rw5qQeo=; b=w6Yt5gaWDt2HMAUWzH/+cV1pn29e5NLJhW/mTAPOjU1ZNkW8bMEewQOxdm3+xVVpgV mCxJKktuSkfOq5MOFleYoe/y3xiaN/jdre5R1vJ04ci/fOaupYF1p1pYT81vR1ybuake RM4zoeCnvXLO/cXHNnzaVDzMuNJc9lDIkZbER0x6Choe9N8UWHqs4Yx3zlowbZmV7io+ D2S0fBgX/baO0eQ2o485ocUMBx/P1Qkj5ngCx4z4qLXt22RUmT1pvJoVaQWzf9/Z7+pV fLJ1n+zw9KXE+gS9jPSLKSimzjyNaF5n4irwhbasNeg4p8R5NvnNSuW0Vobr6NhgIZhm +30g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm3 header.b=aVThYcoa; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=KwsggiRZ; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w17-20020a17090652d100b008da1e19114fsi13562838ejn.322.2023.03.21.17.07.52; Tue, 21 Mar 2023 17:07:52 -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=@itanimul.li header.s=fm3 header.b=aVThYcoa; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=KwsggiRZ; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D9C4C68BC61; Wed, 22 Mar 2023 02:07:38 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1117F68C2E3 for ; Wed, 22 Mar 2023 02:07:31 +0200 (EET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B93B05C01BD for ; Tue, 21 Mar 2023 20:07:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 21 Mar 2023 20:07:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1679443648; x=1679530048; bh=LkSnkMojO7kNYV1vSfhpGbxA55JTrTvrrQF lAUHuF2o=; b=aVThYcoagLGQ6tLFosDuYw5PCZ2aL218kk8J6F+mO15nobmXCrf OiM/FjmY0qXP/HCWilz8TqyvCcigEIf6i49CbhNniYMMDYE9PwQpYKs+zntCe4xc zOERC0TbkgxFxLiJtKNQ04grLqEbZYjSOSKhQttsV6EOZmIFiQTg6pUkYMtQzbLx +At+CfsZKQiyHFnJO8HMJu7sMt9lpa29HWHLqTxzs+LPQLQloD7y0zXNxhf65gyH Y8GL0xaqJ+zyW5NxjjDNncWcsf4Y2xPlpmq0jPOkpVAzgehOcJxaua2Y+53WmnlG 6ecHBiohQOCxaAldtGlMRmfmMx5DhxRQ4WQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1679443648; x= 1679530048; bh=LkSnkMojO7kNYV1vSfhpGbxA55JTrTvrrQFlAUHuF2o=; b=K wsggiRZpi05otv3jpf5CUEvTp9x/5rSGhMHV2OMgFk6yH93TDSSd9e1rx20jEQ6X co8LvgzQNv2/6rawHC5CL0QZmATBDtRr1ghJ31N6WxfNUD3bSuJoyXOcCytyla0i 9dVWADLic62EoNx3TX88d5WCIaB2K04iPM2bTt3fFc2PCHnsGk5VGf/BlhMCUBHm qTzX2s7LGO9as02wtQ+FS6lmwEAJyDDyc03hIh9XWmznGA8NR5jaJpnB0U8Jqueg kxe+s3wftWw6jISr3YczJ2qQYFB9zdjTGbZhaTGKSCItV3IyWR/J8GzxEePLqceo 7stNe8kAPK398pm/FY3Hg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeguddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhggtgfgsehtke ertdertdejnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhi mhhulhdrlhhiqeenucggtffrrghtthgvrhhnpeeujeefteekgedufeeggeeiudffffevud ekkeegudejtdejhfevvdfgheettdehfeenucffohhmrghinhepnhgvohhnrdhssgenucev lhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjuggvkhesih htrghnihhmuhhlrdhlih X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 21 Mar 2023 20:07:28 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Mar 2023 01:07:08 +0100 Message-Id: <20230322000710.47513-1-jdek@itanimul.li> X-Mailer: git-send-email 2.39.2 In-Reply-To: <61cbba0-956c-86ff-340-26a23453e0d@martin.st> References: <61cbba0-956c-86ff-340-26a23453e0d@martin.st> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: add clip N macro 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: fJBT3Z4Twve/ Signed-off-by: J. Dekker --- libavcodec/aarch64/hevcdsp_idct_neon.S | 19 +++++-------------- libavcodec/aarch64/neon.S | 11 +++++++++++ 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/libavcodec/aarch64/hevcdsp_idct_neon.S b/libavcodec/aarch64/hevcdsp_idct_neon.S index 467cb0f48a..3e59dd20bb 100644 --- a/libavcodec/aarch64/hevcdsp_idct_neon.S +++ b/libavcodec/aarch64/hevcdsp_idct_neon.S @@ -5,7 +5,7 @@ * * Ported from arm/hevcdsp_idct_neon.S by * Copyright (c) 2020 Reimar Döffinger - * Copyright (c) 2020 J. Dekker + * Copyright (c) 2023 J. Dekker * * This file is part of FFmpeg. * @@ -38,13 +38,6 @@ const trans, align=4 .short 31, 22, 13, 4 endconst -.macro clip2 in1, in2, min, max - smax \in1, \in1, \min - smax \in2, \in2, \min - smin \in1, \in1, \max - smin \in2, \in2, \max -.endm - function ff_hevc_add_residual_4x4_8_neon, export=1 ld1 {v0.8h-v1.8h}, [x1] ld1 {v2.s}[0], [x0], x2 @@ -182,7 +175,7 @@ function hevc_add_residual_4x4_16_neon, export=0 ld1 {v3.d}[1], [x12], x2 movi v4.8h, #0 sqadd v1.8h, v1.8h, v3.8h - clip2 v0.8h, v1.8h, v4.8h, v21.8h + clip v4.8h, v21.8h, v0.8h, v1.8h st1 {v0.d}[0], [x0], x2 st1 {v0.d}[1], [x0], x2 st1 {v1.d}[0], [x0], x2 @@ -201,7 +194,7 @@ function hevc_add_residual_8x8_16_neon, export=0 sqadd v0.8h, v0.8h, v2.8h ld1 {v3.8h}, [x12] sqadd v1.8h, v1.8h, v3.8h - clip2 v0.8h, v1.8h, v4.8h, v21.8h + clip v4.8h, v21.8h, v0.8h, v1.8h st1 {v0.8h}, [x0], x2 st1 {v1.8h}, [x12], x2 bne 1b @@ -221,8 +214,7 @@ function hevc_add_residual_16x16_16_neon, export=0 sqadd v1.8h, v1.8h, v17.8h sqadd v2.8h, v2.8h, v18.8h sqadd v3.8h, v3.8h, v19.8h - clip2 v0.8h, v1.8h, v20.8h, v21.8h - clip2 v2.8h, v3.8h, v20.8h, v21.8h + clip v20.8h, v21.8h, v0.8h, v1.8h, v2.8h, v3.8h st1 {v0.8h-v1.8h}, [x0], x2 st1 {v2.8h-v3.8h}, [x12], x2 bne 1b @@ -239,8 +231,7 @@ function hevc_add_residual_32x32_16_neon, export=0 sqadd v1.8h, v1.8h, v17.8h sqadd v2.8h, v2.8h, v18.8h sqadd v3.8h, v3.8h, v19.8h - clip2 v0.8h, v1.8h, v20.8h, v21.8h - clip2 v2.8h, v3.8h, v20.8h, v21.8h + clip v20.8h, v21.8h, v0.8h, v1.8h, v2.8h, v3.8h st1 {v0.8h-v3.8h}, [x0], x2 bne 1b ret diff --git a/libavcodec/aarch64/neon.S b/libavcodec/aarch64/neon.S index 1ad32c359d..bc105e4861 100644 --- a/libavcodec/aarch64/neon.S +++ b/libavcodec/aarch64/neon.S @@ -1,6 +1,8 @@ /* * This file is part of FFmpeg. * + * Copyright (c) 2023 J. Dekker + * * 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 @@ -16,6 +18,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +.macro clip min, max, regs:vararg +.irp x, \regs + smax \x, \x, \min +.endr +.irp x, \regs + smin \x, \x, \max +.endr +.endm + .macro transpose_8x8B r0, r1, r2, r3, r4, r5, r6, r7, r8, r9 trn1 \r8\().8B, \r0\().8B, \r1\().8B trn2 \r9\().8B, \r0\().8B, \r1\().8B From patchwork Wed Mar 22 00:07:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 40775 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp2995299pzb; Tue, 21 Mar 2023 17:07:41 -0700 (PDT) X-Google-Smtp-Source: AK7set8ypkvzJ8hgnL2daup0xjBBIDNYp6nF5mefY5xYtdK9d5PjB3AUyx6Xsk/sQNjsS0+xwE9X X-Received: by 2002:a17:906:498a:b0:93b:752:d2a9 with SMTP id p10-20020a170906498a00b0093b0752d2a9mr1097228eju.31.1679443661636; Tue, 21 Mar 2023 17:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679443661; cv=none; d=google.com; s=arc-20160816; b=FZPB+P1hAlAGD2jrpZU9k+/Lp+oRfIqcWUcmkq5TunyErLibDDoup5Y18C8ED4vgLX SpGz988CXdbUx6k2HluRk/lwNHD+HvYuWOz5qx+1RlEWU7G5N9Hvabdv/lALOIn5rW8z Um+TFlW87ykDXJIBaVijf7rzqGjp89Jgu3B6EUX+EVvgqUnxXzIGlCrHkpeCcwKzD5R+ hM0PqJBI1/uHUHaNYTtAPiECgL5qC6X1zsK4T0x7EQZjqxUDXwZJRDE7Zk8Ys0Ur2+Jn v6oMLW+ksEjjynLuMSnfqKWpPsxYnwU58jxpItkeK1+76gu7r7vDn/FwBBGIkalyYsMG GMbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=4i0HyH4T1486Uey0lXrnMnVvu+zIYUYQLdwOCv2v5rE=; b=yw3+Q7D3Vz0UBlDA/piB7LMSe3a+bqEIGqw331+Z00T6IFrOREaW1kllDXpFgOaN+M e8c4Ul8BEkCD+SNmpUZ2O++51+LvOTHNe1nkgIjxH+nalNCRpKuWo3tRITeihljP+yP8 cXj23ndtguRX7BF0gQKOuyXcq9b10jB2i20oGACnjDBnzCfLFaRjwfhuiTIZDTOS52Ar AOvqp1+YGlzgX1sOXioYHzHJ7/SfsQaO3zBQYAWqWZBAlFhpdrxGfoGIRqhaPY1hWj1D 94eJd7BneBLcTPpFw3l/t3awe//UCtSD2799M+fJB4yOsy9cCJBZR7EEcZ4zJkEHikRb 6ESA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm3 header.b=1ZuLbqTl; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=s3a7kAZO; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a3-20020a1709062b0300b0093105432da9si12988727ejg.151.2023.03.21.17.07.40; Tue, 21 Mar 2023 17:07:41 -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=@itanimul.li header.s=fm3 header.b=1ZuLbqTl; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=s3a7kAZO; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 845EE68C340; Wed, 22 Mar 2023 02:07:37 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0D6D268C170 for ; Wed, 22 Mar 2023 02:07:31 +0200 (EET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6EBFF5C012B for ; Tue, 21 Mar 2023 20:07:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 21 Mar 2023 20:07:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1679443649; x= 1679530049; bh=yv4OxHevU0Hi33ficKgGOuda/+o9sN0+gl1urVwfx58=; b=1 ZuLbqTly3GwcDac55K6lq4oKZT3yuHEelmec3U6DUCGnkZ4orGq7GjvmXnGbhIHo gTVhoqwDcgmTZ5w/Dlbh9GlSIsy4T5Xwc6a4Pb/zY7oJb5/zbo4c9FXSxiLaoqkL 7+XVMWpYRWu9GWTzPq+W2GXimNMEQCfkIBKk/4DiUkf7pqUI7T4DOhMoG/BivsaM nq0GKM2O5/zSl7Bu2l3c0A5YSfdZiMZOxjLsuAuL+eEFFuTLg6eUIBRQTgckCHq2 6om3SdhDdv3UxG7u2a3fnP1FQoF9IFmWE1dUZrTeAexO0EJzxzSeF+hC+UBg1M3z 3SK5czAnovl1eTdjb1x7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1679443649; x=1679530049; bh=y v4OxHevU0Hi33ficKgGOuda/+o9sN0+gl1urVwfx58=; b=s3a7kAZOMixUDh14n LeI65DUnYdW3wsSzpvsZcJA+OCl+uob7SKcVPuEFqEHJucLsjod2wfLPFonQAiEa F8xB/VHhlz6xGxOc4wgIG1r+1Pp+juo5CeJJ9oR72PhMhqMjCow7e/Phb9F+hxOI cFSGM3+LAqkqbqHNqxem2kh+ak++0UGt7ALnm63fsXFsYbNZdhZ6oGpoNI+03euU s8vt+wVGKig6DHztiDVgyYTB0DxKyiwBML74hp8t3coWojtEGSWrgMnEjnHTki7E a5FZu8NgCxca1hK09MhuB1a1ZgbpBa4KU8cOSvYE1IBfZrMjuOKafiPO/CKRTrba Qdn6Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeguddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepfdflrdcuffgvkhhkvghrfdcuoehjuggvkhesihhtrghnihhm uhhlrdhliheqnecuggftrfgrthhtvghrnhepgedvhfffuddugeehveeikeeifeefgfevff ektdehkeeifefhveeuteeufefhteetnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr rghmpehmrghilhhfrhhomhepjhguvghksehithgrnhhimhhulhdrlhhi X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 21 Mar 2023 20:07:28 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Mar 2023 01:07:09 +0100 Message-Id: <20230322000710.47513-2-jdek@itanimul.li> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322000710.47513-1-jdek@itanimul.li> References: <61cbba0-956c-86ff-340-26a23453e0d@martin.st> <20230322000710.47513-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/3] checkasm: add hevc_deblock chroma test 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: xBJFipZGLWz3 Signed-off-by: J. Dekker --- Added missing FATE target. tests/checkasm/Makefile | 2 +- tests/checkasm/checkasm.c | 1 + tests/checkasm/checkasm.h | 1 + tests/checkasm/hevc_deblock.c | 87 +++++++++++++++++++++++++++++++++++ tests/fate/checkasm.mak | 1 + 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 tests/checkasm/hevc_deblock.c diff --git a/tests/checkasm/Makefile b/tests/checkasm/Makefile index a6f06c7007..3e62a22bd6 100644 --- a/tests/checkasm/Makefile +++ b/tests/checkasm/Makefile @@ -28,7 +28,7 @@ AVCODECOBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuvdsp.o AVCODECOBJS-$(CONFIG_JPEG2000_DECODER) += jpeg2000dsp.o AVCODECOBJS-$(CONFIG_OPUS_DECODER) += opusdsp.o AVCODECOBJS-$(CONFIG_PIXBLOCKDSP) += pixblockdsp.o -AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_idct.o hevc_sao.o hevc_pel.o +AVCODECOBJS-$(CONFIG_HEVC_DECODER) += hevc_add_res.o hevc_deblock.o hevc_idct.o hevc_sao.o hevc_pel.o AVCODECOBJS-$(CONFIG_UTVIDEO_DECODER) += utvideodsp.o AVCODECOBJS-$(CONFIG_V210_DECODER) += v210dec.o AVCODECOBJS-$(CONFIG_V210_ENCODER) += v210enc.o diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c index e96d84a7da..c2184d260d 100644 --- a/tests/checkasm/checkasm.c +++ b/tests/checkasm/checkasm.c @@ -116,6 +116,7 @@ static const struct { #endif #if CONFIG_HEVC_DECODER { "hevc_add_res", checkasm_check_hevc_add_res }, + { "hevc_deblock", checkasm_check_hevc_deblock }, { "hevc_idct", checkasm_check_hevc_idct }, { "hevc_pel", checkasm_check_hevc_pel }, { "hevc_sao", checkasm_check_hevc_sao }, diff --git a/tests/checkasm/checkasm.h b/tests/checkasm/checkasm.h index 8744a81218..89c643e6a0 100644 --- a/tests/checkasm/checkasm.h +++ b/tests/checkasm/checkasm.h @@ -60,6 +60,7 @@ void checkasm_check_h264dsp(void); void checkasm_check_h264pred(void); void checkasm_check_h264qpel(void); void checkasm_check_hevc_add_res(void); +void checkasm_check_hevc_deblock(void); void checkasm_check_hevc_idct(void); void checkasm_check_hevc_pel(void); void checkasm_check_hevc_sao(void); diff --git a/tests/checkasm/hevc_deblock.c b/tests/checkasm/hevc_deblock.c new file mode 100644 index 0000000000..06c9c1969e --- /dev/null +++ b/tests/checkasm/hevc_deblock.c @@ -0,0 +1,87 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 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 General Public License for more details. + * + * You should have received a copy of the GNU 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. + */ + +#include + +#include "libavutil/intreadwrite.h" +#include "libavutil/mem_internal.h" + +#include "libavcodec/avcodec.h" +#include "libavcodec/hevcdsp.h" + +#include "checkasm.h" + +static const uint32_t pixel_mask[3] = { 0xffffffff, 0x03ff03ff, 0x0fff0fff }; + +#define SIZEOF_PIXEL ((bit_depth + 7) / 8) +#define BUF_STRIDE (8 * 2) +#define BUF_LINES (8) +#define BUF_OFFSET (BUF_STRIDE * BUF_LINES) +#define BUF_SIZE (BUF_STRIDE * BUF_LINES + BUF_OFFSET * 2) + +#define randomize_buffers(buf0, buf1, size) \ + do { \ + uint32_t mask = pixel_mask[(bit_depth - 8) >> 1]; \ + int k; \ + for (k = 0; k < size; k += 4) { \ + uint32_t r = rnd() & mask; \ + AV_WN32A(buf0 + k, r); \ + AV_WN32A(buf1 + k, r); \ + } \ + } while (0) + +static void check_deblock_chroma(HEVCDSPContext h, int bit_depth) +{ + int32_t tc[2] = { 1, 1 }; + uint8_t no_p[2] = { 0, 0 }; + uint8_t no_q[2] = { 0, 0 }; + LOCAL_ALIGNED_32(uint8_t, buf0, [BUF_SIZE]); + LOCAL_ALIGNED_32(uint8_t, buf1, [BUF_SIZE]); + + declare_func_emms(AV_CPU_FLAG_MMX, void, uint8_t *pix, ptrdiff_t stride, int32_t *tc, uint8_t *no_p, uint8_t *no_q); + + randomize_buffers(buf0, buf1, BUF_SIZE); + if (check_func(h.hevc_h_loop_filter_chroma, "hevc_h_loop_filter_chroma_%d", bit_depth)) { + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + } + + randomize_buffers(buf0, buf1, BUF_SIZE); + if (check_func(h.hevc_v_loop_filter_chroma, "hevc_v_loop_filter_chroma_%d", bit_depth)) { + call_ref(buf0 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + call_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + if (memcmp(buf0, buf1, BUF_SIZE)) + fail(); + bench_new(buf1 + BUF_OFFSET, BUF_STRIDE, tc, no_p, no_q); + } +} + +void checkasm_check_hevc_deblock(void) +{ + int bit_depth; + + for (bit_depth = 8; bit_depth <= 12; bit_depth += 2) { + HEVCDSPContext h; + ff_hevc_dsp_init(&h, bit_depth); + check_deblock_chroma(h, bit_depth); + } + report("chroma"); +} diff --git a/tests/fate/checkasm.mak b/tests/fate/checkasm.mak index a4e95541f5..faac764388 100644 --- a/tests/fate/checkasm.mak +++ b/tests/fate/checkasm.mak @@ -15,6 +15,7 @@ FATE_CHECKASM = fate-checkasm-aacpsdsp \ fate-checkasm-h264pred \ fate-checkasm-h264qpel \ fate-checkasm-hevc_add_res \ + fate-checkasm-hevc_deblock \ fate-checkasm-hevc_idct \ fate-checkasm-hevc_pel \ fate-checkasm-hevc_sao \ From patchwork Wed Mar 22 00:07:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 40777 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:d046:b0:cd:afd7:272c with SMTP id hv6csp2995482pzb; Tue, 21 Mar 2023 17:08:02 -0700 (PDT) X-Google-Smtp-Source: AK7set/UjsSEQuy9ZYX4NQNq5Qg/gcSIuO6/qA0kwld9QLMESEXIUijwg2PndvhEN+VSt4pF+oM0 X-Received: by 2002:a17:906:2f02:b0:8b1:7de3:cfaa with SMTP id v2-20020a1709062f0200b008b17de3cfaamr4168032eji.3.1679443682695; Tue, 21 Mar 2023 17:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679443682; cv=none; d=google.com; s=arc-20160816; b=glQiDgoo2aM0lMJQCHi4AVNplgkobLT3NwZEdn6njv9jSRqiQhFYzTEkTwQyaiu6eD mtHiFDosODRh8g6XQahhmucDzUKlXG/XO6mcSoBC/f75XcGsE6RyNrrKvfuy5+kvxtVF 8rlSXV4Sp7T0xU1DHV0FqDYSOdPtRsyL3oJxNw+jQmFwvpaJbyAexLK7Z7kk3a+zYDfy 18d7gcxCsWIOmN8aHgPL+QJagoytpoA8CxSYPWPxAw/A4kleJJ5d9Awh1MTpwyVIKGOC p8sAcsLxXAeGmy/gkU2ed7D+aCjdvLT6I8opzywumpgDAModCIaZkNcZ7c4T54hxINkX 97eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:feedback-id:dkim-signature:dkim-signature:delivered-to; bh=e0ya3reChKhZkGgIkUr8A9I0PstDoSRKu4QCU03WedQ=; b=vX+23H2VtsbKQjbGScNKk/7Uqk50ehC9UekZ1iH0CjRvNtHvSBHbx89kcrjw3gDyIX GN5qvLhX9QD6hNNU9ZjAyoUIU6f+LmRF0irKMrgTqkb7YP82izt8FN6pnIH8vOHqiYAB V4qZxr3qzO3i7p6WxGOSvRUa2YiqS/ZuGe/pA62RRcAF+aNH4HSLDmSvqM11lRwcrSrZ n/mqkAN3DVNp5zV7Ukgs/XeFsOjHz+0Ys6rElHcl2gFjhNgQAMi8+y0PhRvQZ82NM5Qp Y4UG0xR08TMm5BT3FKI3b1vAVtP+2mq5z5G1As1qfkgCC47birLwwu5faai9z3E+IEKS +c0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm3 header.b=oq8Zqegv; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=sOeSrzlF; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id xo17-20020a170907bb9100b00931ebd43e82si11906292ejc.628.2023.03.21.17.08.02; Tue, 21 Mar 2023 17:08:02 -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=@itanimul.li header.s=fm3 header.b=oq8Zqegv; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm2 header.b=sOeSrzlF; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E875868C3F2; Wed, 22 Mar 2023 02:07:39 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1315A68C2E8 for ; Wed, 22 Mar 2023 02:07:31 +0200 (EET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 1AA7F5C01A5 for ; Tue, 21 Mar 2023 20:07:30 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 21 Mar 2023 20:07:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm3; t=1679443650; x= 1679530050; bh=LMXWn/PwmxkRE54MHLnjnZW510uqFCylqfs4uidaAyQ=; b=o q8ZqegvkiLVE1u3JV7PzIvGhwf1MNOCtGAX1u5L5hAOFQYyrFke7L2eHeZMYo0QK PDwjMbiwPGAIZVJSyJwlhihpekd48V2qFRRrbc/6BC53zLCE0tcKutyNHLf3RwX1 aP2Oh9A7k0GPFf3fJ6TNi9bhZtgIX1pUao8hDt59gdtOVRGUNS3dZXNDli5OW1N/ 1Zp76P82DB7lT+P5nqrD8/9JTv/ywAKy/+yW3lB3+kmBsW6WfURGV88iPtpVEAXN POSIGMgMb1kGW6ayH68eCZRWPjJRfjSy41H7hoarIXI5X9humJ01hEx/xEe0Zm42 gVLh3cmntiiT4XaAi+1Yw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:date:feedback-id:feedback-id:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1679443650; x=1679530050; bh=L MXWn/PwmxkRE54MHLnjnZW510uqFCylqfs4uidaAyQ=; b=sOeSrzlFcVgtylOWt l7wI/IXuI/hOLMLR2ONrLeCZWgqoCL3Bv5YiUL8AyBdcoheme3cEcaZg8NPfgxvg appHkOT/ZSQuenPf/rKCmltfFOa33ph3WG2BR8vWxaBB3NuTbh7sf8a9fO6dvuWS XaTXQg8nzdpDP+BasnWQcQO66td21BdoOLu2fxQKK+UVWIUoX+9xwb6Y7GjL1Iqg 63NDwlrtQT8sI6/pI558+3Ofi26C6AxrfLikgqciLK7CEoOTLcTGEpYmuu4sUEkc H6rFsiowjEam/kgTiKdbrkEz1HBF4dvPzhZIyqBnKyPtFwqFs55zDKa0qPpDfNLE Gkiiw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdeguddgudelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepfdflrdcuffgvkhhkvghrfdcuoehjuggvkhesihhtrghnihhm uhhlrdhliheqnecuggftrfgrthhtvghrnhephfdvfeejffegffefieefvefgheeuudelhe fhffevtddthfehudeitdetfeehieetnecuffhomhgrihhnpehnvghonhdrshgsnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhguvghksehith grnhhimhhulhdrlhhi X-ME-Proxy: Feedback-ID: i84994747:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Tue, 21 Mar 2023 20:07:29 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Mar 2023 01:07:10 +0100 Message-Id: <20230322000710.47513-3-jdek@itanimul.li> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322000710.47513-1-jdek@itanimul.li> References: <61cbba0-956c-86ff-340-26a23453e0d@martin.st> <20230322000710.47513-1-jdek@itanimul.li> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 3/3] lavc/aarch64: add hevc deblock chroma 8-12bit 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: uyo7tdUYcpdw Signed-off-by: J. Dekker --- - Using clip macro - Avoided need for .elseif at all, just used better mvni libavcodec/aarch64/Makefile | 3 +- libavcodec/aarch64/hevcdsp_deblock_neon.S | 180 ++++++++++++++++++++++ libavcodec/aarch64/hevcdsp_init_aarch64.c | 18 +++ 3 files changed, 200 insertions(+), 1 deletion(-) create mode 100644 libavcodec/aarch64/hevcdsp_deblock_neon.S diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile index 02fb51c3ab..216191640c 100644 --- a/libavcodec/aarch64/Makefile +++ b/libavcodec/aarch64/Makefile @@ -65,7 +65,8 @@ NEON-OBJS-$(CONFIG_VP9_DECODER) += aarch64/vp9itxfm_16bpp_neon.o \ aarch64/vp9lpf_neon.o \ aarch64/vp9mc_16bpp_neon.o \ aarch64/vp9mc_neon.o -NEON-OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_idct_neon.o \ +NEON-OBJS-$(CONFIG_HEVC_DECODER) += aarch64/hevcdsp_deblock_neon.o \ + aarch64/hevcdsp_idct_neon.o \ aarch64/hevcdsp_init_aarch64.o \ aarch64/hevcdsp_qpel_neon.o \ aarch64/hevcdsp_sao_neon.o diff --git a/libavcodec/aarch64/hevcdsp_deblock_neon.S b/libavcodec/aarch64/hevcdsp_deblock_neon.S new file mode 100644 index 0000000000..49b40f21c8 --- /dev/null +++ b/libavcodec/aarch64/hevcdsp_deblock_neon.S @@ -0,0 +1,180 @@ +/* -*-arm64-*- + * vim: syntax=arm64asm + * + * Copyright (c) 2014 Seppo Tomperi + * Copyright (c) 2023 J. Dekker + * + * 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 + */ + + +#include "libavutil/aarch64/asm.S" +#include "neon.S" + +.macro hevc_loop_filter_chroma_start bitdepth + mov x4, x30 + ldr w14, [x2] + ldr w15, [x2, #4] +.if \bitdepth > 8 + lsl w14, w14, #(\bitdepth - 8) + lsl w15, w15, #(\bitdepth - 8) +.endif + adds w2, w14, w15 + b.eq 1f + dup v16.4h, w14 + dup v17.4h, w15 + trn1 v16.2d, v16.2d, v17.2d +.if \bitdepth > 8 + mvni v19.8h, #((0xff << (\bitdepth - 8)) & 0xff), lsl #8 + movi v18.8h, #0 +.endif + neg v17.8h, v16.8h +.endm + +.macro hevc_loop_filter_chroma_body bitdepth +.if \bitdepth <= 8 + uxtl v0.8h, v0.8b // p1 + uxtl v1.8h, v1.8b // p0 + uxtl v2.8h, v2.8b // q0 + uxtl v3.8h, v3.8b // q1 +.endif + sub v5.8h, v2.8h, v1.8h // q0 - p0 + sub v6.8h, v0.8h, v3.8h // p1 - q1 + shl v5.8h, v5.8h, #2 + add v5.8h, v6.8h, v5.8h + srshr v5.8h, v5.8h, #3 + clip v17.8h, v16.8h, v5.8h + sqadd v1.8h, v1.8h, v5.8h // p0 + delta + sqsub v2.8h, v2.8h, v5.8h // q0 - delta +.if \bitdepth <= 8 + sqxtun v1.8b, v1.8h + sqxtun v2.8b, v2.8h +.else + smin v1.8h, v1.8h, v19.8h + smin v2.8h, v2.8h, v19.8h + clip v18.8h, v19.8h, v1.8h, v2.8h +.endif +.endm + +function hevc_loop_filter_chroma_body_8_neon, export=0 + hevc_loop_filter_chroma_body 8 + ret +endfunc + +function hevc_loop_filter_chroma_body_10_neon, export=0 +hevc_loop_filter_chroma_body_12_neon: + hevc_loop_filter_chroma_body 10 + ret +endfunc + +// void ff_hevc_h_loop_filter_chroma_8_neon(uint8_t *_pix, ptrdiff_t _stride, int *_tc, uint8_t *_no_p, uint8_t *_no_q); + +.macro hevc_h_loop_filter_chroma bitdepth +function ff_hevc_h_loop_filter_chroma_\bitdepth\()_neon, export=1 + hevc_loop_filter_chroma_start \bitdepth + sub x0, x0, x1, lsl #1 +.if \bitdepth > 8 + ld1 {v0.8h}, [x0], x1 + ld1 {v1.8h}, [x0], x1 + ld1 {v2.8h}, [x0], x1 + ld1 {v3.8h}, [x0] +.else + ld1 {v0.8b}, [x0], x1 + ld1 {v1.8b}, [x0], x1 + ld1 {v2.8b}, [x0], x1 + ld1 {v3.8b}, [x0] +.endif + sub x0, x0, x1, lsl #1 + bl hevc_loop_filter_chroma_body_\bitdepth\()_neon +.if \bitdepth > 8 + st1 {v1.8h}, [x0], x1 + st1 {v2.8h}, [x0] +.else + st1 {v1.8b}, [x0], x1 + st1 {v2.8b}, [x0] +.endif +1: ret x4 +endfunc +.endm + +.macro hevc_v_loop_filter_chroma bitdepth +function ff_hevc_v_loop_filter_chroma_\bitdepth\()_neon, export=1 + hevc_loop_filter_chroma_start \bitdepth +.if \bitdepth > 8 + sub x0, x0, #8 + add x3, x0, x1 + lsl x1, x1, #1 + ld1 {v20.8h}, [x0], x1 + ld1 {v21.8h}, [x3], x1 + ld1 {v0.8h}, [x0], x1 + ld1 {v1.8h}, [x3], x1 + ld1 {v2.8h}, [x0], x1 + ld1 {v3.8h}, [x3], x1 + ld1 {v22.8h}, [x0], x1 + ld1 {v23.8h}, [x3], x1 + transpose_8x8H v20, v21, v0, v1, v2, v3, v22, v23, v24, v25 +.else + sub x0, x0, #4 + add x3, x0, x1 + lsl x1, x1, #1 + ld1 {v20.8b}, [x0], x1 + ld1 {v21.8b}, [x3], x1 + ld1 {v0.8b}, [x0], x1 + ld1 {v1.8b}, [x3], x1 + ld1 {v2.8b}, [x0], x1 + ld1 {v3.8b}, [x3], x1 + ld1 {v22.8b}, [x0], x1 + ld1 {v23.8b}, [x3], x1 + transpose_8x8B v20, v21, v0, v1, v2, v3, v22, v23, v24, v25 +.endif + sub x0, x0, x1, lsl #2 + sub x3, x3, x1, lsl #2 + bl hevc_loop_filter_chroma_body_\bitdepth\()_neon +.if \bitdepth > 8 + transpose_8x8H v20, v21, v0, v1, v2, v3, v22, v23, v24, v25 + st1 {v20.8h}, [x0], x1 + st1 {v21.8h}, [x3], x1 + st1 {v0.8h}, [x0], x1 + st1 {v1.8h}, [x3], x1 + st1 {v2.8h}, [x0], x1 + st1 {v3.8h}, [x3], x1 + st1 {v22.8h}, [x0], x1 + st1 {v23.8h}, [x3] +.else + xtn v0.8b, v0.8h // restore + xtn v3.8b, v3.8h + transpose_8x8B v20, v21, v0, v1, v2, v3, v22, v23, v24, v25 + st1 {v20.8b}, [x0], x1 + st1 {v21.8b}, [x3], x1 + st1 {v0.8b}, [x0], x1 + st1 {v1.8b}, [x3], x1 + st1 {v2.8b}, [x0], x1 + st1 {v3.8b}, [x3], x1 + st1 {v22.8b}, [x0], x1 + st1 {v23.8b}, [x3] +.endif +1: ret x4 +endfunc +.endm + +hevc_h_loop_filter_chroma 8 +hevc_h_loop_filter_chroma 10 +hevc_h_loop_filter_chroma 12 + +hevc_v_loop_filter_chroma 8 +hevc_v_loop_filter_chroma 10 +hevc_v_loop_filter_chroma 12 diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c index 1deefca0a2..a923bae35c 100644 --- a/libavcodec/aarch64/hevcdsp_init_aarch64.c +++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c @@ -25,6 +25,18 @@ #include "libavutil/aarch64/cpu.h" #include "libavcodec/hevcdsp.h" +void ff_hevc_v_loop_filter_chroma_8_neon(uint8_t *_pix, ptrdiff_t _stride, + const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q); +void ff_hevc_v_loop_filter_chroma_10_neon(uint8_t *_pix, ptrdiff_t _stride, + const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q); +void ff_hevc_v_loop_filter_chroma_12_neon(uint8_t *_pix, ptrdiff_t _stride, + const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q); +void ff_hevc_h_loop_filter_chroma_8_neon(uint8_t *_pix, ptrdiff_t _stride, + const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q); +void ff_hevc_h_loop_filter_chroma_10_neon(uint8_t *_pix, ptrdiff_t _stride, + const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q); +void ff_hevc_h_loop_filter_chroma_12_neon(uint8_t *_pix, ptrdiff_t _stride, + const int *_tc, const uint8_t *_no_p, const uint8_t *_no_q); void ff_hevc_add_residual_4x4_8_neon(uint8_t *_dst, const int16_t *coeffs, ptrdiff_t stride); void ff_hevc_add_residual_4x4_10_neon(uint8_t *_dst, const int16_t *coeffs, @@ -117,6 +129,8 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) if (!have_neon(av_get_cpu_flags())) return; if (bit_depth == 8) { + c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_8_neon; + c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_8_neon; c->add_residual[0] = ff_hevc_add_residual_4x4_8_neon; c->add_residual[1] = ff_hevc_add_residual_8x8_8_neon; c->add_residual[2] = ff_hevc_add_residual_16x16_8_neon; @@ -167,6 +181,8 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->put_hevc_qpel_bi[9][0][1] = ff_hevc_put_hevc_qpel_bi_h16_8_neon; } if (bit_depth == 10) { + c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_10_neon; + c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_10_neon; c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon; c->add_residual[1] = ff_hevc_add_residual_8x8_10_neon; c->add_residual[2] = ff_hevc_add_residual_16x16_10_neon; @@ -180,6 +196,8 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->idct_dc[3] = ff_hevc_idct_32x32_dc_10_neon; } if (bit_depth == 12) { + c->hevc_h_loop_filter_chroma = ff_hevc_h_loop_filter_chroma_12_neon; + c->hevc_v_loop_filter_chroma = ff_hevc_v_loop_filter_chroma_12_neon; c->add_residual[0] = ff_hevc_add_residual_4x4_12_neon; c->add_residual[1] = ff_hevc_add_residual_8x8_12_neon; c->add_residual[2] = ff_hevc_add_residual_16x16_12_neon;