Mercurial > mplayer.hg
annotate libswscale/internal_bfin.S @ 23444:4a9e6efb8200
Remove some useless code
author | reimar |
---|---|
date | Mon, 04 Jun 2007 13:05:26 +0000 |
parents | d7af89e69e92 |
children | 2d5b7c795a60 |
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 * |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
5 * Blackfin Video Color Space Converters Operations |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
6 * convert I420 YV12 to RGB in various formats, |
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 /* |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
27 YUV420 to RGB565 conversion. This routine takes a YUV 420 planar macroblock |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
28 and converts it to RGB565. R:5 bits, G:6 bits, B:5 bits.. packed into shorts |
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 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
31 The following calculation is used for the conversion: |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
32 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
33 r = clipz((y-oy)*cy + crv*(v-128)) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
34 g = clipz((y-oy)*cy + cgv*(v-128) + cgu*(u-128)) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
35 b = clipz((y-oy)*cy + cbu*(u-128)) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
36 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
37 y,u,v are pre scaled by a factor of 4 i.e. left shifted to gain precision. |
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 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
40 New factorization to elliminate the truncation error which was |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
41 occuring due to the byteop3p. |
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 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
44 1) use the bytop16m to subtract quad bytes we use this in U8 this |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
45 then so the offsets need to be renormalized to 8bits. |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
46 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
47 2) scale operands up by a factor of 4 not 8 because Blackfin |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
48 multiplies include a shift. |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
49 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
50 3) compute into the accumulators cy*yx0, cy*yx1 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
51 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
52 4) compute each of the linear equations |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
53 r = clipz((y-oy)*cy + crv*(v-128)) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
54 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
55 g = clipz((y-oy)*cy + cgv*(v-128) + cgu*(u-128)) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
56 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
57 b = clipz((y-oy)*cy + cbu*(u-128)) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
58 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
59 reuse of the accumulators requires that we actually multiply |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
60 twice once with addition and the second time with a subtaction. |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
61 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
62 because of this we need to compute the equations in the order R B |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
63 then G saving the writes for B in the case of 24/32 bit color |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
64 formats. |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
65 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
66 api: yuv2rgb_kind (uint8_t *Y, uint8_t *U, uint8_t *V, int *out, |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
67 int dW, uint32_t *coeffs); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
68 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
69 A B |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
70 --- --- |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
71 i2 = cb i3 = cr |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
72 i1 = coeff i0 = y |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
73 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
74 Where coeffs have the following layout in memory. |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
75 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
76 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
|
77 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
78 coeffs is a pointer to oy. |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
79 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
80 the {rgb} masks are only utilized by the 565 packing algorithm. Note the data |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
81 replication is used to simplify the internal algorithms for the dual mac architecture |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
82 of BlackFin. |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
83 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
84 All routines are exported with _ff_bfin_ as a symbol prefix |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
85 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
86 rough performance gain compared against -O3: |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
87 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
88 2779809/1484290 187.28% |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
89 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
90 which translates to ~33c/pel to ~57c/pel for the reference vs 17.5 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
91 c/pel for the optimized implementations. Not sure why there is such a |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
92 huge variation on the reference codes on Blackfin I guess it must have |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
93 to do with the memory system. |
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 */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
96 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
97 #define mL1 .l1.text |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
98 #define mL3 .text |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
99 #define MEM mL1 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
100 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
101 #define DEFUN(fname,where,interface) \ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
102 .section where; \ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
103 .global _ff_bfin_ ## fname; \ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
104 .type _ff_bfin_ ## fname, STT_FUNC; \ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
105 .align 8; \ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
106 _ff_bfin_ ## fname |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
107 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
108 #define DEFUN_END(fname) \ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
109 .size _ff_bfin_ ## fname, . - _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 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
112 .text |
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 #define COEFF_LEN 11*4 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
115 #define COEFF_REL_CY_OFF 4*4 |
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 ARG_OUT 20 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
118 #define ARG_W 24 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
119 #define ARG_COEFF 28 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
120 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
121 DEFUN(yuv2rgb565_line,MEM, |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
122 (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
|
123 link 0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
124 [--sp] = (r7:4); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
125 p1 = [fp+ARG_OUT]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
126 r3 = [fp+ARG_W]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
127 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
128 i0 = r0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
129 i2 = r1; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
130 i3 = r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
131 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
132 r0 = [fp+ARG_COEFF]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
133 i1 = r0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
134 b1 = i1; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
135 l1 = COEFF_LEN; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
136 m0 = COEFF_REL_CY_OFF; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
137 p0 = r3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
138 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
139 r0 = [i0++]; // 2Y |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
140 r1.l = w[i2++]; // 2u |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
141 r1.h = w[i3++]; // 2v |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
142 p0 = p0>>2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
143 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
144 lsetup (.L0565, .L1565) lc0 = p0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
145 |
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 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
|
148 r0 -- used to load 4ys |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
149 r1 -- used to load 2us,2vs |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
150 r4 -- y3,y2 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
151 r5 -- y1,y0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
152 r6 -- u1,u0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
153 r7 -- v1,v0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
154 */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
155 r2=[i1++]; // oy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
156 .L0565: |
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 rrrrrrrr gggggggg bbbbbbbb |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
159 5432109876543210 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
160 bbbbb >>3 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
161 gggggggg <<3 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
162 rrrrrrrr <<8 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
163 rrrrrggggggbbbbb |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
164 */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
165 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
166 (r7,r6) = byteop16m (r1:0, r3:2) (r); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
167 r5 = r5 << 2 (v); // y1,y0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
168 r4 = r4 << 2 (v); // y3,y2 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
169 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
170 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
171 /* Y' = y*cy */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
172 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
|
173 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
174 /* R = Y+ crv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
175 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
|
176 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
|
177 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
178 r2 = r2 >> 3 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
179 r3 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
180 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
181 /* B = Y+ cbu*(Cb-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
182 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
|
183 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
|
184 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
185 r2 = r2 << 8 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
186 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
187 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
188 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
189 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
190 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
|
191 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
|
192 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
|
193 r2 = r2 << 3 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
194 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
195 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
196 [p1++]=r3 || r1=[i1++]; // cy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
197 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
198 /* Y' = y*cy */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
199 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
200 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
|
201 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
202 /* R = Y+ crv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
203 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
|
204 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
|
205 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
206 r2 = r2 >> 3 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
207 r3 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
208 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
209 /* B = Y+ cbu*(Cb-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
210 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
|
211 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
|
212 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
213 r2 = r2 << 8 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
214 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
215 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
216 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
217 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
218 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
|
219 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
|
220 r2 = byteop3p(r3:2, r1:0)(LO) || r0 = [i0++]; // 2Y |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
221 r2 = r2 << 3 (v) || r1.l = w[i2++]; // 2u |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
222 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
223 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
224 [p1++]=r3 || r1.h = w[i3++]; // 2v |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
225 .L1565: r2=[i1++]; // oy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
226 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
227 l1 = 0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
228 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
229 (r7:4) = [sp++]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
230 unlink; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
231 rts; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
232 DEFUN_END(yuv2rgb565_line) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
233 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
234 DEFUN(yuv2rgb555_line,MEM, |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
235 (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
|
236 link 0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
237 [--sp] = (r7:4); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
238 p1 = [fp+ARG_OUT]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
239 r3 = [fp+ARG_W]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
240 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
241 i0 = r0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
242 i2 = r1; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
243 i3 = r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
244 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
245 r0 = [fp+ARG_COEFF]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
246 i1 = r0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
247 b1 = i1; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
248 l1 = COEFF_LEN; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
249 m0 = COEFF_REL_CY_OFF; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
250 p0 = r3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
251 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
252 r0 = [i0++]; // 2Y |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
253 r1.l = w[i2++]; // 2u |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
254 r1.h = w[i3++]; // 2v |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
255 p0 = p0>>2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
256 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
257 lsetup (.L0555, .L1555) lc0 = p0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
258 |
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 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
|
261 r0 -- used to load 4ys |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
262 r1 -- used to load 2us,2vs |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
263 r4 -- y3,y2 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
264 r5 -- y1,y0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
265 r6 -- u1,u0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
266 r7 -- v1,v0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
267 */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
268 r2=[i1++]; // oy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
269 .L0555: |
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 rrrrrrrr gggggggg bbbbbbbb |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
272 5432109876543210 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
273 bbbbb >>3 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
274 gggggggg <<2 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
275 rrrrrrrr <<7 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
276 xrrrrrgggggbbbbb |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
277 */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
278 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
279 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
280 (r7,r6) = byteop16m (r1:0, r3:2) (r); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
281 r5 = r5 << 2 (v); // y1,y0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
282 r4 = r4 << 2 (v); // y3,y2 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
283 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
284 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
285 /* Y' = y*cy */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
286 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
|
287 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
288 /* R = Y+ crv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
289 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
|
290 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
|
291 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
292 r2 = r2 >> 3 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
293 r3 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
294 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
295 /* B = Y+ cbu*(Cb-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
296 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
|
297 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
|
298 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
299 r2 = r2 << 7 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
300 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
301 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
302 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
303 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
304 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
|
305 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
|
306 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
|
307 r2 = r2 << 2 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
308 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
309 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
310 [p1++]=r3 || r1=[i1++]; // cy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
311 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
312 /* Y' = y*cy */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
313 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
314 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
|
315 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
316 /* R = Y+ crv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
317 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
|
318 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
|
319 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
320 r2 = r2 >> 3 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
321 r3 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
322 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
323 /* B = Y+ cbu*(Cb-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
324 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
|
325 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
|
326 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
327 r2 = r2 << 7 (v); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
328 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
329 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
330 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
331 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
332 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
|
333 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
|
334 r2 = byteop3p(r3:2, r1:0)(LO) || r0=[i0++]; // 4Y |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
335 r2 = r2 << 2 (v) || r1.l=w[i2++]; // 2u |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
336 r2 = r2 & r5; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
337 r3 = r3 | r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
338 [p1++]=r3 || r1.h=w[i3++]; // 2v |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
339 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
340 .L1555: r2=[i1++]; // oy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
341 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
342 l1 = 0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
343 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
344 (r7:4) = [sp++]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
345 unlink; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
346 rts; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
347 DEFUN_END(yuv2rgb555_line) |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
348 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
349 DEFUN(yuv2rgb24_line,MEM, |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
350 (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
|
351 link 0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
352 [--sp] = (r7:4); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
353 p1 = [fp+ARG_OUT]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
354 r3 = [fp+ARG_W]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
355 p2 = p1; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
356 p2 += 3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
357 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
358 i0 = r0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
359 i2 = r1; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
360 i3 = r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
361 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
362 r0 = [fp+ARG_COEFF]; // coeff buffer |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
363 i1 = r0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
364 b1 = i1; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
365 l1 = COEFF_LEN; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
366 m0 = COEFF_REL_CY_OFF; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
367 p0 = r3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
368 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
369 r0 = [i0++]; // 2Y |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
370 r1.l = w[i2++]; // 2u |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
371 r1.h = w[i3++]; // 2v |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
372 p0 = p0>>2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
373 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
374 lsetup (.L0888, .L1888) lc0 = p0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
375 |
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 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
|
378 r0 -- used to load 4ys |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
379 r1 -- used to load 2us,2vs |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
380 r4 -- y3,y2 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
381 r5 -- y1,y0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
382 r6 -- u1,u0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
383 r7 -- v1,v0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
384 */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
385 r2=[i1++]; // oy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
386 .L0888: |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
387 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
388 (r7,r6) = byteop16m (r1:0, r3:2) (r); |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
389 r5 = r5 << 2 (v); // y1,y0 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
390 r4 = r4 << 2 (v); // y3,y2 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
391 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
392 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
393 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
394 /* Y' = y*cy */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
395 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
|
396 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
397 /* R = Y+ crv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
398 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
|
399 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
|
400 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
401 r2=r2>>16 || B[p1++]=r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
402 B[p2++]=r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
403 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
404 /* B = Y+ cbu*(Cb-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
405 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
|
406 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
|
407 r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
408 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
409 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
410 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
|
411 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
|
412 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
|
413 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
414 r2=r2>>16 || B[p1++]=r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
415 B[p2++]=r2; |
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 r3=r3>>16 || B[p1++]=r3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
418 B[p2++]=r3 || r1=[i1++]; // cy |
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 p1+=3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
421 p2+=3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
422 /* Y' = y*cy */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
423 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
|
424 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
425 /* R = Y+ crv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
426 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
|
427 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
|
428 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
429 r2=r2>>16 || B[p1++]=r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
430 B[p2++]=r2; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
431 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
432 /* B = Y+ cbu*(Cb-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
433 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
|
434 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
|
435 r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
436 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
437 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */ |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
438 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
|
439 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
|
440 r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++]; // gmask |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
441 r2=r2>>16 || B[p1++]=r2 || r0 = [i0++]; // 4y |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
442 B[p2++]=r2 || r1.l = w[i2++]; // 2u |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
443 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
|
444 B[p2++]=r3 || r2=[i1++]; // oy |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
445 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
446 p1+=3; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
447 .L1888: p2+=3; |
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 l1 = 0; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
450 |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
451 (r7:4) = [sp++]; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
452 unlink; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
453 rts; |
786823779b67
Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff
changeset
|
454 DEFUN_END(yuv2rgb888_line) |
23327
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
455 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
456 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
457 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
458 #define ARG_vdst 20 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
459 #define ARG_width 24 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
460 #define ARG_height 28 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
461 #define ARG_lumStride 32 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
462 #define ARG_chromStride 36 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
463 #define ARG_srcStride 40 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
464 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
465 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
|
466 long width, long height, |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
467 long lumStride, long chromStride, long srcStride)): |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
468 link 0; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
469 [--sp] = (r7:4,p5:4); |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
470 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
471 p0 = r1; // Y top even |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
472 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
473 i2 = r2; // *u |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
474 r2 = [fp + ARG_vdst]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
475 i3 = r2; // *v |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
476 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
477 r1 = [fp + ARG_srcStride]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
478 r2 = r0 + r1; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
479 r1 += -16; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
480 m0 = r1; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
481 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
482 i0 = r0; // uyvy_T even |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
483 i1 = r2; // uyvy_B odd |
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 r2 = [fp + ARG_chromStride]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
486 m1 = r2; |
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 p2 += -4; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
491 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
492 p5 = [fp + ARG_width]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
493 p4 = [fp + ARG_height]; |
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 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
497 r6.l = w[i2--]; r6.l = w[i2]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
498 r6.h = w[i3--]; r6.h = w[i3]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
499 /* I0,I1 - src input line pointers |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
500 * p0,p1 - luma output line pointers |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
501 * I2 - dstU |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
502 * I3 - dstV |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
503 */ |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
504 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
505 lsetup (0f, 1f) lc0 = p4; |
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 0: lsetup (2f, 3f) lc1 = p5; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
508 r0 = [i0++] || r2 = [i1++]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
509 r1 = [i0++] || r3 = [i1++]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
510 2: r4 = byteop1p(r1:0, r3:2) || w[i2++] = r6.l; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
511 r5 = byteop1p(r1:0, r3:2) (r) || w[i3++] = r6.h; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
512 r0 = r0 >> 8(v); |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
513 r1 = r1 >> 8(v); |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
514 r2 = r2 >> 8(v); |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
515 r3 = r3 >> 8(v); |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
516 r0 = bytepack(r0, r1); |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
517 r2 = bytepack(r2, r3) || [p0++] = r0; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
518 r6 = pack(r5.l, r4.l) || [p1++] = r2; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
519 r7 = pack(r5.h, r4.h) || r0 = [i0++] || r2 = [i1++]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
520 3: r6 = bytepack(r6, r7) || r1 = [i0++] || r3 = [i1++]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
521 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
522 i0 += m0; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
523 i1 += m0; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
524 p0 = p0 + p2; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
525 1: p1 = p1 + p2; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
526 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
527 w[i2++] = r6.l; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
528 w[i3++] = r6.h; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
529 |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
530 (r7:4,p5:4) = [sp++]; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
531 unlink; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
532 rts; |
d7af89e69e92
Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents:
23289
diff
changeset
|
533 DEFUN_END(uyvytoyv12) |