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