From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 7BF6A495A4 for ; Mon, 13 May 2024 17:00:19 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E5C0D68D6A2; Mon, 13 May 2024 19:59:57 +0300 (EEST) Received: from out162-62-57-49.mail.qq.com (out162-62-57-49.mail.qq.com [162.62.57.49]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AF5A568D5D9 for ; Mon, 13 May 2024 19:59:48 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1715619577; bh=wISf7T5wq85PhZ1s9HbBvJLtfQfqJexcoJTWBTdPfLw=; h=From:To:Cc:Subject:Date; b=fcyqMiXahZDAJNHbDVO68Ne3GmQpWipOay3TflId1ca2Hpds+23B1X5PQFA03tkGv S3hVDvJQ7GqoVH9k/VqVv1LOkaGJG/kmAIAv1dwaRkNGg9L1f1f9LFl9VmYqkx9NHR loax9i9yFX81PcYnRu0QwZLJIEiBl6Z4W3gkOhrM= Received: from localhost.localdomain ([42.56.223.122]) by newxmesmtplogicsvrszb9-0.qq.com (NewEsmtp) with SMTP id EE3A4485; Tue, 14 May 2024 00:59:35 +0800 X-QQ-mid: xmsmtpt1715619575tcc4nrfd0 Message-ID: X-QQ-XMAILINFO: OZZSS56D9fAjSHt1vYhIyRgXitK1kgYmkOKvB0kbYkJEww2c+YJYIT/lUEy2rL KXpXX2IGz6xDEuh1/ffcxmOo1+RVZN3AXbe+y070ihjS5HBFKPx/9Pk7cz8ctxAr6VvLlIUMGIJv ggaK/H5VmxulaelQUYgoZDdtoelUufRsjo2zqfNJDo7N4b3kktGcn+pzSqqurMxlDsqlqYDsY5a+ g5oY3a3YqkgfmB1hN02trPcOlS1LCspfDOsP1pB2VXMW91cfE7ABsvHBjS8YzvXIY5BZZO8eX3DL 6/HCR/ROuL9m73a5M08zrjgPT+lWKdY5Sqpy0fTkaELXQ7Xh4h4N/Ltex8ZPC1FSHdtBA/P4nKBo sm1Kb2vt1YtzJsMZlhB7rrN+QRGx2lFvQbT7np8CIScbZqo1qN+q14Tycy5bfmacNvDf7n2HMeMc CWfbW7MVnhYrqym9ccj53MRZ6NmbUwkfcXrHzLCajlQ41aaQ1goaGQNDDFNz7GrV0dIDg3TC5Ge5 68FKf/+cmjEo7mx7sav29zzKaTazm1Mn5iAoG45kdVxJV51gCgfU4ev0IOg9CNk5HiZQPadz+l+U Tg36M6hGYToH8O28iktrPG5Wi19giKXElHBTOLTX8qoFzz0kGp42B5a8WF1P5Mh/m7KD5hijtbB6 wroKYtimLLSSKNqpgwl4i7QlJkI698HiGl6XFib5s/Ai2Sc2Rean3qFP3PlxSPWDSGdWPFO8B2LH ysT5Megry1x3OxJ5bpDZ1uJWc8OGeZ4i18tLQDZQoQiZrwAZNCKiXmIvsoGhUhKRcy52vzlDa0Cl EhTFsgmQ1BXsIaPWADmqW9V2hvRixHHQbpErUntQZzQ55hnQZyTxjBVtLuqW1aBHRp4QPsdOo5x+ YeCmHRxghY+vWwPseOFUOvDrUkGnRdGpwm8Jj0OpdhkpsbZLvfRMM= X-QQ-XMRINFO: NI4Ajvh11aEj8Xl/2s1/T8w= From: uk7b@foxmail.com To: ffmpeg-devel@ffmpeg.org Date: Tue, 14 May 2024 00:59:18 +0800 X-OQ-MSGID: <20240513165926.1467967-1-uk7b@foxmail.com> X-Mailer: git-send-email 2.45.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 1/9] lavc/vp9dsp: R-V ipred vert 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: From: sunyuechi C908: vp9_vert_8x8_8bpp_c: 22.0 vp9_vert_8x8_8bpp_rvi: 15.7 vp9_vert_16x16_8bpp_c: 71.2 vp9_vert_16x16_8bpp_rvi: 39.0 vp9_vert_32x32_8bpp_c: 300.2 vp9_vert_32x32_8bpp_rvi: 135.2 --- libavcodec/riscv/Makefile | 1 + libavcodec/riscv/vp9_intra_rvi.S | 71 ++++++++++++++++++++++++++++++++ libavcodec/riscv/vp9dsp.h | 6 +++ libavcodec/riscv/vp9dsp_init.c | 15 +++++-- 4 files changed, 90 insertions(+), 3 deletions(-) create mode 100644 libavcodec/riscv/vp9_intra_rvi.S diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile index 89273b1cad..ccd060c666 100644 --- a/libavcodec/riscv/Makefile +++ b/libavcodec/riscv/Makefile @@ -62,6 +62,7 @@ OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o RV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvi.o RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9dsp_init.o +RV-OBJS-$(CONFIG_VP9_DECODER) += riscv/vp9_intra_rvi.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_rvi.S b/libavcodec/riscv/vp9_intra_rvi.S new file mode 100644 index 0000000000..16b6bdb25a --- /dev/null +++ b/libavcodec/riscv/vp9_intra_rvi.S @@ -0,0 +1,71 @@ +/* + * 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" + +#if __riscv_xlen >= 64 +func ff_v_32x32_rvi + ld t0, (a3) + ld t1, 8(a3) + ld t2, 16(a3) + ld t3, 24(a3) + .rept 16 + add a7, a0, a1 + sd t0, (a0) + sd t1, 8(a0) + sd t2, 16(a0) + sd t3, 24(a0) + sh1add a0, a1, a0 + sd t0, (a7) + sd t1, 8(a7) + sd t2, 16(a7) + sd t3, 24(a7) + .endr + + ret +endfunc + +func ff_v_16x16_rvi + ld t0, (a3) + ld t1, 8(a3) + .rept 8 + add a7, a0, a1 + sd t0, (a0) + sd t1, 8(a0) + sh1add a0, a1, a0 + sd t0, (a7) + sd t1, 8(a7) + .endr + + ret +endfunc + +func ff_v_8x8_rvi + ld t0, (a3) + .rept 4 + add a7, a0, a1 + sd t0, (a0) + sh1add a0, a1, a0 + sd t0, (a7) + .endr + + ret +endfunc +#endif diff --git a/libavcodec/riscv/vp9dsp.h b/libavcodec/riscv/vp9dsp.h index 25047ed507..f8bc6563a5 100644 --- a/libavcodec/riscv/vp9dsp.h +++ b/libavcodec/riscv/vp9dsp.h @@ -60,6 +60,12 @@ 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); +void ff_v_32x32_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_v_16x16_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); +void ff_v_8x8_rvi(uint8_t *dst, ptrdiff_t stride, const uint8_t *l, + const uint8_t *a); #define VP9_8TAP_RISCV_RVV_FUNC(SIZE, type, type_idx) \ void ff_put_8tap_##type##_##SIZE##h_rvv(uint8_t *dst, ptrdiff_t dststride, \ diff --git a/libavcodec/riscv/vp9dsp_init.c b/libavcodec/riscv/vp9dsp_init.c index dd418bd5bf..0f64afc6d2 100644 --- a/libavcodec/riscv/vp9dsp_init.c +++ b/libavcodec/riscv/vp9dsp_init.c @@ -24,11 +24,19 @@ #include "libavcodec/vp9dsp.h" #include "vp9dsp.h" -static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp) +static av_cold void vp9dsp_intrapred_init_riscv(VP9DSPContext *dsp, int bpp) { -#if HAVE_RVV +#if HAVE_RV int flags = av_get_cpu_flags(); + if (bpp == 8 && (flags & AV_CPU_FLAG_RV_MISALIGNED) && (flags & AV_CPU_FLAG_RVB_ADDR)) { +# if __riscv_xlen >= 64 + dsp->intra_pred[TX_32X32][VERT_PRED] = ff_v_32x32_rvi; + dsp->intra_pred[TX_16X16][VERT_PRED] = ff_v_16x16_rvi; + dsp->intra_pred[TX_8X8][VERT_PRED] = ff_v_8x8_rvi; +# endif + } +#if HAVE_RVV if (bpp == 8 && flags & AV_CPU_FLAG_RVV_I64 && ff_rv_vlen_least(128)) { dsp->intra_pred[TX_8X8][DC_PRED] = ff_dc_8x8_rvv; dsp->intra_pred[TX_8X8][LEFT_DC_PRED] = ff_dc_left_8x8_rvv; @@ -53,9 +61,10 @@ static av_cold void vp9dsp_intrapred_init_rvv(VP9DSPContext *dsp, int bpp) dsp->intra_pred[TX_16X16][TOP_DC_PRED] = ff_dc_top_16x16_rvv; } #endif +#endif } av_cold void ff_vp9dsp_init_riscv(VP9DSPContext *dsp, int bpp, int bitexact) { - vp9dsp_intrapred_init_rvv(dsp, bpp); + vp9dsp_intrapred_init_riscv(dsp, bpp); } -- 2.45.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".