Commit ca829063 authored by Sébastien Toque's avatar Sébastien Toque
Browse files

split neon converter

parent bd7f8ce9
From 87557a88823d1aca7e62ff465449f537eb4e612f Mon Sep 17 00:00:00 2001
From 07aa86593ef0035b44e00b4fc54eab31fc686bca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Toque?= <xilasz@gmail.com>
Date: Tue, 4 Oct 2011 21:50:22 +0200
Date: Tue, 4 Oct 2011 22:03:43 +0200
Subject: [PATCH] i420->RGB convertor in NEON
---
modules/arm_neon/Modules.am | 8 +
modules/arm_neon/chroma_neon.h | 8 +
modules/arm_neon/i420_rgb.S | 340 ++++++++++++++++++++++++++++++++++++++++
modules/arm_neon/yuv_rgb.c | 158 +++++++++++++++++++
4 files changed, 514 insertions(+), 0 deletions(-)
modules/arm_neon/Modules.am | 9 ++
modules/arm_neon/chroma_neon.h | 8 ++
modules/arm_neon/i420_rgb.S | 209 ++++++++++++++++++++++++++++++++++++++++
modules/arm_neon/nv21_rgb.S | 206 +++++++++++++++++++++++++++++++++++++++
modules/arm_neon/yuv_rgb.c | 158 ++++++++++++++++++++++++++++++
5 files changed, 590 insertions(+), 0 deletions(-)
create mode 100644 modules/arm_neon/i420_rgb.S
create mode 100644 modules/arm_neon/nv21_rgb.S
create mode 100644 modules/arm_neon/yuv_rgb.c
diff --git a/modules/arm_neon/Modules.am b/modules/arm_neon/Modules.am
index 83576eb..b3c416c 100644
index 83576eb..30eee29 100644
--- a/modules/arm_neon/Modules.am
+++ b/modules/arm_neon/Modules.am
@@ -18,7 +18,15 @@ libchroma_yuv_neon_plugin_la_CFLAGS = $(AM_CFLAGS)
@@ -18,7 +18,16 @@ libchroma_yuv_neon_plugin_la_CFLAGS = $(AM_CFLAGS)
libchroma_yuv_neon_plugin_la_LIBADD = $(AM_LIBADD)
libchroma_yuv_neon_plugin_la_DEPENDENCIES =
+libyuv_rgb_neon_plugin_la_SOURCES = \
+ i420_rgb.S \
+ nv21_rgb.S \
+ yuv_rgb.c
+libyuv_rgb_neon_plugin_la_CFLAGS = $(AM_CFLAGS)
+libyuv_rgb_neon_plugin_la_LIBADD = $(AM_LIBADD)
......@@ -50,10 +53,10 @@ index 204c5f1..86595b9 100644
+ const struct yuv_planes *const in, int width, int height);
diff --git a/modules/arm_neon/i420_rgb.S b/modules/arm_neon/i420_rgb.S
new file mode 100644
index 0000000..ec3a1b4
index 0000000..cc0caf3
--- /dev/null
+++ b/modules/arm_neon/i420_rgb.S
@@ -0,0 +1,340 @@
@@ -0,0 +1,209 @@
+ @*****************************************************************************
+ @ i420_rgb.S : ARM NEONv1 I420 to RGB chroma conversion
+ @*****************************************************************************
......@@ -163,7 +166,7 @@ index 0000000..ec3a1b4
+ sub OPAD, OPITCH, WIDTH, lsl #2
+ sub YPAD, YPITCH, WIDTH
+
+loopi420_row:
+loop_row:
+ movgts COUNT, WIDTH
+ add O2, O1, OPITCH
+ add Y2, Y1, YPITCH
......@@ -171,7 +174,7 @@ index 0000000..ec3a1b4
+ vpople {q4-q7}
+ pople {r4-r8,r10-r11,pc}
+
+loopi420_col:
+loop_col:
+
+ /* Common U & V */
+
......@@ -254,7 +257,7 @@ index 0000000..ec3a1b4
+
+ /* next columns (x16) */
+ subs COUNT, COUNT, #16
+ bgt loopi420_col
+ bgt loop_col
+
+ /* next rows (x2) */
+ subs HEIGHT, #2
......@@ -262,9 +265,90 @@ index 0000000..ec3a1b4
+ add Y1, Y2, YPAD
+ add U, U, YPAD, lsr #1
+ add V, V, YPAD, lsr #1
+ b loopi420_row
+ b loop_row
diff --git a/modules/arm_neon/nv21_rgb.S b/modules/arm_neon/nv21_rgb.S
new file mode 100644
index 0000000..82a7099
--- /dev/null
+++ b/modules/arm_neon/nv21_rgb.S
@@ -0,0 +1,206 @@
+ @*****************************************************************************
+ @ nv21_rgb.S : ARM NEONv1 NV21 to RGB chroma conversion
+ @*****************************************************************************
+ @ Copyright (C) 2011 Sébastien Toque
+ @ 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
+
+/* ARM */
+#define O1 r0
+#define O2 r1
+#define WIDTH r2
+#define HEIGHT r3
+#define Y1 r4
+#define Y2 r5
+#define U r6
+#define V r7
+#define YPITCH r8
+#define OPAD r10
+#define YPAD r11
+#define COUNT ip
+#define OPITCH lr
+
+/* NEON */
+#define coefY D0
+#define coefRV D1
+#define coefGU D2
+#define coefGV D3
+#define coefBU D4
+#define Rc Q3
+#define Gc Q4
+#define Bc Q5
+
+#define u D24
+#define v D25
+#define y1 D28
+#define y2 D29
+
+#define chro_r Q6
+#define chro_g Q7
+#define chro_b Q8
+#define red Q9
+#define green Q10
+#define blue Q11
+#define lumi Q15
+
+#define red1 D24
+#define green1 D25
+#define blue1 D26
+#define alpha1 D27
+#define red2 D28
+#define green2 D29
+#define blue2 D30
+#define alpha2 D31
+
+coefficients:
+ .short -15872
+ .short 4992
+ .short -18432
+
+ .align
+ .global nv21_rgb_neon
+ .type nv21_rgb_neon, %function
+nv21_rgb_neon:
......@@ -297,7 +381,7 @@ index 0000000..ec3a1b4
+ sub OPAD, OPITCH, WIDTH, lsl #2
+ sub YPAD, YPITCH, WIDTH
+
+loopnv21_row:
+loop_row:
+ movgts COUNT, WIDTH
+ add O2, O1, OPITCH
+ add Y2, Y1, YPITCH
......@@ -305,7 +389,7 @@ index 0000000..ec3a1b4
+ vpople {q4-q7}
+ pople {r4-r8,r10-r11,pc}
+
+loopnv21_col:
+loop_col:
+
+ /* Common U & V */
+
......@@ -386,14 +470,14 @@ index 0000000..ec3a1b4
+
+ /* next columns (x16) */
+ subs COUNT, COUNT, #16
+ bgt loopnv21_col
+ bgt loop_col
+
+ /* next rows (x2) */
+ subs HEIGHT, #2
+ add O1, O2, OPAD
+ add Y1, Y2, YPAD
+ add U, U, YPAD
+ b loopnv21_row
+ b loop_row
diff --git a/modules/arm_neon/yuv_rgb.c b/modules/arm_neon/yuv_rgb.c
new file mode 100644
index 0000000..8c8565b
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment