]> git.sesse.net Git - vlc/blob - modules/arm_neon/i422_yuyv.S
chroma_yuv_neon: add planar to packet YUV422 conversions
[vlc] / modules / arm_neon / i422_yuyv.S
1  @*****************************************************************************
2  @ i422_yuyv_neon.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 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         .fpu neon
22         .text
23
24 #define O       r0
25 #define OPAD    r1
26 #define WIDTH   r2
27 #define HEIGHT  r3
28 #define Y       r4
29 #define U       r5
30 #define V       r6
31 #define COUNT   ip
32 #define YPAD    lr
33
34         .align
35         .global i422_yuyv_neon
36         .type   i422_yuyv_neon, %function
37 i422_yuyv_neon:
38         push            {r4-r6,lr}
39         ldmia           r1,     {Y, U, V, YPAD}
40         ldmia           r0,     {O, OPAD}
41         cmp             HEIGHT, #0
42         sub             OPAD,   OPAD,   WIDTH,  lsl #1
43         sub             YPAD,   YPAD,   WIDTH
44 1:
45         movgts          COUNT,  WIDTH
46         pople           {r4-r6,pc}
47 2:
48         pld             [U, #64]
49         vld1.u8         {d2},           [U,:64]!
50         pld             [V, #64]
51         vld1.u8         {d3},           [V,:64]!
52         pld             [Y, #64]
53         vzip.u8         d2,     d3
54         subs            COUNT,  COUNT,  #16
55         vld1.u8         {q0},           [Y,:128]!
56         vzip.u8         q0,     q1
57         vst1.u8         {q0-q1},        [O,:128]!
58         bgt             2b
59
60         subs            HEIGHT, #1
61         add             U,      U,      YPAD,   lsr #1
62         add             V,      V,      YPAD,   lsr #1
63         add             Y,      Y,      YPAD
64         add             O,      O,      OPAD
65         b               1b
66
67         .global i422_uyvy_neon
68         .type   i422_uyvy_neon, %function
69 i422_uyvy_neon:
70         push            {r4-r6,lr}
71         ldmia           r1,     {Y, U, V, YPAD}
72         ldmia           r0,     {O, OPAD}
73         cmp             HEIGHT, #0
74         sub             OPAD,   OPAD,   WIDTH,  lsl #1
75         sub             YPAD,   YPAD,   WIDTH
76 1:
77         movgts          COUNT,  WIDTH
78         pople           {r4-r6,pc}
79 2:
80         pld             [U, #64]
81         vld1.u8         {d0},           [U,:64]!
82         pld             [V, #64]
83         vld1.u8         {d1},           [V,:64]!
84         pld             [Y, #64]
85         vzip.u8         d0,     d1
86         subs            COUNT,  COUNT,  #16
87         vld1.u8         {q1},           [Y,:128]!
88         vzip.u8         q0,     q1
89         vst1.u8         {q0-q1},        [O,:128]!
90         bgt             2b
91
92         subs            HEIGHT, #1
93         add             U,      U,      YPAD,   lsr #1
94         add             V,      V,      YPAD,   lsr #1
95         add             Y,      Y,      YPAD
96         add             O,      O,      OPAD
97         b               1b