[FFmpeg-cvslog] avcodec/refstruct: Don't use STRIDE_ALIGN for alignment
Andreas Rheinhardt
git at videolan.org
Fri Mar 1 02:41:27 EET 2024
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Tue Feb 27 21:41:10 2024 +0100| [72becd0627c54d6aa1ba85b21b190ff844915c67] | committer: Andreas Rheinhardt
avcodec/refstruct: Don't use STRIDE_ALIGN for alignment
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 at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72becd0627c54d6aa1ba85b21b190ff844915c67
---
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 {
More information about the ffmpeg-cvslog
mailing list