From patchwork Mon Jul 1 15:23:37 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: 50255 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp1880623vqv; Mon, 1 Jul 2024 08:23:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU9XtXoYWDCxHl776tyc9EvLx3znV3V1W72HHJj0Kogwz8nFCwxpqCFI3fZoOijLChUZrSH+hahlD6Sh1ovwj/8t9FrnY/PvQ00Sw== X-Google-Smtp-Source: AGHT+IENgJ0kKrS7lWGvldwBFpgYIj5HHHGh8h0HV3xK0qwZjqZQ0XVOIsgjsTrekNlmeOPRRsX5 X-Received: by 2002:a2e:a547:0:b0:2ee:46ec:60bc with SMTP id 38308e7fff4ca-2ee5e4c392amr50917191fa.27.1719847430555; Mon, 01 Jul 2024 08:23:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719847430; cv=none; d=google.com; s=arc-20160816; b=aPNKx3B/QwsS56ItVGc911sn/shuqDs9/Lz304mp6o5X3gVX2kJqC9qsIQ99fb2z+y vNqQl0/IHJzYrVtzQpMldXB1fkXWK/LfgigZh8lks0K2S1DQ2TXV9RKXIKPfwvMQuaKu F22m4I4vHKAxmkSYcKcHzekz4FI4zD7z35rl2MIm6xTiHQBqCu7XcZhh4YJ6qXnkin59 7Xh/hBetRvN/G2M8bXVMI1iVkewCc/Qrl+jv6rU+jDZ11bC0XqqZg+ayqZ91D1D1/7Cq aU3t2Jz3oswXcaJ/wWqSHZiN2fhf2kg8iNxF84vve3L0LDKUJUZSoexbsDGs/pwCtBkP w/Aw== 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=fMuus0fT6LRpkUPJ6VJh56oV1Jh2d11hFgwMQA/FDsk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=bZE64KWpLUxbNtnuSLiXGp2pA+HkvQ8DSs57Huve1mjEiLBqt9H5AGtnfqY0V7UndI fzcCzevM1FGFdxjWWaO/D8XKWc5yYhl+YxyXFVRNYcELwz/pnYn3qvnZbSUJBSYxHkzv VOno/wK76KlUZCaj1O0mS9e+EqykBpVgDJifG70G3Ho2kW4I9aRJXgl2JDAI5AstdEpS uhMdBlxTUl1Fb2Kf8+y0m2ZH11dJUyoM0vqOqrfbwdaA0YMsATboC8JUngj+8lttIkj6 ljkB2GHQBm11an2WGQuoH0zL6MATDAnAjBx0hbEmDVEgwgxCsVWoX15sI3o4tFD/idpu Gegg==; 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 38308e7fff4ca-2ee515385cdsi20240971fa.294.2024.07.01.08.23.50; Mon, 01 Jul 2024 08:23:50 -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 C903F68D22E; Mon, 1 Jul 2024 18:23:45 +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 7DD7368D7CA for ; Mon, 1 Jul 2024 18:23:39 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id E0B3EC0170 for ; Mon, 1 Jul 2024 18:23:38 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jul 2024 18:23:37 +0300 Message-ID: <20240701152338.9624-2-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240701152338.9624-1-remi@remlab.net> References: <20240701152338.9624-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/h264dsp: R-V V 8-bit MBAFF 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: M0OmDvBREVwL Performance is (unfortunately) the same as with non-MBAFF, since the hardware under test does not short-circuit vector tail calculations. (IMO, a generic solution or work-around should be agreed on, rather than bespoke approaches all over the place.) --- libavcodec/riscv/h264dsp_init.c | 4 ++++ libavcodec/riscv/h264dsp_rvv.S | 14 ++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/libavcodec/riscv/h264dsp_init.c b/libavcodec/riscv/h264dsp_init.c index 0d4d541992..ab412a9924 100644 --- a/libavcodec/riscv/h264dsp_init.c +++ b/libavcodec/riscv/h264dsp_init.c @@ -31,6 +31,8 @@ void ff_h264_v_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_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); extern int ff_startcode_find_candidate_rvb(const uint8_t *, int); extern int ff_startcode_find_candidate_rvv(const uint8_t *, int); @@ -48,6 +50,8 @@ av_cold void ff_h264dsp_init_riscv(H264DSPContext *dsp, const int bit_depth, if (bit_depth == 8 && ff_rv_vlen_least(128)) { dsp->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_8_rvv; 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->startcode_find_candidate = ff_startcode_find_candidate_rvv; } diff --git a/libavcodec/riscv/h264dsp_rvv.S b/libavcodec/riscv/h264dsp_rvv.S index 77bf40db1f..008f33d4b8 100644 --- a/libavcodec/riscv/h264dsp_rvv.S +++ b/libavcodec/riscv/h264dsp_rvv.S @@ -138,3 +138,17 @@ func ff_h264_h_loop_filter_luma_8_rvv, zve32x vssseg6e8.v v8, (a0), a1 ret endfunc + +func ff_h264_h_loop_filter_luma_mbaff_8_rvv, zve32x + vsetivli zero, 4, e16, m1, ta, ma + vle8.v v4, (a4) + li t0, 0x0101 + vzext.vf2 v6, v4 + addi a0, a0, -3 + vmul.vx v6, v6, t0 # tc_orig + vsetivli zero, 8, e8, m1, ta, ma + vlsseg6e8.v v8, (a0), a1 + jal t0, ff_h264_loop_filter_luma_8_rvv + vssseg6e8.v v8, (a0), a1 + ret +endfunc