[FFmpeg-devel] [PATCH 05/11] lavfi/metal: fix mixed declaration and code

Marvin Scholz epirat07 at gmail.com
Fri Jul 12 19:17:35 EEST 2024


Fix a "mixing declarations and code is incompatible with standards
before C99" warning.
---
 libavfilter/metal/utils.m | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m
index f365d3ceea..d5c85e619d 100644
--- a/libavfilter/metal/utils.m
+++ b/libavfilter/metal/utils.m
@@ -24,11 +24,15 @@ void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
                                        id<MTLComputeCommandEncoder> encoder,
                                        NSUInteger width, NSUInteger height)
 {
-    [encoder setComputePipelineState:pipeline];
-    NSUInteger w = pipeline.threadExecutionWidth;
-    NSUInteger h = pipeline.maxTotalThreadsPerThreadgroup / w;
-    MTLSize threadsPerThreadgroup = MTLSizeMake(w, h, 1);
     BOOL fallback = YES;
+    MTLSize threadsPerThreadgroup;
+    NSUInteger w, h;
+
+    [encoder setComputePipelineState:pipeline];
+    w = pipeline.threadExecutionWidth;
+    h = pipeline.maxTotalThreadsPerThreadgroup / w;
+    threadsPerThreadgroup = MTLSizeMake(w, h, 1);
+
     // MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to include its functionality (including iOS, tvOS, etc)
 #ifdef MAC_OS_X_VERSION_10_15
     if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) {
-- 
2.39.3 (Apple Git-146)




More information about the ffmpeg-devel mailing list