Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] lavc/pixblockdsp: specialise aligned 16-bit get_pixels
Date: Thu, 25 Jul 2024 13:16:21 -0300
Message-ID: <70b707b4-eafd-44a2-b418-6b56dfd07841@gmail.com> (raw)
In-Reply-To: <20240725155336.37121-1-remi@remlab.net>

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.

> +{
> +    for (int i = 0; i < 8; i++)
> +        AV_COPY128(block + i * 8, pixels + i * stride);
> +}
> +
> +static void get_pixels_unaligned_16_c(int16_t *restrict block,
> +                                      const uint8_t *pixels, ptrdiff_t stride)
>   {
>       AV_COPY128U(block + 0 * 8, pixels + 0 * stride);
>       AV_COPY128U(block + 1 * 8, pixels + 1 * stride);
> @@ -90,7 +97,7 @@ av_cold void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx)
>       case 10:
>       case 12:
>       case 14:
> -        c->get_pixels_unaligned =
> +        c->get_pixels_unaligned = get_pixels_unaligned_16_c;
>           c->get_pixels = get_pixels_16_c;
>           break;
>       default:
_______________________________________________
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 16:15 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 [this message]
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

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=70b707b4-eafd-44a2-b418-6b56dfd07841@gmail.com \
    --to=jamrial@gmail.com \
    --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