Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] lavc/vc1dsp: fix R-V V vector lengths
Date: Sat, 16 Dec 2023 22:24:46 +0200 (EET)
Message-ID: <de7d64de-a5ba-b1ee-3f46-9d42d26401b@martin.st> (raw)
In-Reply-To: <20231216085056.4939-1-remi@remlab.net>

On Sat, 16 Dec 2023, Rémi Denis-Courmont wrote:

> The 8x4 and 4x4 use a needlessly large multiplier (unless/until we care
> about embedded 64-bit-vector hardware). This is merely suboptimal.
>
> The 8x4 case also uses an incorrect vector length, which leads to incorrect
> behaviour on future/hypothetical hardware with 256-bit or larger vectors.
>
> Pointed-out-by: Martin Storsjö <martin@martin.st>
> ---
> libavcodec/riscv/vc1dsp_rvv.S | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/libavcodec/riscv/vc1dsp_rvv.S b/libavcodec/riscv/vc1dsp_rvv.S
> index 1a503ecc87..4a00945ead 100644
> --- a/libavcodec/riscv/vc1dsp_rvv.S
> +++ b/libavcodec/riscv/vc1dsp_rvv.S
> @@ -68,7 +68,7 @@ endfunc
> 
> func ff_vc1_inv_trans_8x4_dc_rvv, zve64x
>         lh            t2, (a2)
> -        vsetivli      zero, 8, e8, mf2, ta, ma
> +        vsetivli      zero, 4, e8, mf4, ta, ma
>         vlse64.v      v0, (a0), a1
>         sh1add        t2, t2, t2
>         addi          t2, t2, 1
> @@ -84,14 +84,14 @@ func ff_vc1_inv_trans_8x4_dc_rvv, zve64x
>         vmax.vx       v4, v4, zero
>         vsetvli       zero, zero, e8, m2, ta, ma
>         vnclipu.wi    v0, v4, 0
> -        vsetivli      zero, 8, e8, mf2, ta, ma
> +        vsetivli      zero, 4, e8, mf4, ta, ma
>         vsse64.v      v0, (a0), a1
>         ret
> endfunc
> 
> func ff_vc1_inv_trans_4x4_dc_rvv, zve32x
>         lh            t2, (a2)
> -        vsetivli      zero, 4, e8, mf2, ta, ma
> +        vsetivli      zero, 4, e8, mf4, ta, ma
>         vlse32.v      v0, (a0), a1
>         slli          t1, t2, 4
>         add           t2, t2, t1
> @@ -107,7 +107,7 @@ func ff_vc1_inv_trans_4x4_dc_rvv, zve32x
>         vmax.vx       v2, v2, zero
>         vsetvli       zero, zero, e8, m1, ta, ma
>         vnclipu.wi    v0, v2, 0
> -        vsetivli      zero, 4, e8, mf2, ta, ma
> +        vsetivli      zero, 4, e8, mf4, ta, ma
>         vsse32.v      v0, (a0), a1
>         ret
> endfunc
> -- 
> 2.43.0

The fix sounds reasonable (although I can't say I've followed the code). 
Anyway, I've tested that it does indeed fix the checkasm test, so feel 
free to push - thanks!

// Martin
_______________________________________________
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:[~2023-12-16 20:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16  8:50 Rémi Denis-Courmont
2023-12-16 20:24 ` Martin Storsjö [this message]

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=de7d64de-a5ba-b1ee-3f46-9d42d26401b@martin.st \
    --to=martin@martin.st \
    --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