[FFmpeg-cvslog] swscale/range_convert: drop redundant conditionals from arch-specific init functions

Ramiro Polla git at videolan.org
Sun Oct 27 14:25:06 EET 2024


ffmpeg | branch: master | Ramiro Polla <ramiro.polla at gmail.com> | Sun Sep 22 12:48:12 2024 +0200| [f7ee0195dfd527865666dcc1fd194c849576910f] | committer: Ramiro Polla

swscale/range_convert: drop redundant conditionals from arch-specific init functions

These conditions are already checked for in the main init function.

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

 libswscale/aarch64/swscale.c                  | 2 --
 libswscale/loongarch/swscale_init_loongarch.c | 4 ----
 libswscale/riscv/swscale.c                    | 3 +--
 libswscale/swscale.c                          | 2 +-
 libswscale/x86/swscale.c                      | 2 --
 5 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 20697fc590..79b6272743 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -228,7 +228,6 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
     int cpu_flags = av_get_cpu_flags();
 
     if (have_neon(cpu_flags)) {
-    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
         if (c->dstBpc <= 14) {
             if (c->srcRange) {
                 c->lumConvertRange = ff_lumRangeFromJpeg_neon;
@@ -239,7 +238,6 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
             }
         }
     }
-    }
 }
 
 av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)
diff --git a/libswscale/loongarch/swscale_init_loongarch.c b/libswscale/loongarch/swscale_init_loongarch.c
index 0c3a99d167..fea198338e 100644
--- a/libswscale/loongarch/swscale_init_loongarch.c
+++ b/libswscale/loongarch/swscale_init_loongarch.c
@@ -29,7 +29,6 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
     int cpu_flags = av_get_cpu_flags();
 
     if (have_lsx(cpu_flags)) {
-        if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
             if (c->dstBpc <= 14) {
                 if (c->srcRange) {
                     c->lumConvertRange = lumRangeFromJpeg_lsx;
@@ -39,11 +38,9 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
                     c->chrConvertRange = chrRangeToJpeg_lsx;
                 }
             }
-        }
     }
 #if HAVE_LASX
     if (have_lasx(cpu_flags)) {
-        if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
             if (c->dstBpc <= 14) {
                 if (c->srcRange) {
                     c->lumConvertRange = lumRangeFromJpeg_lasx;
@@ -53,7 +50,6 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
                     c->chrConvertRange = chrRangeToJpeg_lasx;
                 }
             }
-        }
     }
 #endif // #if HAVE_LASX
 }
diff --git a/libswscale/riscv/swscale.c b/libswscale/riscv/swscale.c
index 4bc6fb1e6d..63539fa82e 100644
--- a/libswscale/riscv/swscale.c
+++ b/libswscale/riscv/swscale.c
@@ -39,8 +39,7 @@ av_cold void ff_sws_init_range_convert_riscv(SwsInternal *c)
         { ff_range_lum_from_jpeg_16_rvv, ff_range_chr_from_jpeg_16_rvv },
     };
 
-    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) &&
-        c->dstBpc <= 14 &&
+    if (c->dstBpc <= 14 &&
         (flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {
         bool from = c->srcRange != 0;
 
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 3d9b9d4b96..eeef16a57b 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -562,7 +562,6 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c)
                 c->chrConvertRange = chrRangeToJpeg16_c;
             }
         }
-    }
 
 #if ARCH_AARCH64
     ff_sws_init_range_convert_aarch64(c);
@@ -573,6 +572,7 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c)
 #elif ARCH_X86
     ff_sws_init_range_convert_x86(c);
 #endif
+    }
 }
 
 static av_cold void sws_init_swscale(SwsInternal *c)
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 28e8c2ad26..3de1d71367 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -474,14 +474,12 @@ RANGE_CONVERT_FUNCS_DECL(avx2);
 
 av_cold void ff_sws_init_range_convert_x86(SwsInternal *c)
 {
-    if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
         int cpu_flags = av_get_cpu_flags();
         if (EXTERNAL_AVX2_FAST(cpu_flags)) {
             RANGE_CONVERT_FUNCS(avx2);
         } else if (EXTERNAL_SSE2(cpu_flags)) {
             RANGE_CONVERT_FUNCS(sse2);
         }
-    }
 }
 
 av_cold void ff_sws_init_swscale_x86(SwsInternal *c)



More information about the ffmpeg-cvslog mailing list