diff mbox series

[FFmpeg-devel] lavc/aarch64: Fix compilation with --disable-neon

Message ID CAB0OVGpx80GLMM4GG3Sz8Z=b7sj_5ukGh-iy-c1_GpqWh0Ftiw@mail.gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] lavc/aarch64: Fix compilation with --disable-neon | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Carl Eugen Hoyos March 11, 2020, 12:18 p.m. UTC
Hi!

Attached patch fixes the remaining part of ticket #8565.

Please comment, Carl Eugen

Comments

Carl Eugen Hoyos March 11, 2020, 1:40 p.m. UTC | #1
Am Mi., 11. März 2020 um 13:36 Uhr schrieb Martin Storsjö <martin@martin.st>:
>
> On Wed, 11 Mar 2020, Carl Eugen Hoyos wrote:
>
> > Hi!
> >
> > Attached patch fixes the remaining part of ticket #8565.
>
> This looks correct.

Patch applied.

Thank you, Carl Eugen
diff mbox series

Patch

From c6451d3e57eca639e0272609fd817bf22390111e Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Date: Wed, 11 Mar 2020 13:16:47 +0100
Subject: [PATCH] lavc/aarch64: Fix compilation with --disable-neon

Fixes ticket #8565.
---
 libavcodec/aarch64/Makefile               | 4 ++--
 libavcodec/aarch64/idctdsp_init_aarch64.c | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aarch64/Makefile b/libavcodec/aarch64/Makefile
index 00f93bf59f..aa0b6e5488 100644
--- a/libavcodec/aarch64/Makefile
+++ b/libavcodec/aarch64/Makefile
@@ -6,6 +6,7 @@  OBJS-$(CONFIG_H264DSP)                  += aarch64/h264dsp_init_aarch64.o
 OBJS-$(CONFIG_H264PRED)                 += aarch64/h264pred_init.o
 OBJS-$(CONFIG_H264QPEL)                 += aarch64/h264qpel_init_aarch64.o
 OBJS-$(CONFIG_HPELDSP)                  += aarch64/hpeldsp_init_aarch64.o
+OBJS-$(CONFIG_IDCTDSP)                  += aarch64/idctdsp_init_aarch64.o
 OBJS-$(CONFIG_MPEGAUDIODSP)             += aarch64/mpegaudiodsp_init.o
 OBJS-$(CONFIG_NEON_CLOBBER_TEST)        += aarch64/neontest.o
 OBJS-$(CONFIG_VIDEODSP)                 += aarch64/videodsp_init.o
@@ -41,8 +42,7 @@  NEON-OBJS-$(CONFIG_H264PRED)            += aarch64/h264pred_neon.o
 NEON-OBJS-$(CONFIG_H264QPEL)            += aarch64/h264qpel_neon.o             \
                                            aarch64/hpeldsp_neon.o
 NEON-OBJS-$(CONFIG_HPELDSP)             += aarch64/hpeldsp_neon.o
-NEON-OBJS-$(CONFIG_IDCTDSP)             += aarch64/idctdsp_init_aarch64.o      \
-                                           aarch64/simple_idct_neon.o
+NEON-OBJS-$(CONFIG_IDCTDSP)             += aarch64/simple_idct_neon.o
 NEON-OBJS-$(CONFIG_MDCT)                += aarch64/mdct_neon.o
 NEON-OBJS-$(CONFIG_MPEGAUDIODSP)        += aarch64/mpegaudiodsp_neon.o
 NEON-OBJS-$(CONFIG_VP8DSP)              += aarch64/vp8dsp_neon.o
diff --git a/libavcodec/aarch64/idctdsp_init_aarch64.c b/libavcodec/aarch64/idctdsp_init_aarch64.c
index 0406e60830..742a3372e3 100644
--- a/libavcodec/aarch64/idctdsp_init_aarch64.c
+++ b/libavcodec/aarch64/idctdsp_init_aarch64.c
@@ -21,6 +21,8 @@ 
  */
 
 #include "libavutil/attributes.h"
+#include "libavutil/cpu.h"
+#include "libavutil/arm/cpu.h"
 #include "libavcodec/avcodec.h"
 #include "libavcodec/idctdsp.h"
 #include "idct.h"
@@ -28,7 +30,9 @@ 
 av_cold void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx,
                                      unsigned high_bit_depth)
 {
-    if (!avctx->lowres && !high_bit_depth) {
+    int cpu_flags = av_get_cpu_flags();
+
+    if (have_neon(cpu_flags) && !avctx->lowres && !high_bit_depth) {
         if (avctx->idct_algo == FF_IDCT_AUTO ||
             avctx->idct_algo == FF_IDCT_SIMPLEAUTO ||
             avctx->idct_algo == FF_IDCT_SIMPLENEON) {
-- 
2.24.1