diff options
author | Jiaxun Yang <jiaxun.yang@flygoat.com> | 2020-07-18 23:35:40 +0800 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2020-07-23 17:21:58 +0200 |
commit | e2fa12e3ae0494a72f5d0d4a67633805746391c1 (patch) | |
tree | 4e1a4ae3f6d719a68f63957428845d504913eef9 /libavcodec/mips/videodsp_init.c | |
parent | e387fcd01cb84d9493f3b96158addd2a85f086c6 (diff) | |
download | ffmpeg-e2fa12e3ae0494a72f5d0d4a67633805746391c1.tar.gz |
libavcodec: Enable runtime detection for MIPS MMI & MSA
Apply optimized functions according to cpuflags.
MSA is usually put after MMI as it's generally faster than MMI.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/mips/videodsp_init.c')
-rw-r--r-- | libavcodec/mips/videodsp_init.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavcodec/mips/videodsp_init.c b/libavcodec/mips/videodsp_init.c index 817040420b..07c23bcf7e 100644 --- a/libavcodec/mips/videodsp_init.c +++ b/libavcodec/mips/videodsp_init.c @@ -18,12 +18,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/mips/cpu.h" #include "config.h" #include "libavutil/attributes.h" #include "libavutil/mips/asmdefs.h" #include "libavcodec/videodsp.h" -#if HAVE_MSA static void prefetch_mips(uint8_t *mem, ptrdiff_t stride, int h) { register const uint8_t *p = mem; @@ -41,11 +41,11 @@ static void prefetch_mips(uint8_t *mem, ptrdiff_t stride, int h) : [stride] "r" (stride) ); } -#endif // #if HAVE_MSA av_cold void ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc) { -#if HAVE_MSA - ctx->prefetch = prefetch_mips; -#endif // #if HAVE_MSA + int cpu_flags = av_get_cpu_flags(); + + if (have_msa(cpu_flags)) + ctx->prefetch = prefetch_mips; } |