[PR] [release/8.0] avcodec/get_buffer: use frame pixel format instead of context (PR #23887)
ffmpeg-devel via ffmpeg-devel <[email protected]> Thu, 23 Jul 2026 14:13:38 -0000
| Newsgroups | gmane.comp.video.ffmpeg.devel |
|---|---|
| Message-ID | <178481602590.59.12781665763636920805@29965ddac10e> |
PR #23887 opened by ffmpeg-devel URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23887 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23887.patch **Backport:** https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23881 The documentation for get_buffer2() states: "This callback must use the frame values, not the codec context values, to calculate the required buffer size." Fixes wrong output on hbd LCEVC enhanced samples where the base stream is 8bit. >From 84ad21fd8ccf06d12f6c558858c057503e88de0e Mon Sep 17 00:00:00 2001 From: James Almer <[email protected]> Date: Thu, 23 Jul 2026 10:39:44 -0300 Subject: [PATCH] avcodec/get_buffer: use frame pixel format instead of context The documentation for get_buffer2() states: "This callback must use the frame values, not the codec context values, to calculate the required buffer size." Fixes wrong output on hbd LCEVC enhanced samples where the base stream is 8bit. Signed-off-by: James Almer <[email protected]> (cherry picked from commit e1c1b6c55835d13647636340d478d370aa48fb8d) --- libavcodec/get_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/get_buffer.c b/libavcodec/get_buffer.c index b391adf24f..1e0cfc21da 100644 --- a/libavcodec/get_buffer.c +++ b/libavcodec/get_buffer.c @@ -95,7 +95,7 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) do { // NOTE: do not align linesizes individually, this breaks e.g. assumptions // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2 - ret = av_image_fill_linesizes(linesize, avctx->pix_fmt, w); + ret = av_image_fill_linesizes(linesize, frame->format, w); if (ret < 0) goto fail; // increase alignment of w for next try (rhs gives the lowest bit set in w) @@ -108,7 +108,7 @@ static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) for (i = 0; i < 4; i++) linesize1[i] = linesize[i]; - ret = av_image_fill_plane_sizes(size, avctx->pix_fmt, h, linesize1); + ret = av_image_fill_plane_sizes(size, frame->format, h, linesize1); if (ret < 0) goto fail; -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]