[FFmpeg-devel] [PATCH 08/11] avfilter/vf_coreimage: simplify list_filters code

Marvin Scholz epirat07 at gmail.com
Fri Jul 12 20:19:37 EEST 2024


Use fast-enumeration and get rid of unnecessary intermediate variables.
---
 libavfilter/vf_coreimage.m | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/libavfilter/vf_coreimage.m b/libavfilter/vf_coreimage.m
index bfc17764b5..38355414bd 100644
--- a/libavfilter/vf_coreimage.m
+++ b/libavfilter/vf_coreimage.m
@@ -102,18 +102,13 @@ static void list_filters(CoreImageContext *ctx)
         filter_categories = [NSArray arrayWithObjects:kCICategoryGenerator, nil];
     }
 
-    NSArray *filter_names = [CIFilter filterNamesInCategories:filter_categories];
-    NSEnumerator *filters = [filter_names objectEnumerator];
-
-    NSString *filter_name;
-    while (filter_name = [filters nextObject]) {
-        CIFilter *filter             = [CIFilter filterWithName:filter_name];
-        NSDictionary *filter_attribs = [filter attributes]; // <nsstring, id>
-        NSArray      *filter_inputs  = [filter inputKeys];  // <nsstring>
+    for (NSString *filter_name in [CIFilter filterNamesInCategories:filter_categories]) {
+        CIFilter *filter = [CIFilter filterWithName:filter_name];
+        NSDictionary<NSString *, id> *filter_attribs = [filter attributes];
 
         av_log(ctx, AV_LOG_INFO, "Filter: %s\n", [filter_name UTF8String]);
 
-        for (NSString *input in filter_inputs) {
+        for (NSString *input in [filter inputKeys]) {
             NSDictionary *input_attribs = [filter_attribs valueForKey:input];
             NSString *input_class       = [input_attribs valueForKey:kCIAttributeClass];
             if ([input_class isEqualToString:@"NSNumber"]) {
-- 
2.39.3 (Apple Git-146)




More information about the ffmpeg-devel mailing list