@@ -225,6 +225,9 @@ void ff_chrRangeToJpeg_neon(int16_t *dstU, int16_t *dstV, int width);
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) {
@@ -236,6 +239,7 @@ av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c)
}
}
}
+ }
}
av_cold void ff_sws_init_swscale_aarch64(SwsContext *c)
@@ -296,6 +300,5 @@ av_cold void ff_sws_init_swscale_aarch64(SwsContext *c)
default:
break;
}
- ff_sws_init_range_convert_aarch64(c);
}
}
@@ -95,7 +95,6 @@ av_cold void ff_sws_init_swscale_loongarch(SwsContext *c)
}
}
#endif // #if HAVE_LASX
- ff_sws_init_range_convert_loongarch(c);
}
av_cold void rgb2rgb_init_loongarch(void)
@@ -26,9 +26,11 @@ void ff_range_chr_to_jpeg_16_rvv(int16_t *, int16_t *, int);
void ff_range_lum_from_jpeg_16_rvv(int16_t *, int);
void ff_range_chr_from_jpeg_16_rvv(int16_t *, int16_t *, int);
-av_cold static void ff_sws_init_range_convert_riscv(SwsContext *c, int flags)
+av_cold void ff_sws_init_range_convert_riscv(SwsContext *c)
{
#if HAVE_RVV
+ int flags = av_get_cpu_flags();
+
static const struct {
void (*lum)(int16_t *, int);
void (*chr)(int16_t *, int16_t *, int);
@@ -67,9 +69,9 @@ RVV_INPUT(rgba32);
av_cold void ff_sws_init_swscale_riscv(SwsContext *c)
{
+#if HAVE_RVV
int flags = av_get_cpu_flags();
-#if HAVE_RVV
if ((flags & AV_CPU_FLAG_RVV_I32) && (flags & AV_CPU_FLAG_RVB)) {
switch (c->srcFormat) {
case AV_PIX_FMT_ABGR:
@@ -122,5 +124,4 @@ av_cold void ff_sws_init_swscale_riscv(SwsContext *c)
}
}
#endif
- ff_sws_init_range_convert_riscv(c, flags);
}
@@ -554,6 +554,16 @@ av_cold void ff_sws_init_range_convert(SwsContext *c)
}
}
}
+
+#if ARCH_AARCH64
+ ff_sws_init_range_convert_aarch64(c);
+#elif ARCH_LOONGARCH64
+ ff_sws_init_range_convert_loongarch(c);
+#elif ARCH_RISCV
+ ff_sws_init_range_convert_riscv(c);
+#elif ARCH_X86
+ ff_sws_init_range_convert_x86(c);
+#endif
}
static av_cold void sws_init_swscale(SwsContext *c)
@@ -697,6 +697,7 @@ void ff_updateMMXDitherTables(SwsContext *c, int dstY);
av_cold void ff_sws_init_range_convert(SwsContext *c);
av_cold void ff_sws_init_range_convert_aarch64(SwsContext *c);
av_cold void ff_sws_init_range_convert_loongarch(SwsContext *c);
+av_cold void ff_sws_init_range_convert_riscv(SwsContext *c);
av_cold void ff_sws_init_range_convert_x86(SwsContext *c);
SwsFunc ff_yuv2rgb_init_x86(SwsContext *c);
@@ -1078,16 +1078,8 @@ int sws_setColorspaceDetails(struct SwsContext *c, const int inv_table[4],
c->srcRange = srcRange;
c->dstRange = dstRange;
- if (need_reinit) {
+ if (need_reinit)
ff_sws_init_range_convert(c);
-#if ARCH_AARCH64
- ff_sws_init_range_convert_aarch64(c);
-#elif ARCH_LOONGARCH64
- ff_sws_init_range_convert_loongarch(c);
-#elif ARCH_X86
- ff_sws_init_range_convert_x86(c);
-#endif
- }
c->dstFormatBpp = av_get_bits_per_pixel(desc_dst);
c->srcFormatBpp = av_get_bits_per_pixel(desc_src);
@@ -851,6 +851,4 @@ switch(c->dstBpc){ \
}
#endif
-
- ff_sws_init_range_convert_x86(c);
}