From patchwork Mon Jul 1 19:13:28 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: 50266 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:cc64:0:b0:482:c625:d099 with SMTP id k4csp2009163vqv; Mon, 1 Jul 2024 12:14:06 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWujKfQhiHOv8EVIzC7sRDE/Hj/7+El0Bu0UjWDvR/kHfgQhGgkgiJXqxC17utowgyNkjTiDNUMGNTzpGzGki2ZsHSvR6eC4EgFJA== X-Google-Smtp-Source: AGHT+IGimIwZzbAuviJz97DQWj5qADS06A8gtQk6mx6Z1AkgMtVKz7B41EnSjfJXYCM2Cs7HYBTO X-Received: by 2002:a05:6512:3b11:b0:52c:dbc2:ea1 with SMTP id 2adb3069b0e04-52e82646845mr4367780e87.6.1719861246050; Mon, 01 Jul 2024 12:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719861246; cv=none; d=google.com; s=arc-20160816; b=yVJVfEQo8E07dB+USm7QjKnr/sRU4f399jOEnJQD3i9+Kk80/C4BCFncuqdAQOj0DC T2CgpWB0wFwnIemm6FXBAC0sfSmatBt2Nf2dYiSAS2KN+MlSjBioZCRKKBxDAFoz0nkU OgEnMw0z9MuO35wCNyMfSy1FiylIw6PzMwy92kiAjXOOvqIdWDIZns2V9rxKzAwPg3HS 37zhcRP+EFkgCMlJvXtC5JZ8qJgiVldPipX4pY3KESkWpw9G80bgBueNlfU9t3QDpMyd eRJNROIJpPPockJtDBwpRAxxDGzvbZZ3uwFznhvxGCYVpbWc/HVkxuIjDnNnCHP1otWa bqYg== 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=C7fAUt2mrZvWriL1XMuBV2K9//p+E/nHqjgzORfZa+w=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=SFGOs2hDO813DDUovmNxLxNsw/m6x3azvm4PK04PS8c58NbfMSu3GYjhV+uhzftHBz bfyRYUe6hp/r89bbAc69mWoiX/GowEc3XlWIkd4eincaGn1vEtRa1jy+/4HCSYdaHIcg v1uoDQ9mqOV1uJWkEVm0+hTaHZ1UKe0Aw5Ndz2OjYmeENQQ0GyFO5zSIopBS0oD0cMPV htMwn4e+j4JXf3gvS8BRDLGUNrEr4DasemngyD5A7pbeORAGqxDecHnn9KBMLnCsC0eG vTTS493h1+V7vxBRWp1ctlsnO40JHmKRIRqKabhrg/UY5qpNMDw1dvYSjJrhT1LGzrPa jFPg==; 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 2adb3069b0e04-52e7ab0e702si2501213e87.158.2024.07.01.12.14.05; Mon, 01 Jul 2024 12:14:06 -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 D0C0868D851; Mon, 1 Jul 2024 22:13:39 +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 15BB268D72B for ; Mon, 1 Jul 2024 22:13:30 +0300 (EEST) Received: from basile.remlab.net (localhost [IPv6:::1]) by ursule.remlab.net (Postfix) with ESMTP id 6E7F5C02F9 for ; Mon, 1 Jul 2024 22:13:29 +0300 (EEST) From: =?utf-8?q?R=C3=A9mi_Denis-Courmont?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jul 2024 22:13:28 +0300 Message-ID: <20240701191328.466433-4-remi@remlab.net> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240701191328.466433-1-remi@remlab.net> References: <20240701191328.466433-1-remi@remlab.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/4] lavc/h263dsp: R-V V dct_unquantize_{intra, inter} 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: nAznwZuAxRrs T-Head C908: h263dsp.dct_unquantize_inter_c: 3.7 h263dsp.dct_unquantize_inter_rvv_i32: 1.7 h263dsp.dct_unquantize_intra_c: 4.0 h263dsp.dct_unquantize_intra_rvv_i32: 1.5 SpacemiT X60: h263dsp.dct_unquantize_inter_c: 3.5 h263dsp.dct_unquantize_inter_rvv_i32: 1.2 h263dsp.dct_unquantize_intra_c: 3.5 h263dsp.dct_unquantize_intra_rvv_i32: 1.2 --- libavcodec/riscv/h263dsp_init.c | 15 ++++++++++++--- libavcodec/riscv/h263dsp_rvv.S | 27 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/libavcodec/riscv/h263dsp_init.c b/libavcodec/riscv/h263dsp_init.c index 21b536366c..78d537d1e1 100644 --- a/libavcodec/riscv/h263dsp_init.c +++ b/libavcodec/riscv/h263dsp_init.c @@ -25,6 +25,8 @@ #include "libavutil/riscv/cpu.h" #include "libavcodec/h263dsp.h" +void ff_h263_dct_unquantize_intra_rvv(int16_t *, ptrdiff_t len, int, int); +void ff_h263_dct_unquantize_inter_rvv(int16_t *, ptrdiff_t len, int, int); void ff_h263_h_loop_filter_rvv(uint8_t *src, int stride, int q); void ff_h263_v_loop_filter_rvv(uint8_t *src, int stride, int q); @@ -33,9 +35,16 @@ av_cold void ff_h263dsp_init_riscv(H263DSPContext *c) #if HAVE_RVV int flags = av_get_cpu_flags(); - if ((flags & AV_CPU_FLAG_RVV_I32) && ff_rv_vlen_least(128)) { - c->h263_h_loop_filter = ff_h263_h_loop_filter_rvv; - c->h263_v_loop_filter = ff_h263_v_loop_filter_rvv; + if (flags & AV_CPU_FLAG_RVV_I32) { + if (ff_rv_vlen_least(128) || (flags & AV_CPU_FLAG_RVB_ADDR)) { + c->h263_dct_unquantize_intra = ff_h263_dct_unquantize_intra_rvv; + c->h263_dct_unquantize_inter = ff_h263_dct_unquantize_inter_rvv; + } + + if (ff_rv_vlen_least(128)) { + c->h263_h_loop_filter = ff_h263_h_loop_filter_rvv; + c->h263_v_loop_filter = ff_h263_v_loop_filter_rvv; + } } #endif } diff --git a/libavcodec/riscv/h263dsp_rvv.S b/libavcodec/riscv/h263dsp_rvv.S index 97503d527c..f2b7eb9a87 100644 --- a/libavcodec/riscv/h263dsp_rvv.S +++ b/libavcodec/riscv/h263dsp_rvv.S @@ -20,6 +20,33 @@ #include "libavutil/riscv/asm.S" +func ff_h263_dct_unquantize_intra_rvv, zve32x + addi a0, a0, 2 + j 1f +endfunc + +func ff_h263_dct_unquantize_inter_rvv, zve32x + addi a1, a1, 1 +1: + vsetvli t0, a1, e16, m8, ta, mu + vle16.v v8, (a0) +#if defined(__riscv_v_min_vlen) && __riscv_v_min_vlen < 128 + sub a1, a1, t0 +#endif + vmv.v.x v16, a3 + vmslt.vi v0, v8, 0 + vneg.v v16, v16, v0.t + vmsne.vi v0, v8, 0 + vmadd.vx v8, a2, v16, v0.t + vse16.v v8, (a0) +#if defined(__riscv_v_min_vlen) && __riscv_v_min_vlen < 128 + sh1add a0, t0, a0 + bnez a1, 1b +#endif + + ret +endfunc + .option push .option norelax func ff_h263_h_loop_filter_rvv, zve32x