This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit ea9ae1166b5cd50b4cfe666a163081a1dc74caf4
Author:     Lynne <[email protected]>
AuthorDate: Tue Feb 3 18:08:36 2026 +0100
Commit:     Lynne <[email protected]>
CommitDate: Thu Feb 19 19:42:28 2026 +0100

    vulkan_ffv1: precalculate bits and use a specialization constant
---
 libavcodec/vulkan/ffv1_common.glsl   |  2 +-
 libavcodec/vulkan/ffv1_dec.comp.glsl | 25 +++++++++++--------------
 libavcodec/vulkan_ffv1.c             |  2 +-
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/libavcodec/vulkan/ffv1_common.glsl 
b/libavcodec/vulkan/ffv1_common.glsl
index 625e615054..94b83ad09e 100644
--- a/libavcodec/vulkan/ffv1_common.glsl
+++ b/libavcodec/vulkan/ffv1_common.glsl
@@ -46,7 +46,7 @@ layout (constant_id =  8) const bool planar_rgb = false;
 layout (constant_id =  9) const int codec_planes = 0;
 layout (constant_id = 10) const int color_planes = 0;
 layout (constant_id = 11) const int planes = 0;
-layout (constant_id = 12) const int bits_per_raw_sample = 0;
+layout (constant_id = 12) const int bits = 0;
 
 layout (constant_id = 13) const int chroma_shift_x = 0;
 layout (constant_id = 14) const int chroma_shift_y = 0;
diff --git a/libavcodec/vulkan/ffv1_dec.comp.glsl 
b/libavcodec/vulkan/ffv1_dec.comp.glsl
index 0d7dec48a3..862f907972 100644
--- a/libavcodec/vulkan/ffv1_dec.comp.glsl
+++ b/libavcodec/vulkan/ffv1_dec.comp.glsl
@@ -63,7 +63,7 @@ int get_isymbol(inout RangeCoder c, uint state_off)
     return READ(c, min(e + 10, 21)) ? -a : a;
 }
 
-void decode_line_pcm(inout SliceContext sc, ivec2 sp, int w, int y, int p, int 
bits)
+void decode_line_pcm(inout SliceContext sc, ivec2 sp, int w, int y, int p)
 {
 #ifndef RGB
     if (p > 0 && p < 3) {
@@ -74,15 +74,17 @@ void decode_line_pcm(inout SliceContext sc, ivec2 sp, int 
w, int y, int p, int b
 
     for (int x = 0; x < w; x++) {
         uint v = 0;
-        for (int i = (bits - 1); i >= 0; i--)
-            v |= uint(get_rac_equi(sc.c)) << i;
+
+        [[unroll]]
+        for (uint i = (rct_offset >> 1); i > 0; i >>= 1)
+            v |= get_rac_equi(sc.c) ? i : 0;
 
         imageStore(dec[p], sp + LADDR(ivec2(x, y)), uvec4(v));
     }
 }
 
 void decode_line(inout SliceContext sc, ivec2 sp, int w,
-                 int y, int p, int bits, uint state_off,
+                 int y, int p, uint state_off,
                  uint8_t quant_table_idx, int run_index)
 {
 #ifndef RGB
@@ -118,7 +120,7 @@ void golomb_init(inout SliceContext sc)
 }
 
 void decode_line(inout SliceContext sc, ivec2 sp, int w,
-                 int y, int p, int bits, uint state_off,
+                 int y, int p, uint state_off,
                  uint8_t quant_table_idx, inout int run_index)
 {
 #ifndef RGB
@@ -230,12 +232,7 @@ void decode_slice(inout SliceContext sc, const uint 
slice_idx)
     int w = sc.slice_dim.x;
     ivec2 sp = sc.slice_pos;
 
-    int bits = bits_per_raw_sample;
 #ifdef RGB
-    bits = 9;
-    if (bits != 8 || sc.slice_coding_mode != 0)
-        bits = bits_per_raw_sample + int(sc.slice_coding_mode != 1);
-
     sp.y = int(gl_WorkGroupID.y)*rgb_linecache;
 #endif
 
@@ -245,7 +242,7 @@ void decode_slice(inout SliceContext sc, const uint 
slice_idx)
 #ifdef RGB
         for (int y = 0; y < sc.slice_dim.y; y++) {
             for (int p = 0; p < color_planes; p++)
-                decode_line_pcm(sc, sp, w, y, p, bits);
+                decode_line_pcm(sc, sp, w, y, p);
 
             writeout_rgb(sc, sp, w, y, false);
         }
@@ -256,7 +253,7 @@ void decode_slice(inout SliceContext sc, const uint 
slice_idx)
                 h = ceil_rshift(h, chroma_shift.y);
 
             for (int y = 0; y < h; y++)
-                decode_line_pcm(sc, sp, w, y, p, bits);
+                decode_line_pcm(sc, sp, w, y, p);
         }
 #endif
         return;
@@ -275,7 +272,7 @@ void decode_slice(inout SliceContext sc, const uint 
slice_idx)
     int run_index = 0;
     for (int y = 0; y < sc.slice_dim.y; y++) {
         for (int p = 0; p < color_planes; p++)
-            decode_line(sc, sp, w, y, p, bits,
+            decode_line(sc, sp, w, y, p,
                         slice_state_off[p], quant_table_idx[p], run_index);
 
         writeout_rgb(sc, sp, w, y, true);
@@ -288,7 +285,7 @@ void decode_slice(inout SliceContext sc, const uint 
slice_idx)
 
         int run_index = 0;
         for (int y = 0; y < h; y++)
-            decode_line(sc, sp, w, y, p, bits,
+            decode_line(sc, sp, w, y, p,
                         slice_state_off[p], quant_table_idx[p], run_index);
     }
 #endif
diff --git a/libavcodec/vulkan_ffv1.c b/libavcodec/vulkan_ffv1.c
index 044d95ceed..e01321f890 100644
--- a/libavcodec/vulkan_ffv1.c
+++ b/libavcodec/vulkan_ffv1.c
@@ -822,7 +822,7 @@ static int vk_decode_ffv1_init(AVCodecContext *avctx)
     SPEC_LIST_ADD(sl,  9, 32, f->plane_count);
     SPEC_LIST_ADD(sl, 10, 32, color_planes);
     SPEC_LIST_ADD(sl, 11, 32, av_pix_fmt_count_planes(sw_format));
-    SPEC_LIST_ADD(sl, 12, 32, bits);
+    SPEC_LIST_ADD(sl, 12, 32, bits + is_rgb);
 
     SPEC_LIST_ADD(sl, 13, 32, f->chroma_h_shift);
     SPEC_LIST_ADD(sl, 14, 32, f->chroma_v_shift);

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to