From patchwork Sun Jul 14 16:28:21 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: 50534 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1850287vqb; Sun, 14 Jul 2024 09:29:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWC/10a0jqB8J3NXSuKsit50/iCNM/j//4pPAL2XlnKwLrPmAeh5FW1IgG/fiMOtBFOgY2/1zIqc/UXdjqQ5NTNFwEq1nG0vsICNw== X-Google-Smtp-Source: AGHT+IFZmLOh/c5NWl9jBz+PM4H3tE+AzZJPSKk7wOnR1Pg38Rjp8IGZvEVgu59gB62j7+eOlf5w X-Received: by 2002:a17:906:fb96:b0:a77:c26c:a56e with SMTP id a640c23a62f3a-a780b7053cfmr1132130366b.45.1720974587496; Sun, 14 Jul 2024 09:29:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720974587; cv=none; d=google.com; s=arc-20160816; b=p0jCKK6V1St9bgA4+k9dJfJVbphOVDJOuaAGQDdyA49cHIZZ+pW1zu7DiqMf/OdYt7 pWeiLo9QCxsQtMz2f8ftVhBsiQegynXMLc5k0XuBoO8M/ltNthtq/G1kk435I7c3BrnE j/0Sc4gSy1/Dmyn0Xz+HK5N5JAPSKxfMZHhSCkuTuHRLNML1EPGzdJap/acSNTZpVlo+ oP4oJBNjaHEMppe7iJ41XGXw3tpyemOuqxC/LzJ/Lm/SmqOwvR99FSaGV2eMb/f6ckRP FKoFgF8Qz4pJXdx1l8tPh+JpNvTWlA2/8Gb9KsAVUH8Fx42XIHLHxDCo6V6hK21/szyW BPqg== 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:date:to:from:message-id :dkim-signature:delivered-to; bh=snV3x0KMCWqqeJgnsWBZogrWL8XLHA+PafW9UWmyXSs=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=OQnAHKYdPGx1EWYHP1brAD0vT8KuDwGXsFRMm9/Fz5l9bl3GgFE/Xu8IvJ8D7OoIpY qqgbJydm+bpbsKVOgrqaCif3HvHMfizONS5TdzjtpCJif0u3R0StLKRYPNesU481jbeV Z9J2QaaHILMxIJm80y4o9e8zNq9X6cIbxvTZT8fJe5yWNKWzxYPc4fHw5vNeNdS+APXS EjlZKaA+zeQG0vpBh9sDW5FbE9X2llTIGgtZ29P9cpYnVQO8AKao44Y2CtXEYfB2eVNe yjyMsSXBcPO/DjWxrV4PQ2touopPuptvI/qCGJL4Cq19fS2+hQoYww0KzknZP2dBSDoH RTHQ==; 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="V2VADK/8"; 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 a640c23a62f3a-a79bc827a99si161292466b.987.2024.07.14.09.29.46; Sun, 14 Jul 2024 09:29:47 -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="V2VADK/8"; 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 E40FF68DA10; Sun, 14 Jul 2024 19:29:37 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-251-53.mail.qq.com (out203-205-251-53.mail.qq.com [203.205.251.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 034E768D9AA for ; Sun, 14 Jul 2024 19:29:23 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1720974553; bh=mYNqGAb6kDU85VjjgX2brTjXcCLSEdNue60kkrzmu0o=; h=From:To:Cc:Subject:Date; b=V2VADK/84f5IyZhvyoR+6NbimyZl4YN6NYYYGkdWdA8/l1s7jzAqk42Otyybcc8Du 45yW0gBkEv1i1oalU/gR4FXHQ+L/X1J8U9f5tbsheF4fZSlX1ujQpCZomaUqLP0fTS bH473nPbAEhyDCuVQzvGwSsLk7/xJIxy76Pf7HYM= Received: from localhost.localdomain ([42.57.187.151]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 74C3C47E; Mon, 15 Jul 2024 00:29:12 +0800 X-QQ-mid: xmsmtpt1720974552tzvep95db Message-ID: X-QQ-XMAILINFO: MQ+wLuVvI2LQ/ZseSjkWbtRPdsuMRtsFbMDxA0eGpAsByli7JQP55G1aXt/7Uz KUyTRzUT4TmMl7uQnPcWxJwb4ShsBIHm45yt1mCjD3EjLf0EQS4EDFUIgaRsOj0cJU+FCy7vxv5M 60d/Jm6cPN9idD991s1mGPwnKVESax3ZrNDFpGm43FRvs8HS74UW1T3C6JG0huJrdCEwp/4Wimvh f0ArGM1875e89e001hQjYGgAmzuI9UUyenLIWtrWDViXlpjg/bh+xyZUPyrdCjsUifwyGQjvI+/I DJ8nyxInEqvMIWJvys0HtpSHo4f8gYtbcTg99z6yXRumdxdHfRprmzNIYZ9tPknqIXxcWdG+qoBq Ror9Nq4CdwXNobF9aZkjdKrDTyXrohK8MjaL65teJHT2aZJS21obi1UgKlaGzIU6sxq5yJ0kPSrY w4VzueekU5wHJoINODy16LAtdoQhihPGki8OptvXurvfsnqlinDU7qNG4cLh+aA9wflumd6bOrNx OJAjd8f8YkdbMg+sUitkf1jLlwktrktxQc/bPqxYPyZvmlp1NGaAlxdlbjtRek61J3hJwn9pC+dv CZCpdMOAIzefZSIzGoBkBPlS0KAXqHUcYoh6Xkc0iQf/TXIUtFvJeS9kpUtAzT09OZCrTuvXfU1x 48YwrPTRaX+CriG0vtD+vGm2eSo0E8Zxcyrp7YkBImtW/FQccCtjgTzjUUAbL8azefy0VO5yDUmF PN3pJXkaYDhoVGtge2CqvQCJvzWD3DU7pz4aQA8akX+hvfp8LdN3rbh9prbPDsC8DdJ7MMngvtoe LqVvKuCuAeSb/GC1/Gd7sYK07of2FXTY62aHNSROONFXyUY/P0VGF7rbJV//RkECP6uSoKWJbf3Q btgQWtfz0OZJzdLQDtl3AbZM4qeoLamA== X-QQ-XMRINFO: NyFYKkN4Ny6FSmKK/uo/jdU= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jul 2024 00:28:21 +0800 X-OQ-MSGID: <20240714162824.2728146-1-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/4] lavc/vp8dsp: R-V V 256 bilin,epel 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: 3Kv7kQUmyNRJ From: sunyuechi X60 new vp8_put_bilin16_h_c : 42.5 42.5 vp8_put_bilin16_h_rvv_i32 : 4.7 3.2 vp8_put_bilin16_hv_c : 71.5 71.7 vp8_put_bilin16_hv_rvv_i32 : 8.5 7.5 vp8_put_bilin16_v_c : 43.0 42.7 vp8_put_bilin16_v_rvv_i32 : 4.2 3.0 vp8_put_epel16_h4_c : 82.0 82.0 vp8_put_epel16_h4_rvv_i32 : 12.2 9.7 vp8_put_epel16_h6v6_c : 196.2 196.2 vp8_put_epel16_h6v6_rvv_i32 : 31.2 26.2 vp8_put_epel16_v4_c : 82.2 82.2 vp8_put_epel16_v4_rvv_i32 : 12.0 10.0 ... --- libavcodec/riscv/vp8dsp_init.c | 136 +++++++++++++++++++-------------- libavcodec/riscv/vp8dsp_rvv.S | 133 +++++++++++++++++++------------- 2 files changed, 162 insertions(+), 107 deletions(-) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index d9e2beb237..dcb6307d5b 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -35,13 +35,19 @@ void ff_vp8_idct_dc_add4uv_rvv(uint8_t *dst, int16_t block[4][16], ptrdiff_t str VP8_EPEL(16, rvi); VP8_EPEL(8, rvi); VP8_EPEL(4, rvi); -VP8_EPEL(16, rvv); -VP8_EPEL(8, rvv); -VP8_EPEL(4, rvv); +VP8_EPEL(16, rvv128); +VP8_EPEL(8, rvv128); +VP8_EPEL(4, rvv128); +VP8_EPEL(16, rvv256); +VP8_EPEL(8, rvv256); +VP8_EPEL(4, rvv256); -VP8_BILIN(16, rvv); -VP8_BILIN(8, rvv); -VP8_BILIN(4, rvv); +VP8_BILIN(16, rvv128); +VP8_BILIN(8, rvv128); +VP8_BILIN(4, rvv128); +VP8_BILIN(16, rvv256); +VP8_BILIN(8, rvv256); +VP8_BILIN(4, rvv256); av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) { @@ -58,64 +64,82 @@ av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) c->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_rvi; } #if HAVE_RVV - if (flags & AV_CPU_FLAG_RVV_I32 && ff_rv_vlen_least(128)) { - c->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_rvv; - c->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_rvv; - c->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_rvv; - c->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_rvv; - c->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_rvv; - c->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_rvv; +#define init_bilin(vlen) \ + c->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_rvv##vlen; \ + c->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_rvv##vlen; - c->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_rvv; - c->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_rvv; - c->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_rvv; - c->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_rvv; - c->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_rvv; - c->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_rvv; +#define init_epel_h_v(vlen) \ + c->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[0][0][1] = ff_put_vp8_epel16_h4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[0][1][0] = ff_put_vp8_epel16_v4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_rvv##vlen; - c->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_rvv; - c->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_rvv; - c->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_rvv; - c->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_rvv; - c->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_rvv; - c->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_rvv; - c->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_rvv; - c->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_rvv; - c->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_rvv; - c->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_rvv; - c->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_rvv; - c->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_rvv; +#define init_epel_hv(vlen) \ + c->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[0][2][1] = ff_put_vp8_epel16_h4v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[0][1][1] = ff_put_vp8_epel16_h4v4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[0][1][2] = ff_put_vp8_epel16_h6v4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_rvv##vlen; \ + c->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_rvv##vlen; - if (flags & AV_CPU_FLAG_RVB_ADDR) { - c->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_rvv; - c->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_rvv; - c->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_rvv; - c->put_vp8_epel_pixels_tab[0][0][1] = ff_put_vp8_epel16_h4_rvv; - c->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_rvv; - c->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_rvv; + int vlenb = ff_get_rv_vlenb(); - c->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_rvv; - c->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_rvv; - c->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_rvv; - c->put_vp8_epel_pixels_tab[0][1][0] = ff_put_vp8_epel16_v4_rvv; - c->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_rvv; - c->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_rvv; + if (flags & AV_CPU_FLAG_RVV_I32 && vlenb >= 32) { + init_bilin(256); + if (flags & AV_CPU_FLAG_RVB_ADDR) { + init_epel_h_v(256); +#if __riscv_xlen <= 64 + init_epel_hv(256); +#endif + } + } else if (flags & AV_CPU_FLAG_RVV_I32 && vlenb >= 16) { + init_bilin(128); + if (flags & AV_CPU_FLAG_RVB_ADDR) { + init_epel_h_v(128); #if __riscv_xlen <= 64 - c->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_rvv; - c->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_rvv; - c->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_rvv; - c->put_vp8_epel_pixels_tab[0][2][1] = ff_put_vp8_epel16_h4v6_rvv; - c->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_rvv; - c->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_rvv; - c->put_vp8_epel_pixels_tab[0][1][1] = ff_put_vp8_epel16_h4v4_rvv; - c->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_rvv; - c->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_rvv; - c->put_vp8_epel_pixels_tab[0][1][2] = ff_put_vp8_epel16_h6v4_rvv; - c->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_rvv; - c->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_rvv; + init_epel_hv(128); #endif } } +#undef init_bilin +#undef init_epel_h_v +#undef init_epel_hv #endif #endif } diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index d366748a0a..0cbf1672f7 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -21,7 +21,8 @@ #include "libavutil/riscv/asm.S" -.macro vsetvlstatic8 len +.macro vsetvlstatic8 len, vlen +.if \vlen == 128 .if \len <= 4 vsetivli zero, \len, e8, mf4, ta, ma .elseif \len <= 8 @@ -31,9 +32,21 @@ .elseif \len <= 31 vsetivli zero, \len, e8, m2, ta, ma .endif +.else +.if \len <= 4 + vsetivli zero, \len, e8, mf8, ta, ma +.elseif \len <= 8 + vsetivli zero, \len, e8, mf4, ta, ma +.elseif \len <= 16 + vsetivli zero, \len, e8, mf2, ta, ma +.elseif \len <= 31 + vsetivli zero, \len, e8, m1, ta, ma +.endif +.endif .endm -.macro vsetvlstatic16 len +.macro vsetvlstatic16 len, vlen +.if \vlen == 128 .if \len <= 4 vsetivli zero, \len, e16, mf2, ta, ma .elseif \len <= 8 @@ -41,6 +54,15 @@ .elseif \len <= 16 vsetivli zero, \len, e16, m2, ta, ma .endif +.else +.if \len <= 4 + vsetivli zero, \len, e16, mf4, ta, ma +.elseif \len <= 8 + vsetivli zero, \len, e16, mf2, ta, ma +.elseif \len <= 16 + vsetivli zero, \len, e16, m1, ta, ma +.endif +.endif .endm #if __riscv_xlen >= 64 @@ -263,10 +285,10 @@ endfunc vnsra.wi \dst, v24, 3 .endm -.macro put_vp8_bilin_h_v type mn -func ff_put_vp8_bilin4_\type\()_rvv, zve32x - vsetvlstatic8 4 -.Lbilin_\type: +.macro put_vp8_bilin_h_v vlen, type, mn +func ff_put_vp8_bilin4_\type\()_rvv\vlen, zve32x + vsetvlstatic8 4, \vlen +.Lbilin_\type\vlen: li t1, 8 li t4, 4 sub t1, t1, \mn @@ -306,12 +328,10 @@ func ff_put_vp8_bilin4_\type\()_rvv, zve32x endfunc .endm -put_vp8_bilin_h_v h a5 -put_vp8_bilin_h_v v a6 - -func ff_put_vp8_bilin4_hv_rvv, zve32x - vsetvlstatic8 4 -.Lbilin_hv: +.macro put_vp8_bilin_hv vlen +func ff_put_vp8_bilin4_hv_rvv\vlen, zve32x + vsetvlstatic8 4, \vlen +.Lbilin_hv\vlen: li t3, 8 sub t1, t3, a5 sub t2, t3, a6 @@ -332,23 +352,32 @@ func ff_put_vp8_bilin4_hv_rvv, zve32x ret endfunc +.endm + +.irp vlen,256,128 +put_vp8_bilin_h_v \vlen, h, a5 +put_vp8_bilin_h_v \vlen, v, a6 +put_vp8_bilin_hv \vlen +.endr .irp len,16,8 -func ff_put_vp8_bilin\len\()_h_rvv, zve32x - vsetvlstatic8 \len - j .Lbilin_h +.irp vlen,256,128 +func ff_put_vp8_bilin\len\()_h_rvv\vlen, zve32x + vsetvlstatic8 \len, \vlen + j .Lbilin_h\vlen endfunc -func ff_put_vp8_bilin\len\()_v_rvv, zve32x - vsetvlstatic8 \len - j .Lbilin_v +func ff_put_vp8_bilin\len\()_v_rvv\vlen, zve32x + vsetvlstatic8 \len, \vlen + j .Lbilin_v\vlen endfunc -func ff_put_vp8_bilin\len\()_hv_rvv, zve32x - vsetvlstatic8 \len - j .Lbilin_hv +func ff_put_vp8_bilin\len\()_hv_rvv\vlen, zve32x + vsetvlstatic8 \len, \vlen + j .Lbilin_hv\vlen endfunc .endr +.endr const subpel_filters .byte 0, -6, 123, 12, -1, 0 @@ -378,7 +407,7 @@ endconst .endif .endm -.macro epel_load dst len size type from_mem regtype +.macro epel_load dst, len, vlen, size, type, from_mem, regtype .ifc \type,v sub t6, a2, a3 add a7, a2, a3 @@ -426,26 +455,26 @@ endconst .endif li t6, 64 vwadd.wx v16, v16, t6 - vsetvlstatic16 \len + vsetvlstatic16 \len, \vlen vwadd.vv v24, v16, v20 vnsra.wi v24, v24, 7 vmax.vx v24, v24, zero - vsetvlstatic8 \len + vsetvlstatic8 \len, \vlen vnclipu.wi \dst, v24, 0 .endm -.macro epel_load_inc dst len size type from_mem regtype - epel_load \dst \len \size \type \from_mem \regtype +.macro epel_load_inc dst, len, vlen, size, type, from_mem, regtype + epel_load \dst, \len, \vlen, \size, \type, \from_mem, \regtype add a2, a2, a3 .endm -.macro epel len size type -func ff_put_vp8_epel\len\()_\type\()\size\()_rvv, zve32x +.macro epel len, vlen, size, type +func ff_put_vp8_epel\len\()_\type\()\size\()_rvv\vlen, zve32x epel_filter \size \type t - vsetvlstatic8 \len + vsetvlstatic8 \len, \vlen 1: addi a4, a4, -1 - epel_load_inc v30 \len \size \type 1 t + epel_load_inc v30, \len, \vlen, \size, \type, 1, t vse8.v v30, (a0) add a0, a0, a1 bnez a4, 1b @@ -454,8 +483,8 @@ func ff_put_vp8_epel\len\()_\type\()\size\()_rvv, zve32x endfunc .endm -.macro epel_hv len hsize vsize -func ff_put_vp8_epel\len\()_h\hsize\()v\vsize\()_rvv, zve32x +.macro epel_hv len, vlen, hsize, vsize +func ff_put_vp8_epel\len\()_h\hsize\()v\vsize\()_rvv\vlen, zve32x #if __riscv_xlen == 64 addi sp, sp, -48 .irp n,0,1,2,3,4,5 @@ -470,22 +499,22 @@ func ff_put_vp8_epel\len\()_h\hsize\()v\vsize\()_rvv, zve32x sub a2, a2, a3 epel_filter \hsize h t epel_filter \vsize v s - vsetvlstatic8 \len + vsetvlstatic8 \len, \vlen .if \hsize == 6 || \vsize == 6 sub a2, a2, a3 - epel_load_inc v0 \len \hsize h 1 t + epel_load_inc v0, \len, \vlen, \hsize, h, 1, t .endif - epel_load_inc v2 \len \hsize h 1 t - epel_load_inc v4 \len \hsize h 1 t - epel_load_inc v6 \len \hsize h 1 t - epel_load_inc v8 \len \hsize h 1 t + epel_load_inc v2, \len, \vlen, \hsize, h, 1, t + epel_load_inc v4, \len, \vlen, \hsize, h, 1, t + epel_load_inc v6, \len, \vlen, \hsize, h, 1, t + epel_load_inc v8, \len, \vlen, \hsize, h, 1, t .if \hsize == 6 || \vsize == 6 - epel_load_inc v10 \len \hsize h 1 t + epel_load_inc v10, \len, \vlen, \hsize, h, 1, t .endif addi a4, a4, -1 1: addi a4, a4, -1 - epel_load v30 \len \vsize v 0 s + epel_load v30, \len, \vlen, \vsize, v, 0, s vse8.v v30, (a0) .if \hsize == 6 || \vsize == 6 vmv.v.v v0, v2 @@ -495,13 +524,13 @@ func ff_put_vp8_epel\len\()_h\hsize\()v\vsize\()_rvv, zve32x vmv.v.v v6, v8 .if \hsize == 6 || \vsize == 6 vmv.v.v v8, v10 - epel_load_inc v10 \len \hsize h 1 t + epel_load_inc v10, \len, \vlen, \hsize, h, 1, t .else - epel_load_inc v8 \len 4 h 1 t + epel_load_inc v8, \len, \vlen, 4, h, 1, t .endif add a0, a0, a1 bnez a4, 1b - epel_load v30 \len \vsize v 0 s + epel_load v30, \len, \vlen, \vsize, v, 0, s vse8.v v30, (a0) #if __riscv_xlen == 64 @@ -521,14 +550,16 @@ endfunc .endm .irp len,16,8,4 -epel \len 6 h -epel \len 4 h -epel \len 6 v -epel \len 4 v +.irp vlen,256,128 +epel \len, \vlen, 6, h +epel \len, \vlen, 4, h +epel \len, \vlen, 6, v +epel \len, \vlen, 4, v #if __riscv_xlen <= 64 -epel_hv \len 6 6 -epel_hv \len 4 4 -epel_hv \len 6 4 -epel_hv \len 4 6 +epel_hv \len, \vlen, 6, 6 +epel_hv \len, \vlen, 4, 4 +epel_hv \len, \vlen, 6, 4 +epel_hv \len, \vlen, 4, 6 #endif .endr +.endr From patchwork Sun Jul 14 16:28:22 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: 50536 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1850482vqb; Sun, 14 Jul 2024 09:30:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUmGQYep2W3RZD9oE0esyMZy117NnkhALsaDjYZgj7GL44UDYjko2B6Y8gaM1jZwh3GCEl49tWA7ghw89ib56rYQ8mCYCbk6RjY4w== X-Google-Smtp-Source: AGHT+IFcbIYo/Y4MyRF2w4fYTsZBUDkF54j14rUAZmg5k9imRObr8QqAgR9iY00+siE+DZLnKSkO X-Received: by 2002:a17:906:71d4:b0:a77:cdaa:88aa with SMTP id a640c23a62f3a-a780b68913emr1219336266b.4.1720974614959; Sun, 14 Jul 2024 09:30:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720974614; cv=none; d=google.com; s=arc-20160816; b=VNca2xLS9oE13m6ikqkg/wUDWD+k/6Zx+kCfze4fH7D5VGYZ1HiaW+os9E/cMgaq8U bdkU5gopqrcJDZo0ohGbgTIn8/LcuW1FnGX+sEnTXYcuHVg3scuCPD20ShqAoS9gw+j+ XTHFfHF/E25rSNz3cZ0IIgPq/CVbjt/tMJg90lCn5MkS507jgFiPfmNxaZmaGtCLNTf3 0d5wLbsJC39obEbJXH/YhFbpdBR9KxTQl9Gyhjp3rkwBkQfWW1UpjGfAam+4DUEJ47dz QOo768s95BAS6uzrQh2sSN4fdQIPEw8Y18jhpj/Mjhk0IauY/Iv+Et8W3jyFZlAlyvIB GS3w== 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=tjXX76A/dADaEKEOtT2zsLx9tgY8zR37lzj7CkWUIOg=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=G1r1X58n5gGWpVB/3+icP83RD07XhXRlFxgM0Y9cKMFvXS3J8LZGiWS1IUh95bJv9l q3igxq6hfLYXOsZ13+b2K/UE4C1VQB+JdtilZ+mTBCbT2dP+V7MDV/LJR26qDSZtVrDe BLMYzKGc981i5XKsRap+PHbAW8kWkShVg1mnk45IcMI3zFe61WtCRxBbja5RJjPQhqHG w81Lb5jgqYMvZRcGG/M1o+FHaTbzItLKz+wEUZVJaQ/gQc2TyAYKVQDdRrg6pF22AyMX 3A4594k8phc5TDcaobgY7mqRZBaWLDm7hEnCr29/lteOxehzc1JZbDuEYT2lk44OTF5M sReg==; 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=ORCCPBzX; 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 a640c23a62f3a-a79bc58b138si167018366b.97.2024.07.14.09.30.14; Sun, 14 Jul 2024 09:30:14 -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=ORCCPBzX; 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 4AE9F68DA8E; Sun, 14 Jul 2024 19:29:42 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-251-59.mail.qq.com (out203-205-251-59.mail.qq.com [203.205.251.59]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0350268D9AA for ; Sun, 14 Jul 2024 19:29:27 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1720974554; bh=fBFWfgS0Pp+wSUI0J1npzXGFUI4CLsMKbiU8NgZ8MEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ORCCPBzX8dSBh6W09JRHfNeY/gMfHq8KpDwm9jSp32ST92+EuUYhsMEKhSwdF05Q8 U3Es0IVHGKYFvnH85laidEE3Ixg6o+6uyzgC+pCClGGBxDAvEl4SU0G3s18+AgoMzi M7wT9AOx0PTDKE5OVwYqXD+bL8ZuOtEfZ0E53ayE= Received: from localhost.localdomain ([42.57.187.151]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 74C3C47E; Mon, 15 Jul 2024 00:29:12 +0800 X-QQ-mid: xmsmtpt1720974553tov6oflda Message-ID: X-QQ-XMAILINFO: My/elTziho8NFgr+y3cOM5Ftg2lV5uwDS3x/yKHL27zaIHxJSYJ8qHWMi9aXbT beJdiJa/pjE4GP0wQ+GhbS/QjxlYVGqk9HkSUdLT6bCgeS0dwY0n55rCVy4p0r6y2WU4PoIb4Qm6 eGH1c4KY9DSQdLdiX3TurlWOpSRb39SrNoA+smbZpiNOsJDxDIONsBR1rAYKqfxS40DxYcaaD9gN 02SI65ZV+Antq/f8JCv9kCBEIqXX7YGfBWx42YPZhGRY+R2OBelKa+GzXQNm404+6SXhSGttkZL1 3RWvWJS0asnD/5rdPZ4abD6d8hiEVzJRUheOFWeewApGMgAJZG1pvHbfppJ2OZenu49J3oYds7gE sl8yfktE2+X16uveQFN8rZkZ8jxJthDRnsW4bYyuwKovELiSQ/c/c3v3B9Rz7KASs7cuCIjxfs3s zmUDhlz4UmfZEWcfUKEr0EnkgCNDUk3XlwRwiAyH/2J+N3DJBRtU48SQKsLXSmtAIxIYdO8rjm1M fKnK2+GWP9gCx1RWVNtas0DfGMULLRJmpJe+fgfshqqAv4HE4aoK149Hk7YAWGt92ZVNOsyXsuhk QMg1ahj9ybdse45Xw+8Yl9TTtF879dzwhqiZ6Stp0EJmulzTGDNMy0PNGZhQU7hXWjoLCKVEP6Ca s2jpFrdWR1iu8Gj1SGPLbAhmUP+OtevYX0v4TYjnikxd/YSXviHiNeqwu5IDsrh2W5OmBrXjHHBl CeXodOtdk6Q92GDsjM/bhSe0zPdoYT4txnUGRjnstif5eL5Ld7QFzC+2DqF8gA9RL9XrDudeNUB1 Il0MefyOCaxiaD+OAl9YbdWtnn0artUayz+4vRi55G1yEApUtW3YhZfqXGI2lH0SAN6HbRLg4YfI Qe5BX/ZuxNPzww1paFbrBnecAZCq7ahj4457ryam0nySW4eK7RdhYNRLKrdrvuz20yeiRb3tHr1h H+a4VHJMg= X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jul 2024 00:28:22 +0800 X-OQ-MSGID: <20240714162824.2728146-2-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240714162824.2728146-1-uk7b@foxmail.com> References: <20240714162824.2728146-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/4] lavc/vp8dsp: R-V V loop_filter_simple 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: lGuUSdLNlZ3m From: sunyuechi C908 X60 vp8_loop_filter_simple_h_c : 6.2 5.7 vp8_loop_filter_simple_h_rvv_i32 : 3.0 2.5 vp8_loop_filter_simple_v_c : 6.5 6.2 vp8_loop_filter_simple_v_rvv_i32 : 2.0 1.5 --- libavcodec/riscv/vp8dsp_init.c | 18 +++++++- libavcodec/riscv/vp8dsp_rvv.S | 77 ++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index dcb6307d5b..8c5b2c8b04 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -49,6 +49,9 @@ VP8_BILIN(16, rvv256); VP8_BILIN(8, rvv256); VP8_BILIN(4, rvv256); +VP8_LF(rvv128); +VP8_LF(rvv256); + av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) { #if HAVE_RV @@ -147,9 +150,15 @@ av_cold void ff_vp78dsp_init_riscv(VP8DSPContext *c) av_cold void ff_vp8dsp_init_riscv(VP8DSPContext *c) { #if HAVE_RVV + int vlenb = ff_get_rv_vlenb(); + +#define init_loop_filter(vlen) \ + c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_rvv##vlen; \ + c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_rvv##vlen; + int flags = av_get_cpu_flags(); - if (flags & AV_CPU_FLAG_RVV_I32 && ff_rv_vlen_least(128)) { + if (flags & AV_CPU_FLAG_RVV_I32 && vlenb >= 16) { #if __riscv_xlen >= 64 if (flags & AV_CPU_FLAG_RVV_I64) c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_rvv; @@ -159,6 +168,13 @@ av_cold void ff_vp8dsp_init_riscv(VP8DSPContext *c) c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_rvv; if (flags & AV_CPU_FLAG_RVV_I64) c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_rvv; + + if (vlenb >= 32) { + init_loop_filter(256); + } else { + init_loop_filter(128); + } } +#undef init_loop_filter #endif } diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index 0cbf1672f7..3cec4dd135 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -275,6 +275,83 @@ func ff_vp78_idct_dc_add4uv_rvv, zve64x ret endfunc +.macro filter_fmin len, vlen, a, f1, p0f2, q0f1, p0, q0 + vsetvlstatic16 \len, \vlen + vsext.vf2 \q0f1, \a + vmin.vx \p0f2, \q0f1, a6 + vmin.vx \q0f1, \q0f1, t6 + vadd.vi \p0f2, \p0f2, 3 + vadd.vi \q0f1, \q0f1, 4 + vsra.vi \p0f2, \p0f2, 3 + vsra.vi \f1, \q0f1, 3 + vadd.vv \p0f2, \p0f2, \p0 + vsub.vv \q0f1, \q0, \f1 + vmax.vx \p0f2, \p0f2, zero + vmax.vx \q0f1, \q0f1, zero +.endm + +.macro filter len, vlen, type, normal, inner, dst, stride, fE, fI, thresh +.ifc \type,v + sub t3, \dst, \stride // -1 + sub t2, t3, \stride // -2 + add t4, \dst, \stride // 1 + vle8.v v3, (t2) // p1 + vle8.v v4, (t3) // p0 + vle8.v v5, (\dst) // q0 + vle8.v v6, (t4) // q1 +.else + addi t2, \dst, -2 + addi t3, \dst, -1 + vlsseg4e8.v v3, (t2), \stride +.endif + vwsubu.vv v10, v3, v6 // p1-q1 + vwsubu.vv v12, v5, v4 // q0-p0 + + vnclip.wi v16, v10, 0 // clip_int8(p1 - q1) + vsetvlstatic16 \len, \vlen + // vp8_simple_limit(dst + i, stride, flim) + li a6, 2 + vneg.v v22, v10 + vneg.v v24, v12 + vmax.vv v22, v22, v10 + vmax.vv v24, v24, v12 + vsrl.vi v22, v22, 1 + vmacc.vx v22, a6, v24 + vmsleu.vx v0, v22, \fE + + li a7, 3 + li a6, 124 + li t6, 123 + vmul.vx v22, v12, a7 // 3 * (q0 - p0) + vzext.vf2 v24, v4 // p0 + vzext.vf2 v20, v5 // q0 + vsetvlstatic8 \len, \vlen + vwadd.wv v10, v22, v16 + vnclip.wi v28, v10, 0 + filter_fmin \len, \vlen, v28, v12, v26, v10, v24, v20 + vsetvlstatic8 \len, \vlen + vnclipu.wi v30, v26, 0 + vnclipu.wi v31, v10, 0 +.ifc \type,v + vse8.v v30, (t3), v0.t + vse8.v v31, (\dst), v0.t +.else + vssseg2e8.v v30, (t3), \stride, v0.t +.endif + +.endm + +.irp type,v,h +.irp vlen,256,128 +func ff_vp8_\type\()_loop_filter16_simple_rvv\vlen, zve32x + csrwi vxrm, 0 + vsetvlstatic8 16, \vlen + filter 16, \vlen, \type, 0, 0, a0, a1, a2, a3, a4 + ret +endfunc +.endr +.endr + .macro bilin_load_h dst mn addi t5, a2, 1 vle8.v \dst, (a2) From patchwork Sun Jul 14 16:28:23 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: 50533 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1850255vqb; Sun, 14 Jul 2024 09:29:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXIhK/zJDcQUbCIR9Ldn/zMNwcOcIgzjUPnwcSQUkaDQROA9ZPbt0FGn0wnR4CuSMvsgKNobAGqXyO+f54EgRbiAbUyccQe0IWYUw== X-Google-Smtp-Source: AGHT+IGSaPyUZ5nWbAQu7Q451WXMnCc9Rk4HSVi9zZjSD3EP348ynJucBSHdwUkYUFYMD+qY/mfu X-Received: by 2002:a2e:9bcc:0:b0:2ee:493f:d751 with SMTP id 38308e7fff4ca-2eeb30fd3admr120964041fa.23.1720974578009; Sun, 14 Jul 2024 09:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720974577; cv=none; d=google.com; s=arc-20160816; b=UHnyPqZBEAMax8NnoHgt9sJPoMTGZqa2G+3ytiQZbkNoLysRyxy+aJkjR79g/kfPVD LCCS0FC/xcxQSrzpXVqWFgGm8jNK0Kxm+tS2aJMnQRcosihY5gfIXPdOtPbH4/DYkqx9 hHuTIIABPHFDUjbUVFegv4AUUh1fIKkRokm2EgsGhKurViaYqPde1y7O1a3dTgKUwMxH tnNMme0Z7cZETgHqzxVz9n2XjD6fBMvB8DwP2r1ejOLG2BftMie/ZAsEMneCZ5oaiVFp awQMdA3bQumpZG2co1+6AH7juLKY1740RsatxNmCC3ARNrjMzM3Brc9WBkaorIHRNxER DrLw== 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=UzGhVyJyxKBN5toiO6LbhsDiVtHYWevNF04Z7RR0XTA=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=GK6Tm003pqBWIo9SNGgwJzhhqxmBgtO07ZbXY9EaN+U/JMLqYZxPUrc7ngeR+ChmRz UjM1Bh9wQFB7twkmdUBMT7xkNK7UFYPoBT439BakNH+YnstUqxFzezD3J7qKsOYMk1y8 dUUuzk0ZKH42cUtCHsMFCDMCROnXZYhLrsSnNBkUyA1JfeUab8k6boKnPq7I75T5RuNl 837lPojI51knRFjxhYy4oKxIvsXfgq6sOHhTrdm8ergCyFiTQO7P2ayGfaXy60RBGTWl I9H9q0QuHclmok7c7qlxlp4eFAcs2iomq+eayfAKXhe1qr5UtwC3zXYKUv90R7zli+VZ 0fjQ==; 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=V+pP9oA+; 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 38308e7fff4ca-2eee19724bfsi9086571fa.637.2024.07.14.09.29.37; Sun, 14 Jul 2024 09:29:37 -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=V+pP9oA+; 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 1BE7868D9C7; Sun, 14 Jul 2024 19:29:33 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from xmbghk7.mail.qq.com (xmbghk7.mail.qq.com [43.163.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D187668D7F5 for ; Sun, 14 Jul 2024 19:29:23 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1720974555; bh=PS05g8FxRU7jtvkEjb6XPQKFOXklBN+H7dAnLePff50=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=V+pP9oA+wIUecXjcLO45okVcV4bGbzYeLajGC0tsrzJKdkssrlQn0UPd4cLHS3gha r6h4q7Nk6HIjxb1b9Rq0ONM8y4Gv6z4VUy76wBcu1875JZcPJqit4fJD4gY5PGAEtP feJZYHoPpYisVtcj7JL9MndyXWQ/qrUbnx3qHePs= Received: from localhost.localdomain ([42.57.187.151]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 74C3C47E; Mon, 15 Jul 2024 00:29:12 +0800 X-QQ-mid: xmsmtpt1720974554t80i7ssmu Message-ID: X-QQ-XMAILINFO: N5sfBKY/oC4kxGsf5WAq3/4sdhFuTA+G1KNyi61gu44FpdV1sDJLUPClifpqvf +Pnmu/WkwbnrsBJmLbxhpz2191HSB/K66BF/dgU7Z7ZJYXA+MN6W2NJ/DTL+VxwmcF1GK+RuPmBw 08vrGmRTkSiV93E7PDosaXivSlL2e6M9mmD8SDdTRITlpzIuFe4daCXK87jgBfAKLV3gLmlZ2jEF QtLaguyVyHdvesCK14ieQleWutYpHN7GtE0iaOKzGrNA4xYKBClaqrk6oXOQ0Sf+McQmpyhgEIkx JFZW5MDEV4MauAE4Ck8Gncyw3c0xMh3qexIiLmdxD1VPennWwRbTc2LslmgASEXeV+K7Pl08Aelk vGNyvvBrBx7Iq0jBTAlIg9eKtiiMW6EyUMfxTHtB6zOZ6NSR3hx9+hxDzYKzqW9EC2iHELX5ehsV VZgkeCGn73vV8vfXYvrFzO9i1xsLWDv6Vpmq7ZjzC2LEOARoB07eBv/DkvmlzLq+XFaldBzugs1q KVa+6bvP/N7BHK4+5i2IeXU48ZW7aqhVN8cRYNbAeVHI6wWfojV+PwbwfCJLJQyuJcjE/wFfkxrn ezd8t5Xv7LAUejVwJ+cli008ZjCHbshpVutHwJwyHSQ2e1PZIcOONCaWeEtjtg1jcJGzXMP8eBxr OrTIDudrwV9ahvxrnWNYX06OEC4JLVIjqHWIkGzLogx47xNkhDR1en1vCRSGBZWx7qLfe0gXrlw1 vOy+7FpLK2st/bW1uMXcUn60U6jpUIh69DazgKF7nwPaTycKX81g/DnXcjX4YCGAs57g0DJ82uDQ 5ldwxUhYxOxLL9Df6qo0cH5YV/qdRkZX+/uEQLPsxkI7UGdLda/gqg2Cc77M4L7TLnqubJAFAYFB Hx50PBdw6ygDTxS6hlXdb5bkOlhGeSgNYNyOtlB11NIxtDB/+ECg0= X-QQ-XMRINFO: OD9hHCdaPRBwq3WW+NvGbIU= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jul 2024 00:28:23 +0800 X-OQ-MSGID: <20240714162824.2728146-3-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240714162824.2728146-1-uk7b@foxmail.com> References: <20240714162824.2728146-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/4] 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: gisNogqonZrm From: sunyuechi C908 X60 vp8_loop_filter8uv_inner_h_c : 11.0 9.5 vp8_loop_filter8uv_inner_h_rvv_i32 : 10.5 8.7 vp8_loop_filter8uv_inner_v_c : 11.2 11.0 vp8_loop_filter8uv_inner_v_rvv_i32 : 7.7 6.2 vp8_loop_filter16y_inner_h_c : 11.2 9.0 vp8_loop_filter16y_inner_h_rvv_i32 : 8.0 6.2 vp8_loop_filter16y_inner_v_c : 11.5 10.5 vp8_loop_filter16y_inner_v_rvv_i32 : 5.2 3.7 --- libavcodec/riscv/vp8dsp_init.c | 6 ++- libavcodec/riscv/vp8dsp_rvv.S | 90 ++++++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index 8c5b2c8b04..8cb21b8ceb 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -154,7 +154,11 @@ av_cold void ff_vp8dsp_init_riscv(VP8DSPContext *c) #define init_loop_filter(vlen) \ c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_rvv##vlen; \ - c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_rvv##vlen; + c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_rvv##vlen; \ + c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_rvv##vlen; \ + c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_rvv##vlen; \ + c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_rvv##vlen; \ + c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_rvv##vlen; int flags = av_get_cpu_flags(); diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index 3cec4dd135..036872a29e 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -275,6 +275,13 @@ func ff_vp78_idct_dc_add4uv_rvv, zve64x ret endfunc +.macro filter_abs dst, mask, tmp, diff, fI + vneg.v \tmp, \diff + vmax.vv \dst, \tmp, \diff + vmsleu.vx \tmp, \dst, \fI + vmand.mm \mask, \mask, \tmp +.endm + .macro filter_fmin len, vlen, a, f1, p0f2, q0f1, p0, q0 vsetvlstatic16 \len, \vlen vsext.vf2 \q0f1, \a @@ -299,13 +306,36 @@ endfunc vle8.v v4, (t3) // p0 vle8.v v5, (\dst) // q0 vle8.v v6, (t4) // q1 + .if \normal + sub t1, t2, \stride // -3 + sub t0, t1, \stride // -4 + add t5, t4, \stride // 2 + add t6, t5, \stride // 3 + vle8.v v1, (t0) // p3 + vle8.v v2, (t1) // p2 + vle8.v v7, (t5) // q2 + vle8.v v8, (t6) // q3 + .endif .else addi t2, \dst, -2 addi t3, \dst, -1 + .if \normal + addi t1, \dst, -4 + vlsseg8e8.v v1, (t1), \stride + .else vlsseg4e8.v v3, (t2), \stride + .endif .endif vwsubu.vv v10, v3, v6 // p1-q1 vwsubu.vv v12, v5, v4 // q0-p0 +.if \normal + vwsubu.vv v30, v1, v2 // p3-p2 + vwsubu.vv v28, v2, v3 // p2-p1 + vwsubu.vv v26, v3, v4 // p1-p0 + vwsubu.vv v24, v8, v7 // q3-q2 + vwsubu.vv v22, v7, v6 // q2-q1 + vwsubu.vv v8, v6, v5 // q1-q0 +.endif vnclip.wi v16, v10, 0 // clip_int8(p1 - q1) vsetvlstatic16 \len, \vlen @@ -319,6 +349,24 @@ endfunc vmacc.vx v22, a6, v24 vmsleu.vx v0, v22, \fE +.if \normal + vneg.v v22, v26 + vmax.vv v26, v22, v26 + vmsleu.vx v1, v26, \fI + filter_abs v22, v1, v10, v28, \fI + filter_abs v22, v1, v10, v30, \fI + filter_abs v22, v1, v10, v24, \fI + filter_abs v22, v1, v10, v22, \fI + filter_abs v20, v1, v10, v8, \fI + vzext.vf2 v8, v3 // p1 + vmand.mm v1, v0, v1 // vp8_simple_limit && normal + vmsgtu.vx v26, v26, \thresh // hev: FFABS(p1 - p0) > thresh + vmsgtu.vx v3, v20, \thresh // hev: FFABS(q1 - q0) > thresh + vzext.vf2 v14, v6 // q1 + vmor.mm v3, v3, v26 // FFABS(p1 - p0) > thresh || FFABS(q1 - q0) > thresh + vmand.mm v0, v1, v3 // v0 = normal && hev + vmnot.m v3, v3 // v3 = !hv +.endif li a7, 3 li a6, 124 li t6, 123 @@ -339,6 +387,33 @@ endfunc vssseg2e8.v v30, (t3), \stride, v0.t .endif +.if \normal + vmand.mm v0, v1, v3 // vp8_normal_limit & !hv + + vnclip.wi v22, v22, 0 // clip_int8(a); + filter_fmin \len, \vlen, v22, v12, v26, v10, v24, v20 + vadd.vi v12, v12, 1 + vsra.vi v12, v12, 1 // (f1 + 1) >> 1; + vadd.vv v8, v8, v12 // p1 + a + vsub.vv v14, v14, v12 // q1 - a + + vmax.vx v8, v8, zero + vmax.vx v14, v14, zero + vsetvlstatic8 \len, \vlen + vnclipu.wi v3, v8, 0 // -2 + vnclipu.wi v4, v26, 0 // -1 + vnclipu.wi v5, v10, 0 // 0 + vnclipu.wi v6, v14, 0 // 1 + + .ifc \type,v + vse8.v v3, (t2), v0.t // -2 + vse8.v v4, (t3), v0.t // -1 + vse8.v v5, (\dst), v0.t // 0 + vse8.v v6, (t4), v0.t // 1 + .else + vssseg4e8.v v3, (t2), \stride, v0.t + .endif +.endif .endm .irp type,v,h @@ -349,6 +424,21 @@ func ff_vp8_\type\()_loop_filter16_simple_rvv\vlen, zve32x filter 16, \vlen, \type, 0, 0, a0, a1, a2, a3, a4 ret endfunc + +func ff_vp8_\type\()_loop_filter16_inner_rvv\vlen, zve32x + csrwi vxrm, 0 + vsetvlstatic8 16, \vlen + filter 16, \vlen, \type, 1, 1, a0, a1, a2, a3, a4 + ret +endfunc + +func ff_vp8_\type\()_loop_filter8uv_inner_rvv\vlen, zve32x + csrwi vxrm, 0 + vsetvlstatic8 8, \vlen + filter 8, \vlen, \type, 1, 1, a0, a2, a3, a4, a5 + filter 8, \vlen, \type, 1, 1, a1, a2, a3, a4, a5 + ret +endfunc .endr .endr From patchwork Sun Jul 14 16:28:24 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: 50535 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:612c:2298:b0:482:c625:d099 with SMTP id fp24csp1850344vqb; Sun, 14 Jul 2024 09:29:57 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWPYxQ4Hgd/VYE4N4de8rNnpJVtV/sL8oKpelm2laizPmUBbID+3l7VVjhqNOEOo4/kqaXBHB7N7N7s9LPGgdRDg3dWzQIaWR18sA== X-Google-Smtp-Source: AGHT+IEM4a5RJYPTuFAsQUnz1V3rN5XGLqETOvWJfwXmf8e7QOM6b7IF36mAqNPJyVZdk2Wb3jPf X-Received: by 2002:a05:6512:2205:b0:52c:e5ac:ecd2 with SMTP id 2adb3069b0e04-52eb99d2146mr10826271e87.51.1720974597110; Sun, 14 Jul 2024 09:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720974597; cv=none; d=google.com; s=arc-20160816; b=Nll/yx4iZzMD/zfCpssFv6NfzIASIS4a/jgG4bjB+gL5lQTddfFtOOv3uoPoZG660b zc41rWMjMuAqBOjARxRLz+3E8/SQwP1LslOBzqkOn7FJMdzTnJOV55VWdJYJ9Q/+fr+5 1ilPZngwmm9aZo261TJ3oOgZ6lG1sl3/dGkivFI7ctC0LE50Bajnd7sPuSM+Gy36Dmmh bzKf/idEpwS8stgfYP4Rn4/uLYTWvCZNRMK5DHgMIVt794iOuf941+cVwxYmeq3SSCNR LUIQOkqSQoe5CwidEGlT4yyuldGrEy5E37rx8OnyqqFmpDPYeX9K/s9bs/7cjNXJEYdB 1pWQ== 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=4J5SVle4mmvIagtE++q7sfk8iVN/viWUqspROF5KKHc=; fh=D0bFwGkf4X22/D/bfeDVrXKIx7S6kcXsNzy10j8ORbQ=; b=HYceBuHUhgcWYq5WlMCzWiFVoRq4RYwkd1U7wzn/Eqzt/WFx/np/hAXu5buRfGUMrT xsgYBsmRz8uLv5Jsz1Xi3UhYM+fhFPWQb+kdMScs9MGg4jUx8BOnUpElUbM1lqMpOU/Q 8UIU45UkRZhHBbhrgdXQTc7XOrENsXO3Rfni9uptVhHdbUej5FjdTdaeAKLgvPyv1h05 oe4pTLIO7EuVyniL4/jcHnKq4p8yM6gl2il04Y46Mp9IdDl3We0VNmUZNX2Apf2ozdYP D03Hq5qP8Ae8PCWz/N/uRYMiqXJb9MWGDagDOHG12sMxM4ZnTADRYKZ9QW3WDah0hf29 //Zw==; 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=G0Hsh9Qk; 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 2adb3069b0e04-52ed255b9f3si990237e87.209.2024.07.14.09.29.56; Sun, 14 Jul 2024 09:29:57 -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=G0Hsh9Qk; 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 037E868DA40; Sun, 14 Jul 2024 19:29:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from out203-205-221-153.mail.qq.com (out203-205-221-153.mail.qq.com [203.205.221.153]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3475868D9C7 for ; Sun, 14 Jul 2024 19:29:23 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1720974556; bh=ehTTGIwj2ewAlCbE2B0FVxZa+7fWhfe0DKmJYSxx8yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G0Hsh9QktT1tD+NXTJQ4TEaPyalts7a3tcATaZ8IPlw6D83ajiWo35vR8R+Lz2KbW pH3gifsSqnio0tlVpHGb8LUy7isp720iD1IQ2jraFwVB3or2bLl1du39HsXx9CZVwo oUosiZFAdlYTMwsDs5AuePW7Txh81BbWQt0DwMNM= Received: from localhost.localdomain ([42.57.187.151]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id 74C3C47E; Mon, 15 Jul 2024 00:29:12 +0800 X-QQ-mid: xmsmtpt1720974555tr9g3ra4i Message-ID: X-QQ-XMAILINFO: NhpLzBn2I3Xwy8hCfkUzzj4+bM9VXiswKfauv47E+ri8GVml81dvh83zAVYtk0 i75bFnu3F6k77L+KDu0X7xy/qSkT3MwuKdD73BqDFFYJ52MG2KOiM2ivZNN3iGbyLqBG/DpCgIMA 9SEFbgMIa7XqkBZY0tE2iBxig7QdtUKCXJUujP+0gf9NT6wRQfTZYOC2QfFxP5FlMPguT5cE5av7 iUBjnz/ZCw8MjrPiecOuDcjzlNXzGo6/u3eLa33NSdMSmNxrRvGkDC3Ugxd9f33Bp52a6ForwYwA T2cYEkTlimlCbBvpXvYbaXemRX5TbXJfy7sgkXkLvBrX3V+vn8Oa1oLB2DNaXa1cx9liCwFEwR8Y PwrhIZTZONzwM6LcVyPwL2ivtgE50Q1XvnvNQeAPm7b0/XfMkvz3VRVQ4hT6nvbVnTmDEMdnn4ui eRcZGwEaQ70GkY/oTmYF1Eiv1JhXaCKYKKecpZVumejKz7ErJTUPILBXPIvcE4jL9yzW5EnuzwRB OGSvfjQTwP/SZ0jsOJLKemkj+2fOMMjKdYx3QHEHsreIuXXPfqS/jYrZAZ2wc9MMlx8Mv+K8sqVT JG36DL8f6q3Oovrrg8nQcT0DFmR3YyZPSaT+IbUGsqsEW/tSU4HcVK96tYPYFx+eOze6mSqUw4qw t3sv0uGnC1fD/18pf7omFu8xKRXH6JpTLRpb4uZDE6S7KsbeXEwwDvWU302WjYIJMKR0JbdZHjNr Kpri/OAX1s/nCcWZpYBoRftLMYOXP0vFiNLMpzY0g1UAULXDobXjGnRaV82aEsDBgwBvrf75zRLZ Ydx0FpXD82A4eUbxqBXxYNKvjBUYSNMCedYk8Ml/prlJMV8zXYwFdmoZhI/kqSCpkJUQaZvj/upz Aj214Yo9463AdBcyBJ6Om+yK4Tmmud30/r4Mx8ZSnbvfWqC0AZh/U= X-QQ-XMRINFO: Nq+8W0+stu50PRdwbJxPCL0= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Jul 2024 00:28:24 +0800 X-OQ-MSGID: <20240714162824.2728146-4-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240714162824.2728146-1-uk7b@foxmail.com> References: <20240714162824.2728146-1-uk7b@foxmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/4] lavc/vp8dsp: 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 Cc: sunyuechi Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: B6QMAuFDBVnt From: sunyuechi C908 X60 vp8_loop_filter8uv_h_c : 12.2 10.0 vp8_loop_filter8uv_h_rvv_i32 : 11.5 9.7 vp8_loop_filter8uv_v_c : 13.2 11.2 vp8_loop_filter8uv_v_rvv_i32 : 8.0 6.5 vp8_loop_filter16y_h_c : 11.7 10.5 vp8_loop_filter16y_h_rvv_i32 : 9.2 7.2 vp8_loop_filter16y_v_c : 11.5 10.5 vp8_loop_filter16y_v_rvv_i32 : 5.5 3.7 --- libavcodec/riscv/vp8dsp_init.c | 6 +++- libavcodec/riscv/vp8dsp_rvv.S | 59 ++++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/libavcodec/riscv/vp8dsp_init.c b/libavcodec/riscv/vp8dsp_init.c index 8cb21b8ceb..c53223a0e8 100644 --- a/libavcodec/riscv/vp8dsp_init.c +++ b/libavcodec/riscv/vp8dsp_init.c @@ -158,7 +158,11 @@ av_cold void ff_vp8dsp_init_riscv(VP8DSPContext *c) c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_rvv##vlen; \ c->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_rvv##vlen; \ c->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_rvv##vlen; \ - c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_rvv##vlen; + c->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_rvv##vlen; \ + c->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_rvv##vlen; \ + c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_rvv##vlen; \ + c->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_rvv##vlen; \ + c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_rvv##vlen; int flags = av_get_cpu_flags(); diff --git a/libavcodec/riscv/vp8dsp_rvv.S b/libavcodec/riscv/vp8dsp_rvv.S index 036872a29e..298910ea90 100644 --- a/libavcodec/riscv/vp8dsp_rvv.S +++ b/libavcodec/riscv/vp8dsp_rvv.S @@ -390,12 +390,43 @@ endfunc .if \normal vmand.mm v0, v1, v3 // vp8_normal_limit & !hv + .if \inner vnclip.wi v22, v22, 0 // clip_int8(a); filter_fmin \len, \vlen, v22, v12, v26, v10, v24, v20 vadd.vi v12, v12, 1 vsra.vi v12, v12, 1 // (f1 + 1) >> 1; vadd.vv v8, v8, v12 // p1 + a vsub.vv v14, v14, v12 // q1 - a + .else + li t6, 27 + li a7, 18 + li a6, 9 + vwmul.vx v22, v28, t6 + vwmul.vx v4, v28, a7 + vwmul.vx v26, v28, a6 + vsetvlstatic16 \len, \vlen + li a7, 63 + vzext.vf2 v18, v2 // p2 + vzext.vf2 v28, v7 // q2 + vadd.vx v22, v22, a7 + vadd.vx v4, v4, a7 + vadd.vx v26, v26, a7 + vsra.vi v22, v22, 7 // a0 + vsra.vi v4, v4, 7 // a1 + vsra.vi v26, v26, 7 // a2 + vadd.vv v18, v18, v26 + vadd.vv v8, v8, v4 + vadd.vv v30, v24, v22 + vsub.vv v28, v28, v26 + vsub.vv v10, v20, v22 + vsub.vv v14, v14, v4 + vmax.vx v18, v18, zero + vmax.vx v8, v8, zero + vmax.vx v26, v30, zero + vmax.vx v10, v10, zero + vmax.vx v14, v14, zero + vmax.vx v28, v28, zero + .endif vmax.vx v8, v8, zero vmax.vx v14, v14, zero @@ -404,14 +435,27 @@ endfunc vnclipu.wi v4, v26, 0 // -1 vnclipu.wi v5, v10, 0 // 0 vnclipu.wi v6, v14, 0 // 1 + .if !\inner + vnclipu.wi v2, v18, 0 + vnclipu.wi v7, v28, 0 + addi t0, \dst, -3 + .endif .ifc \type,v vse8.v v3, (t2), v0.t // -2 vse8.v v4, (t3), v0.t // -1 vse8.v v5, (\dst), v0.t // 0 vse8.v v6, (t4), v0.t // 1 + .if !\inner + vse8.v v2, (t1), v0.t + vse8.v v7, (t5), v0.t + .endif .else + .if \inner vssseg4e8.v v3, (t2), \stride, v0.t + .else + vssseg6e8.v v2, (t0), \stride, v0.t + .endif .endif .endif .endm @@ -439,6 +483,21 @@ func ff_vp8_\type\()_loop_filter8uv_inner_rvv\vlen, zve32x filter 8, \vlen, \type, 1, 1, a1, a2, a3, a4, a5 ret endfunc + +func ff_vp8_\type\()_loop_filter16_rvv\vlen, zve32x + csrwi vxrm, 0 + vsetvlstatic8 16, \vlen + filter 16, \vlen, \type, 1, 0, a0, a1, a2, a3, a4 + ret +endfunc + +func ff_vp8_\type\()_loop_filter8uv_rvv\vlen, zve32x + csrwi vxrm, 0 + vsetvlstatic8 8, \vlen + filter 8, \vlen, \type, 1, 0, a0, a2, a3, a4, a5 + filter 8, \vlen, \type, 1, 0, a1, a2, a3, a4, a5 + ret +endfunc .endr .endr