[FFmpeg-devel] [PATCH 2/3] avutil/frame: fix setting plane_padding
James Almer
jamrial at gmail.com
Sat Nov 16 19:01:25 EET 2024
STRIDE_ALIGN is a lavc define and is not necessarely 32. And align may be <= 0 at the
point plane_padding is being set.
Signed-off-by: James Almer <jamrial at gmail.com>
---
libavutil/frame.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/libavutil/frame.c b/libavutil/frame.c
index f42f310023..093853b173 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -174,7 +174,7 @@ static int get_video_buffer(AVFrame *frame, int align)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
int ret, padded_height;
- int plane_padding = FFMAX(16 + 16/*STRIDE_ALIGN*/, align);
+ int plane_padding;
ptrdiff_t linesizes[4];
size_t total_size, sizes[4];
@@ -184,10 +184,11 @@ static int get_video_buffer(AVFrame *frame, int align)
if ((ret = av_image_check_size(frame->width, frame->height, 0, NULL)) < 0)
return ret;
- if (!frame->linesize[0]) {
- if (align <= 0)
- align = ALIGN;
+ if (align <= 0)
+ align = ALIGN;
+ plane_padding = FFMAX(ALIGN, align);
+ if (!frame->linesize[0]) {
for (int i = 1; i <= align; i += i) {
ret = av_image_fill_linesizes(frame->linesize, frame->format,
FFALIGN(frame->width, i));
--
2.47.0
More information about the ffmpeg-devel
mailing list