[FFmpeg-cvslog] arm: Macroize the test for 'setend' CPU instruction support

Ben Avison git at videolan.org
Tue Jul 22 12:51:41 CEST 2014


ffmpeg | branch: master | Ben Avison <bavison at riscosopen.org> | Mon Jul 21 14:53:06 2014 +0100| [6869612f5c7d4d2f20f69a5658328a761deadb1c] | committer: Diego Biurrun

arm: Macroize the test for 'setend' CPU instruction support

Signed-off-by: Diego Biurrun <diego at biurrun.de>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6869612f5c7d4d2f20f69a5658328a761deadb1c
---

 libavcodec/arm/h264dsp_init_arm.c |    6 +-----
 libavutil/arm/cpu.h               |    6 ++++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/libavcodec/arm/h264dsp_init_arm.c b/libavcodec/arm/h264dsp_init_arm.c
index f9712d8..7cb1312 100644
--- a/libavcodec/arm/h264dsp_init_arm.c
+++ b/libavcodec/arm/h264dsp_init_arm.c
@@ -104,12 +104,8 @@ av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth,
 {
     int cpu_flags = av_get_cpu_flags();
 
-    if (have_armv6(cpu_flags) && !(have_vfpv3(cpu_flags) || have_neon(cpu_flags))) {
-        // This function uses the 'setend' instruction which is deprecated
-        // on ARMv8. This instruction is serializing on some ARMv7 cores as
-        // well. Therefore, only use the function on ARMv6.
+    if (have_setend(cpu_flags))
         c->h264_find_start_code_candidate = ff_h264_find_start_code_candidate_armv6;
-    }
     if (have_neon(cpu_flags))
         h264dsp_init_neon(c, bit_depth, chroma_format_idc);
 }
diff --git a/libavutil/arm/cpu.h b/libavutil/arm/cpu.h
index 52e839c..224409a 100644
--- a/libavutil/arm/cpu.h
+++ b/libavutil/arm/cpu.h
@@ -30,4 +30,10 @@
 #define have_vfpv3(flags)   CPUEXT(flags, VFPV3)
 #define have_neon(flags)    CPUEXT(flags, NEON)
 
+/* Some functions use the 'setend' instruction which is deprecated on ARMv8
+ * and serializing on some ARMv7 cores. This macro ensures such functions
+ * are only enabled on ARMv6. */
+#define have_setend(flags)                                              \
+    (have_armv6(flags) && !(have_vfpv3(flags) || have_neon(flags)))
+
 #endif /* AVUTIL_ARM_CPU_H */



More information about the ffmpeg-cvslog mailing list