From patchwork Sat Mar 2 07:42:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: flow gg X-Patchwork-Id: 46692 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:a919:b0:19e:cdac:8cce with SMTP id cd25csp1729432pzb; Fri, 1 Mar 2024 23:42:28 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXFkC4XASinY+2Pvz/FVtBFdZvopvZbsgMkvF0WIzjOaK5036QP9RHGFayNZI9PRmDsDy2wB7UmZ2Fmg4j4FcUflEIpuQ276weHdA== X-Google-Smtp-Source: AGHT+IGYgwmB5BA3VlslG4u0HYTcS8j/X1rTiRVnvxLRgODlhurcUZPLn2Vl5gVJmz9Vdv33PzBO X-Received: by 2002:a17:907:8e86:b0:a3f:a12:f8e6 with SMTP id tx6-20020a1709078e8600b00a3f0a12f8e6mr3072225ejc.6.1709365348105; Fri, 01 Mar 2024 23:42:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1709365348; cv=none; d=google.com; s=arc-20160816; b=SkoNZM8RBCwYQtUhE3mb+rR9ecrfWsvY6NkgaLabT63saXVkmGuMtgBmSHsiOZN4Lj gUKH1wQISWBm/N/CXDeOkW4KEQISaGj9ae3vkV+ubv16fYBX+1EaPC8oyx50BXWq1MYW 2bDxxK3OwZ4c+qdKlLyei6arnKoqhGXt3mDvDTuNkMXDo6l0I1LFbgcgPDGv8dlO8iv/ sqMFz1IRkEdBSX0lurcH4yW2k6Vf/Qzs7XaCsVs51Igo9JRPvaBKj7cKMF2YEzSXCd9m 8gE0LNXrKUH1BDBKRT5gPJpCNHZa7vGDKno2Rn56jeAHNpkbGvVHLXq+MqIoj0gzq1MA aOVQ== 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=leZPxpevKcA/RnWBIdP3tQjrmZh9SfpRMjiokhKOKmM=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=K5FZypsaUcJ64TY6Bm7N8QQqmecg823s+nta86PRkv+5z898anIyUJRdWFg8wat1o9 WB00BKCBIEe8saTHZOn1pMdKvjXtTxU+NaFJY7MY1qyxgdlRbDFQMGtcTS7Wu3oz8i1e sSvfyM06Mhms+Vi07mn+5daKHQYBes0tg15zrGdC5E+dEqphk1h//u6B+fuiWe0NrKru LPAlmI18clkEUAv2UtZbBNU1ZUbCGefCOoV9GyREOoG0AfnE262OyPqrO0xdHf3nRyWW wj3IIP9t22Wxl9QWKDM057lHHMMkfXsRJokd2bW1pGYLBqwDh8d4dWDm88cmlegXBb6d 1MCA==; 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=VVNDrI2u; 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 o15-20020a17090611cf00b00a442bf21c32si2064974eja.653.2024.03.01.23.42.27; Fri, 01 Mar 2024 23:42:28 -0800 (PST) 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=VVNDrI2u; 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 4B42A68D28E; Sat, 2 Mar 2024 09:42:25 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 40BD568D28E for ; Sat, 2 Mar 2024 09:42:19 +0200 (EET) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6903ffc4bc6so11034936d6.2 for ; Fri, 01 Mar 2024 23:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709365337; x=1709970137; darn=ffmpeg.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=RpYycfeqqhoQoQ+fsKdtE6Ru3P26e3gLivJEidYcfBY=; b=VVNDrI2uHflSrWmwzbfCs7JELx9xgMm6i5L7HhwZ2s+8CDEgeNHW/qZclnGKl82wz0 +fSWGN0sWUFyRbooeQlZdVmxRBc85ufcg9rRh422pyAPZGxk60xgTCbsePH3yOVmKBVm sg66yy+L+J8Bv5sOpOkLZjW9WpS3VG+8ZRIvT/ZFOLOBj1p3nBTsui4bGowpGapuDxnF PjjvmxlErI/8C5db7toEj9SN9As44s5O2oweiO2tCv/ia+LxlONCCdroAHhpyRQ27NB+ OKdfsD8kfxyy7Y8/VnI00hW5w4I2ZLAF+I9A+IqA9WmqU7DLp3ESCuJTT4AB6i4q4kpc 2M+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709365337; x=1709970137; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=RpYycfeqqhoQoQ+fsKdtE6Ru3P26e3gLivJEidYcfBY=; b=iHyV8XuyfWGC/fDxML6cTiLjd7meR9ZPrBlj9KvLTJOjru9jKuF7CJhNPn/U0SiLP2 pR/Gp19D7zFkkV7NNPVLhx+bqIRKo9Avz7Gp2lYJyXU5IQKeYJOq4ki/byhGCERb3ybE /+0b+wLR32cVI/EGrFw3N/j2iZ9c5kjW78U6Aju/XKQta3ovJdHrh8Jm+7+qB/jXsgpN Z/C4MAwVunhUTeDnDSxHz7tt0dzfFQhSO5oS2lDSmoDyNyXIu7p4Q6MXLEKgecLLckoW iZLdzx0lwW1TBtjEUqt9mRPnPI1Jk0scE9LCZ12VQr/C6jXgiu2veYn+F6V+CvTwMrqs uBhA== X-Gm-Message-State: AOJu0Yy4qRkvyd+bC8QQ/tj2vGqvO2j5o203hS2bW8/T9tCKhyFW1qjt 6w2CCWemvdtr8MGfikpbSSoxTbb2lSYpodk6O9H0MqL+o5jMpH0LVk4Yei92nTZdn/4LvLIXnL7 sYGQxlt7nKoa8Sxx9nhMtOezwq1I3KLAIqZY= X-Received: by 2002:a0c:9b02:0:b0:68f:6f52:e7cb with SMTP id b2-20020a0c9b02000000b0068f6f52e7cbmr4343681qve.55.1709365337681; Fri, 01 Mar 2024 23:42:17 -0800 (PST) MIME-Version: 1.0 From: flow gg Date: Sat, 2 Mar 2024 15:42:06 +0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [FFmpeg-devel] [PATCH 1/4] lavc/vp9dsp: R-V V ipred dc 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: tvF0x+AXAVI5 From adaae06a3e18bccec1772a3134334cbea652ae77 Mon Sep 17 00:00:00 2001 From: sunyuechi Date: Mon, 26 Feb 2024 14:42:17 +0800 Subject: [PATCH 1/4] lavc/vp9dsp: R-V V ipred dc C908: vp9_dc_8x8_8bpp_c: 46.0 vp9_dc_8x8_8bpp_rvv_i64: 41.0 vp9_dc_16x16_8bpp_c: 109.2 vp9_dc_16x16_8bpp_rvv_i32: 72.7 vp9_dc_32x32_8bpp_c: 365.2 vp9_dc_32x32_8bpp_rvv_i32: 165.5 vp9_dc_127_8x8_8bpp_c: 23.0 vp9_dc_127_8x8_8bpp_rvv_i64: 22.0 vp9_dc_127_16x16_8bpp_c: 70.2 vp9_dc_127_16x16_8bpp_rvv_i32: 51.7 vp9_dc_127_32x32_8bpp_c: 295.2 vp9_dc_127_32x32_8bpp_rvv_i32: 140.2 vp9_dc_128_8x8_8bpp_c: 23.0 vp9_dc_128_8x8_8bpp_rvv_i64: 22.0 vp9_dc_128_16x16_8bpp_c: 70.2 vp9_dc_128_16x16_8bpp_rvv_i32: 51.7 vp9_dc_128_32x32_8bpp_c: 295.2 vp9_dc_128_32x32_8bpp_rvv_i32: 140.2 vp9_dc_129_8x8_8bpp_c: 23.0 vp9_dc_129_8x8_8bpp_rvv_i64: 22.0 vp9_dc_129_16x16_8bpp_c: 70.2 vp9_dc_129_16x16_8bpp_rvv_i32: 51.7 vp9_dc_129_32x32_8bpp_c: 295.2 vp9_dc_129_32x32_8bpp_rvv_i32: 140.2 vp9_dc_left_8x8_8bpp_c: 38.0 vp9_dc_left_8x8_8bpp_rvv_i64: 36.0 vp9_dc_left_16x16_8bpp_c: 93.2 vp9_dc_left_16x16_8bpp_rvv_i32: 67.7 vp9_dc_left_32x32_8bpp_c: 333.2 vp9_dc_left_32x32_8bpp_rvv_i32: 158.5 vp9_dc_top_8x8_8bpp_c: 38.7 vp9_dc_top_8x8_8bpp_rvv_i64: 36.0 vp9_dc_top_16x16_8bpp_c: 93.2 vp9_dc_top_16x16_8bpp_rvv_i32: 67.7 vp9_dc_top_32x32_8bpp_c: 333.2 vp9_dc_top_32x32_8bpp_rvv_i32: 156.2 --- libavcodec/riscv/Makefile | 2 + libavcodec/riscv/vp9_intra_rvv.S | 201 +++++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp.h | 64 ++++++++++ libavcodec/riscv/vp9dsp_init.c | 61 ++++++++++ libavcodec/vp9dsp.c | 2 + libavcodec/vp9dsp.h | 1 + 6 files changed, 331 insertions(+) create mode 100644 libavcodec/riscv/vp9_intra_rvv.S create mode 100644 libavcodec/riscv/vp9dsp.h create mode 100644 libavcodec/riscv/vp9dsp_init.c diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index dff8784102..c237e60800 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -60,5 +60,7 @@ OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o +OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o +RVV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvv.o OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_init.o RVV-OBJS-$(CONFIG_VORBIS_DECODER) += riscv/vorbisdsp_rvv.o diff --git a/libavcodec/riscv/vp9_intra_rvv.S b/libavcodec/riscv/vp9_intra_rvv.S new file mode 100644 index 0000000000..b3b0470cfc --- /dev/null +++ b/libavcodec/riscv/vp9_intra_rvv.S @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/riscv/asm.S" + +.macro getdc type size + vmv.v.x v16, zero +.ifc \type,top + vle8.v v8, (a3) + vwredsumu.vs v16, v8, v16 + vsetivli zero, 1, e16, m1, ta, ma + vmv.x.s t1, v16 + .ifc \size,32 + addi t1, t1, 16 + srai t1, t1, 5 + .elseif \size == 16 + addi t1, t1, 8 + srai t1, t1, 4 + .elseif \size == 8 + addi t1, t1, 4 + srai t1, t1, 3 + .endif +.elseif \type == left + vle8.v v8, (a2) + vwredsumu.vs v16, v8, v16 + vsetivli zero, 1, e16, m1, ta, ma + vmv.x.s t1, v16 + .ifc \size,32 + addi t1, t1, 16 + srai t1, t1, 5 + .elseif \size == 16 + addi t1, t1, 8 + srai t1, t1, 4 + .elseif \size == 8 + addi t1, t1, 4 + srai t1, t1, 3 + .endif +.elseif \type == 127 + li t1, 127 +.elseif \type == 128 + li t1, 128 +.elseif \type == 129 + li t1, 129 +.elseif \type == none + vle8.v v8, (a2) + vwredsumu.vs v16, v8, v16 + vle8.v v8, (a3) + vwredsumu.vs v16, v8, v16 + vsetivli zero, 1, e16, m1, ta, ma + vmv.x.s t1, v16 + .ifc \size,32 + addi t1, t1, 32 + srai t1, t1, 6 + .elseif \size == 16 + addi t1, t1, 16 + srai t1, t1, 5 + .elseif \size == 8 + addi t1, t1, 8 + srai t1, t1, 4 + .endif +.endif +.endm + +.macro dc32x32 type restore + li t0, 32 + vsetvli zero, t0, e8, m2, ta, ma + getdc \type 32 + + .ifc \restore,1 + vsetvli zero, t0, e8, m2, ta, ma + .endif + vmv.v.x v0, t1 + + .rept 31 + vse8.v v0, (a0) + add a0, a0, a1 + .endr + vse8.v v0, (a0) + + ret +.endm + +.macro dc16x16 type restore + vsetivli zero, 16, e8, m1, ta, ma + getdc \type 16 + + .ifc \restore,1 + vsetivli zero, 16, e8, m1, ta, ma + .endif + vmv.v.x v0, t1 + + .rept 15 + vse8.v v0, (a0) + add a0, a0, a1 + .endr + vse8.v v0, (a0) + + ret +.endm + +.macro dc8x8 type + vsetivli zero, 8, e8, mf2, ta, ma + getdc \type 8 + + li t0, 64 + vsetvli zero, t0, e8, m4, ta, ma + vmv.v.x v0, t1 + vsetivli zero, 8, e8, mf2, ta, ma + vsse64.v v0, (a0), a1 + + ret +.endm + +func ff_dc_127_32x32_rvv, zve32x + dc32x32 127 0 +endfunc + +func ff_dc_127_16x16_rvv, zve32x + dc16x16 127 0 +endfunc + +func ff_dc_127_8x8_rvv, zve64x + dc8x8 127 +endfunc + +func ff_dc_128_32x32_rvv, zve32x + dc32x32 128 0 +endfunc + +func ff_dc_128_16x16_rvv, zve32x + dc16x16 128 0 +endfunc + +func ff_dc_128_8x8_rvv, zve64x + dc8x8 128 +endfunc + +func ff_dc_129_32x32_rvv, zve32x + dc32x32 129 0 +endfunc + +func ff_dc_129_16x16_rvv, zve32x + dc16x16 129 0 +endfunc + +func ff_dc_129_8x8_rvv, zve64x + dc8x8 129 +endfunc + +func ff_dc_32x32_rvv, zve32x + dc32x32 none 1 +endfunc + +func ff_dc_16x16_rvv, zve32x + dc16x16 none 1 +endfunc + +func ff_dc_8x8_rvv, zve64x + dc8x8 none +endfunc + +func ff_dc_left_32x32_rvv, zve32x + dc32x32 left 1 +endfunc + +func ff_dc_left_16x16_rvv, zve32x + dc16x16 left 1 +endfunc + +func ff_dc_left_8x8_rvv, zve64x + dc8x8 left +endfunc + +func ff_dc_top_32x32_rvv, zve32x + dc32x32 top 1 +endfunc + +func ff_dc_top_16x16_rvv, zve32x + dc16x16 top 1 +endfunc + +func ff_dc_top_8x8_rvv, zve64x + dc8x8 top +endfunc diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h new file mode 100644 index 0000000000..abd57bd836 --- /dev/null +++ b/libavcodec/riscv/vp9dsp.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_RISCV_VP9DSP_RISCV_H +#define AVCODEC_RISCV_VP9DSP_RISCV_H + +#include +#include + +void ff_dc_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_top_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_top_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_top_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_left_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_left_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_left_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_127_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_127_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_127_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_128_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_128_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_128_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_129_32x32_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_129_16x16_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_dc_129_8x8_rvv(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); + +#endif // #ifndef AVCODEC_RISCV_VP9DSP_RISCV_H diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c new file mode 100644 index 0000000000..69ab39004c --- /dev/null +++ b/libavcodec/riscv/vp9dsp_init.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024 Institue of Software Chinese Academy of Sciences (ISCAS). + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lervvr General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lervvr General Public License for more details. + * + * You should have received a copy of the GNU Lervvr General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/riscv/cpu.h" +#include "libavcodec/vp9dsp.h" +#include "vp9dsp.h" + +static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp) +{ + #if HAVE_RVV + int flags = av_get_cpu_flags(); + + if (bpp == 8 && flags & AV_CPU_FLAG_RVV_I64 && ff_get_rv_vlenb() >= 16) { + dsp->intra_pred[TX_8X8][DC_PRED] = ff_dc_8x8_rvv; + dsp->intra_pred[TX_8X8][LEFT_DC_PRED] = ff_dc_left_8x8_rvv; + dsp->intra_pred[TX_8X8][DC_127_PRED] = ff_dc_127_8x8_rvv; + dsp->intra_pred[TX_8X8][DC_128_PRED] = ff_dc_128_8x8_rvv; + dsp->intra_pred[TX_8X8][DC_129_PRED] = ff_dc_129_8x8_rvv; + dsp->intra_pred[TX_8X8][TOP_DC_PRED] = ff_dc_top_8x8_rvv; + } + + if (bpp == 8 && flags & AV_CPU_FLAG_RVV_I32 && ff_get_rv_vlenb() >= 16) { + dsp->intra_pred[TX_32X32][DC_PRED] = ff_dc_32x32_rvv; + dsp->intra_pred[TX_16X16][DC_PRED] = ff_dc_16x16_rvv; + dsp->intra_pred[TX_32X32][LEFT_DC_PRED] = ff_dc_left_32x32_rvv; + dsp->intra_pred[TX_16X16][LEFT_DC_PRED] = ff_dc_left_16x16_rvv; + dsp->intra_pred[TX_32X32][DC_127_PRED] = ff_dc_127_32x32_rvv; + dsp->intra_pred[TX_16X16][DC_127_PRED] = ff_dc_127_16x16_rvv; + dsp->intra_pred[TX_32X32][DC_128_PRED] = ff_dc_128_32x32_rvv; + dsp->intra_pred[TX_16X16][DC_128_PRED] = ff_dc_128_16x16_rvv; + dsp->intra_pred[TX_32X32][DC_129_PRED] = ff_dc_129_32x32_rvv; + dsp->intra_pred[TX_16X16][DC_129_PRED] = ff_dc_129_16x16_rvv; + dsp->intra_pred[TX_32X32][TOP_DC_PRED] = ff_dc_top_32x32_rvv; + dsp->intra_pred[TX_16X16][TOP_DC_PRED] = ff_dc_top_16x16_rvv; + } + #endif +} + +av_cold void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact) +{ + vp9dsp_intrapred_init_rvv(dsp, bpp); +} diff --git a/libavcodec/vp9dsp.c b/libavcodec/vp9dsp.c index d8ddf74d4f..967e6e1e1a 100644 --- a/libavcodec/vp9dsp.c +++ b/libavcodec/vp9dsp.c @@ -100,6 +100,8 @@ av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact) ff_vp9dsp_init_aarch64(dsp, bpp); #elif ARCH_ARM ff_vp9dsp_init_arm(dsp, bpp); +#elif ARCH_RISCV + ff_vp9dsp_init_riscv(dsp, bpp, bitexact); #elif ARCH_X86 ff_vp9dsp_init_x86(dsp, bpp, bitexact); #elif ARCH_MIPS diff --git a/libavcodec/vp9dsp.h b/libavcodec/vp9dsp.h index be0ac0b181..772848e349 100644 --- a/libavcodec/vp9dsp.h +++ b/libavcodec/vp9dsp.h @@ -131,6 +131,7 @@ void ff_vp9dsp_init_12(VP9DSPContext *dsp); void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp, int bpp); void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp); +void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact); void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact); void ff_vp9dsp_init_mips(VP9DSPContext *dsp, int bpp); void ff_vp9dsp_init_loongarch(VP9DSPContext *dsp, int bpp); -- 2.44.0