From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/refstruct: Don't use STRIDE_ALIGN for alignment
Date: Thu, 29 Feb 2024 10:36:06 +0100
Message-ID: <AS8P250MB07443C45EB0A322DCF416E488F5F2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <AS8P250MB0744D05C77FDE35D02DB3A0A8F592@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM>
Andreas Rheinhardt:
> It was always intended that the buffers returned by
> RefStruct shall have the same alignment guarantees
> as the buffers returned by av_malloc(); said alignment
> depends upon the arch and the enabled instruction set
> and the code used STRIDE_ALIGN as a proxy for this.
>
> Yet since 7945d30e91b96d2f4f5b612048169087d214d41e
> there is a better way to get av_malloc's alignment:
> ALIGN_64 in mem_internal.h. So use this.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
> libavcodec/refstruct.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/refstruct.c b/libavcodec/refstruct.c
> index 81e8c9795c..f89af156c2 100644
> --- a/libavcodec/refstruct.c
> +++ b/libavcodec/refstruct.c
> @@ -20,13 +20,13 @@
> #include <stdint.h>
> #include <string.h>
>
> -#include "internal.h"
> #include "refstruct.h"
>
> #include "libavutil/avassert.h"
> #include "libavutil/error.h"
> #include "libavutil/macros.h"
> #include "libavutil/mem.h"
> +#include "libavutil/mem_internal.h"
> #include "libavutil/thread.h"
>
> #ifndef REFSTRUCT_CHECKED
> @@ -46,9 +46,9 @@
> MKTAG('R', 'e', 'f', 'S') | (uint64_t)MKTAG('t', 'r', 'u', 'c') << 32)
>
> #if __STDC_VERSION__ >= 201112L && !defined(_MSC_VER)
> -#define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), FFMAX3(STRIDE_ALIGN, 16, _Alignof(max_align_t)))
> +#define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), FFMAX(ALIGN_64, _Alignof(max_align_t)))
> #else
> -#define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), FFMAX(STRIDE_ALIGN, 16))
> +#define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), ALIGN_64)
> #endif
>
> typedef struct RefCount {
Will apply this patch tomorrow unless there are objections.
- Andreas
_______________________________________________
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".
prev parent reply other threads:[~2024-02-29 9:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 21:14 Andreas Rheinhardt
2024-02-29 9:36 ` Andreas Rheinhardt [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=AS8P250MB07443C45EB0A322DCF416E488F5F2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
--to=andreas.rheinhardt@outlook.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