diff mbox series

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

Message ID D2NQZKJWIKRK.KD4LQ30H62Z8@gmail.com
State New
Headers show
Series [FFmpeg-devel,01/11] avdevice/audiotoolbox: fix mixed declaration and code | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marvin Scholz July 12, 2024, 4:17 p.m. UTC
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 mbox series

Patch

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, *)) {