From patchwork Sat Apr 20 15:55:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: flow gg X-Patchwork-Id: 48194 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp1312783pzb; Sat, 20 Apr 2024 08:55:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVkwGOrVVkmdEldw+OaAh/cEst2vpyNciXN8gtgTuz+f4+eMTaGfHhnSiE2h4EDs6RHOV1L0CABvHWhbxWfRMZnEpmsmlhHvzTjDw== X-Google-Smtp-Source: AGHT+IETGysDnGMlXn0LGPV9pj0G0selDMwnl4M3r4KcJiS2Mi9JCn3KbS+WwENboeJcmC1HP3oM X-Received: by 2002:a05:6402:3da:b0:571:ba0f:fb8a with SMTP id t26-20020a05640203da00b00571ba0ffb8amr7503325edw.1.1713628555757; Sat, 20 Apr 2024 08:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713628555; cv=none; d=google.com; s=arc-20160816; b=kCXH+cp3zXHiZ90nlIx37ZnEfinxlVZR8PNZlWnQzbnFOoIkTrI/n4d2K0+j+WnotB +Lr4JqlAJCWADn3GWO5oB1NYAmlZg+1yT1exSZ2kDvNtS27rRDhePBNiLgCNj6sLgAeG bXWu6QQY1pqBwLsF9mHJqrlNuX50f+bZMcYbH2c1c4g7vn/naJkITn++kiYEz3yQJNh5 0u0lE2MZcr0Jg6sKZ0MdFi+MtRTCnGH1QPqzrw3Bb5sPTYv0hw1UoKJFvQ8fHZnJBd8g 2w3Ws35dnuUjV4SwRF3AEk8dW0bAw4W4vCTaEadceOwa5t+Xxan0vFiPoOVT5lzA2Wer Qniw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:to :message-id:date:from:mime-version:dkim-signature:delivered-to; bh=W5cOPTL89NqVLV7oE6gxkAbr+y7S3R8hZwI1DbOjaGQ=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=Ou2T5rDdGn1dkDuYJ1SUngIZCn017+gH1EVX5ZTpWSuu18V6BxSLjfWBXp+mp7PUbE 0yg0A0nUB5veoyS6VhWSDdWf57oGyjqNBu1vfvBMcog6o5EKQDSsk33ka5VSYWrbrlJQ 2/rKe2Igt8KyylJvX3/4/kaTI8lihq0AgbbDl/hSI4xo30UnbswqBBCqBDevBJaLY9Go /Y3xJbH51QagENapsneftLhWFpU9Ik31ADCtaGY1v7myxukqd+JDoPCTKM2YGz3CUnjq 54GAuPH1gX4LQXmUOh3+B5ZHW/+3hNsl3wNeizuSZdNi//n81XCDUkdkWmfslVRuOCG6 j4iA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="Obdzv8w/"; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y12-20020a50e60c000000b0056fffc4c19esi3529853edm.165.2024.04.20.08.55.55; Sat, 20 Apr 2024 08:55:55 -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=@gmail.com header.s=20230601 header.b="Obdzv8w/"; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id CE7DB68D197; Sat, 20 Apr 2024 18:55:52 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4312668D197 for ; Sat, 20 Apr 2024 18:55:46 +0300 (EEST) Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-78f05b62602so196865885a.0 for ; Sat, 20 Apr 2024 08:55:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713628544; x=1714233344; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=Ax2GeK1IODor/W4om+SMXwtTMHkxDhI0iGbJncZanJM=; b=Obdzv8w/zay+zVr3anBZA3wkTauVCpeK2fkryx94FIynCqzq5CbKwHaw90YA+OzIVb OoQdjSTkbQfOhejyMFME5Si/CNYotyvH9pBRSwtqpDQ8QhwPmhQ35Ml1rl083dt+Jvfm VxJd+Wo+xOol8d2hmKlLdSzIuvqfQES5Lxoo8D+Yt4c72ku1VQ777XexZD+IuWmSFpzZ yA11SzVX+SaMy2oL4AqrReSypR57Gb3O8GZUmoMNBUWzcNTpIzmsJBH6MvQM2gfoaxio +f7gL1hKuLejASj6K6DhSLQuwWzsa6XPMGcfTt/f8h/VlMvc88EA5bhmOiJCBp6LZRfo KgXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713628544; x=1714233344; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Ax2GeK1IODor/W4om+SMXwtTMHkxDhI0iGbJncZanJM=; b=CGLpwz+iqJstnOm2PDNpCDDWab8ZZuh4s3lSW9hjNAf7EUk2LkBzIILV78t0o4n6As EtIKm8HNFc7Lp6LgB/Tgq0INCIZc7RDU4ln6MZrv6dn5zsoyo9vhkHdxC8QxwEFrkRrm jdmZO7ohBpdyCiFLPWUZkJQlG3s4diCOtui8CAlTvw/4gpa3IhwHB/hCusFLO8hia76O /ErkhTDtC+RoALJJqsxAUyLtF3K2ECF3ie6Jk4e3uECq9nupFYYIXxXqF2kJYl2/6bFD zSvzm7WKdUcEAbPrcUoU9Rsyh9rgBvuLjR36L7ogmcUg8WkqR4z3PjII414OpL7aSybQ msFw== X-Gm-Message-State: AOJu0YznqA6vZIsGvUJyVJYBG68JSCnrcGJ5nqcKe/Bkl57ubUCI2O23 8baJ2ovo4T37XALc+7wig+0PLhqDkhBu58XK3ircVXuXF4Lc/7JW72/50TJSkPGz5he/bttR2eA m3dhH0NwyTf14Z9tVqFsNYFmUCCRuOA== X-Received: by 2002:a0c:f6cc:0:b0:69b:e95e:cdfc with SMTP id d12-20020a0cf6cc000000b0069be95ecdfcmr6078996qvo.34.1713628544645; Sat, 20 Apr 2024 08:55:44 -0700 (PDT) MIME-Version: 1.0 From: flow gg Date: Sat, 20 Apr 2024 23:55:33 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH 2/3] lavc/vp8dsp: R-V V loop_filter_inner 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: MP92t9Y98Jhg From c033ab8d30135dc02b09b1747c0761baefdcbb4a Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Sat, 20 Apr 2024 23:13:07 +0800 Subject: [PATCH 2/3] lavc/vp8dsp: R-V V loop_filter_inner C908: vp8_loop_filter8uv_inner_v_c: 738.2 vp8_loop_filter8uv_inner_v_rvv_i32: 455.2 vp8_loop_filter16y_inner_h_c: 685.0 vp8_loop_filter16y_inner_h_rvv_i32: 497.0 vp8_loop_filter16y_inner_v_c: 743.7 vp8_loop_filter16y_inner_v_rvv_i32: 295.7 --- libavcodec/riscv/vp8dsp_init.c | 4 ++ libavcodec/riscv/vp8dsp_rvv.S | 110 +++++++++++++++++++++++++++++++++ 2 files changed, 114 insertions(+) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index 46ca71ed04..aa95021df5 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -123,6 +123,10 @@ av_cold void ff_vp8dsp_init_riscv(VP8DSPContext *c) c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_rvv; } + c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_rvv; + c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_rvv; + c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_rvv; + c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_rvv; c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_rvv; } diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index 2eadfc5766..f10e269d9d 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -72,6 +72,13 @@ func ff_vp8_idct_dc_add4uv_rvv, zve32x ret endfunc +.macro filter_abs dst diff fI + vneg.v v8, \diff + vmax.vv \dst, v8, \diff + vmsleu.vx v8, \dst, \fI + vmand.mm v27, v27, v8 +.endm + .macro filter_fmin len a f1 p0f2 q0f1 .ifc \len,16 vsetvli zero, zero, e16, m2, ta, ma @@ -101,6 +108,16 @@ endfunc vle8.v v11, (t4) vle8.v v17, (t1) vle8.v v22, (\dst) + .if \normal + sub t3, t2, a6 + sub t0, t1, a6 + add t6, \dst, a6 + add a7, t4, a6 + vle8.v v2, (t3) + vle8.v v15, (t0) + vle8.v v10, (t6) + vle8.v v14, (a7) + .endif .else addi t1, \dst, -1 addi a6, \dst, -2 @@ -109,9 +126,28 @@ endfunc vlse8.v v11, (t4), \stride vlse8.v v17, (t1), \stride vlse8.v v22, (\dst), \stride + .if \normal + addi t5, \dst, -4 + addi t0, \dst, -3 + addi t6, \dst, 2 + addi a7, \dst, 3 + vlse8.v v2, (t5), \stride + vlse8.v v15, (t0), \stride + vlse8.v v10, (t6), \stride + vlse8.v v14, (a7), \stride + .endif .endif vwsubu.vv v12, v1, v11 // p1-q1 vwsubu.vv v24, v22, v17 // q0-p0 + +.if \normal + vwsubu.vv v30, v1, v17 + vwsubu.vv v20, v11, v22 + vwsubu.vv v28, v1, v15 + vwsubu.vv v4, v2, v15 + vwsubu.vv v6, v10, v11 + vwsubu.vv v2, v14, v10 +.endif vnclip.wi v23, v12, 0 .ifc \len,16 @@ -130,6 +166,26 @@ endfunc vmacc.vx v18, a7, v8 vmsleu.vx v0, v18, \fE +.if \normal + vneg.v v18, v30 + vmax.vv v30, v18, v30 + vmsleu.vx v27, v30, \fI + filter_abs v18 v28 \fI + filter_abs v18 v4 \fI + filter_abs v18 v6 \fI + filter_abs v18 v2 \fI + filter_abs v20 v20 \fI + vmand.mm v27, v0, v27 // vp8_simple_limit && normal + + vmsgtu.vx v20, v20, \thresh // hev + vmsgtu.vx v3, v30, \thresh + vmor.mm v3, v3, v20 // v3 = hev: > thresh + vzext.vf2 v18, v1 // v18 = p1 + vmand.mm v0, v27, v3 // v0 = normal && hev + vzext.vf2 v20, v11 // v12 = q1 + vmnot.m v3, v3 // v3 = !hv +.endif + li t5, 3 li a7, 124 li t3, 123 @@ -163,8 +219,62 @@ endfunc vsse8.v v6, (\dst), \stride, v0.t .endif +.if \normal + vmand.mm v0, v27, v3 // vp8_normal_limit & !hv + + .if \inner + vnclip.wi v30, v30, 0 + filter_fmin \len v30 v24 v4 v6 + vadd.vi v24, v24, 1 + vsra.vi v24, v24, 1 // (f1 + 1) >> 1; + vadd.vv v8, v18, v24 + vsub.vv v10, v20, v24 + .endif + + vmax.vx v8, v8, zero + vmax.vx v10, v10, zero +.ifc \len,16 + vsetvli zero, zero, e8, m1, ta, ma +.else + vsetvli zero, zero, e8, mf2, ta, ma +.endif + vnclipu.wi v4, v4, 0 + vnclipu.wi v5, v6, 0 + vnclipu.wi v6, v8, 0 + vnclipu.wi v7, v10, 0 + .ifc \type,v + vse8.v v4, (t1), v0.t + vse8.v v5, (\dst), v0.t + vse8.v v6, (t2), v0.t + vse8.v v7, (t4), v0.t + .else + vsse8.v v4, (t1), \stride, v0.t + vsse8.v v5, (\dst), \stride, v0.t + vsse8.v v6, (a6), \stride, v0.t + vsse8.v v7, (t4), \stride, v0.t + .endif +.endif .endm +func ff_vp8_h_loop_filter16_inner_rvv, zve32x + vsetivli zero, 16, e8, m1, ta, ma + filter 16 h 1 1 a0 a1 a2 a3 a4 + ret +endfunc + +func ff_vp8_v_loop_filter16_inner_rvv, zve32x + vsetivli zero, 16, e8, m1, ta, ma + filter 16 v 1 1 a0 a1 a2 a3 a4 + ret +endfunc + +func ff_vp8_v_loop_filter8uv_inner_rvv, zve32x + vsetivli zero, 8, e8, mf2, ta, ma + filter 8 v 1 1 a0 a2 a3 a4 a5 + filter 8 v 1 1 a1 a2 a3 a4 a5 + ret +endfunc + func ff_vp8_v_loop_filter16_simple_rvv, zve32x vsetivli zero, 16, e8, m1, ta, ma filter 16 v 0 0 a0 a1 a2 a3 a4 -- 2.44.0