]> git.sesse.net Git - vlc/blob - modules/arm_neon/i420_yuy2.S
8d8645c372c71394d2eb77357b91dd3e370055fb
[vlc] / modules / arm_neon / i420_yuy2.S
1  @*****************************************************************************
2  @ i420_yuyv_neon.S : ARM NEONv1 I420 to YUYV chroma conversion
3  @*****************************************************************************
4  @ Copyright (C) 2009 RĂ©mi Denis-Courmont
5  @
6  @ This program is free software; you can redistribute it and/or modify
7  @ it under the terms of the GNU General Public License as published by
8  @ the Free Software Foundation; either version 2 of the License, or
9  @ (at your option) any later version.
10  @
11  @ This program is distributed in the hope that it will be useful,
12  @ but WITHOUT ANY WARRANTY; without even the implied warranty of
13  @ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  @ GNU General Public License for more details.
15  @
16  @ You should have received a copy of the GNU General Public License
17  @ along with this program; if not, write to the Free Software Foundation,
18  @ Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  @****************************************************************************/
20
21         .fpu neon
22         .text
23
24 #define O1      r0
25 #define O2      r1
26 #define PITCH   r2
27 #define HEIGHT  r3
28 #define Y1      r4
29 #define Y2      r5
30 #define U       r6
31 #define V       r7
32 #define END_O1  r12
33
34         .align
35         .global i420_yuyv_neon
36         .type   i420_yuyv_neon, %function
37 i420_yuyv_neon:
38         push            {r4-r7, lr}
39         ldmia           r1,     {Y1, U, V}
40         add             O2,     O1,     PITCH, lsl #1
41         add             Y2,     Y1,     PITCH
42 1:
43         mov             END_O1, O2
44         pld             [Y2]
45 2:
46         pld             [U, #64]
47         vld1.u8         {d2},           [U,:64]!
48         pld             [V, #64]
49         vld1.u8         {d3},           [V,:64]!
50         pld             [Y1, #64]
51         vzip.u8         d2,     d3
52         vld1.u8         {q0},           [Y1,:128]!
53         pld             [Y2, #64]
54         vmov            q3,     q1
55         vzip.u8         q0,     q1
56         vld1.u8         {q2},           [Y2,:128]!
57         vzip.u8         q2,     q3
58         vst1.u8         {q0-q1},        [O1,:128]!
59         vst1.u8         {q2-q3},        [O2,:128]!
60
61         cmp             O1,     END_O1
62         bne             2b
63
64         sub             HEIGHT, #2
65         mov             O1,     O2
66         add             O2,     PITCH,  lsl #1
67         mov             Y1,     Y2
68         add             Y2,     PITCH
69
70         cmp             HEIGHT, #0
71         bne             1b
72
73         pop             {r4-r7, pc}
74
75         .global i420_uyvy_neon
76         .type   i420_uyvy_neon, %function
77 i420_uyvy_neon:
78         push            {r4-r7, lr}
79         ldmia           r1,     {Y1, U, V}
80         add             O2,     O1,     PITCH, lsl #1
81         add             Y2,     Y1,     PITCH
82 1:
83         mov             END_O1, O2
84 2:
85         pld             [U, #64]
86         vld1.u8         {d0},           [U,:64]!
87         pld             [V, #64]
88         vld1.u8         {d1},           [V,:64]!
89         pld             [Y1, #64]
90         vzip.u8         d0,     d1
91         vld1.u8         {q1},           [Y1,:128]!
92         pld             [Y2, #64]
93         vmov            q2,     q0
94         vzip.u8         q0,     q1
95         vld1.u8         {q3},           [Y2,:128]!
96         vzip.u8         q2,     q3
97         vst1.u8         {q0-q1},        [O1,:128]!
98         vst1.u8         {q2-q3},        [O2,:128]!
99
100         cmp             O1,     END_O1
101         bne             2b
102
103         sub             HEIGHT, #2
104         mov             O1,     O2
105         add             O2,     PITCH,  lsl #1
106         mov             Y1,     Y2
107         add             Y2,     PITCH
108
109         cmp             HEIGHT, #0
110         bne             1b
111
112         pop             {r4-r7, pc}