PR #25182 opened by Marti2203 URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25182 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25182.patch
Follow-up to #25180, from its review. In `columns` mode, both interleaved paths of `horizontal_frame_pack()` reduce `length` and `lines` for the chroma planes but never restore them for the alpha plane. With subsampled alpha formats only part of the output alpha plane is written: for two 16x12 `yuva420p` views, 96 of the 384 alpha samples per frame (the rest keep whatever the frame buffer held, zeros with the default pool), and half of them for `yuva422p`. Formats without chroma subsampling are unaffected. The fix resets the dimensions at the start of each plane, as suggested in the review. Checked against the expected interleaving of the two views' alpha values: `yuva420p` goes from 192/768 to 768/768 correct samples over two frames, `yuva422p10` from 384/768 to 768/768; the Y/U/V planes are byte-identical before and after. The second commit adds `filter-framepack-columns-alpha-yuva420p` and `-yuva422p10` (generated input, distinct alpha patterns per view, covering the 8-bit and high bit depth loops). Both differ on master and match with the fix. The existing `fate-filter-framepack-*` tests still pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) From bd95fd3a3f2c114541205a7da527e91c3b2f13ea Mon Sep 17 00:00:00 2001 From: Martin Mirchev <[email protected]> Date: Sun, 18 Oct 2026 18:54:37 +0800 Subject: [PATCH 1/2] avfilter/vf_framepack: copy the full alpha plane in columns mode The interleaved horizontal paths reduced length and lines for the chroma planes but never restored them for the alpha plane, so with subsampled alpha formats only part of the alpha plane was written: a quarter of it for yuva420p and half for yuva422p. Reset the dimensions for every plane. Signed-off-by: Martin Mirchev <[email protected]> --- libavfilter/vf_framepack.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavfilter/vf_framepack.c b/libavfilter/vf_framepack.c index 5480ef0fc1..3cc6850cfc 100644 --- a/libavfilter/vf_framepack.c +++ b/libavfilter/vf_framepack.c @@ -172,6 +172,8 @@ static void horizontal_frame_pack(AVFilterLink *outlink, int lines = out->height; for (plane = 0; plane < s->pix_desc->nb_components; plane++) { + length = out->width / 2; + lines = out->height; if (plane == 1 || plane == 2) { length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w); lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h); @@ -207,6 +209,8 @@ static void horizontal_frame_pack(AVFilterLink *outlink, int lines = out->height; for (plane = 0; plane < s->pix_desc->nb_components; plane++) { + length = out->width / 2; + lines = out->height; if (plane == 1 || plane == 2) { length = AV_CEIL_RSHIFT(out->width / 2, s->pix_desc->log2_chroma_w); lines = AV_CEIL_RSHIFT(out->height, s->pix_desc->log2_chroma_h); -- 2.54.0 From 9784034f9a48d0a91bc92267628c81c72cf3a68b Mon Sep 17 00:00:00 2001 From: Martin Mirchev <[email protected]> Date: Sun, 18 Oct 2026 18:54:37 +0800 Subject: [PATCH 2/2] fate/filter-video: add framepack columns tests with alpha Use distinct alpha patterns in the two views, with yuva420p and yuva422p10 to cover both the 8-bit and the high bit depth paths. Signed-off-by: Martin Mirchev <[email protected]> --- tests/fate/filter-video.mak | 10 ++++++++++ tests/ref/fate/filter-framepack-columns-alpha-yuva420p | 7 +++++++ .../ref/fate/filter-framepack-columns-alpha-yuva422p10 | 7 +++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/ref/fate/filter-framepack-columns-alpha-yuva420p create mode 100644 tests/ref/fate/filter-framepack-columns-alpha-yuva422p10 diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 4a065ec032..7705735b94 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -224,6 +224,16 @@ $(FATE_FILTER_FRAMEPACK): CMD = framecrc -c:v pgmyuv -i $(TARGET_PATH)/tests/vsy FATE_FILTER_VSYNTH_PGMYUV-$(CONFIG_FRAMEPACK_FILTER) += $(FATE_FILTER_FRAMEPACK) fate-filter-framepack: $(FATE_FILTER_FRAMEPACK) +FATE_FILTER_FRAMEPACK_COLUMNS_ALPHA := $(addprefix fate-filter-framepack-columns-alpha-, yuva420p yuva422p10) +fate-filter-framepack-columns-alpha-yuva420p: FPCA_FMT = yuva420p +fate-filter-framepack-columns-alpha-yuva420p: FPCA_OUT = yuva420p +fate-filter-framepack-columns-alpha-yuva420p: FPCA_STEP = 1 +fate-filter-framepack-columns-alpha-yuva422p10: FPCA_FMT = yuva422p10 +fate-filter-framepack-columns-alpha-yuva422p10: FPCA_OUT = yuva422p10le +fate-filter-framepack-columns-alpha-yuva422p10: FPCA_STEP = 4 +$(FATE_FILTER_FRAMEPACK_COLUMNS_ALPHA): CMD = framecrc -lavfi "testsrc2=s=16x12:r=1:d=2,format=$(FPCA_FMT),split[l][r];[l]geq=lum=16+X+Y:cb=80:cr=160:a=(1+X+16*Y+N)*$(FPCA_STEP)[left];[r]geq=lum=200-X-Y:cb=160:cr=80:a=(240-X-16*Y-N)*$(FPCA_STEP)[right];[left][right]framepack=columns,scale" -pix_fmt $(FPCA_OUT) +FATE_FILTER-$(call FILTERFRAMECRC, FRAMEPACK TESTSRC2 FORMAT SPLIT GEQ SCALE) += $(FATE_FILTER_FRAMEPACK_COLUMNS_ALPHA) + FATE_FILTER_GAINMAP_SRC = testsrc2=s=64x48:r=1:d=1,scale,format=gbrpf32,split[b][a];[b]setparams=color_trc=iec61966-2-1:color_primaries=bt709[base];[a]setparams=color_trc=smpte2084:color_primaries=bt2020[alt];[base][alt] FATE_FILTER-$(call FILTERFRAMECRC, GAINMAP TESTSRC2 FORMAT SETPARAMS SPLIT, SCALE_FILTER) += fate-filter-gainmap fate-filter-gainmap-luma fate-filter-gainmap-maxrgb fate-filter-gainmap-fixed diff --git a/tests/ref/fate/filter-framepack-columns-alpha-yuva420p b/tests/ref/fate/filter-framepack-columns-alpha-yuva420p new file mode 100644 index 0000000000..fa2c114daa --- /dev/null +++ b/tests/ref/fate/filter-framepack-columns-alpha-yuva420p @@ -0,0 +1,7 @@ +#tb 0: 1/1 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 32x12 +#sar 0: 1/1 +0, 0, 0, 1, 960, 0x0979b0cf +0, 1, 1, 1, 960, 0x0a39b0cf diff --git a/tests/ref/fate/filter-framepack-columns-alpha-yuva422p10 b/tests/ref/fate/filter-framepack-columns-alpha-yuva422p10 new file mode 100644 index 0000000000..4d53f8eb88 --- /dev/null +++ b/tests/ref/fate/filter-framepack-columns-alpha-yuva422p10 @@ -0,0 +1,7 @@ +#tb 0: 1/1 +#media_type 0: video +#codec_id 0: rawvideo +#dimensions 0: 32x12 +#sar 0: 1/1 +0, 0, 0, 1, 2304, 0x13561534 +0, 1, 1, 1, 2304, 0xbab41534 -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
