]> git.sesse.net Git - vlc/blob - modules/video_chroma/i420_yuyv_neon.S
NEON accelerated I420/YV12 -> YUYV/UYVY chroma conversion
[vlc] / modules / video_chroma / i420_yuyv_neon.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
18  @ Foundation, 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  r8
33
34         .align
35         .global i420_uyvy_neon
36         .type   i420_uyvy_neon, %function
37 i420_uyvy_neon:
38         push            {r4-r8}
39         add             r8,     pc,     #(indexes+64-.-8)
40         b               i420_pack_neon
41
42         .global i420_yuyv_neon
43         .type   i420_yuyv_neon, %function
44 i420_yuyv_neon:
45         push            {r4-r8}
46         add             r8,     pc,     #(indexes-.-8)
47         .hidden i420_pack_neon
48 i420_pack_neon:
49         vld1.u8         {d24-d27},      [r8]!
50         ldmia           r1,     {r4, r6, r7}
51         vld1.u8         {d28-d31},      [r8]
52         add             O2,     O1,     PITCH, lsl #1
53         add             Y2,     Y1,     PITCH
54 1:
55         mov             END_O1, O2
56 2:
57         vld1.u8         {d0-d1},        [Y1,:128]!
58         vld1.u8         {d2},           [U,:64]!
59         vld1.u8         {d3},           [V,:64]!
60         vld1.u8         {d4-d5},        [Y2,:128]!
61         vtbl.u8         d16,    {d0-d3},        d24
62         vtbl.u8         d17,    {d0-d3},        d25
63         vtbl.u8         d18,    {d0-d3},        d26
64         vtbl.u8         d19,    {d0-d3},        d27
65         vtbl.u8         d20,    {d2-d5},        d28
66         vtbl.u8         d21,    {d2-d5},        d29
67         vtbl.u8         d22,    {d2-d5},        d30
68         vtbl.u8         d23,    {d2-d5},        d31
69         vst1.u8         {d16-d19},      [O1,:128]!
70         vst1.u8         {d20-d23},      [O2,:128]!
71
72         cmp             O1,     END_O1
73         bne             2b
74
75         sub             HEIGHT, #2
76         mov             O1,     O2
77         add             O2,     PITCH,  lsl #1
78         mov             Y1,     Y2
79         add             Y2,     PITCH
80
81         cmp             HEIGHT, #0
82         bne             1b
83
84         pop             {r4-r8}
85         bx              lr
86
87         .hidden indexes
88 indexes:
89         @ YUYV1
90         .byte   0x00, 0x10, 0x01, 0x18, 0x02, 0x11, 0x03, 0x19
91         .byte   0x04, 0x12, 0x05, 0x1A, 0x06, 0x13, 0x07, 0x1B
92         .byte   0x08, 0x14, 0x09, 0x1C, 0x0A, 0x15, 0x0B, 0x1D
93         .byte   0x0C, 0x16, 0x0D, 0x1E, 0x0E, 0x17, 0x0F, 0x1F
94         @ YUYV2
95         .byte   0x10, 0x00, 0x11, 0x08, 0x12, 0x01, 0x13, 0x09
96         .byte   0x14, 0x02, 0x15, 0x0A, 0x16, 0x03, 0x17, 0x0B
97         .byte   0x18, 0x04, 0x19, 0x0C, 0x1A, 0x05, 0x1B, 0x0D
98         .byte   0x1C, 0x06, 0x1D, 0x0E, 0x1E, 0x07, 0x1F, 0x0F
99         @ UYVY1
100         .byte   0x10, 0x00, 0x18, 0x01, 0x11, 0x02, 0x19, 0x03
101         .byte   0x12, 0x04, 0x1A, 0x05, 0x13, 0x06, 0x1B, 0x07
102         .byte   0x14, 0x08, 0x1C, 0x09, 0x15, 0x0A, 0x1D, 0x0B
103         .byte   0x16, 0x0C, 0x1E, 0x0D, 0x17, 0x0E, 0x1F, 0x0F
104         @ UYVY2
105         .byte   0x00, 0x10, 0x08, 0x11, 0x01, 0x12, 0x09, 0x13
106         .byte   0x02, 0x14, 0x0A, 0x15, 0x03, 0x16, 0x0B, 0x17
107         .byte   0x04, 0x18, 0x0C, 0x19, 0x05, 0x1A, 0x0D, 0x1B
108         .byte   0x06, 0x1C, 0x0E, 0x1D, 0x07, 0x1E, 0x0F, 0x1F