On 11/9/2024 1:57 PM, Pavel Koshevoy wrote:
This avoids unpleasant surprises to av_frame_get_buffer callers
that explicitly specified 64-byte alignment and didn't get
AVFrame.data pointers that are 64-byte aligned.

Again, the doxy is clear that only the buffer sizes are aligned, not the pointers. I'd rather not make this change here. Please see https://ffmpeg.org//pipermail/ffmpeg-devel/2024-November/335811.html


In particular, this fixes an issue in vf_zscale.
https://github.com/sekrit-twc/zimg/issues/212
---
  libavutil/frame.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index f0a0dba018..7faf7aeae8 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -216,6 +216,7 @@ static int get_video_buffer(AVFrame *frame, int align)
          total_size += sizes[i];
      }
+ total_size += align - 1;
      frame->buf[0] = av_buffer_alloc(total_size);
      if (!frame->buf[0]) {
          ret = AVERROR(ENOMEM);
@@ -223,7 +224,8 @@ static int get_video_buffer(AVFrame *frame, int align)
      }
if ((ret = av_image_fill_pointers(frame->data, frame->format, padded_height,
-                                      frame->buf[0]->data, frame->linesize)) < 
0)
+                                      (uint8_t 
*)FFALIGN((uintptr_t)frame->buf[0]->data, align),
+                                      frame->linesize)) < 0)
          goto fail;
for (int i = 1; i < 4; i++) {

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to