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