The branch, master has been updated
       via  2796ce20d9a91193dbdca9aa980accfb9f2794b0 (commit)
      from  4d7c609be37dc57d31527c8c9e5945dc9491a7cd (commit)


- Log -----------------------------------------------------------------
commit 2796ce20d9a91193dbdca9aa980accfb9f2794b0
Author:     Zhao Zhili <quinkbl...@foxmail.com>
AuthorDate: Thu Aug 21 11:01:35 2025 +0800
Commit:     Zhao Zhili <quinkbl...@foxmail.com>
CommitDate: Thu Aug 21 11:01:35 2025 +0800

    avfilter/vf_colordetect: Reorder to avoid null pointer check
    
    Follow the general practice to assign the C implementation to DSP,
    then the SIMD-optimized version.

diff --git a/libavfilter/vf_colordetect.c b/libavfilter/vf_colordetect.c
index a7fc98e2f1..88374ac3e2 100644
--- a/libavfilter/vf_colordetect.c
+++ b/libavfilter/vf_colordetect.c
@@ -229,19 +229,16 @@ static av_cold void uninit(AVFilterContext *ctx)
 av_cold void ff_color_detect_dsp_init(FFColorDetectDSPContext *dsp, int depth,
                                       enum AVColorRange color_range)
 {
+    dsp->detect_range = depth > 8 ? ff_detect_range16_c : ff_detect_range_c;
+    if (color_range == AVCOL_RANGE_JPEG) {
+        dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_full_c : 
ff_detect_alpha_full_c;
+    } else {
+        dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_limited_c : 
ff_detect_alpha_limited_c;
+    }
+
 #if ARCH_X86
     ff_color_detect_dsp_init_x86(dsp, depth, color_range);
 #endif
-
-    if (!dsp->detect_range)
-        dsp->detect_range = depth > 8 ? ff_detect_range16_c : 
ff_detect_range_c;
-    if (!dsp->detect_alpha) {
-        if (color_range == AVCOL_RANGE_JPEG) {
-            dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_full_c : 
ff_detect_alpha_full_c;
-        } else {
-            dsp->detect_alpha = depth > 8 ? ff_detect_alpha16_limited_c : 
ff_detect_alpha_limited_c;
-        }
-    }
 }
 
 static const AVFilterPad colordetect_inputs[] = {

-----------------------------------------------------------------------

Summary of changes:
 libavfilter/vf_colordetect.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)


hooks/post-receive
-- 

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to