Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Rémi Denis-Courmont" <remi@remlab.net>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] lavc/vc1dsp: R-V V mspel_pixels
Date: Sun, 12 May 2024 14:48:03 +0300
Message-ID: <3172497.tWg0yfUdDb@basile.remlab.net> (raw)
In-Reply-To: <tencent_94CF9E2AB0C5D55062B1F45C20164C183106@qq.com>

Le perjantaina 10. toukokuuta 2024, 11.21.14 EEST uk7b@foxmail.com a écrit :
> From: sunyuechi <sunyuechi@iscas.ac.cn>
> 
>                                                       C908 X60
> vc1dsp.avg_vc1_mspel_pixels_tab[0][0]_c            :  14.7 13.2
> vc1dsp.avg_vc1_mspel_pixels_tab[0][0]_rvv_i32      :   2.5  2.2
> vc1dsp.avg_vc1_mspel_pixels_tab[1][0]_c            :   3.7  3.5
> vc1dsp.avg_vc1_mspel_pixels_tab[1][0]_rvv_i64      :   1.0  1.2
> vc1dsp.put_vc1_mspel_pixels_tab[0][0]_c            :   9.0  8.0
> vc1dsp.put_vc1_mspel_pixels_tab[0][0]_rvi          :   1.0  1.0
> vc1dsp.put_vc1_mspel_pixels_tab[1][0]_c            :   2.5  2.2
> vc1dsp.put_vc1_mspel_pixels_tab[1][0]_rvi          :   0.5  0.5
> ---
>  libavcodec/riscv/Makefile      |  1 +
>  libavcodec/riscv/vc1dsp_init.c | 16 +++++++++++-
>  libavcodec/riscv/vc1dsp_rvi.S  | 48 ++++++++++++++++++++++++++++++++++
>  libavcodec/riscv/vc1dsp_rvv.S  | 48 ++++++++++++++++++++++++++++++++++
>  4 files changed, 112 insertions(+), 1 deletion(-)
>  create mode 100644 libavcodec/riscv/vc1dsp_rvi.S
> 
> diff --git a/libavcodec/riscv/Makefile b/libavcodec/riscv/Makefile
> index 43b5c21cf4..cd5cc21cfd 100644
> --- a/libavcodec/riscv/Makefile
> +++ b/libavcodec/riscv/Makefile
> @@ -59,6 +59,7 @@ RVV-OBJS-$(CONFIG_TAK_DECODER) += riscv/takdsp_rvv.o
>  OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_init.o
>  RVV-OBJS-$(CONFIG_UTVIDEO_DECODER) += riscv/utvideodsp_rvv.o
>  OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_init.o
> +RV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvi.o
>  RVV-OBJS-$(CONFIG_VC1DSP) += riscv/vc1dsp_rvv.o
>  OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_init.o
>  RVV-OBJS-$(CONFIG_VP8DSP) += riscv/vp8dsp_rvv.o
> diff --git a/libavcodec/riscv/vc1dsp_init.c b/libavcodec/riscv/vc1dsp_init.c
> index e47b644f80..555aa5aea7 100644
> --- a/libavcodec/riscv/vc1dsp_init.c
> +++ b/libavcodec/riscv/vc1dsp_init.c
> @@ -29,19 +29,33 @@ void ff_vc1_inv_trans_8x8_dc_rvv(uint8_t *dest,
> ptrdiff_t stride, int16_t *block void ff_vc1_inv_trans_4x8_dc_rvv(uint8_t
> *dest, ptrdiff_t stride, int16_t *block); void
> ff_vc1_inv_trans_8x4_dc_rvv(uint8_t *dest, ptrdiff_t stride, int16_t
> *block); void ff_vc1_inv_trans_4x4_dc_rvv(uint8_t *dest, ptrdiff_t stride,
> int16_t *block); +void ff_put_pixels16x16_rvi(uint8_t *dst, const uint8_t
> *src, ptrdiff_t line_size, int rnd); +void ff_put_pixels8x8_rvi(uint8_t
> *dst, const uint8_t *src, ptrdiff_t line_size, int rnd); +void
> ff_avg_pixels16x16_rvv(uint8_t *dst, const uint8_t *src, ptrdiff_t
> line_size, int rnd); +void ff_avg_pixels8x8_rvv(uint8_t *dst, const uint8_t
> *src, ptrdiff_t line_size, int rnd);
> 
>  av_cold void ff_vc1dsp_init_riscv(VC1DSPContext *dsp)
>  {
> -#if HAVE_RVV
> +#if HAVE_RV
>      int flags = av_get_cpu_flags();
> 
> +# if __riscv_xlen >= 64
> +    if (flags & AV_CPU_FLAG_RVI) {
> +        dsp->put_vc1_mspel_pixels_tab[1][0] = ff_put_pixels8x8_rvi;
> +        dsp->put_vc1_mspel_pixels_tab[0][0] = ff_put_pixels16x16_rvi;
> +    }
> +# endif
> +#if HAVE_RVV
>      if (flags & AV_CPU_FLAG_RVV_I32 && ff_get_rv_vlenb() >= 16) {
>          dsp->vc1_inv_trans_4x8_dc = ff_vc1_inv_trans_4x8_dc_rvv;
>          dsp->vc1_inv_trans_4x4_dc = ff_vc1_inv_trans_4x4_dc_rvv;
> +        dsp->avg_vc1_mspel_pixels_tab[0][0] = ff_avg_pixels16x16_rvv;
>          if (flags & AV_CPU_FLAG_RVV_I64) {
>              dsp->vc1_inv_trans_8x8_dc = ff_vc1_inv_trans_8x8_dc_rvv;
>              dsp->vc1_inv_trans_8x4_dc = ff_vc1_inv_trans_8x4_dc_rvv;
> +            dsp->avg_vc1_mspel_pixels_tab[1][0] = ff_avg_pixels8x8_rvv;
>          }
>      }
>  #endif
> +#endif
>  }
> diff --git a/libavcodec/riscv/vc1dsp_rvi.S b/libavcodec/riscv/vc1dsp_rvi.S
> new file mode 100644
> index 0000000000..1d5660316f
> --- /dev/null
> +++ b/libavcodec/riscv/vc1dsp_rvi.S
> @@ -0,0 +1,48 @@
> +/*
> + * 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_put_pixels8x8_rvi
> +.rept 8
> +        ld t0, (a1)
> +        sd t0, (a0)
> +        add a1, a1, a2
> +        add a0, a0, a2
> +.endr
> +
> +        ret
> +endfunc

Are you sure that these accesses are aligned? Same below

> +
> +func ff_put_pixels16x16_rvi
> +.rept 16
> +        ld t0, (a1)
> +        ld t1, 8(a1)
> +        sd t0, (a0)
> +        sd t1, 8(a0)
> +        add a1, a1, a2
> +        add a0, a0, a2
> +.endr
> +
> +        ret
> +endfunc
> +#endif
> +

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/



_______________________________________________
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".

  reply	other threads:[~2024-05-12 11:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-04 10:01 uk7b
2024-05-04 10:08 ` flow gg
2024-05-04 17:53 ` Rémi Denis-Courmont
2024-05-05  9:15   ` uk7b
2024-05-05  9:18   ` flow gg
2024-05-05 19:26     ` Rémi Denis-Courmont
2024-05-10  8:21       ` uk7b
2024-05-12 11:48         ` Rémi Denis-Courmont [this message]
2024-05-12 12:43           ` uk7b
2024-05-12 12:43           ` flow gg
2024-05-12 12:57             ` uk7b
2024-05-10  8:22       ` flow gg
2024-05-10 15:34         ` Rémi Denis-Courmont
2024-05-11 10:02           ` flow gg
2024-05-11 10:24             ` Rémi Denis-Courmont
2024-05-11 10:47               ` flow gg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3172497.tWg0yfUdDb@basile.remlab.net \
    --to=remi@remlab.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git