From patchwork Thu Apr 28 13:42:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Dekker" X-Patchwork-Id: 35471 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:3b9e:b0:7d:cfb5:dc7c with SMTP id b30csp3597890pzh; Thu, 28 Apr 2022 06:42:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLy20hy7sp0X48bPKWjJ8Y+/zuVEwkE8F2qwv5LeScUv4mhuyzQo7h/LJ4Fp4dViJnbNnT X-Received: by 2002:a50:9986:0:b0:413:bbdd:d5a1 with SMTP id m6-20020a509986000000b00413bbddd5a1mr36055899edb.26.1651153347749; Thu, 28 Apr 2022 06:42:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651153347; cv=none; d=google.com; s=arc-20160816; b=Rl3tz2Xyupw66emUUMA/JBhjXB12WOuHzvrqE5FoNuIfFIb8iWSm9NYwgLj6Ee7Haj lkvgUM96wtthv2HqoOPhM2hoPvPPrrnWIKCX7udT74iPQcp2iwu0JWhd0sLgSECvHtLy jMN7zcI+8+fCn8cQ6y9RWwppscPs5p//kRNWMHVHnhWlyFhpw4LT+UgjFI+V4MThV1LU x1xENhiudsLqDpBZpl76ejAOHTr69ZQ8wydYceSymOvX/RqvsUx6SIGNhKZrkIyxxRmp 6z1lBtsr0rwZUrdCh2FnsdV+MwO1SZxCSkFapIAAA3BEhhKBE16X9UZKRKwAL7xElxJM pKxw== 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:message-id:date:to:from :dkim-signature:dkim-signature:delivered-to; bh=bAa/s2T5ZoIJO+EfBcvDdRA2ldSKnv9Pm13L1VPpFE0=; b=kst5GU0e/KGNP+5VTsuUtSLHNizUI+FHVhIf7WKjIN8AH4nQyBsLdyuQdGMSvhyuRA i4VynKIWCdQXuuVxn/WbQsLj5fcg/SqQLwDrGrVyLG89pHEW2/Fjqq1X+r6KvqlNAc6t Qwq3DdkqQ8jDSQM9hp8V138I/3mvpLLn7oi3KKx0cr5AeelewG+EtcUU50K6nGnm0861 pMtClk4X6IYablTs7PtS9JlxyE1T71rXqmD6xlj83uZcAl6MoX9QibQTpP4cKTW4E0Vu pz9g8m/OZGLUg5kOFMA7d1f6juTVqNUbECOEZhcZ2c/A9OFPhS774iINHqAiWyT730/G hzdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@itanimul.li header.s=fm2 header.b=jWmngqMl; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=CF27oPQQ; 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 u22-20020a170906069600b006eff1696032si889520ejb.14.2022.04.28.06.42.27; Thu, 28 Apr 2022 06:42:27 -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=fm2 header.b=jWmngqMl; dkim=neutral (body hash did not verify) header.i=@messagingengine.com header.s=fm1 header.b=CF27oPQQ; 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 550FB68B2BE; Thu, 28 Apr 2022 16:42:23 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 622C368B2BE for ; Thu, 28 Apr 2022 16:42:16 +0300 (EEST) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id F42255C00BC for ; Thu, 28 Apr 2022 09:42:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 28 Apr 2022 09:42:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=itanimul.li; h= cc:content-transfer-encoding:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:sender:subject:subject:to:to; s=fm2; t=1651153334; x=1651239734; bh=0J99Gyc3f/hkt1SB9/pOLMJn/ cUscEgU1eN7jnzuAnM=; b=jWmngqMl/zQIyBhoNwHZAr+eLb9colrodVzpHKrj3 GYnEvoqJm3v8LO5K9e1fmtY1VX63QxkqwqXfNHQRGOHuwBWHy1/ku53TWOtAoiqp VnGqy5vXxlnD2eQT/qsM2eEBJKfMZWBBhQWYOcKWz1HiiBdudwqamFrosR3Y0rBx w0r3+BPTMkMbWzSsnGLsze8YC9x/cgs8l4Ftwjb5NpZa+6RbJmL/RvwtW53ktJJ9 DbXUmWsIBgLyagCs0TvRlJLNgV3uAs61rKqor7FUquL18STEh6T9XuXKR7CkzWIz kyoVscEFgpejUypbmmckzCL+nCD+G1MwUn7JVdnuQnE2w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:date :from:from:in-reply-to:message-id:mime-version:reply-to:sender :subject:subject:to:to:x-me-proxy:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1651153334; x=1651239734; bh=0 J99Gyc3f/hkt1SB9/pOLMJn/cUscEgU1eN7jnzuAnM=; b=CF27oPQQvyFBCr+v0 LBNEMaXwbTf098WJ0+3UH09ejr3Z2b/ywlGyxS1NWqlBx7gBV7iZt+xTwFR/iWdF zOo89d50zF/4mI3/l3amGECfAbF1IjM2g1v2rFu63M6mfiAlxx7d0BJWTAg3dIYx 58jHnkLrOmYUM2VzcQVKDKXtQz9BVLIYu3niPVMYn9MPQ7dtIdna4n7TMZqTS3Fg A++Omb7tqv9iIpfHkSd/IGgdcvztz3B3hlhhkGrdBXgatWwa04z98ZdHh7egtTOR 4B0ZWPJRC8suhO/2oGcbRIvZucU/+l8+8qXUwi8KLqYUgCMEbRR/DsG8V9Psu+Yv g71yg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudejgdeikecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkffoggfgsedtkeertdertd dtnecuhfhrohhmpedflfdrucffvghkkhgvrhdfuceojhguvghksehithgrnhhimhhulhdr lhhiqeenucggtffrrghtthgvrhhnpefhfedtieetieejieegveefveehudelveevteejke evieeukeejvefhhfetjeethfenucffohhmrghinhepnhgvohhnrdhssgenucevlhhushht vghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjuggvkhesihhtrghnih hmuhhlrdhlih X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 28 Apr 2022 09:42:14 -0400 (EDT) From: "J. Dekker" To: ffmpeg-devel@ffmpeg.org Date: Thu, 28 Apr 2022 15:42:09 +0200 Message-Id: <20220428134211.4786-1-jdek@itanimul.li> X-Mailer: git-send-email 2.32.0 (Apple Git-132) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavc/aarch64: fix hevc sao band filter 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: NaS9LDPM0p0y The SAO band filter can be called with non-multiples of 8, we round up to the nearest multiple of 8 to account for this. Signed-off-by: J. Dekker --- libavcodec/aarch64/hevcdsp_init_aarch64.c | 10 +++++----- libavcodec/aarch64/hevcdsp_sao_neon.S | 8 ++++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/libavcodec/aarch64/hevcdsp_init_aarch64.c b/libavcodec/aarch64/hevcdsp_init_aarch64.c index 1e40be740c..c8963e6104 100644 --- a/libavcodec/aarch64/hevcdsp_init_aarch64.c +++ b/libavcodec/aarch64/hevcdsp_init_aarch64.c @@ -75,11 +75,11 @@ av_cold void ff_hevc_dsp_init_aarch64(HEVCDSPContext *c, const int bit_depth) c->idct_dc[1] = ff_hevc_idct_8x8_dc_8_neon; c->idct_dc[2] = ff_hevc_idct_16x16_dc_8_neon; c->idct_dc[3] = ff_hevc_idct_32x32_dc_8_neon; - // This function is disabled, as it doesn't handle widths that aren't - // an even multiple of 8 correctly. fate-hevc doesn't exercise that - // for the current size, but if enabled for bigger sizes, the cases - // of non-multiple of 8 seem to arise. -// c->sao_band_filter[0] = ff_hevc_sao_band_filter_8x8_8_neon; + c->sao_band_filter[0] = + c->sao_band_filter[1] = + c->sao_band_filter[2] = + c->sao_band_filter[3] = + c->sao_band_filter[4] = ff_hevc_sao_band_filter_8x8_8_neon; } if (bit_depth == 10) { c->add_residual[0] = ff_hevc_add_residual_4x4_10_neon; diff --git a/libavcodec/aarch64/hevcdsp_sao_neon.S b/libavcodec/aarch64/hevcdsp_sao_neon.S index d523bf584d..e07e0cea2d 100644 --- a/libavcodec/aarch64/hevcdsp_sao_neon.S +++ b/libavcodec/aarch64/hevcdsp_sao_neon.S @@ -41,7 +41,11 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1 and w10, w10, #0x1F strh w9, [sp, x10, lsl #1] bne 0b + add w6, w6, #7 + bic w6, w6, #7 ld1 {v16.16b-v19.16b}, [sp], #64 + sub x2, x2, x6 + sub x3, x3, x6 movi v20.8h, #1 1: mov w8, w6 // beginning of line 2: // Simple layout for accessing 16bit values @@ -52,7 +56,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1 // |xDE#xAD|xCA#xFE|xBE#xEF|xFE#xED|.... // +-----------------------------------> // i-0 i-1 i-2 i-3 - ld1 {v2.8b}, [x1] // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); + ld1 {v2.8b}, [x1], #8 // dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]); uxtl v0.8h, v2.8b // load src[x] ushr v2.8h, v0.8h, #3 // >> BIT_DEPTH - 3 shl v1.8h, v2.8h, #1 // low (x2, accessing short) @@ -61,7 +65,7 @@ function ff_hevc_sao_band_filter_8x8_8_neon, export=1 tbx v2.16b, {v16.16b-v19.16b}, v1.16b // table add v1.8h, v0.8h, v2.8h // src[x] + table sqxtun v4.8b, v1.8h // clip + narrow - st1 {v4.8b}, [x0] // store + st1 {v4.8b}, [x0], #8 // store subs w8, w8, #8 // done 8 pixels bne 2b subs w7, w7, #1 // finished line, prep. new