]> git.sesse.net Git - vlc/blob - modules/arm_neon/i422_yuyv.S
enable the macosx GUI to handle negative stop-time
[vlc] / modules / arm_neon / i422_yuyv.S
1  @*****************************************************************************
2  @ i422_yuyv.S : ARM NEONv1 I422 to YUYV chroma conversion
3  @*****************************************************************************
4  @ Copyright (C) 2011 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 Lesser General Public License as published by
8  @ the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
15  @
16  @ You should have received a copy of the GNU Lesser 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         .syntax unified
22         .fpu neon
23         .text
24
25 #define O       r0
26 #define OPAD    r1
27 #define WIDTH   r2
28 #define HEIGHT  r3
29 #define Y       r4
30 #define U       r5
31 #define V       r6
32 #define COUNT   ip
33 #define YPAD    lr
34
35         .align 2
36         .global i422_yuyv_neon
37         .type   i422_yuyv_neon, %function
38 i422_yuyv_neon:
39         push            {r4-r6,lr}
40         ldmia           r1,     {Y, U, V, YPAD}
41         ldmia           r0,     {O, OPAD}
42         cmp             HEIGHT, #0
43         sub             OPAD,   OPAD,   WIDTH,  lsl #1
44         sub             YPAD,   YPAD,   WIDTH
45 1:
46         movsgt          COUNT,  WIDTH
47         pople           {r4-r6,pc}
48 2:
49         pld             [U, #64]
50         vld1.u8         {d2},           [U,:64]!
51         pld             [V, #64]
52         vld1.u8         {d3},           [V,:64]!
53         pld             [Y, #64]
54         vzip.u8         d2,     d3
55         subs            COUNT,  COUNT,  #16
56         vld1.u8         {q0},           [Y,:128]!
57         vzip.u8         q0,     q1
58         @ TODO: unroll (1 cycle stall)
59         vst1.u8         {q0-q1},        [O,:128]!
60         bgt             2b
61
62         subs            HEIGHT, #1
63         add             U,      U,      YPAD,   lsr #1
64         add             V,      V,      YPAD,   lsr #1
65         add             Y,      Y,      YPAD
66         add             O,      O,      OPAD
67         b               1b
68
69         .global i422_uyvy_neon
70         .type   i422_uyvy_neon, %function
71 i422_uyvy_neon:
72         push            {r4-r6,lr}
73         ldmia           r1,     {Y, U, V, YPAD}
74         ldmia           r0,     {O, OPAD}
75         cmp             HEIGHT, #0
76         sub             OPAD,   OPAD,   WIDTH,  lsl #1
77         sub             YPAD,   YPAD,   WIDTH
78 1:
79         movsgt          COUNT,  WIDTH
80         pople           {r4-r6,pc}
81 2:
82         pld             [U, #64]
83         vld1.u8         {d0},           [U,:64]!
84         pld             [V, #64]
85         vld1.u8         {d1},           [V,:64]!
86         pld             [Y, #64]
87         vzip.u8         d0,     d1
88         subs            COUNT,  COUNT,  #16
89         vld1.u8         {q1},           [Y,:128]!
90         vzip.u8         q0,     q1
91         vst1.u8         {q0-q1},        [O,:128]!
92         bgt             2b
93
94         subs            HEIGHT, #1
95         add             U,      U,      YPAD,   lsr #1
96         add             V,      V,      YPAD,   lsr #1
97         add             Y,      Y,      YPAD
98         add             O,      O,      OPAD
99         b               1b