From patchwork Wed Aug 21 20:11:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 51107 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4062:b0:48e:c0f8:d0de with SMTP id kz34csp658789vqb; Wed, 21 Aug 2024 13:12:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUuOuOskX6DHBPSJwg5Q4EPa8IrBS+Rq6LZ8cYIA4LtateSM6UExKQxxKWfjNq8wt1kySDs0vRjDXqENEKvKDif@gmail.com X-Google-Smtp-Source: AGHT+IHtQIKwqHccXxlYFqctYhoMG0+wuPDnBQbSk8uEjEeAqgJsJFvxnSE6fAqVTJjomBluSHVW X-Received: by 2002:a17:907:7251:b0:a86:829d:317d with SMTP id a640c23a62f3a-a86829d3c4cmr166855666b.64.1724271142546; Wed, 21 Aug 2024 13:12:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724271142; cv=none; d=google.com; s=arc-20160816; b=VV7G/1Ye5r3GRYWiEPpbnPxK4FbD+U6VOjkCJLPnfIinJfP6BMD6mpBXXCx/1S2Bx0 4wV05tOeItlGQMfEJgIWsvq3DKxS4Zqbhdd5bQcuyWBtryEaPWHrYTJnMfB1IeYL+Xhd JHdcpvTwZLJo/IK6aZpT3Q/aqpaY930Ee5QGxAMg0OHtiDwCBVJ51oaHmmzNlPbZTgC6 FrrbH6ru80NhSIk9LIHP8b5DQV5phJhtSQwXBc/M1VJk+W1G1vAA1Q7ic6N31knK1CIc pzSmaapkcJW/U1OaPIScI4J08gAMP3FLxKbS6uEjL+VqzdkdBe43AT8slQT0F7vqITca KVvA== 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 :delivered-to; bh=8GfXxA0yKio55iLEhnz/R2fB2tBYvSExxtU0rpWU5+E=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=OeOYw42ajF2aFQG53Uli0MVz4e5VkGwPO6jMGMeFi/TeeSuPcB3M7/WBHzQV4AN2SC IdPuAaym+4Vx9f9Nrf//Jl+EaYon4oeqTX2eLSLYX3ytanTLq1ZdGKaEE/6pFPHAVPOu eYk4EcPiifJwi2Tx43wpRXz37LsA5pv0Gt+D/sDl6PVWaa2gQwOBr5uJwYlnlghx1+4T Zsnzx8CzeQjnd3sUjausVLt7bcoVRri+X6Ccgg+rSa2g7EbNm9EbZjdAzTT3KSy8kDtu L++P2TyYwciCItn/5yTnoMWS5M1mpbxV+umFHTHu+0ClqBi8u8RcH0+dUpgnU06z7zM/ eNAA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 a640c23a62f3a-a868f29a5a1si5927166b.268.2024.08.21.13.12.21; Wed, 21 Aug 2024 13:12:22 -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; 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 9D17468DDDC; Wed, 21 Aug 2024 23:12:02 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4D24968DD23 for ; Wed, 21 Aug 2024 23:11:53 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 4D06AC006D for ; Wed, 21 Aug 2024 23:11:52 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Aug 2024 23:11:50 +0300 Message-ID: <20240821201152.86195-1-remi@remlab.net> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavc/h264dsp: do not write back unmodified rows in R-V V loop 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: 1qmm21Keo493 --- libavcodec/riscv/h264dsp_rvv.S | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S index 0d641008cb..2149c4217f 100644 --- a/libavcodec/riscv/h264dsp_rvv.S +++ b/libavcodec/riscv/h264dsp_rvv.S @@ -301,8 +301,9 @@ func ff_h264_h_loop_filter_luma_8_rvv, zve32x vmul.vx v6, v6, t0 vsetivli zero, 16, e8, m1, ta, ma vlsseg6e8.v v8, (a0), a1 + addi a0, a0, 1 jal t0, ff_h264_loop_filter_luma_8_rvv - vssseg6e8.v v8, (a0), a1 + vssseg4e8.v v9, (a0), a1 ret endfunc @@ -316,7 +317,8 @@ func ff_h264_h_loop_filter_luma_mbaff_8_rvv, zve32x vmul.vx v6, v6, t0 # tc_orig vsetivli zero, 8, e8, m1, ta, ma vlsseg6e8.v v8, (a0), a1 + addi a0, a0, 1 jal t0, ff_h264_loop_filter_luma_8_rvv - vssseg6e8.v v8, (a0), a1 + vssseg4e8.v v9, (a0), a1 ret endfunc From patchwork Wed Aug 21 20:11:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 51106 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4062:b0:48e:c0f8:d0de with SMTP id kz34csp658703vqb; Wed, 21 Aug 2024 13:12:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUxKUHKmzDjlP2YlZPoy1cB6ChQJQ+eMhq2hFLczOQX3uRZL3cXuCXrSytiB40aj7g7PBLBDIh0U0QTfv9+ord4@gmail.com X-Google-Smtp-Source: AGHT+IF8Mrhd7iZHTGTiz7KSrHdJ9XzLTkfdUeW1pop0/iwERq96e/ypmDnGhhgvHvWD0gGc43zW X-Received: by 2002:a05:6512:b1c:b0:52e:9beb:bc09 with SMTP id 2adb3069b0e04-53348556906mr990329e87.3.1724271133088; Wed, 21 Aug 2024 13:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724271133; cv=none; d=google.com; s=arc-20160816; b=d9Er27XMn8DnaG7wNP3qQYFRvU7UBsdV23Yyg0aQiGrWM2ZnX9XOEGxwNPF7jyY3tl 0UF8JgvnRYsOFYq8HKksEb0QATuOPV9L22tMUMl5qrnDQIKNgxSpyzRwOS1pOQ9AfC4Y c/kb0xVLYCsCFy6N6xkIw7NgaNqn9TUDohE61cxDbgRJs6iSK/pW6AU6sGwKSZfL+lIh n8I/7QL9rxWi6DNaIb8PimpvTvINLnA/BAKvH2wjSHcS+MaeXk0Zjssc2gBra01LBixS c71dDIMYKbLKkWW677siHOoAi53CVoe4/Egr9NN+ObdKl0Gkua2/ueGb1EfJBt3Hs6G9 O2qg== 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:delivered-to; bh=K/rrc1UBcJBiFv+5fWsIdjVmDixDp+Bu2+2Q+lJmWIc=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=XAWRmZypQ/4yFxIhfMgX+FlFT7BkW0Ab1BkiQggv7itbsQ9FRrBqC2+XEqxPiFE7gY DD9tg6zGfam/YLS/HUh9Abz1E0fY4vckMNAgIDmSKjM6ClNtV4v5dZs+k1tVM7wLwWm+ yxL4i0h9ZPLU70ELO/43HLJD+Yvpjn3rRfP3C4814rjmrYRnwkCXsGDQrdRFvgBcj6aw y4YuSV0npKuGIx2N+NpeC3IFhwrSkz1gNg6ueX790SleENsvQu79CRTuDksjmggBjtDr O+nrF5sDe3piWrtCidrHirKEKS3M0MbGNu1VEonWS6ht3BRGQEbzHS264ZCBu6VHJ4OP C5HA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 4fb4d7f45d1cf-5bebc0c6582si8788533a12.629.2024.08.21.13.12.12; Wed, 21 Aug 2024 13:12:13 -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; 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 A6DD268DDAE; Wed, 21 Aug 2024 23:12:00 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 468A368DC86 for ; Wed, 21 Aug 2024 23:11:53 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 7CB31C0099 for ; Wed, 21 Aug 2024 23:11:52 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Aug 2024 23:11:51 +0300 Message-ID: <20240821201152.86195-2-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240821201152.86195-1-remi@remlab.net> References: <20240821201152.86195-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/3] lavc/h264dsp: adjust group multiplier down in R-V V loop 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: MG2HHwXq7280 --- libavcodec/riscv/h264dsp_rvv.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S index 2149c4217f..2472ba7925 100644 --- a/libavcodec/riscv/h264dsp_rvv.S +++ b/libavcodec/riscv/h264dsp_rvv.S @@ -309,7 +309,7 @@ endfunc func ff_h264_h_loop_filter_luma_mbaff_8_rvv, zve32x lpad 0 - vsetivli zero, 4, e16, mf2, ta, ma + vsetivli zero, 4, e16, mf4, ta, ma vle8.v v4, (a4) li t0, 0x0101 vzext.vf2 v6, v4 From patchwork Wed Aug 21 20:11:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= X-Patchwork-Id: 51105 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:4062:b0:48e:c0f8:d0de with SMTP id kz34csp658620vqb; Wed, 21 Aug 2024 13:12:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUhFdsRAxiUxY9AnKeuu2SrcCUZSSzj+ooxqfEHWxj7Mq8ceGkAMPk3w27enwXMURkDfywGgHwhHiBzVEBIb/qJ@gmail.com X-Google-Smtp-Source: AGHT+IFhpHXth5op/G6MbsOnlVC+SAggLz2IsN/ZyuxwHwogrp4Or2WF2j//n5/AiaISOXN8xBlZ X-Received: by 2002:a05:6512:2206:b0:530:db20:1f0f with SMTP id 2adb3069b0e04-5334858ffe5mr1267625e87.4.1724271124127; Wed, 21 Aug 2024 13:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1724271124; cv=none; d=google.com; s=arc-20240605; b=YOtDbMavXW5QhncBYTnWlW2ZA/lehB+6/Bokr6zTWQCSmYyrSwV+FyMjhZFUkqDClB f1BAf/f3AbdT6Cnq6ozl7pTcAw3fqJdBrsfPHCUXqLY+XKbaGudUkHTTdWVuuDkcxZRx C4inXcJ30MSIldQYHIxqrD4eQmCkJCrKj+5xaF02OIz0PaTXhNY/+kbDNDeZyAvdiEQv loTrpFhotGLnlFnVCuXA6nQYpZmZ0idy/K0xMEj9bAdz9z0U5FeZeHoie41Y6rKB6dDc 0BriN0Yp4G3e8ZX7GZ58kuL6GxcMWKeKDTkfpDamlGggFfdMDkVzx9GmZYw3BhZET4GW rcPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:delivered-to; bh=JYIlG7vWxJqs8Ecpxy1scn1ayAc3YP572oKfcds0eKg=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=O9C0+guAhDenL7w4zduJIKytSy6ISz6Hj3SdggImYKLwP7FaoCAjI2j1doSAaESFiJ SK8T+mXuq6eVKwyPfNKuC/ona0w1+wYzYsQl8laFwYOfIRJgAQ2Jm0gy3ApFer0AtoG4 qrtr6b44n0HAXL146Pa6DJti9XQdZHzVWP6r3DG49fiyjj1GY+ivZGo4rHEJUFL/qUqn udhWDQYnittTdu4NQMtYTy5iLfKRbJ+Viu83bTJeylsLB8gJRF1XuumwSEj0chbRLGHB esGPvZr0XGR8v3H18iRlniCvu2ZgVyOKqDhKQyNISVyOTmgw3CjAVS9aOAsVVUeqxcPz GVdg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; 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 2adb3069b0e04-5334e222379si55309e87.409.2024.08.21.13.12.03; Wed, 21 Aug 2024 13:12:04 -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; 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 A3A1068DDA8; Wed, 21 Aug 2024 23:11:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from ursule.remlab.net (vps-a2bccee9.vps.ovh.net [51.75.19.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4978B68DC8A for ; Wed, 21 Aug 2024 23:11:53 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id A925FC0422 for ; Wed, 21 Aug 2024 23:11:52 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Wed, 21 Aug 2024 23:11:52 +0300 Message-ID: <20240821201152.86195-3-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240821201152.86195-1-remi@remlab.net> References: <20240821201152.86195-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] lavc/h264dsp: R-V V loop_filter_chroma 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: OkLwddDo0LT6 T-Head C908: h264_v_loop_filter_chroma_8bpp_c: 137.4 h264_v_loop_filter_chroma_8bpp_rvv_i32: 54.2 --- libavcodec/riscv/h264dsp_init.c | 15 +++++ libavcodec/riscv/h264dsp_rvv.S | 99 ++++++++++++++++++++++++++++----- 2 files changed, 99 insertions(+), 15 deletions(-) diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c index b99c0124ee..9ffc9b0333 100644 --- a/libavcodec/riscv/h264dsp_init.c +++ b/libavcodec/riscv/h264dsp_init.c @@ -40,6 +40,13 @@ void ff_h264_h_loop_filter_luma_8_rvv(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0); void ff_h264_h_loop_filter_luma_mbaff_8_rvv(uint8_t *pix, ptrdiff_t stride, int alpha, int beta, int8_t *tc0); +void ff_h264_v_loop_filter_chroma_8_rvv(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma_8_rvv(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma_mbaff_8_rvv(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta, + int8_t *tc0); #define IDCT_DEPTH(depth) \ void ff_h264_idct_add_##depth##_rvv(uint8_t *d, int16_t *s, int stride); \ @@ -101,6 +108,14 @@ av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const int bit_depth, dsp->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_8_rvv; dsp->h264_h_loop_filter_luma_mbaff = ff_h264_h_loop_filter_luma_mbaff_8_rvv; + dsp->h264_v_loop_filter_chroma = + ff_h264_v_loop_filter_chroma_8_rvv; + if (chroma_format_idc <= 1) { + dsp->h264_h_loop_filter_chroma = + ff_h264_h_loop_filter_chroma_8_rvv; + dsp->h264_h_loop_filter_chroma_mbaff = + ff_h264_h_loop_filter_chroma_mbaff_8_rvv; + } dsp->h264_idct_add = ff_h264_idct_add_8_rvv; dsp->h264_idct8_add = ff_h264_idct8_add_8_rvv; diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S index 2472ba7925..7648f4868b 100644 --- a/libavcodec/riscv/h264dsp_rvv.S +++ b/libavcodec/riscv/h264dsp_rvv.S @@ -191,61 +191,85 @@ const ff_h264_weight_funcs_8_rvv .endr endconst - .variant_cc ff_h264_loop_filter_luma_8_rvv -func ff_h264_loop_filter_luma_8_rvv, zve32x +.macro loop_filter type, inners, e8mul, e16mul + .variant_cc ff_h264_loop_filter_\type\()_8_rvv +func ff_h264_loop_filter_\type\()_8_rvv, zve32x # p2: v8, p1: v9, p0: v10, q0: v11, q1: v12, q2: v13 # alpha: a2, beta: a3, tc_orig: v6 csrwi vxrm, 0 +.ifc \type, luma vaaddu.vv v14, v10, v11 # (p0 + q0 + 1) / 2 +.endif vwsubu.vv v16, v9, v12 +.ifc \type, luma vwaddu.vv v18, v8, v14 vwaddu.vv v20, v13, v14 +.endif vnsra.wi v24, v16, 2 # (p1 - q1) / 4 +.ifc \type, luma vnsrl.wi v14, v18, 1 vnsrl.wi v15, v20, 1 vneg.v v5, v6 # -tc_orig +.endif vwsubu.vv v22, v11, v10 # q0 - p0 +.ifc \type, luma vwsubu.vv v18, v14, v9 vwsubu.vv v20, v15, v12 +.endif vwadd.wv v16, v22, v24 vmsge.vi v7, v6, 0 # tc_orig >= 0 +.ifc \type, luma vnclip.wi v14, v18, 0 vnclip.wi v15, v20, 0 +.endif vnclip.wi v16, v16, 1 # clip8((q0 - p0 + (p1 - q1) / 4 + 1) >> 1) +.ifc \type, luma vmin.vv v14, v14, v6 vmin.vv v15, v15, v6 vmax.vv v14, v14, v5 # clip(p2 + ... - p1, +/-tc_orig) vmax.vv v15, v15, v5 # clip(q2 + ... - q1, +/-tc_orig) +.endif vwsubu.vv v20, v10, v11 vwsubu.vv v24, v9, v10 vwsubu.vv v26, v10, v9 vwsubu.vv v28, v12, v11 vwsubu.vv v30, v11, v12 +.ifc \type, luma vwsubu.vv v0, v8, v10 vwsubu.vv v2, v10, v8 vwsubu.vv v4, v13, v11 vwsubu.vv v18, v11, v13 - vsetvli zero, zero, e16, m2, ta, ma +.endif + vsetvli zero, zero, e16, \e16mul, ta, ma vmax.vv v20, v20, v22 # abs(p0 - q0) vmax.vv v24, v24, v26 # abs(p1 - p0) vmax.vv v28, v28, v30 # abs(q1 - q0) +.ifc \type, luma vmax.vv v22, v0, v2 # abs(p2 - p0) vmax.vv v26, v4, v18 # abs(q2 - q0) +.endif vmslt.vx v1, v20, a2 vmslt.vx v2, v24, a3 vmand.mm v7, v7, v1 vmslt.vx v3, v28, a3 vmand.mm v7, v7, v2 +.ifc \type, luma vmslt.vx v0, v22, a3 vmand.mm v7, v7, v3 # whether to update p0 and q0 vmslt.vx v1, v26, a3 vmand.mm v0, v0, v7 - vsetvli zero, zero, e8, m1, ta, mu +.else + vmand.mm v0, v7, v3 # whether to update p0 and q0 +.endif + vsetvli zero, zero, e8, \e8mul, ta, mu +.ifc \type, luma vadd.vi v6, v6, 1, v0.t # tc++ vadd.vv v9, v9, v14, v0.t # p1' vmand.mm v0, v1, v7 vadd.vi v6, v6, 1, v0.t # tc++ vadd.vv v12, v12, v15, v0.t # q1' + vmmv.m v0, v7 +.endif vneg.v v5, v6 # -tc vmin.vv v16, v16, v6 vwcvtu.x.x.v v18, v10 @@ -253,43 +277,59 @@ func ff_h264_loop_filter_luma_8_rvv, zve32x vwcvtu.x.x.v v20, v11 vwadd.wv v18, v18, v16 vwsub.wv v20, v20, v16 - vmmv.m v0, v7 - vsetvli zero, zero, e16, m2, ta, ma + vsetvli zero, zero, e16, \e16mul, ta, ma vmax.vx v18, v18, zero vmax.vx v20, v20, zero - vsetvli zero, zero, e8, m1, ta, mu + vsetvli zero, zero, e8, \e8mul, ta, mu vnclipu.wi v10, v18, 0, v0.t # p0' vnclipu.wi v11, v20, 0, v0.t # q0' jr t0 endfunc -func ff_h264_v_loop_filter_luma_8_rvv, zve32x +func ff_h264_v_loop_filter_\type\()_8_rvv, zve32x lpad 0 +.ifc \type, luma vsetivli zero, 4, e32, m1, ta, ma vle8.v v4, (a4) li t0, 0x01010101 vzext.vf4 v6, v4 +.else + vsetivli zero, 4, e16, mf2, ta, ma + vle8.v v4, (a4) + li t0, 0x0101 + vzext.vf2 v6, v4 +.endif sub t3, a0, a1 vmul.vx v6, v6, t0 - vsetivli zero, 16, e8, m1, ta, ma + vsetivli zero, 4 * \inners, e8, \e8mul, ta, ma vle8.v v11, (a0) sub t2, t3, a1 vid.v v0 vle8.v v10, (t3) - sub t1, t2, a1 - vle8.v v9, (t2) add t5, a0, a1 - vle8.v v8, (t1) - add t6, t5, a1 + vle8.v v9, (t2) +.ifc \type, luma + sub t1, t2, a1 +.endif vle8.v v12, (t5) +.ifc \type, luma + add t6, t5, a1 + vle8.v v8, (t1) vle8.v v13, (t6) - jal t0, ff_h264_loop_filter_luma_8_rvv +.endif + jal t0, ff_h264_loop_filter_\type\()_8_rvv +.ifc \type, luma vse8.v v9, (t2) + vse8.v v12, (t5) +.endif vse8.v v10, (t3) vse8.v v11, (a0) - vse8.v v12, (t5) ret endfunc +.endm + +loop_filter luma, 4, m1, m2 +loop_filter chroma, 2, mf2, m1 func ff_h264_h_loop_filter_luma_8_rvv, zve32x lpad 0 @@ -322,3 +362,32 @@ func ff_h264_h_loop_filter_luma_mbaff_8_rvv, zve32x vssseg4e8.v v9, (a0), a1 ret endfunc + +func ff_h264_h_loop_filter_chroma_8_rvv, zve32x + lpad 0 + vsetivli zero, 4, e16, mf2, ta, ma + vle8.v v4, (a4) + li t0, 0x0101 + vzext.vf2 v6, v4 + addi a0, a0, -2 + vmul.vx v6, v6, t0 + vsetivli zero, 8, e8, mf2, ta, ma + vlsseg4e8.v v9, (a0), a1 + addi a0, a0, 1 + jal t0, ff_h264_loop_filter_chroma_8_rvv + vssseg2e8.v v10, (a0), a1 + ret +endfunc + +func ff_h264_h_loop_filter_chroma_mbaff_8_rvv, zve32x + lpad 0 + vsetivli zero, 4, e8, mf4, ta, ma + vle8.v v6, (a4) + addi a0, a0, -2 + vsetivli zero, 4, e8, mf2, ta, ma + vlsseg4e8.v v9, (a0), a1 + addi a0, a0, 1 + jal t0, ff_h264_loop_filter_chroma_8_rvv + vssseg2e8.v v10, (a0), a1 + ret +endfunc