From ddc140ebfc9ebf1743b2cc060e092e880224483c Mon Sep 17 00:00:00 2001 From: Lynne Date: Tue, 22 Sep 2026 01:19:31 +0900 Subject: [PATCH] vulkan/prores_ks_estimate_slice: zero the bits of a missing alpha plane The trellis and the encoder sum the bits of all four planes, but without an alpha plane nothing wrote the fourth. In VRAM this produced garbage slice sizes, and a frame size that crashed the packet assembly. --- libavcodec/vulkan/prores_ks_estimate_slice.comp.glsl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libavcodec/vulkan/prores_ks_estimate_slice.comp.glsl b/libavcodec/vulkan/prores_ks_estimate_slice.comp.glsl index 16af85cf83..01d2531584 100644 --- a/libavcodec/vulkan/prores_ks_estimate_slice.comp.glsl +++ b/libavcodec/vulkan/prores_ks_estimate_slice.comp.glsl @@ -254,6 +254,16 @@ void main() [[maximally_reconverges]] scores[slice].bits[q][plane] = FFALIGN(bits, 8); scores[slice].score[q][plane] = error; + /* The trellis and the encoder sum all four planes */ + if (num_planes == 3 && plane == 0) { + scores[slice].bits[q][3] = 0; + scores[slice].score[q][3] = 0; + if (q == max_quant) { + scores[slice].bits[max_quant + 1][3] = 0; + scores[slice].score[max_quant + 1][3] = 0; + } + } + /* Accumulate total bits and error of all planes */ int total_bits = sum_of_planes(bits); int total_score = sum_of_planes(error);