This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit c3291993eb16cc732da486b9b7d51657b9d715d9 Author: Lynne <[email protected]> AuthorDate: Sat Dec 13 18:41:53 2025 +0100 Commit: Lynne <[email protected]> CommitDate: Sat Dec 13 19:12:24 2025 +0100 vulkan_ffv1: use proper rounded divisions for plane width and height Fixes #20314 --- libavcodec/vulkan/common.comp | 3 +++ libavcodec/vulkan/ffv1_dec.comp | 10 +++++----- libavcodec/vulkan/ffv1_enc.comp | 10 +++++----- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/libavcodec/vulkan/common.comp b/libavcodec/vulkan/common.comp index f5f466ce31..d50e629f06 100644 --- a/libavcodec/vulkan/common.comp +++ b/libavcodec/vulkan/common.comp @@ -65,6 +65,9 @@ layout(buffer_reference, buffer_reference_align = 8) buffer u64buf { #define mid_pred(a, b, c) \ max(min((a), (b)), min(max((a), (b)), (c))) +#define ceil_rshift(a, b) \ + (-((-(a)) >> (b))) + /* TODO: optimize */ uint align(uint src, uint a) { diff --git a/libavcodec/vulkan/ffv1_dec.comp b/libavcodec/vulkan/ffv1_dec.comp index b726491e98..22a961a6df 100644 --- a/libavcodec/vulkan/ffv1_dec.comp +++ b/libavcodec/vulkan/ffv1_dec.comp @@ -63,7 +63,7 @@ void decode_line_pcm(inout SliceContext sc, ivec2 sp, int w, int y, int p, int b #ifndef RGB if (p > 0 && p < 3) { - w >>= chroma_shift.x; + w = ceil_rshift(w, chroma_shift.x); sp >>= chroma_shift; } #endif @@ -83,7 +83,7 @@ void decode_line(inout SliceContext sc, ivec2 sp, int w, { #ifndef RGB if (p > 0 && p < 3) { - w >>= chroma_shift.x; + w = ceil_rshift(w, chroma_shift.x); sp >>= chroma_shift; } #endif @@ -125,7 +125,7 @@ void decode_line(inout SliceContext sc, ivec2 sp, int w, { #ifndef RGB if (p > 0 && p < 3) { - w >>= chroma_shift.x; + w = ceil_rshift(w, chroma_shift.x); sp >>= chroma_shift; } #endif @@ -249,7 +249,7 @@ void decode_slice(inout SliceContext sc, const uint slice_idx) for (int p = 0; p < planes; p++) { int h = sc.slice_dim.y; if (p > 0 && p < 3) - h >>= chroma_shift.y; + h = ceil_rshift(h, chroma_shift.y); for (int y = 0; y < h; y++) decode_line_pcm(sc, sp, w, y, p, bits); @@ -274,7 +274,7 @@ void decode_slice(inout SliceContext sc, const uint slice_idx) for (int p = 0; p < planes; p++) { int h = sc.slice_dim.y; if (p > 0 && p < 3) - h >>= chroma_shift.y; + h = ceil_rshift(h, chroma_shift.y); int run_index = 0; for (int y = 0; y < h; y++) diff --git a/libavcodec/vulkan/ffv1_enc.comp b/libavcodec/vulkan/ffv1_enc.comp index 78372f5b3a..f766b69a14 100644 --- a/libavcodec/vulkan/ffv1_enc.comp +++ b/libavcodec/vulkan/ffv1_enc.comp @@ -61,7 +61,7 @@ void encode_line_pcm(inout SliceContext sc, readonly uimage2D img, #ifndef RGB if (p > 0 && p < 3) { - w >>= chroma_shift.x; + w = ceil_rshift(w, chroma_shift.x); sp >>= chroma_shift; } #endif @@ -81,7 +81,7 @@ void encode_line(inout SliceContext sc, readonly uimage2D img, uint state_off, #ifndef RGB if (p > 0 && p < 3) { - w >>= chroma_shift.x; + w = ceil_rshift(w, chroma_shift.x); sp >>= chroma_shift; } #endif @@ -123,7 +123,7 @@ void encode_line(inout SliceContext sc, readonly uimage2D img, uint state_off, #ifndef RGB if (p > 0 && p < 3) { - w >>= chroma_shift.x; + w = ceil_rshift(w, chroma_shift.x); sp >>= chroma_shift; } #endif @@ -244,7 +244,7 @@ void encode_slice(inout SliceContext sc, const uint slice_idx) int h = sc.slice_dim.y; if (c > 0 && c < 3) - h >>= chroma_shift.y; + h = ceil_rshift(h, chroma_shift.y); /* Takes into account dual-plane YUV formats */ int p = min(c, planes - 1); @@ -276,7 +276,7 @@ void encode_slice(inout SliceContext sc, const uint slice_idx) int h = sc.slice_dim.y; if (c > 0 && c < 3) - h >>= chroma_shift.y; + h = ceil_rshift(h, chroma_shift.y); int p = min(c, planes - 1); int comp = c - p; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
