[FFmpeg-cvslog] vulkan/ffv1: fix sync issue in cached bitstream reader/writer

Lynne git at videolan.org
Thu May 22 23:24:00 EEST 2025


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Fri May 23 05:11:07 2025 +0900| [977d1a24bc01ad2a9674f7bc749c6dc4adde0e13] | committer: Lynne

vulkan/ffv1: fix sync issue in cached bitstream reader/writer

The issue is that there is an explicit lack of synchronization as only the very
first invocation writes symbols and updates the state, which other invocations
then store.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=977d1a24bc01ad2a9674f7bc749c6dc4adde0e13
---

 libavcodec/vulkan/ffv1_dec.comp | 2 ++
 libavcodec/vulkan/ffv1_enc.comp | 1 +
 2 files changed, 3 insertions(+)

diff --git a/libavcodec/vulkan/ffv1_dec.comp b/libavcodec/vulkan/ffv1_dec.comp
index 1d33b32c6b..a90bac321b 100644
--- a/libavcodec/vulkan/ffv1_dec.comp
+++ b/libavcodec/vulkan/ffv1_dec.comp
@@ -110,6 +110,8 @@ void decode_line(inout SliceContext sc, ivec2 sp, int w,
 
 #ifdef CACHED_SYMBOL_READER
         }
+
+        barrier();
         sb.v = state[gl_LocalInvocationID.x];
 #endif
     }
diff --git a/libavcodec/vulkan/ffv1_enc.comp b/libavcodec/vulkan/ffv1_enc.comp
index 65a7df1359..78372f5b3a 100644
--- a/libavcodec/vulkan/ffv1_enc.comp
+++ b/libavcodec/vulkan/ffv1_enc.comp
@@ -107,6 +107,7 @@ void encode_line(inout SliceContext sc, readonly uimage2D img, uint state_off,
             put_symbol(sc.c, context_off, d[1]);
 
 #ifdef CACHED_SYMBOL_READER
+        barrier();
         sb.v = state[gl_LocalInvocationID.x];
 #endif
     }



More information about the ffmpeg-cvslog mailing list