From patchwork Tue May 7 16:54:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: uk7b@foxmail.com X-Patchwork-Id: 48641 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:9c99:b0:1af:836d:81b3 with SMTP id mj25csp38962pzb; Tue, 7 May 2024 09:56:00 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV7a2a7K7DzEkqBTtfCLylVJC+qL5jQbZvNPZrRM7R/eJEQ+kd5A4Ny3voseeT8DWMNVgAOLacaGEr56tflhnOJcQG4jNJISdiGIQ== X-Google-Smtp-Source: AGHT+IG9iuW564f77B8k5BRcSpCmJyLeekfxI/bOooV2/BPTkjX/3gLlWA6siAfdgBvuf62m8DUH X-Received: by 2002:a17:906:1d13:b0:a59:9c2f:c7d4 with SMTP id a640c23a62f3a-a59e4cf83d6mr273725266b.19.1715100960422; Tue, 07 May 2024 09:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1715100960; cv=none; d=google.com; s=arc-20160816; b=gqq0b5BX6q4R0CKzBJ8a58EnJ2yVVN+MyZGuvHEmb5CR5k9Wb3EsjNXwSECRcQ9Xx5 ycanUGBbWhy7kwDTuL1A3F6rgnalxsAAhDRVIEZPAps0ca0i2ynvGqZcaZhtLMWkKp33 8bkHhyhtXjn4oLmTL8MVfXUDy95xXnCPTX0I4hoxZ19cktHUmrUC1/bDgii0dCppbYTZ KugwkKRUdbrVjgbgB1hFPmnkThsGWERGblrnI8wK+WVxwtCMAWoxuugmsDqlGxE+Zv5D f81Z0aOrSSC+iYPdKGdZCXwN3xRJk0ItHmHEWOiqIqwQSFAqw8hywfqIrDKKE4CmoZU8 0qaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to:date :to:from:message-id:dkim-signature:delivered-to; bh=qJ9sOIcAr7BA0x20e3zp8Bxd9JFTrAEgTDsRMZDfyvs=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=Zecb7IpTRC5NxHnsNEYUPm8jee5s5oKxMM5cNPbB94z5197ATRx+j+KcR5+K1AqMUH bp0gbSgFVdBOHkwsbW7RN3sb1UD/htNaR66WtHxQaCnuQg053bvPXbHtta+SwoMhLgWe 1DtXYeO2RBoqXsMab4jypE3Dbp6kYBKFpBKgMyxkt+/0Uj5bZ8QjewgxnwfbUxCbDh38 9IPLIybhWiaMTFlLFOvWwOA2RMdc4Y3heOQ2CbESfrxgwfyBkgGNxxKUUV+4/L/ydhoy Wwlj9ZVECGc7pGB0rFdNS5ijli3hvB4o4H/nTJR64VQYq46fsEj2/wJFaAJWIXmATEmg jrRw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=HwBmGBgb; 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=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id ca11-20020a170906a3cb00b00a59c2a29930si3226172ejb.965.2024.05.07.09.55.59; Tue, 07 May 2024 09:56:00 -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=@foxmail.com header.s=s201512 header.b=HwBmGBgb; 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=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F173B68D7DF; Tue, 7 May 2024 19:54:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out162-62-58-211.mail.qq.com (out162-62-58-211.mail.qq.com [162.62.58.211]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B198568D7AF for ; Tue, 7 May 2024 19:54:40 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1715100871; bh=P/SLLleASiRFwco2p4DXe0CxdCTLtjVsvuw3szcBCfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HwBmGBgbPaJ6pqoipVI02d/ZBjLtDIThHw12rY5WYwTdHyaXIWF0/3wpB28LANpiQ Dd85IQlN+q6JwK5pOgDkffVkN5+/8MCTg2hwzQslD4O75wma2p+3TMGxxC8wkDzYlZ nFQOhLoIZBYGhHJdwPlZOid1/XyY8CoKLngvPkH8= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrszb9-1.qq.com (NewEsmtp) with SMTP id D99244C2; Wed, 08 May 2024 00:54:25 +0800 X-QQ-mid: xmsmtpt1715100871t43qmdii8 Message-ID: X-QQ-XMAILINFO: Nqk65Hg7/x2M6NY1WF+cKnW7WVJmvhNulsKMPEnion/2QUvg8glP1YcucqbXDj qPthRKHwJ440t9edJyq/cdyC0xTiX448fUAHXfDP70pHsUudoVpLVQxuANOy+CGrSN8Lkoa9SnLz MjBIExtCTH7gadjfV2BnQRPHwzoQcotzrdYinehw07agql5Pgr/DDDniCYfajZijnH01Z++aQQWG fDG3qIMoo9iPsGRHMRhDnxo1KRXtXkcIQfluPGFVlmIlftHRAPTLLj6+MIHzBSMe97ZvNPRSoSNA K/j4CTEfsaGMW753RA+m0y+XlVY+s8kjX4YeVKLx3/bYbPIWvY4loHsr/VJJlMLk5SvhQbwLmQ1N KBPI2xyL0MihhNWXxtPmDqd8+FTtazqTRaloHVDb8PhmotzaBi4e1gJStYy2duLRI7J6Nq1ovXGe BrUcFO6aTcU/mMz3nTV9eRCdzdEsxDS9eLsO+NqOyEkX6u8mcBKgK65du2BiBOpcAtKKZHpGxpPS SR1X2AQIN+QKFZ9TKJ//b4FIO67CIRK/haV3dT780dLzFA3qg6cDACJAFj5geVZydxt7Pb4qZNRn 1LmjJ6Q9Dca0a9rARYyH0/xu4XoVReUNa9iTEdOtgRzBoFzTQdTm0afH7eK4am0flO0ML6bMD8XO GRVBkhTp0dRlSDrBHsX7l9Fsjx8IvK67X1P4tLTIUQN4UwLAK1RxulLsBgsDrOoD4T2rlTh63K6k c2iZov+vrpqlHJxlfmYMRw1ZNGsVHnDwKf3XItdacnjGuHQ4hDEAdhwf3aXrdte4GQdJ8lJDm46v m7tY8EAIoQ7HOpu4YFjXWNxCsjrxJinFo7JnFZODX835K58kyJA9kMW2dnzoaU1mVZaxWqeppH/A SlwLX3Sv8luWXyVwo/rFanCyWU/TUsy4P/RcLcKiQtpc4AXkr1TJP0iVmPilDpZQ== X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Wed, 8 May 2024 00:54:11 +0800 X-OQ-MSGID: <20240507165412.1306563-8-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240507165412.1306563-1-uk7b@foxmail.com> References: <20240507165412.1306563-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v4 8/9] 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 Cc: sunyuechi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 2v20ioQc+Yy2 From: sunyuechi 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 | 104 +++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index 3acfe75d67..2adff1052a 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -129,6 +129,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 4260545c6d..a930d0b8f4 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -94,6 +94,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 vsetvlstatic16 \len vsext.vf2 \q0f1, \a @@ -119,6 +126,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 @@ -127,9 +144,27 @@ 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 vsetvlstatic16 \len // vp8_simple_limit(dst + i, stride, flim) @@ -141,6 +176,25 @@ endfunc vsrl.vi v18, v18, 1 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 @@ -165,6 +219,37 @@ 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 + vsetvlstatic8 \len + 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_v_loop_filter16_simple_rvv, zve32x @@ -179,6 +264,25 @@ func ff_vp8_h_loop_filter16_simple_rvv, zve32x ret endfunc +func ff_vp8_h_loop_filter16_inner_rvv, zve32x + vsetvlstatic8 16 + filter 16 h 1 1 a0 a1 a2 a3 a4 + ret +endfunc + +func ff_vp8_v_loop_filter16_inner_rvv, zve32x + vsetvlstatic8 16 + filter 16 v 1 1 a0 a1 a2 a3 a4 + ret +endfunc + +func ff_vp8_v_loop_filter8uv_inner_rvv, zve32x + vsetvlstatic8 8 + filter 8 v 1 1 a0 a2 a3 a4 a5 + filter 8 v 1 1 a1 a2 a3 a4 a5 + ret +endfunc + .macro bilin_load dst len type mn .ifc \type,v add t5, a2, a3