]> git.sesse.net Git - vlc/blob - modules/arm_neon/yuyv_i422.S
enable the macosx GUI to handle negative stop-time
[vlc] / modules / arm_neon / yuyv_i422.S
1  @*****************************************************************************
2  @ yuyv_i422.S : ARM NEONv1 packed to planar YUV422 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 I       r0
26 #define IPAD    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 yuyv_i422_neon
37         .type   yuyv_i422_neon, %function
38 yuyv_i422_neon:
39         push            {r4-r6,lr}
40         ldmia           r0,     {Y, U, V, YPAD}
41         ldmia           r1,     {I, IPAD}
42         cmp             HEIGHT, #0
43         sub             YPAD,   YPAD,   WIDTH
44         sub             IPAD,   IPAD,   WIDTH,  lsl #1
45 1:
46         movsgt          COUNT,  WIDTH
47         pople           {r4-r6,pc}
48 2:
49         pld             [I, #64]
50         subs            COUNT,  COUNT,  #16
51         vld1.u8         {q0-q1},        [I,:128]!
52         vuzp.u8         q0,     q1
53         @ TODO: unroll (1 cycle stall)
54         vuzp.u8         d2,     d3
55         vst1.u8         {q0},           [Y,:128]!
56         vst1.u8         {d2},           [U,:64]!
57         vst1.u8         {d3},           [V,:64]!
58         bgt             2b
59
60         subs            HEIGHT, #1
61         add             I,      I,      IPAD
62         add             Y,      Y,      YPAD
63         add             U,      U,      YPAD,   lsr #1
64         add             V,      V,      YPAD,   lsr #1
65         b               1b
66
67         .global uyvy_i422_neon
68         .type   uyvy_i422_neon, %function
69 uyvy_i422_neon:
70         push            {r4-r6,lr}
71         ldmia           r0,     {Y, U, V, YPAD}
72         ldmia           r1,     {I, IPAD}
73         cmp             HEIGHT, #0
74         sub             YPAD,   YPAD,   WIDTH
75         sub             IPAD,   IPAD,   WIDTH,  lsl #1
76 1:
77         movsgt          COUNT,  WIDTH
78         pople           {r4-r6,pc}
79 2:
80         pld             [I, #64]
81         subs            COUNT,  COUNT,  #16
82         vld1.u8         {q0-q1},        [I,:128]!
83         vuzp.u8         q0,     q1
84         vuzp.u8         d0,     d1
85         vst1.u8         {q1},           [Y,:128]!
86         vst1.u8         {d0},           [U,:64]!
87         vst1.u8         {d1},           [V,:64]!
88         bgt             2b
89
90         subs            HEIGHT, #1
91         add             I,      I,      IPAD
92         add             Y,      Y,      YPAD
93         add             U,      U,      YPAD,   lsr #1
94         add             V,      V,      YPAD,   lsr #1
95         b               1b