Move ARM NEON optimizations to arm_neon/
authorRémi Denis-Courmont <remi@remlab.net>
Sun, 10 Jan 2010 15:47:34 +0000 (17:47 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sun, 10 Jan 2010 16:13:11 +0000 (18:13 +0200)
15 files changed:
configure.ac
modules/Makefile.am
modules/arm_neon/.gitignore [new file with mode: 0644]
modules/arm_neon/Modules.am [new file with mode: 0644]
modules/arm_neon/audio_format.c [new file with mode: 0644]
modules/arm_neon/i420_yuy2.S [new file with mode: 0644]
modules/arm_neon/i420_yuy2.c [new file with mode: 0644]
modules/arm_neon/s32_s16.S [new file with mode: 0644]
modules/audio_filter/converter/Modules.am
modules/audio_filter/converter/neon.c [deleted file]
modules/audio_filter/converter/neon_s32_s16.S [deleted file]
modules/video_chroma/Modules.am
modules/video_chroma/i420_yuyv_neon.S [deleted file]
modules/video_chroma/neon.c [deleted file]
po/POTFILES.in

index 4e70382..53f95e7 100644 (file)
@@ -1526,16 +1526,22 @@ AC_ARG_ENABLE(neon,
 ])
 AS_IF([test "${enable_neon}" != "no"], [
   AC_CACHE_CHECK([if $CC groks NEON inline assembly], [ac_cv_neon_inline], [
+    CFLAGS="${CFLAGS_save} -mfpu=neon"
     AC_COMPILE_IFELSE([
       AC_LANG_PROGRAM(,[[asm volatile("vqmovun.s64 d0, q1":::"d0");]])
     ], [
-      ac_cv_neon_inline="yes"
+      ac_cv_neon_inline="-mfpu=neon"
     ], [
       ac_cv_neon_inline="no"
     ])
   ])
+  ARM_NEON_CFLAGS="$ac_cv_neon_inline"
+], [
+  ac_cv_neon_inline="no"
 ])
-AM_CONDITIONAL(HAVE_NEON, [test "${ac_cv_neon_inline}" = "yes"])
+AC_SUBST(ARM_NEON_CFLAGS)
+AM_CONDITIONAL(HAVE_ARM_NEON, [test "${ac_cv_neon_inline}" != "no"])
+
 
 AC_ARG_ENABLE(altivec,
 [  --disable-altivec       disable AltiVec optimizations (default auto)],, [
@@ -5190,6 +5196,7 @@ AC_CONFIG_FILES([
   modules/3dnow/Makefile
   modules/sse2/Makefile
   modules/altivec/Makefile
+  modules/arm_neon/Makefile
 ])
 
 dnl Generate makefiles
index 9476872..e533432 100644 (file)
@@ -26,6 +26,7 @@ EXTRA_SUBDIRS = \
        sse2 \
        3dnow \
        altivec \
+       arm_neon \
        $(NULL)
 
 SUBDIRS = $(BASE_SUBDIRS)
@@ -48,6 +49,9 @@ endif
 if HAVE_ALTIVEC
 SUBDIRS += altivec
 endif
+if HAVE_ARM_NEON
+SUBDIRS += arm_neon
+endif
 
 dist_noinst_SCRIPTS = genmf list.sh
 dist_noinst_DATA = LIST
diff --git a/modules/arm_neon/.gitignore b/modules/arm_neon/.gitignore
new file mode 100644 (file)
index 0000000..08a6d72
--- /dev/null
@@ -0,0 +1 @@
+Makefile.am
diff --git a/modules/arm_neon/Modules.am b/modules/arm_neon/Modules.am
new file mode 100644 (file)
index 0000000..1ba5c5d
--- /dev/null
@@ -0,0 +1,20 @@
+AM_CFLAGS += $(ARM_NEON_CFLAGS)
+
+libaudio_format_neon_plugin_la_SOURCES = \
+       s32_s16.S \
+       audio_format.c
+libaudio_format_neon_plugin_la_CFLAGS = $(AM_CFLAGS)
+libaudio_format_neon_plugin_la_LIBADD = $(AM_LIBADD)
+libaudio_format_neon_plugin_la_DEPENDENCIES =
+
+libi420_yuy2_neon_plugin_la_SOURCES = \
+       i420_yuy2.S \
+       i420_yuy2.c
+libi420_yuy2_neon_plugin_la_CFLAGS = $(AM_CFLAGS)
+libi420_yuy2_neon_plugin_la_LIBADD = $(AM_LIBADD)
+libi420_yuy2_neon_plugin_la_DEPENDENCIES =
+
+libvlc_LTLIBRARIES += \
+       libaudio_format_neon_plugin.la \
+       libi420_yuy2_neon_plugin.la \
+       $(NULL)
diff --git a/modules/arm_neon/audio_format.c b/modules/arm_neon/audio_format.c
new file mode 100644 (file)
index 0000000..94005a6
--- /dev/null
@@ -0,0 +1,160 @@
+/*****************************************************************************
+ * audio_format.c: NEON assembly optimized audio conversions
+ *****************************************************************************
+ * Copyright (C) 2009 Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_aout.h>
+#include <vlc_filter.h>
+
+#include <assert.h>
+
+static int Open (vlc_object_t *);
+
+vlc_module_begin ()
+    set_description (N_("ARM NEON audio format conversions") )
+    set_capability ("audio filter", 20)
+    set_callbacks (Open, NULL)
+vlc_module_end ()
+
+static block_t *Do_F32_S32 (filter_t *, block_t *);
+static block_t *Do_S32_S16 (filter_t *, block_t *);
+
+static int Open (vlc_object_t *obj)
+{
+    filter_t *filter = (filter_t *)obj;
+
+    if (!AOUT_FMTS_SIMILAR (&filter->fmt_in.audio, &filter->fmt_out.audio))
+        return VLC_EGENERIC;
+
+    switch (filter->fmt_in.audio.i_format)
+    {
+        case VLC_CODEC_FL32:
+            switch (filter->fmt_out.audio.i_format)
+            {
+                case VLC_CODEC_FI32:
+                    filter->pf_audio_filter = Do_F32_S32;
+                    break;
+                default:
+                    return VLC_EGENERIC;
+            }
+            break;
+
+        case VLC_CODEC_FI32:
+            switch (filter->fmt_out.audio.i_format)
+            {
+                case VLC_CODEC_S16N:
+                    filter->pf_audio_filter = Do_S32_S16;
+                    break;
+                default:
+                    return VLC_EGENERIC;
+            }
+            break;
+        default:
+            return VLC_EGENERIC;
+    }
+    return VLC_SUCCESS;
+}
+
+/**
+ * Single-precision floating point to signed fixed point conversion.
+ */
+static block_t *Do_F32_S32 (filter_t *filter, block_t *inbuf)
+{
+    unsigned nb_samples = inbuf->i_nb_samples
+                     * aout_FormatNbChannels (&filter->fmt_in.audio);
+    int32_t *outp = (int32_t *)inbuf->p_buffer;
+    int32_t *endp = outp + nb_samples;
+
+    if (nb_samples & 1)
+    {
+        asm volatile (
+            "vldr.32 s0, [%[outp]]\n"
+            "vcvt.s32.f32 d0, d0, #28\n"
+            "vstr.32 s0, [%[outp]]\n"
+            :
+            : [outp] "r" (outp)
+            : "d0", "memory");
+        outp++;
+    }
+
+    if (nb_samples & 2)
+        asm volatile (
+            "vld1.f32 {d0}, [%[outp]]\n"
+            "vcvt.s32.f32 d0, d0, #28\n"
+            "vst1.s32 {d0}, [%[outp]]!\n"
+            : [outp] "+r" (outp)
+            :
+            : "d0", "memory");
+
+    if (nb_samples & 4)
+        asm volatile (
+            "vld1.f32 {q0}, [%[outp]]\n"
+            "vcvt.s32.f32 q0, q0, #28\n"
+            "vst1.s32 {q0}, [%[outp]]!\n"
+            : [outp] "+r" (outp)
+            :
+            : "q0", "memory");
+
+    while (outp != endp)
+        asm volatile (
+            "vld1.f32 {q0-q1}, [%[outp]]\n"
+            "vcvt.s32.f32 q0, q0, #28\n"
+            "vcvt.s32.f32 q1, q1, #28\n"
+            "vst1.s32 {q0-q1}, [%[outp]]!\n"
+            : [outp] "+r" (outp)
+            :
+            : "q0", "q1", "memory");
+
+    return inbuf;
+}
+
+void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, unsigned nb);
+void s32_s16_neon (int16_t *out, const int32_t *in, unsigned nb);
+
+/**
+ * Signed 32-bits fixed point to signed 16-bits integer
+ */
+static block_t *Do_S32_S16 (filter_t *filter, block_t *inbuf)
+{
+    const int32_t *in = (int32_t *)inbuf->p_buffer;
+    int16_t *out = (int16_t *)in;
+    unsigned nb;
+
+    nb = ((-(uintptr_t)in) & 12) >> 2;
+    out += nb; /* fix up misalignment */
+    inbuf->p_buffer += 2 * nb;
+
+    s32_s16_neon_unaligned (out, in, nb);
+    in += nb;
+    out += nb;
+
+    nb = inbuf->i_nb_samples
+         * aout_FormatNbChannels (&filter->fmt_in.audio) - nb;
+    assert (!(((uintptr_t)in) & 15));
+    assert (!(((uintptr_t)out) & 15));
+
+    s32_s16_neon (out, in, nb);
+    inbuf->i_buffer /= 2;
+    return inbuf;
+}
diff --git a/modules/arm_neon/i420_yuy2.S b/modules/arm_neon/i420_yuy2.S
new file mode 100644 (file)
index 0000000..995cf62
--- /dev/null
@@ -0,0 +1,108 @@
+ @*****************************************************************************
+ @ i420_yuyv_neon.S : ARM NEONv1 I420 to YUYV chroma conversion
+ @*****************************************************************************
+ @ Copyright (C) 2009 Rémi Denis-Courmont
+ @
+ @ This program is free software; you can redistribute it and/or modify
+ @ it under the terms of the GNU General Public License as published by
+ @ the Free Software Foundation; either version 2 of the License, or
+ @ (at your option) any later version.
+ @
+ @ This program is distributed in the hope that it will be useful,
+ @ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ @ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ @ GNU General Public License for more details.
+ @
+ @ You should have received a copy of the GNU General Public License
+ @ along with this program; if not, write to the Free Software Foundation,
+ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ @****************************************************************************/
+
+       .fpu neon
+       .text
+
+#define O1     r0
+#define        O2      r1
+#define        PITCH   r2
+#define        HEIGHT  r3
+#define        Y1      r4
+#define        Y2      r5
+#define        U       r6
+#define        V       r7
+#define        END_O1  r12
+
+       .align
+       .global i420_yuyv_neon
+       .type   i420_yuyv_neon, %function
+i420_yuyv_neon:
+       push            {r4-r7, lr}
+       ldmia           r1,     {Y1, U, V}
+       add             O2,     O1,     PITCH, lsl #1
+       add             Y2,     Y1,     PITCH
+1:
+       mov             END_O1, O2
+       pld             [Y2]
+2:
+       pld             [U, #64]
+       vld1.u8         {d2},           [U,:64]!
+       pld             [V, #64]
+       vld1.u8         {d3},           [V,:64]!
+       pld             [Y1, #64]
+       vzip.u8         d2,     d3
+       vld1.u8         {q0},           [Y1,:128]!
+       pld             [Y2, #64]
+       vmov            q3,     q1
+       vzip.u8         q0,     q1
+       vld1.u8         {q2},           [Y2,:128]!
+       vzip.u8         q2,     q3
+       vst1.u8         {q0-q1},        [O1,:128]!
+       vst1.u8         {q2-q3},        [O2,:128]!
+
+       cmp             O1,     END_O1
+       bne             2b
+
+       sub             HEIGHT, #2
+       mov             O1,     O2
+       add             O2,     PITCH,  lsl #1
+       mov             Y1,     Y2
+       add             Y2,     PITCH
+
+       cmp             HEIGHT, #0
+       bne             1b
+
+       pop             {r4-r7, pc}
+
+       .global i420_uyvy_neon
+       .type   i420_uyvy_neon, %function
+i420_uyvy_neon:
+       push            {r4-r7, lr}
+       ldmia           r1,     {Y1, U, V}
+       add             O2,     O1,     PITCH, lsl #1
+       add             Y2,     Y1,     PITCH
+1:
+       mov             END_O1, O2
+2:
+       vld1.u8         {d0},           [U,:64]!
+       vld1.u8         {d1},           [V,:64]!
+       vzip.u8         d0,     d1
+       vld1.u8         {q1},           [Y1,:128]!
+       vmov            q2,     q0
+       vzip.u8         q0,     q1
+       vld1.u8         {q3},           [Y2,:128]!
+       vzip.u8         q2,     q3
+       vst1.u8         {q0-q1},        [O1,:128]!
+       vst1.u8         {q2-q3},        [O2,:128]!
+
+       cmp             O1,     END_O1
+       bne             2b
+
+       sub             HEIGHT, #2
+       mov             O1,     O2
+       add             O2,     PITCH,  lsl #1
+       mov             Y1,     Y2
+       add             Y2,     PITCH
+
+       cmp             HEIGHT, #0
+       bne             1b
+
+       pop             {r4-r7, pc}
diff --git a/modules/arm_neon/i420_yuy2.c b/modules/arm_neon/i420_yuy2.c
new file mode 100644 (file)
index 0000000..ae5d60b
--- /dev/null
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * i420_yuy2.c : ARM NEONv1 YUV 4:2:0 to YUV :2:2 chroma conversion for VLC
+ *****************************************************************************
+ * Copyright (C) 2009 Rémi Denis-Courmont
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_filter.h>
+#include <vlc_cpu.h>
+
+static int Open (vlc_object_t *);
+
+vlc_module_begin ()
+    set_description (N_("ARM NEON video chroma conversions"))
+    set_capability ("video filter2", 250)
+    set_callbacks (Open, NULL)
+    add_requirement (NEON)
+vlc_module_end ()
+
+void i420_yuyv_neon (uint8_t *out, const uint8_t **in,
+                     uintptr_t pitch, uintptr_t height);
+
+static void I420_YUYV (filter_t *filter, picture_t *src, picture_t *dst)
+{
+    uint8_t *out = dst->p->p_pixels;
+    const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
+    size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
+    size_t height = filter->fmt_in.video.i_height;
+
+    i420_yuyv_neon (out, yuv, pitch, height);
+}
+
+void i420_uyvy_neon (uint8_t *out, const uint8_t **in,
+                     uintptr_t pitch, uintptr_t height);
+
+static void I420_UYVY (filter_t *filter, picture_t *src, picture_t *dst)
+{
+    uint8_t *out = dst->p->p_pixels;
+    const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
+    size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
+    size_t height = filter->fmt_in.video.i_height;
+
+    i420_yuyv_neon (out, yuv, pitch, height);
+}
+
+VIDEO_FILTER_WRAPPER (I420_YUYV)
+VIDEO_FILTER_WRAPPER (I420_UYVY)
+
+static int Open (vlc_object_t *obj)
+{
+    filter_t *filter = (filter_t *)obj;
+
+    if (((filter->fmt_in.video.i_width | filter->fmt_in.video.i_height) & 1)
+     || (filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
+     || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height))
+        return VLC_EGENERIC;
+
+    switch (filter->fmt_in.video.i_chroma)
+    {
+        case VLC_CODEC_YV12:
+        case VLC_CODEC_I420:
+            switch (filter->fmt_out.video.i_chroma)
+            {
+                case VLC_CODEC_YUYV:
+                    filter->pf_video_filter = I420_YUYV_Filter;
+                    break;
+                case VLC_CODEC_UYVY:
+                    filter->pf_video_filter = I420_UYVY_Filter;
+                    break;
+                default:
+                    return VLC_EGENERIC;
+            }
+            break;
+
+        default:
+            return VLC_EGENERIC;
+    }
+    return VLC_SUCCESS;
+}
diff --git a/modules/arm_neon/s32_s16.S b/modules/arm_neon/s32_s16.S
new file mode 100644 (file)
index 0000000..88effca
--- /dev/null
@@ -0,0 +1,100 @@
+ @*****************************************************************************
+ @ neon_s32_s16.S : ARM NEONv1 fi32 to s16n audio sample conversion
+ @*****************************************************************************
+ @ Copyright (C) 2009 Rémi Denis-Courmont
+ @
+ @ This program is free software; you can redistribute it and/or modify
+ @ it under the terms of the GNU General Public License as published by
+ @ the Free Software Foundation; either version 2 of the License, or
+ @ (at your option) any later version.
+ @
+ @ This program is distributed in the hope that it will be useful,
+ @ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ @ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ @ GNU General Public License for more details.
+ @
+ @ You should have received a copy of the GNU General Public License
+ @ along with this program; if not, write to the Free Software Foundation,
+ @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ @****************************************************************************/
+
+       .fpu neon
+       .text
+
+#define        OUT     r0
+#define        IN      r1
+#define        N       r2
+#define        BUF     r3
+#define HALF   ip
+
+       .align
+       .global s32_s16_neon
+       .type   s32_s16_neon, %function
+       @ Converts fixed-point 32-bits to signed 16-bits
+       @ Input and output must be on 128-bits boundary
+s32_s16_neon:
+       pld             [IN]
+2:
+       cmp             N,      #8
+       blt             s32_s16_neon_unaligned
+       vld1.s32        {q8-q9},        [IN,:128]!
+
+3:     @ Main loop
+       pld             [IN, #64]
+       sub             N,      #8
+       vqrshrn.s32     d16,    q8,     #13
+       vqrshrn.s32     d17,    q9,     #13
+       cmp             N,      #8
+       blt             4f
+       vld1.s32        {q10-q11},      [IN,:128]!
+       sub             N,      #8
+       vqrshrn.s32     d18,    q10,    #13
+       vqrshrn.s32     d19,    q11,    #13
+       cmp             N,      #8
+       blt             5f
+       vld1.s32        {q12-q13},      [IN,:128]!
+       sub             N,      #8
+       vqrshrn.s32     d20,    q12,    #13
+       vqrshrn.s32     d21,    q13,    #13
+       vst1.s16        {d16-d19},      [OUT,:128]!
+       cmp             N,      #8
+       blt             6f
+       vld1.s32        {q8-q9},        [IN,:128]!
+       vst1.s16        {d20-d21},      [OUT,:128]!
+       b               3b
+4:
+       vst1.s16        {d16-d17},      [OUT,:128]!
+       b               7f
+5:
+       vst1.s16        {d16-d19},      [OUT,:128]!
+       b               7f
+6:
+       vst1.s16        {d20-d21},      [OUT,:128]!
+7:
+       cmp             N,      #4
+       blt             s32_s16_neon_unaligned
+       vld1.s32        {q8},           [IN,:128]!
+       sub             N,      #4
+       vqrshrn.s32     d16,    q8,     #13
+       vst1.s16        {d16},          [OUT,:64]!
+
+       @ Fall through for last 0-3 samples
+
+       .global s32_s16_neon_unaligned
+       .type   s32_s16_neon_unaligned, %function
+       @ Converts fixed-point 32-bits to signed 16-bits
+       @ Input must be on 32-bits boundary, output on 16-bits
+s32_s16_neon_unaligned:
+       mov             HALF,   #4096
+1:
+       cmp             N,      #0
+       bxeq            lr
+
+       ldr             BUF,    [IN]
+       add             IN,     #4
+       add             OUT,    #2
+       qadd            BUF,    HALF,   BUF
+       sub             N,      #1
+       ssat            BUF,    #16,    BUF, asr #13
+       strh            BUF,    [OUT, #-2]
+       b               1b
index 1f0f611..5fc3263 100644 (file)
@@ -1,8 +1,5 @@
 SOURCES_converter_fixed = fixed.c
 SOURCES_converter_float = float.c
-SOURCES_converter_neon = \
-       neon_s32_s16.S \
-       neon.c
 SOURCES_a52tospdif = a52tospdif.c
 SOURCES_a52tofloat32 = a52tofloat32.c
 SOURCES_dtstospdif = dtstospdif.c
@@ -15,6 +12,3 @@ libvlc_LTLIBRARIES += \
        libconverter_fixed_plugin.la \
        libconverter_float_plugin.la \
        $(NULL)
-if HAVE_NEON
-libvlc_LTLIBRARIES += libconverter_neon_plugin.la
-endif
diff --git a/modules/audio_filter/converter/neon.c b/modules/audio_filter/converter/neon.c
deleted file mode 100644 (file)
index ce2441b..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*****************************************************************************
- * arm_neon.c: NEON assembly optimized audio conversions
- *****************************************************************************
- * Copyright (C) 2009 Rémi Denis-Courmont
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_aout.h>
-#include <vlc_filter.h>
-#include <vlc_cpu.h>
-
-#include <assert.h>
-
-static int Open (vlc_object_t *);
-
-vlc_module_begin ()
-    set_description (N_("ARM NEON audio format conversions") )
-    set_capability ("audio filter", 20)
-    set_callbacks (Open, NULL)
-    add_requirement (NEON)
-vlc_module_end ()
-
-static block_t *Do_F32_S32 (filter_t *, block_t *);
-static block_t *Do_S32_S16 (filter_t *, block_t *);
-
-static int Open (vlc_object_t *obj)
-{
-    filter_t *filter = (filter_t *)obj;
-
-    if (!AOUT_FMTS_SIMILAR (&filter->fmt_in.audio, &filter->fmt_out.audio))
-        return VLC_EGENERIC;
-
-    switch (filter->fmt_in.audio.i_format)
-    {
-        case VLC_CODEC_FL32:
-            switch (filter->fmt_out.audio.i_format)
-            {
-                case VLC_CODEC_FI32:
-                    filter->pf_audio_filter = Do_F32_S32;
-                    break;
-                default:
-                    return VLC_EGENERIC;
-            }
-            break;
-
-        case VLC_CODEC_FI32:
-            switch (filter->fmt_out.audio.i_format)
-            {
-                case VLC_CODEC_S16N:
-                    filter->pf_audio_filter = Do_S32_S16;
-                    break;
-                default:
-                    return VLC_EGENERIC;
-            }
-            break;
-        default:
-            return VLC_EGENERIC;
-    }
-    return VLC_SUCCESS;
-}
-
-/**
- * Single-precision floating point to signed fixed point conversion.
- */
-static block_t *Do_F32_S32 (filter_t *filter, block_t *inbuf)
-{
-    unsigned nb_samples = inbuf->i_nb_samples
-                     * aout_FormatNbChannels (&filter->fmt_in.audio);
-    int32_t *outp = (int32_t *)inbuf->p_buffer;
-    int32_t *endp = outp + nb_samples;
-
-    if (nb_samples & 1)
-    {
-        asm volatile (
-            "vldr.32 s0, [%[outp]]\n"
-            "vcvt.s32.f32 d0, d0, #28\n"
-            "vstr.32 s0, [%[outp]]\n"
-            :
-            : [outp] "r" (outp)
-            : "d0", "memory");
-        outp++;
-    }
-
-    if (nb_samples & 2)
-        asm volatile (
-            "vld1.f32 {d0}, [%[outp]]\n"
-            "vcvt.s32.f32 d0, d0, #28\n"
-            "vst1.s32 {d0}, [%[outp]]!\n"
-            : [outp] "+r" (outp)
-            :
-            : "d0", "memory");
-
-    if (nb_samples & 4)
-        asm volatile (
-            "vld1.f32 {q0}, [%[outp]]\n"
-            "vcvt.s32.f32 q0, q0, #28\n"
-            "vst1.s32 {q0}, [%[outp]]!\n"
-            : [outp] "+r" (outp)
-            :
-            : "q0", "memory");
-
-    while (outp != endp)
-        asm volatile (
-            "vld1.f32 {q0-q1}, [%[outp]]\n"
-            "vcvt.s32.f32 q0, q0, #28\n"
-            "vcvt.s32.f32 q1, q1, #28\n"
-            "vst1.s32 {q0-q1}, [%[outp]]!\n"
-            : [outp] "+r" (outp)
-            :
-            : "q0", "q1", "memory");
-
-    return inbuf;
-}
-
-void s32_s16_neon_unaligned (int16_t *out, const int32_t *in, unsigned nb);
-void s32_s16_neon (int16_t *out, const int32_t *in, unsigned nb);
-
-/**
- * Signed 32-bits fixed point to signed 16-bits integer
- */
-static block_t *Do_S32_S16 (filter_t *filter, block_t *inbuf)
-{
-    const int32_t *in = (int32_t *)inbuf->p_buffer;
-    int16_t *out = (int16_t *)in;
-    unsigned nb;
-
-    nb = ((-(uintptr_t)in) & 12) >> 2;
-    out += nb; /* fix up misalignment */
-    inbuf->p_buffer += 2 * nb;
-
-    s32_s16_neon_unaligned (out, in, nb);
-    in += nb;
-    out += nb;
-
-    nb = inbuf->i_nb_samples
-         * aout_FormatNbChannels (&filter->fmt_in.audio) - nb;
-    assert (!(((uintptr_t)in) & 15));
-    assert (!(((uintptr_t)out) & 15));
-
-    s32_s16_neon (out, in, nb);
-    inbuf->i_buffer /= 2;
-    return inbuf;
-}
diff --git a/modules/audio_filter/converter/neon_s32_s16.S b/modules/audio_filter/converter/neon_s32_s16.S
deleted file mode 100644 (file)
index 88effca..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
- @*****************************************************************************
- @ neon_s32_s16.S : ARM NEONv1 fi32 to s16n audio sample conversion
- @*****************************************************************************
- @ Copyright (C) 2009 Rémi Denis-Courmont
- @
- @ This program is free software; you can redistribute it and/or modify
- @ it under the terms of the GNU General Public License as published by
- @ the Free Software Foundation; either version 2 of the License, or
- @ (at your option) any later version.
- @
- @ This program is distributed in the hope that it will be useful,
- @ but WITHOUT ANY WARRANTY; without even the implied warranty of
- @ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- @ GNU General Public License for more details.
- @
- @ You should have received a copy of the GNU General Public License
- @ along with this program; if not, write to the Free Software Foundation,
- @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- @****************************************************************************/
-
-       .fpu neon
-       .text
-
-#define        OUT     r0
-#define        IN      r1
-#define        N       r2
-#define        BUF     r3
-#define HALF   ip
-
-       .align
-       .global s32_s16_neon
-       .type   s32_s16_neon, %function
-       @ Converts fixed-point 32-bits to signed 16-bits
-       @ Input and output must be on 128-bits boundary
-s32_s16_neon:
-       pld             [IN]
-2:
-       cmp             N,      #8
-       blt             s32_s16_neon_unaligned
-       vld1.s32        {q8-q9},        [IN,:128]!
-
-3:     @ Main loop
-       pld             [IN, #64]
-       sub             N,      #8
-       vqrshrn.s32     d16,    q8,     #13
-       vqrshrn.s32     d17,    q9,     #13
-       cmp             N,      #8
-       blt             4f
-       vld1.s32        {q10-q11},      [IN,:128]!
-       sub             N,      #8
-       vqrshrn.s32     d18,    q10,    #13
-       vqrshrn.s32     d19,    q11,    #13
-       cmp             N,      #8
-       blt             5f
-       vld1.s32        {q12-q13},      [IN,:128]!
-       sub             N,      #8
-       vqrshrn.s32     d20,    q12,    #13
-       vqrshrn.s32     d21,    q13,    #13
-       vst1.s16        {d16-d19},      [OUT,:128]!
-       cmp             N,      #8
-       blt             6f
-       vld1.s32        {q8-q9},        [IN,:128]!
-       vst1.s16        {d20-d21},      [OUT,:128]!
-       b               3b
-4:
-       vst1.s16        {d16-d17},      [OUT,:128]!
-       b               7f
-5:
-       vst1.s16        {d16-d19},      [OUT,:128]!
-       b               7f
-6:
-       vst1.s16        {d20-d21},      [OUT,:128]!
-7:
-       cmp             N,      #4
-       blt             s32_s16_neon_unaligned
-       vld1.s32        {q8},           [IN,:128]!
-       sub             N,      #4
-       vqrshrn.s32     d16,    q8,     #13
-       vst1.s16        {d16},          [OUT,:64]!
-
-       @ Fall through for last 0-3 samples
-
-       .global s32_s16_neon_unaligned
-       .type   s32_s16_neon_unaligned, %function
-       @ Converts fixed-point 32-bits to signed 16-bits
-       @ Input must be on 32-bits boundary, output on 16-bits
-s32_s16_neon_unaligned:
-       mov             HALF,   #4096
-1:
-       cmp             N,      #0
-       bxeq            lr
-
-       ldr             BUF,    [IN]
-       add             IN,     #4
-       add             OUT,    #2
-       qadd            BUF,    HALF,   BUF
-       sub             N,      #1
-       ssat            BUF,    #16,    BUF, asr #13
-       strh            BUF,    [OUT, #-2]
-       b               1b
index 3e01f16..b90632d 100644 (file)
@@ -36,13 +36,3 @@ libvlc_LTLIBRARIES += \
        libi420_rgb_plugin.la \
        libgrey_yuv_plugin.la \
        $(NULL)
-
-libchroma_neon_plugin_la_SOURCES = \
-       i420_yuyv_neon.S \
-       neon.c
-libchroma_neon_plugin_la_CFLAGS = $(AM_CFLAGS)
-libchroma_neon_plugin_la_LIBADD = $(AM_LIBADD)
-libchroma_neon_plugin_la_DEPENDENCIES =
-if HAVE_NEON
-libvlc_LTLIBRARIES += libchroma_neon_plugin.la
-endif
diff --git a/modules/video_chroma/i420_yuyv_neon.S b/modules/video_chroma/i420_yuyv_neon.S
deleted file mode 100644 (file)
index 995cf62..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
- @*****************************************************************************
- @ i420_yuyv_neon.S : ARM NEONv1 I420 to YUYV chroma conversion
- @*****************************************************************************
- @ Copyright (C) 2009 Rémi Denis-Courmont
- @
- @ This program is free software; you can redistribute it and/or modify
- @ it under the terms of the GNU General Public License as published by
- @ the Free Software Foundation; either version 2 of the License, or
- @ (at your option) any later version.
- @
- @ This program is distributed in the hope that it will be useful,
- @ but WITHOUT ANY WARRANTY; without even the implied warranty of
- @ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- @ GNU General Public License for more details.
- @
- @ You should have received a copy of the GNU General Public License
- @ along with this program; if not, write to the Free Software Foundation,
- @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- @****************************************************************************/
-
-       .fpu neon
-       .text
-
-#define O1     r0
-#define        O2      r1
-#define        PITCH   r2
-#define        HEIGHT  r3
-#define        Y1      r4
-#define        Y2      r5
-#define        U       r6
-#define        V       r7
-#define        END_O1  r12
-
-       .align
-       .global i420_yuyv_neon
-       .type   i420_yuyv_neon, %function
-i420_yuyv_neon:
-       push            {r4-r7, lr}
-       ldmia           r1,     {Y1, U, V}
-       add             O2,     O1,     PITCH, lsl #1
-       add             Y2,     Y1,     PITCH
-1:
-       mov             END_O1, O2
-       pld             [Y2]
-2:
-       pld             [U, #64]
-       vld1.u8         {d2},           [U,:64]!
-       pld             [V, #64]
-       vld1.u8         {d3},           [V,:64]!
-       pld             [Y1, #64]
-       vzip.u8         d2,     d3
-       vld1.u8         {q0},           [Y1,:128]!
-       pld             [Y2, #64]
-       vmov            q3,     q1
-       vzip.u8         q0,     q1
-       vld1.u8         {q2},           [Y2,:128]!
-       vzip.u8         q2,     q3
-       vst1.u8         {q0-q1},        [O1,:128]!
-       vst1.u8         {q2-q3},        [O2,:128]!
-
-       cmp             O1,     END_O1
-       bne             2b
-
-       sub             HEIGHT, #2
-       mov             O1,     O2
-       add             O2,     PITCH,  lsl #1
-       mov             Y1,     Y2
-       add             Y2,     PITCH
-
-       cmp             HEIGHT, #0
-       bne             1b
-
-       pop             {r4-r7, pc}
-
-       .global i420_uyvy_neon
-       .type   i420_uyvy_neon, %function
-i420_uyvy_neon:
-       push            {r4-r7, lr}
-       ldmia           r1,     {Y1, U, V}
-       add             O2,     O1,     PITCH, lsl #1
-       add             Y2,     Y1,     PITCH
-1:
-       mov             END_O1, O2
-2:
-       vld1.u8         {d0},           [U,:64]!
-       vld1.u8         {d1},           [V,:64]!
-       vzip.u8         d0,     d1
-       vld1.u8         {q1},           [Y1,:128]!
-       vmov            q2,     q0
-       vzip.u8         q0,     q1
-       vld1.u8         {q3},           [Y2,:128]!
-       vzip.u8         q2,     q3
-       vst1.u8         {q0-q1},        [O1,:128]!
-       vst1.u8         {q2-q3},        [O2,:128]!
-
-       cmp             O1,     END_O1
-       bne             2b
-
-       sub             HEIGHT, #2
-       mov             O1,     O2
-       add             O2,     PITCH,  lsl #1
-       mov             Y1,     Y2
-       add             Y2,     PITCH
-
-       cmp             HEIGHT, #0
-       bne             1b
-
-       pop             {r4-r7, pc}
diff --git a/modules/video_chroma/neon.c b/modules/video_chroma/neon.c
deleted file mode 100644 (file)
index 625ae7a..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*****************************************************************************
- * neon.c : ARM NEONv1 chroma conversion module for VLC
- *****************************************************************************
- * Copyright (C) 2009 Rémi Denis-Courmont
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *****************************************************************************/
-
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
-#include <vlc_common.h>
-#include <vlc_plugin.h>
-#include <vlc_filter.h>
-#include <vlc_cpu.h>
-
-static int Open (vlc_object_t *);
-
-vlc_module_begin ()
-    set_description (N_("ARM NEON video chroma conversions"))
-    set_capability ("video filter2", 250)
-    set_callbacks (Open, NULL)
-    add_requirement (NEON)
-vlc_module_end ()
-
-void i420_yuyv_neon (uint8_t *out, const uint8_t **in,
-                     uintptr_t pitch, uintptr_t height);
-
-static void I420_YUYV (filter_t *filter, picture_t *src, picture_t *dst)
-{
-    uint8_t *out = dst->p->p_pixels;
-    const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
-    size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
-    size_t height = filter->fmt_in.video.i_height;
-
-    i420_yuyv_neon (out, yuv, pitch, height);
-}
-
-void i420_uyvy_neon (uint8_t *out, const uint8_t **in,
-                     uintptr_t pitch, uintptr_t height);
-
-static void I420_UYVY (filter_t *filter, picture_t *src, picture_t *dst)
-{
-    uint8_t *out = dst->p->p_pixels;
-    const uint8_t *yuv[3] = { src->Y_PIXELS, src->U_PIXELS, src->V_PIXELS, };
-    size_t pitch = (filter->fmt_in.video.i_width + 15) & ~15;
-    size_t height = filter->fmt_in.video.i_height;
-
-    i420_yuyv_neon (out, yuv, pitch, height);
-}
-
-VIDEO_FILTER_WRAPPER (I420_YUYV)
-VIDEO_FILTER_WRAPPER (I420_UYVY)
-
-static int Open (vlc_object_t *obj)
-{
-    filter_t *filter = (filter_t *)obj;
-
-    if (((filter->fmt_in.video.i_width | filter->fmt_in.video.i_height) & 1)
-     || (filter->fmt_in.video.i_width != filter->fmt_out.video.i_width)
-     || (filter->fmt_in.video.i_height != filter->fmt_out.video.i_height))
-        return VLC_EGENERIC;
-
-    switch (filter->fmt_in.video.i_chroma)
-    {
-        case VLC_CODEC_YV12:
-        case VLC_CODEC_I420:
-            switch (filter->fmt_out.video.i_chroma)
-            {
-                case VLC_CODEC_YUYV:
-                    filter->pf_video_filter = I420_YUYV_Filter;
-                    break;
-                case VLC_CODEC_UYVY:
-                    filter->pf_video_filter = I420_UYVY_Filter;
-                    break;
-                default:
-                    return VLC_EGENERIC;
-            }
-            break;
-
-        default:
-            return VLC_EGENERIC;
-    }
-    return VLC_SUCCESS;
-}
index 31c1ccb..a8b9fb2 100644 (file)
@@ -311,6 +311,8 @@ modules/access_output/rtmp.c
 modules/access_output/shout.c
 modules/access_output/udp.c
 modules/altivec/memcpy.c
+modules/arm_neon/audio_format.c
+modules/arm_neon/i420_yuy2.c
 modules/audio_filter/channel_mixer/dolby.c
 modules/audio_filter/channel_mixer/headphone.c
 modules/audio_filter/channel_mixer/mono.c
@@ -325,7 +327,6 @@ modules/audio_filter/converter/fixed.c
 modules/audio_filter/converter/float.c
 modules/audio_filter/converter/format.c
 modules/audio_filter/converter/mpgatofixed32.c
-modules/audio_filter/converter/neon.c
 modules/audio_filter/equalizer.c
 modules/audio_filter/equalizer_presets.h
 modules/audio_filter/normvol.c
@@ -1076,7 +1077,6 @@ modules/video_chroma/i420_yuy2.h
 modules/video_chroma/i422_i420.c
 modules/video_chroma/i422_yuy2.c
 modules/video_chroma/i422_yuy2.h
-modules/video_chroma/neon.c
 modules/video_chroma/yuy2_i420.c
 modules/video_chroma/yuy2_i422.c
 modules/video_filter/adjust.c