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

These conditions are already checked for in the main init function.
This commit is contained in:
Ramiro Polla 2024-09-22 12:48:12 +02:00
parent 7728b3357d
commit f7ee0195df
5 changed files with 2 additions and 11 deletions

View File

@ -228,7 +228,6 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsInternal *c)
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
if (have_neon(cpu_flags)) { if (have_neon(cpu_flags)) {
if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
if (c->dstBpc <= 14) { if (c->dstBpc <= 14) {
if (c->srcRange) { if (c->srcRange) {
c->lumConvertRange = ff_lumRangeFromJpeg_neon; 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) av_cold void ff_sws_init_swscale_aarch64(SwsInternal *c)

View File

@ -29,7 +29,6 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
int cpu_flags = av_get_cpu_flags(); int cpu_flags = av_get_cpu_flags();
if (have_lsx(cpu_flags)) { if (have_lsx(cpu_flags)) {
if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
if (c->dstBpc <= 14) { if (c->dstBpc <= 14) {
if (c->srcRange) { if (c->srcRange) {
c->lumConvertRange = lumRangeFromJpeg_lsx; c->lumConvertRange = lumRangeFromJpeg_lsx;
@ -39,11 +38,9 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
c->chrConvertRange = chrRangeToJpeg_lsx; c->chrConvertRange = chrRangeToJpeg_lsx;
} }
} }
}
} }
#if HAVE_LASX #if HAVE_LASX
if (have_lasx(cpu_flags)) { if (have_lasx(cpu_flags)) {
if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat)) {
if (c->dstBpc <= 14) { if (c->dstBpc <= 14) {
if (c->srcRange) { if (c->srcRange) {
c->lumConvertRange = lumRangeFromJpeg_lasx; c->lumConvertRange = lumRangeFromJpeg_lasx;
@ -53,7 +50,6 @@ av_cold void ff_sws_init_range_convert_loongarch(SwsInternal *c)
c->chrConvertRange = chrRangeToJpeg_lasx; c->chrConvertRange = chrRangeToJpeg_lasx;
} }
} }
}
} }
#endif // #if HAVE_LASX #endif // #if HAVE_LASX
} }

View File

@ -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 }, { ff_range_lum_from_jpeg_16_rvv, ff_range_chr_from_jpeg_16_rvv },
}; };
if (c->srcRange != c->dstRange && !isAnyRGB(c->dstFormat) && if (c->dstBpc <= 14 &&
c->dstBpc <= 14 &&
(flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) { (flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {
bool from = c->srcRange != 0; bool from = c->srcRange != 0;

View File

@ -562,7 +562,6 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c)
c->chrConvertRange = chrRangeToJpeg16_c; c->chrConvertRange = chrRangeToJpeg16_c;
} }
} }
}
#if ARCH_AARCH64 #if ARCH_AARCH64
ff_sws_init_range_convert_aarch64(c); ff_sws_init_range_convert_aarch64(c);
@ -573,6 +572,7 @@ av_cold void ff_sws_init_range_convert(SwsInternal *c)
#elif ARCH_X86 #elif ARCH_X86
ff_sws_init_range_convert_x86(c); ff_sws_init_range_convert_x86(c);
#endif #endif
}
} }
static av_cold void sws_init_swscale(SwsInternal *c) static av_cold void sws_init_swscale(SwsInternal *c)

View File

@ -474,14 +474,12 @@ RANGE_CONVERT_FUNCS_DECL(avx2);
av_cold void ff_sws_init_range_convert_x86(SwsInternal *c) 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(); int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_AVX2_FAST(cpu_flags)) { if (EXTERNAL_AVX2_FAST(cpu_flags)) {
RANGE_CONVERT_FUNCS(avx2); RANGE_CONVERT_FUNCS(avx2);
} else if (EXTERNAL_SSE2(cpu_flags)) { } else if (EXTERNAL_SSE2(cpu_flags)) {
RANGE_CONVERT_FUNCS(sse2); RANGE_CONVERT_FUNCS(sse2);
} }
}
} }
av_cold void ff_sws_init_swscale_x86(SwsInternal *c) av_cold void ff_sws_init_swscale_x86(SwsInternal *c)