diff mbox series

[FFmpeg-devel,02/14] swscale/range_convert: drop redundant conditionals from arch-specific init functions

Message ID 20240923124017.33659-3-ramiro.polla@gmail.com
State New
Headers show
Series swscale/range_convert: fix mpeg ranges in yuv range conversion for non-8-bit pixel formats | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Ramiro Polla Sept. 23, 2024, 12:40 p.m. UTC
These conditions are already checked for in the main init function.
---
 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 mbox series

Patch

diff --git a/libswscale/aarch64/swscale.c b/libswscale/aarch64/swscale.c
index 863627d7c3..653144dbca 100644
--- a/libswscale/aarch64/swscale.c
+++ b/libswscale/aarch64/swscale.c
@@ -228,7 +228,6 @@  av_cold void ff_sws_init_range_convert_aarch64(SwsContext *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(SwsContext *c)
             }
         }
     }
-    }
 }
 
 av_cold void ff_sws_init_swscale_aarch64(SwsContext *c)
diff --git a/libswscale/loongarch/swscale_init_loongarch.c b/libswscale/loongarch/swscale_init_loongarch.c
index 88ad21a103..9f12f5e166 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(SwsContext *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(SwsContext *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(SwsContext *c)
                     c->chrConvertRange = chrRangeToJpeg_lasx;
                 }
             }
-        }
     }
 #endif // #if HAVE_LASX
 }
diff --git a/libswscale/riscv/swscale.c b/libswscale/riscv/swscale.c
index ad579308c5..fc592c39d5 100644
--- a/libswscale/riscv/swscale.c
+++ b/libswscale/riscv/swscale.c
@@ -39,8 +39,7 @@  av_cold void ff_sws_init_range_convert_riscv(SwsContext *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 7f47dab4b6..df9d3e5ae3 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -553,7 +553,6 @@  av_cold void ff_sws_init_range_convert(SwsContext *c)
                 c->chrConvertRange = chrRangeToJpeg16_c;
             }
         }
-    }
 
 #if ARCH_AARCH64
     ff_sws_init_range_convert_aarch64(c);
@@ -564,6 +563,7 @@  av_cold void ff_sws_init_range_convert(SwsContext *c)
 #elif ARCH_X86
     ff_sws_init_range_convert_x86(c);
 #endif
+    }
 }
 
 static av_cold void sws_init_swscale(SwsContext *c)
diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index c82311d87b..7ecb1f6542 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(SwsContext *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(SwsContext *c)