diff options
author | Hao Chen <chenhao@loongson.cn> | 2022-09-09 17:00:24 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2022-09-10 22:56:38 +0200 |
commit | 38cacce22a613d660d4d78e65b0ecdb7be0b908c (patch) | |
tree | 2368d69307256f398900a4af4b91bd9bf239fceb /libswscale/utils.c | |
parent | 09cce812453f989a0537c62b6db1020ea266553d (diff) | |
download | ffmpeg-38cacce22a613d660d4d78e65b0ecdb7be0b908c.tar.gz |
swscale/la: Optimize hscale functions with lasx.
ffmpeg -i 1_h264_1080p_30fps_3Mbps.mp4 -f rawvideo -s 640x480 -y /dev/null -an
before: 101fps
after: 138fps
Signed-off-by: Hao Chen <chenhao@loongson.cn>
Reviewed-by: yinshiyou-hf@loongson.cn
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libswscale/utils.c')
-rw-r--r-- | libswscale/utils.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/libswscale/utils.c b/libswscale/utils.c index 14e2700733..45baa22b23 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -53,6 +53,7 @@ #include "libavutil/ppc/cpu.h" #include "libavutil/x86/asm.h" #include "libavutil/x86/cpu.h" +#include "libavutil/loongarch/cpu.h" #include "rgb2rgb.h" #include "swscale.h" @@ -659,6 +660,15 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos, filterAlign = 1; } + if (have_lasx(cpu_flags)) { + int reNum = minFilterSize & (0x07); + + if (minFilterSize < 5) + filterAlign = 4; + if (reNum < 3) + filterAlign = 1; + } + av_assert0(minFilterSize > 0); filterSize = (minFilterSize + (filterAlign - 1)) & (~(filterAlign - 1)); av_assert0(filterSize > 0); @@ -1844,7 +1854,8 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, { const int filterAlign = X86_MMX(cpu_flags) ? 4 : PPC_ALTIVEC(cpu_flags) ? 8 : - have_neon(cpu_flags) ? 4 : 1; + have_neon(cpu_flags) ? 4 : + have_lasx(cpu_flags) ? 8 : 1; if ((ret = initFilter(&c->hLumFilter, &c->hLumFilterPos, &c->hLumFilterSize, c->lumXInc, |