annotate libswscale/bfin/internal_bfin.S @ 30828:5f145a3b3832

Commit files by Steinar Gunderson, forgotten in r30866. Fixes compilation on x86-32.
author cehoyos
date Tue, 09 Mar 2010 12:00:30 +0000
parents cdb6693dd949
children 22779f940406
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29042
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
1 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
2 * Copyright (C) 2007 Marc Hoffman <marc.hoffman@analog.com>
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
3 * April 20, 2007
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
4 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
5 * Blackfin video color space converter operations
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
6 * convert I420 YV12 to RGB in various formats
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
7 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
8 * This file is part of FFmpeg.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
9 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
10 * FFmpeg is free software; you can redistribute it and/or
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
11 * modify it under the terms of the GNU Lesser General Public
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
12 * License as published by the Free Software Foundation; either
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
13 * version 2.1 of the License, or (at your option) any later version.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
14 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
15 * FFmpeg is distributed in the hope that it will be useful,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
18 * Lesser General Public License for more details.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
19 *
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
20 * You should have received a copy of the GNU Lesser General Public
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
21 * License along with FFmpeg; if not, write to the Free Software
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
23 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
24
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
25
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
26 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
27 YUV420 to RGB565 conversion. This routine takes a YUV 420 planar macroblock
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
28 and converts it to RGB565. R:5 bits, G:6 bits, B:5 bits.. packed into shorts.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
29
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
30
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
31 The following calculation is used for the conversion:
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
32
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
33 r = clipz((y-oy)*cy + crv*(v-128))
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
34 g = clipz((y-oy)*cy + cgv*(v-128) + cgu*(u-128))
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
35 b = clipz((y-oy)*cy + cbu*(u-128))
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
36
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
37 y,u,v are prescaled by a factor of 4 i.e. left-shifted to gain precision.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
38
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
39
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
40 New factorization to eliminate the truncation error which was
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
41 occurring due to the byteop3p.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
42
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
43
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
44 1) Use the bytop16m to subtract quad bytes we use this in U8 this
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
45 then so the offsets need to be renormalized to 8bits.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
46
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
47 2) Scale operands up by a factor of 4 not 8 because Blackfin
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
48 multiplies include a shift.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
49
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
50 3) Compute into the accumulators cy*yx0, cy*yx1.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
51
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
52 4) Compute each of the linear equations:
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
53 r = clipz((y - oy) * cy + crv * (v - 128))
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
54
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
55 g = clipz((y - oy) * cy + cgv * (v - 128) + cgu * (u - 128))
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
56
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
57 b = clipz((y - oy) * cy + cbu * (u - 128))
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
58
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
59 Reuse of the accumulators requires that we actually multiply
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
60 twice once with addition and the second time with a subtraction.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
61
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
62 Because of this we need to compute the equations in the order R B
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
63 then G saving the writes for B in the case of 24/32 bit color
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
64 formats.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
65
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
66 API: yuv2rgb_kind (uint8_t *Y, uint8_t *U, uint8_t *V, int *out,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
67 int dW, uint32_t *coeffs);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
68
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
69 A B
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
70 --- ---
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
71 i2 = cb i3 = cr
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
72 i1 = coeff i0 = y
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
73
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
74 Where coeffs have the following layout in memory.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
75
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
76 uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
77
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
78 coeffs is a pointer to oy.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
79
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
80 The {rgb} masks are only utilized by the 565 packing algorithm. Note the data
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
81 replication is used to simplify the internal algorithms for the dual Mac
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
82 architecture of BlackFin.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
83
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
84 All routines are exported with _ff_bfin_ as a symbol prefix.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
85
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
86 Rough performance gain compared against -O3:
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
87
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
88 2779809/1484290 187.28%
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
89
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
90 which translates to ~33c/pel to ~57c/pel for the reference vs 17.5
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
91 c/pel for the optimized implementations. Not sure why there is such a
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
92 huge variation on the reference codes on Blackfin I guess it must have
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
93 to do with the memory system.
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
94 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
95
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
96 #define mL3 .text
30430
cdb6693dd949 Blackfin: use SRAM only when CONFIG_SRAM is set
mru
parents: 29042
diff changeset
97 #if defined(__FDPIC__) && CONFIG_SRAM
29042
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
98 #define mL1 .l1.text
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
99 #else
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
100 #define mL1 mL3
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
101 #endif
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
102 #define MEM mL1
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
103
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
104 #define DEFUN(fname,where,interface) \
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
105 .section where; \
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
106 .global _ff_bfin_ ## fname; \
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
107 .type _ff_bfin_ ## fname, STT_FUNC; \
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
108 .align 8; \
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
109 _ff_bfin_ ## fname
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
110
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
111 #define DEFUN_END(fname) \
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
112 .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
113
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
114
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
115 .text
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
116
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
117 #define COEFF_LEN 11*4
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
118 #define COEFF_REL_CY_OFF 4*4
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
119
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
120 #define ARG_OUT 20
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
121 #define ARG_W 24
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
122 #define ARG_COEFF 28
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
123
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
124 DEFUN(yuv2rgb565_line,MEM,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
125 (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
126 link 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
127 [--sp] = (r7:4);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
128 p1 = [fp+ARG_OUT];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
129 r3 = [fp+ARG_W];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
130
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
131 i0 = r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
132 i2 = r1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
133 i3 = r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
134
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
135 r0 = [fp+ARG_COEFF];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
136 i1 = r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
137 b1 = i1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
138 l1 = COEFF_LEN;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
139 m0 = COEFF_REL_CY_OFF;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
140 p0 = r3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
141
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
142 r0 = [i0++]; // 2Y
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
143 r1.l = w[i2++]; // 2u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
144 r1.h = w[i3++]; // 2v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
145 p0 = p0>>2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
146
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
147 lsetup (.L0565, .L1565) lc0 = p0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
148
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
149 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
150 uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
151 r0 -- used to load 4ys
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
152 r1 -- used to load 2us,2vs
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
153 r4 -- y3,y2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
154 r5 -- y1,y0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
155 r6 -- u1,u0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
156 r7 -- v1,v0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
157 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
158 r2=[i1++]; // oy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
159 .L0565:
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
160 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
161 rrrrrrrr gggggggg bbbbbbbb
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
162 5432109876543210
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
163 bbbbb >>3
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
164 gggggggg <<3
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
165 rrrrrrrr <<8
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
166 rrrrrggggggbbbbb
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
167 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
168 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
169 (r7,r6) = byteop16m (r1:0, r3:2) (r);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
170 r5 = r5 << 2 (v); // y1,y0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
171 r4 = r4 << 2 (v); // y3,y2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
172 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
173 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
174 /* Y' = y*cy */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
175 a1 = r1.h*r5.h, a0 = r1.l*r5.l || r1=[i1++]; // crv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
176
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
177 /* R = Y+ crv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
178 r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
179 a1 -= r1.h*r7.l, a0 -= r1.l*r7.l || r5=[i1++]; // rmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
180 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
181 r2 = r2 >> 3 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
182 r3 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
183
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
184 /* B = Y+ cbu*(Cb-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
185 r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
186 a1 -= r1.h*r6.l, a0 -= r1.l*r6.l || r5=[i1++]; // bmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
187 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
188 r2 = r2 << 8 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
189 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
190 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
191
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
192 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
193 a1 += r1.h*r6.l, a0 += r1.l*r6.l || r1=[i1++]; // cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
194 r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
195 r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++m0]; // gmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
196 r2 = r2 << 3 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
197 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
198 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
199 [p1++]=r3 || r1=[i1++]; // cy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
200
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
201 /* Y' = y*cy */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
202
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
203 a1 = r1.h*r4.h, a0 = r1.l*r4.l || r1=[i1++]; // crv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
204
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
205 /* R = Y+ crv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
206 r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
207 a1 -= r1.h*r7.h, a0 -= r1.l*r7.h || r5=[i1++]; // rmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
208 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
209 r2 = r2 >> 3 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
210 r3 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
211
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
212 /* B = Y+ cbu*(Cb-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
213 r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
214 a1 -= r1.h*r6.h, a0 -= r1.l*r6.h || r5=[i1++]; // bmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
215 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
216 r2 = r2 << 8 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
217 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
218 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
219
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
220 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
221 a1 += r1.h*r6.h, a0 += r1.l*r6.h || r1=[i1++]; // cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
222 r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h) || r5=[i1++]; // gmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
223 r2 = byteop3p(r3:2, r1:0)(LO) || r0 = [i0++]; // 2Y
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
224 r2 = r2 << 3 (v) || r1.l = w[i2++]; // 2u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
225 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
226 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
227 [p1++]=r3 || r1.h = w[i3++]; // 2v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
228 .L1565: r2=[i1++]; // oy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
229
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
230 l1 = 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
231
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
232 (r7:4) = [sp++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
233 unlink;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
234 rts;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
235 DEFUN_END(yuv2rgb565_line)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
236
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
237 DEFUN(yuv2rgb555_line,MEM,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
238 (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
239 link 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
240 [--sp] = (r7:4);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
241 p1 = [fp+ARG_OUT];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
242 r3 = [fp+ARG_W];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
243
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
244 i0 = r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
245 i2 = r1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
246 i3 = r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
247
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
248 r0 = [fp+ARG_COEFF];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
249 i1 = r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
250 b1 = i1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
251 l1 = COEFF_LEN;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
252 m0 = COEFF_REL_CY_OFF;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
253 p0 = r3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
254
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
255 r0 = [i0++]; // 2Y
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
256 r1.l = w[i2++]; // 2u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
257 r1.h = w[i3++]; // 2v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
258 p0 = p0>>2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
259
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
260 lsetup (.L0555, .L1555) lc0 = p0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
261
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
262 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
263 uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
264 r0 -- used to load 4ys
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
265 r1 -- used to load 2us,2vs
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
266 r4 -- y3,y2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
267 r5 -- y1,y0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
268 r6 -- u1,u0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
269 r7 -- v1,v0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
270 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
271 r2=[i1++]; // oy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
272 .L0555:
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
273 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
274 rrrrrrrr gggggggg bbbbbbbb
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
275 5432109876543210
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
276 bbbbb >>3
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
277 gggggggg <<2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
278 rrrrrrrr <<7
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
279 xrrrrrgggggbbbbb
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
280 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
281
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
282 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
283 (r7,r6) = byteop16m (r1:0, r3:2) (r);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
284 r5 = r5 << 2 (v); // y1,y0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
285 r4 = r4 << 2 (v); // y3,y2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
286 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
287 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
288 /* Y' = y*cy */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
289 a1 = r1.h*r5.h, a0 = r1.l*r5.l || r1=[i1++]; // crv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
290
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
291 /* R = Y+ crv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
292 r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
293 a1 -= r1.h*r7.l, a0 -= r1.l*r7.l || r5=[i1++]; // rmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
294 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
295 r2 = r2 >> 3 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
296 r3 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
297
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
298 /* B = Y+ cbu*(Cb-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
299 r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
300 a1 -= r1.h*r6.l, a0 -= r1.l*r6.l || r5=[i1++]; // bmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
301 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
302 r2 = r2 << 7 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
303 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
304 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
305
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
306 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
307 a1 += r1.h*r6.l, a0 += r1.l*r6.l || r1=[i1++]; // cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
308 r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
309 r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++m0]; // gmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
310 r2 = r2 << 2 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
311 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
312 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
313 [p1++]=r3 || r1=[i1++]; // cy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
314
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
315 /* Y' = y*cy */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
316
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
317 a1 = r1.h*r4.h, a0 = r1.l*r4.l || r1=[i1++]; // crv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
318
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
319 /* R = Y+ crv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
320 r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
321 a1 -= r1.h*r7.h, a0 -= r1.l*r7.h || r5=[i1++]; // rmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
322 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
323 r2 = r2 >> 3 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
324 r3 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
325
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
326 /* B = Y+ cbu*(Cb-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
327 r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
328 a1 -= r1.h*r6.h, a0 -= r1.l*r6.h || r5=[i1++]; // bmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
329 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
330 r2 = r2 << 7 (v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
331 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
332 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
333
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
334 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
335 a1 += r1.h*r6.h, a0 += r1.l*r6.h || r1=[i1++]; // cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
336 r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h) || r5=[i1++]; // gmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
337 r2 = byteop3p(r3:2, r1:0)(LO) || r0=[i0++]; // 4Y
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
338 r2 = r2 << 2 (v) || r1.l=w[i2++]; // 2u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
339 r2 = r2 & r5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
340 r3 = r3 | r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
341 [p1++]=r3 || r1.h=w[i3++]; // 2v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
342
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
343 .L1555: r2=[i1++]; // oy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
344
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
345 l1 = 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
346
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
347 (r7:4) = [sp++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
348 unlink;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
349 rts;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
350 DEFUN_END(yuv2rgb555_line)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
351
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
352 DEFUN(yuv2rgb24_line,MEM,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
353 (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, int dW, uint32_t *coeffs)):
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
354 link 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
355 [--sp] = (r7:4);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
356 p1 = [fp+ARG_OUT];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
357 r3 = [fp+ARG_W];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
358 p2 = p1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
359 p2 += 3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
360
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
361 i0 = r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
362 i2 = r1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
363 i3 = r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
364
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
365 r0 = [fp+ARG_COEFF]; // coeff buffer
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
366 i1 = r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
367 b1 = i1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
368 l1 = COEFF_LEN;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
369 m0 = COEFF_REL_CY_OFF;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
370 p0 = r3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
371
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
372 r0 = [i0++]; // 2Y
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
373 r1.l = w[i2++]; // 2u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
374 r1.h = w[i3++]; // 2v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
375 p0 = p0>>2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
376
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
377 lsetup (.L0888, .L1888) lc0 = p0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
378
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
379 /*
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
380 uint32_t oy,oc,zero,cy,crv,rmask,cbu,bmask,cgu,cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
381 r0 -- used to load 4ys
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
382 r1 -- used to load 2us,2vs
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
383 r4 -- y3,y2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
384 r5 -- y1,y0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
385 r6 -- u1,u0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
386 r7 -- v1,v0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
387 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
388 r2=[i1++]; // oy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
389 .L0888:
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
390 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
391 (r7,r6) = byteop16m (r1:0, r3:2) (r);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
392 r5 = r5 << 2 (v); // y1,y0
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
393 r4 = r4 << 2 (v); // y3,y2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
394 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
395 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
396
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
397 /* Y' = y*cy */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
398 a1 = r1.h*r5.h, a0 = r1.l*r5.l || r1=[i1++]; // crv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
399
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
400 /* R = Y+ crv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
401 r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
402 a1 -= r1.h*r7.l, a0 -= r1.l*r7.l || r5=[i1++]; // rmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
403 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
404 r2=r2>>16 || B[p1++]=r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
405 B[p2++]=r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
406
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
407 /* B = Y+ cbu*(Cb-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
408 r2.h = (a1 += r1.h*r6.l), r2.l = (a0 += r1.l*r6.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
409 a1 -= r1.h*r6.l, a0 -= r1.l*r6.l || r5=[i1++]; // bmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
410 r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
411
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
412 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
413 a1 += r1.h*r6.l, a0 += r1.l*r6.l || r1=[i1++]; // cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
414 r2.h = (a1 += r1.h*r7.l), r2.l = (a0 += r1.l*r7.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
415 r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++m0]; // gmask, oy,cy,zero
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
416
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
417 r2=r2>>16 || B[p1++]=r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
418 B[p2++]=r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
419
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
420 r3=r3>>16 || B[p1++]=r3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
421 B[p2++]=r3 || r1=[i1++]; // cy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
422
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
423 p1+=3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
424 p2+=3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
425 /* Y' = y*cy */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
426 a1 = r1.h*r4.h, a0 = r1.l*r4.l || r1=[i1++]; // crv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
427
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
428 /* R = Y+ crv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
429 r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
430 a1 -= r1.h*r7.h, a0 -= r1.l*r7.h || r5=[i1++]; // rmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
431 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
432 r2=r2>>16 || B[p1++]=r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
433 B[p2++]=r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
434
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
435 /* B = Y+ cbu*(Cb-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
436 r2.h = (a1 += r1.h*r6.h), r2.l = (a0 += r1.l*r6.h);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
437 a1 -= r1.h*r6.h, a0 -= r1.l*r6.h || r5=[i1++]; // bmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
438 r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
439
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
440 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
441 a1 += r1.h*r6.h, a0 += r1.l*r6.h || r1=[i1++]; // cgv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
442 r2.h = (a1 += r1.h*r7.h), r2.l = (a0 += r1.l*r7.h);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
443 r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++]; // gmask
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
444 r2=r2>>16 || B[p1++]=r2 || r0 = [i0++]; // 4y
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
445 B[p2++]=r2 || r1.l = w[i2++]; // 2u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
446 r3=r3>>16 || B[p1++]=r3 || r1.h = w[i3++]; // 2v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
447 B[p2++]=r3 || r2=[i1++]; // oy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
448
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
449 p1+=3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
450 .L1888: p2+=3;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
451
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
452 l1 = 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
453
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
454 (r7:4) = [sp++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
455 unlink;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
456 rts;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
457 DEFUN_END(yuv2rgb24_line)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
458
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
459
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
460
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
461 #define ARG_vdst 20
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
462 #define ARG_width 24
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
463 #define ARG_height 28
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
464 #define ARG_lumStride 32
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
465 #define ARG_chromStride 36
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
466 #define ARG_srcStride 40
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
467
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
468 DEFUN(uyvytoyv12, mL3, (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
469 long width, long height,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
470 long lumStride, long chromStride, long srcStride)):
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
471 link 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
472 [--sp] = (r7:4,p5:4);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
473
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
474 p0 = r1; // Y top even
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
475
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
476 i2 = r2; // *u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
477 r2 = [fp + ARG_vdst];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
478 i3 = r2; // *v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
479
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
480 r1 = [fp + ARG_srcStride];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
481 r2 = r0 + r1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
482 r1 += -8; // i0,i1 is pre read need to correct
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
483 m0 = r1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
484
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
485 i0 = r0; // uyvy_T even
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
486 i1 = r2; // uyvy_B odd
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
487
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
488 p2 = [fp + ARG_lumStride];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
489 p1 = p0 + p2; // Y bot odd
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
490
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
491 p5 = [fp + ARG_width];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
492 p4 = [fp + ARG_height];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
493 r0 = p5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
494 p4 = p4 >> 1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
495 p5 = p5 >> 2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
496
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
497 r2 = [fp + ARG_chromStride];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
498 r0 = r0 >> 1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
499 r2 = r2 - r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
500 m1 = r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
501
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
502 /* I0,I1 - src input line pointers
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
503 * p0,p1 - luma output line pointers
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
504 * I2 - dstU
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
505 * I3 - dstV
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
506 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
507
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
508 lsetup (0f, 1f) lc1 = p4; // H/2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
509 0: r0 = [i0++] || r2 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
510 r1 = [i0++] || r3 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
511 r4 = byteop1p(r1:0, r3:2);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
512 r5 = byteop1p(r1:0, r3:2) (r);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
513 lsetup (2f, 3f) lc0 = p5; // W/4
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
514 2: r0 = r0 >> 8(v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
515 r1 = r1 >> 8(v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
516 r2 = r2 >> 8(v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
517 r3 = r3 >> 8(v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
518 r0 = bytepack(r0, r1);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
519 r2 = bytepack(r2, r3) || [p0++] = r0; // yyyy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
520 r6 = pack(r5.l, r4.l) || [p1++] = r2; // yyyy
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
521 r7 = pack(r5.h, r4.h) || r0 = [i0++] || r2 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
522 r6 = bytepack(r6, r7) || r1 = [i0++] || r3 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
523 r4 = byteop1p(r1:0, r3:2) || w[i2++] = r6.l; // uu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
524 3: r5 = byteop1p(r1:0, r3:2) (r) || w[i3++] = r6.h; // vv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
525
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
526 i0 += m0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
527 i1 += m0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
528 i2 += m1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
529 i3 += m1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
530 p0 = p0 + p2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
531 1: p1 = p1 + p2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
532
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
533 (r7:4,p5:4) = [sp++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
534 unlink;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
535 rts;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
536 DEFUN_END(uyvytoyv12)
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
537
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
538 DEFUN(yuyvtoyv12, mL3, (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
539 long width, long height,
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
540 long lumStride, long chromStride, long srcStride)):
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
541 link 0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
542 [--sp] = (r7:4,p5:4);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
543
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
544 p0 = r1; // Y top even
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
545
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
546 i2 = r2; // *u
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
547 r2 = [fp + ARG_vdst];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
548 i3 = r2; // *v
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
549
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
550 r1 = [fp + ARG_srcStride];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
551 r2 = r0 + r1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
552 r1 += -8; // i0,i1 is pre read need to correct
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
553 m0 = r1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
554
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
555 i0 = r0; // uyvy_T even
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
556 i1 = r2; // uyvy_B odd
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
557
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
558 p2 = [fp + ARG_lumStride];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
559 p1 = p0 + p2; // Y bot odd
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
560
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
561 p5 = [fp + ARG_width];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
562 p4 = [fp + ARG_height];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
563 r0 = p5;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
564 p4 = p4 >> 1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
565 p5 = p5 >> 2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
566
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
567 r2 = [fp + ARG_chromStride];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
568 r0 = r0 >> 1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
569 r2 = r2 - r0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
570 m1 = r2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
571
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
572 /* I0,I1 - src input line pointers
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
573 * p0,p1 - luma output line pointers
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
574 * I2 - dstU
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
575 * I3 - dstV
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
576 */
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
577
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
578 lsetup (0f, 1f) lc1 = p4; // H/2
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
579 0: r0 = [i0++] || r2 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
580 r1 = [i0++] || r3 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
581 r4 = bytepack(r0, r1);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
582 r5 = bytepack(r2, r3);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
583 lsetup (2f, 3f) lc0 = p5; // W/4
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
584 2: r0 = r0 >> 8(v) || [p0++] = r4; // yyyy-even
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
585 r1 = r1 >> 8(v) || [p1++] = r5; // yyyy-odd
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
586 r2 = r2 >> 8(v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
587 r3 = r3 >> 8(v);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
588 r4 = byteop1p(r1:0, r3:2);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
589 r5 = byteop1p(r1:0, r3:2) (r);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
590 r6 = pack(r5.l, r4.l);
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
591 r7 = pack(r5.h, r4.h) || r0 = [i0++] || r2 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
592 r6 = bytepack(r6, r7) || r1 = [i0++] || r3 = [i1++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
593 r4 = bytepack(r0, r1) || w[i2++] = r6.l; // uu
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
594 3: r5 = bytepack(r2, r3) || w[i3++] = r6.h; // vv
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
595
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
596 i0 += m0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
597 i1 += m0;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
598 i2 += m1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
599 i3 += m1;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
600 p0 = p0 + p2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
601 1: p1 = p1 + p2;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
602
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
603 (r7:4,p5:4) = [sp++];
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
604 unlink;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
605 rts;
c198fbb7172e Move bfin specific code to its subdir.
ramiro
parents:
diff changeset
606 DEFUN_END(yuyvtoyv12)