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/pixblockdsp: specialise aligned 16-bit get_pixels
Date: Thu, 25 Jul 2024 23:28:44 +0300
Message-ID: <3537221.IQgDZ5Ah3G@basile.remlab.net> (raw)
In-Reply-To: <fa2e01b9-5db7-4641-9dd8-537d34c6bd3c@gmail.com>

Le torstaina 25. heinäkuuta 2024, 21.25.11 EEST James Almer a écrit :
> On 7/25/2024 1:50 PM, Rémi Denis-Courmont wrote:
> > Le torstaina 25. heinäkuuta 2024, 19.16.21 EEST James Almer a écrit :
> >> On 7/25/2024 12:53 PM, Rémi Denis-Courmont wrote:
> >>> The current code assumes that we have unaligned rows, which hurts on
> >>> platforms with slower unaligned accesses. (Also, this lets the compiler
> >>> unroll manually, which it seems to do in practice.)
> >>> ---
> >>> 
> >>>    libavcodec/pixblockdsp.c | 9 ++++++++-
> >>>    1 file changed, 8 insertions(+), 1 deletion(-)
> >>> 
> >>> diff --git a/libavcodec/pixblockdsp.c b/libavcodec/pixblockdsp.c
> >>> index bbbeca1618..1fff244511 100644
> >>> --- a/libavcodec/pixblockdsp.c
> >>> +++ b/libavcodec/pixblockdsp.c
> >>> @@ -26,6 +26,13 @@
> >>> 
> >>>    static void get_pixels_16_c(int16_t *restrict block, const uint8_t
> >>>    *pixels,
> >>>    
> >>>                                ptrdiff_t stride)
> >> 
> >> Is there a way to hint the compiler that block is 16 byte aligned? GCC
> >> 14 at least emits unaligned loads and stores for these.
> > 
> > We don't have uint128_t, so the best we could do is cast to uint64_t *.
> > Though GCC 13 emits 64-bit loads and stores on RV64 here with the given
> > code. Is this maybe a problem with the COPY128 macro definition on x86?
> 
> AV_COPY128 with GCC x86 uses aligned load intrinsics, but at least GCC
> 14 emits movdqu instructions here for some reason.

Another approach would be to define a structure with size and alignment of 16 
bytes, but I am none too sure that compilers will like it all that much. TBH, 
I am merely aiming for 64-bit aligned loads and stores here, which is a big 
improvement over 8-bit ones.

-- 
レミ・デニ-クールモン
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-07-25 20:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25 15:53 Rémi Denis-Courmont
2024-07-25 16:16 ` James Almer
2024-07-25 16:50   ` Rémi Denis-Courmont
2024-07-25 18:25     ` James Almer
2024-07-25 20:28       ` Rémi Denis-Courmont [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=3537221.IQgDZ5Ah3G@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