opengl: fix vdpau GLX usage
[vlc.git] / modules / arm_neon / yuyv_i422.S
blob62d826c838795af4726bd86a0393a6e4da42d959
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  @****************************************************************************/
21 #include "asm.S"
23         .syntax unified
24 #if HAVE_AS_FPU_DIRECTIVE
25         .fpu    neon
26 #endif
27         .text
29 #define I       r0
30 #define IPAD    r1
31 #define WIDTH   r2
32 #define HEIGHT  r3
33 #define Y       r4
34 #define U       r5
35 #define V       r6
36 #define COUNT   ip
37 #define YPAD    lr
39         .align 2
40 function yuyv_i422_neon
41         push            {r4-r6,lr}
42         ldmia           r0,     {Y, U, V, YPAD}
43         ldmia           r1,     {I, IPAD}
44         cmp             HEIGHT, #0
45         sub             YPAD,   YPAD,   WIDTH
46         sub             IPAD,   IPAD,   WIDTH,  lsl #1
48         ite             gt
49         movsgt          COUNT,  WIDTH
50         pople           {r4-r6,pc}
52         pld             [I, #64]
53         subs            COUNT,  COUNT,  #16
54         vld1.u8         {q0-q1},        [I,:128]!
55         vuzp.u8         q0,     q1
56         @ TODO: unroll (1 cycle stall)
57         vuzp.u8         d2,     d3
58         vst1.u8         {q0},           [Y,:128]!
59         vst1.u8         {d2},           [U,:64]!
60         vst1.u8         {d3},           [V,:64]!
61         bgt             2b
63         subs            HEIGHT, #1
64         add             I,      I,      IPAD
65         add             Y,      Y,      YPAD
66         add             U,      U,      YPAD,   lsr #1
67         add             V,      V,      YPAD,   lsr #1
68         b               1b
70 function uyvy_i422_neon
71         push            {r4-r6,lr}
72         ldmia           r0,     {Y, U, V, YPAD}
73         ldmia           r1,     {I, IPAD}
74         cmp             HEIGHT, #0
75         sub             YPAD,   YPAD,   WIDTH
76         sub             IPAD,   IPAD,   WIDTH,  lsl #1
78         ite             gt
79         movsgt          COUNT,  WIDTH
80         pople           {r4-r6,pc}
82         pld             [I, #64]
83         subs            COUNT,  COUNT,  #16
84         vld1.u8         {q0-q1},        [I,:128]!
85         vuzp.u8         q0,     q1
86         vuzp.u8         d0,     d1
87         vst1.u8         {q1},           [Y,:128]!
88         vst1.u8         {d0},           [U,:64]!
89         vst1.u8         {d1},           [V,:64]!
90         bgt             2b
92         subs            HEIGHT, #1
93         add             I,      I,      IPAD
94         add             Y,      Y,      YPAD
95         add             U,      U,      YPAD,   lsr #1
96         add             V,      V,      YPAD,   lsr #1
97         b               1b