annotate libswscale/internal_bfin.S @ 26657:6c9312893275

Add paragraph about homepage translation.
author diego
date Thu, 08 May 2008 00:14:18 +0000
parents a8ff60976ccb
children 23f1738030fc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
25959
diego
parents: 23811
diff changeset
40 New factorization to eliminate the truncation error which was
23289
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
25978
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 25959
diff changeset
97 #define mL3 .text
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 25959
diff changeset
98 #ifdef __FDPIC__
23289
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
99 #define mL1 .l1.text
25978
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 25959
diff changeset
100 #else
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 25959
diff changeset
101 #define mL1 mL3
a8ff60976ccb FLAT objects cannot have multiple sections, so using the L1 attributes breaks
diego
parents: 25959
diff changeset
102 #endif
23289
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
103 #define MEM mL1
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
104
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
105 #define DEFUN(fname,where,interface) \
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
106 .section where; \
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
107 .global _ff_bfin_ ## fname; \
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
108 .type _ff_bfin_ ## fname, STT_FUNC; \
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
109 .align 8; \
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
110 _ff_bfin_ ## fname
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 #define DEFUN_END(fname) \
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
113 .size _ff_bfin_ ## fname, . - _ff_bfin_ ## fname
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
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
116 .text
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
117
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
118 #define COEFF_LEN 11*4
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
119 #define COEFF_REL_CY_OFF 4*4
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 #define ARG_OUT 20
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
122 #define ARG_W 24
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
123 #define ARG_COEFF 28
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
124
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
125 DEFUN(yuv2rgb565_line,MEM,
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
126 (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
127 link 0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
128 [--sp] = (r7:4);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
129 p1 = [fp+ARG_OUT];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
130 r3 = [fp+ARG_W];
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 i0 = r0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
133 i2 = r1;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
134 i3 = r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
135
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
136 r0 = [fp+ARG_COEFF];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
137 i1 = r0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
138 b1 = i1;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
139 l1 = COEFF_LEN;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
140 m0 = COEFF_REL_CY_OFF;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
141 p0 = r3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
142
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
143 r0 = [i0++]; // 2Y
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
144 r1.l = w[i2++]; // 2u
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
145 r1.h = w[i3++]; // 2v
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
146 p0 = p0>>2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
147
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
148 lsetup (.L0565, .L1565) lc0 = p0;
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 /*
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
151 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
152 r0 -- used to load 4ys
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
153 r1 -- used to load 2us,2vs
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
154 r4 -- y3,y2
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
155 r5 -- y1,y0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
156 r6 -- u1,u0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
157 r7 -- v1,v0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
158 */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
159 r2=[i1++]; // oy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
160 .L0565:
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
161 /*
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
162 rrrrrrrr gggggggg bbbbbbbb
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
163 5432109876543210
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
164 bbbbb >>3
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
165 gggggggg <<3
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
166 rrrrrrrr <<8
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
167 rrrrrggggggbbbbb
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
168 */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
169 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
170 (r7,r6) = byteop16m (r1:0, r3:2) (r);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
171 r5 = r5 << 2 (v); // y1,y0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
172 r4 = r4 << 2 (v); // y3,y2
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
173 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
174 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
175 /* Y' = y*cy */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
176 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
177
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
178 /* R = Y+ crv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
179 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
180 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
181 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
182 r2 = r2 >> 3 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
183 r3 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
184
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
185 /* B = Y+ cbu*(Cb-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
186 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
187 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
188 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
189 r2 = r2 << 8 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
190 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
191 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
192
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
193 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
194 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
195 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
196 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
197 r2 = r2 << 3 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
198 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
199 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
200 [p1++]=r3 || r1=[i1++]; // cy
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 /* Y' = y*cy */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
203
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
204 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
205
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
206 /* R = Y+ crv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
207 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
208 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
209 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
210 r2 = r2 >> 3 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
211 r3 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
212
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
213 /* B = Y+ cbu*(Cb-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
214 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
215 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
216 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
217 r2 = r2 << 8 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
218 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
219 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
220
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
221 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
222 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
223 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
224 r2 = byteop3p(r3:2, r1:0)(LO) || r0 = [i0++]; // 2Y
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
225 r2 = r2 << 3 (v) || r1.l = w[i2++]; // 2u
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
226 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
227 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
228 [p1++]=r3 || r1.h = w[i3++]; // 2v
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
229 .L1565: r2=[i1++]; // oy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
230
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
231 l1 = 0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
232
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
233 (r7:4) = [sp++];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
234 unlink;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
235 rts;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
236 DEFUN_END(yuv2rgb565_line)
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
237
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
238 DEFUN(yuv2rgb555_line,MEM,
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
239 (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
240 link 0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
241 [--sp] = (r7:4);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
242 p1 = [fp+ARG_OUT];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
243 r3 = [fp+ARG_W];
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 i0 = r0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
246 i2 = r1;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
247 i3 = r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
248
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
249 r0 = [fp+ARG_COEFF];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
250 i1 = r0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
251 b1 = i1;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
252 l1 = COEFF_LEN;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
253 m0 = COEFF_REL_CY_OFF;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
254 p0 = r3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
255
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
256 r0 = [i0++]; // 2Y
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
257 r1.l = w[i2++]; // 2u
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
258 r1.h = w[i3++]; // 2v
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
259 p0 = p0>>2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
260
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
261 lsetup (.L0555, .L1555) lc0 = p0;
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 /*
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
264 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
265 r0 -- used to load 4ys
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
266 r1 -- used to load 2us,2vs
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
267 r4 -- y3,y2
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
268 r5 -- y1,y0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
269 r6 -- u1,u0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
270 r7 -- v1,v0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
271 */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
272 r2=[i1++]; // oy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
273 .L0555:
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
274 /*
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
275 rrrrrrrr gggggggg bbbbbbbb
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
276 5432109876543210
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
277 bbbbb >>3
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
278 gggggggg <<2
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
279 rrrrrrrr <<7
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
280 xrrrrrgggggbbbbb
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
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
283 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
284 (r7,r6) = byteop16m (r1:0, r3:2) (r);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
285 r5 = r5 << 2 (v); // y1,y0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
286 r4 = r4 << 2 (v); // y3,y2
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
287 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
288 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
289 /* Y' = y*cy */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
290 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
291
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
292 /* R = Y+ crv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
293 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
294 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
295 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
296 r2 = r2 >> 3 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
297 r3 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
298
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
299 /* B = Y+ cbu*(Cb-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
300 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
301 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
302 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
303 r2 = r2 << 7 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
304 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
305 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
306
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
307 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
308 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
309 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
310 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
311 r2 = r2 << 2 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
312 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
313 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
314 [p1++]=r3 || r1=[i1++]; // cy
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 /* Y' = y*cy */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
317
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
318 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
319
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
320 /* R = Y+ crv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
321 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
322 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
323 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
324 r2 = r2 >> 3 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
325 r3 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
326
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
327 /* B = Y+ cbu*(Cb-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
328 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
329 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
330 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
331 r2 = r2 << 7 (v);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
332 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
333 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
334
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
335 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
336 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
337 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
338 r2 = byteop3p(r3:2, r1:0)(LO) || r0=[i0++]; // 4Y
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
339 r2 = r2 << 2 (v) || r1.l=w[i2++]; // 2u
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
340 r2 = r2 & r5;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
341 r3 = r3 | r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
342 [p1++]=r3 || r1.h=w[i3++]; // 2v
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 .L1555: r2=[i1++]; // oy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
345
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
346 l1 = 0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
347
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
348 (r7:4) = [sp++];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
349 unlink;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
350 rts;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
351 DEFUN_END(yuv2rgb555_line)
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
352
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
353 DEFUN(yuv2rgb24_line,MEM,
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
354 (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
355 link 0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
356 [--sp] = (r7:4);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
357 p1 = [fp+ARG_OUT];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
358 r3 = [fp+ARG_W];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
359 p2 = p1;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
360 p2 += 3;
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 i0 = r0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
363 i2 = r1;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
364 i3 = r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
365
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
366 r0 = [fp+ARG_COEFF]; // coeff buffer
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
367 i1 = r0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
368 b1 = i1;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
369 l1 = COEFF_LEN;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
370 m0 = COEFF_REL_CY_OFF;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
371 p0 = r3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
372
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
373 r0 = [i0++]; // 2Y
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
374 r1.l = w[i2++]; // 2u
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
375 r1.h = w[i3++]; // 2v
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
376 p0 = p0>>2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
377
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
378 lsetup (.L0888, .L1888) lc0 = p0;
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 /*
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
381 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
382 r0 -- used to load 4ys
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
383 r1 -- used to load 2us,2vs
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
384 r4 -- y3,y2
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
385 r5 -- y1,y0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
386 r6 -- u1,u0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
387 r7 -- v1,v0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
388 */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
389 r2=[i1++]; // oy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
390 .L0888:
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
391 (r4,r5) = byteop16m (r1:0, r3:2) || r3=[i1++]; // oc
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
392 (r7,r6) = byteop16m (r1:0, r3:2) (r);
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
393 r5 = r5 << 2 (v); // y1,y0
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
394 r4 = r4 << 2 (v); // y3,y2
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
395 r6 = r6 << 2 (v) || r0=[i1++]; // u1,u0, r0=zero
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
396 r7 = r7 << 2 (v) || r1=[i1++]; // v1,v0 r1=cy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
397
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
398 /* Y' = y*cy */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
399 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
400
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
401 /* R = Y+ crv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
402 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
403 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
404 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
405 r2=r2>>16 || B[p1++]=r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
406 B[p2++]=r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
407
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
408 /* B = Y+ cbu*(Cb-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
409 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
410 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
411 r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
412
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
413 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
414 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
415 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
416 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
417
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
418 r2=r2>>16 || B[p1++]=r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
419 B[p2++]=r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
420
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
421 r3=r3>>16 || B[p1++]=r3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
422 B[p2++]=r3 || r1=[i1++]; // cy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
423
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
424 p1+=3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
425 p2+=3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
426 /* Y' = y*cy */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
427 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
428
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
429 /* R = Y+ crv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
430 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
431 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
432 r2 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cbu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
433 r2=r2>>16 || B[p1++]=r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
434 B[p2++]=r2;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
435
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
436 /* B = Y+ cbu*(Cb-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
437 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
438 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
439 r3 = byteop3p(r3:2, r1:0)(LO) || r1=[i1++]; // cgu
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
440
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
441 /* G = Y+ cgu*(Cb-128)+cgv*(Cr-128) */
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
442 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
443 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
444 r2 = byteop3p(r3:2, r1:0)(LO) || r5=[i1++]; // gmask
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
445 r2=r2>>16 || B[p1++]=r2 || r0 = [i0++]; // 4y
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
446 B[p2++]=r2 || r1.l = w[i2++]; // 2u
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
447 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
448 B[p2++]=r3 || r2=[i1++]; // oy
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
449
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
450 p1+=3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
451 .L1888: p2+=3;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
452
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
453 l1 = 0;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
454
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
455 (r7:4) = [sp++];
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
456 unlink;
786823779b67 Blackfin optimized YUV420 to RGB CSC Color Space Converters.
gpoirier
parents:
diff changeset
457 rts;
23454
2d5b7c795a60 correcting spelling error, yuv2rgb888_line was renamed to yuv2rgb24_line
mhoffman
parents: 23327
diff changeset
458 DEFUN_END(yuv2rgb24_line)
23327
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
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
462 #define ARG_vdst 20
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
463 #define ARG_width 24
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
464 #define ARG_height 28
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
465 #define ARG_lumStride 32
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
466 #define ARG_chromStride 36
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
467 #define ARG_srcStride 40
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
468
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
469 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
470 long width, long height,
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
471 long lumStride, long chromStride, long srcStride)):
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
472 link 0;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
473 [--sp] = (r7:4,p5:4);
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
474
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
475 p0 = r1; // Y top even
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 i2 = r2; // *u
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
478 r2 = [fp + ARG_vdst];
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
479 i3 = r2; // *v
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
480
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
481 r1 = [fp + ARG_srcStride];
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
482 r2 = r0 + r1;
23583
9d5a291f1873 document pointer offset by -8
mhoffman
parents: 23582
diff changeset
483 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
484 m0 = r1;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
485
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
486 i0 = r0; // uyvy_T even
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
487 i1 = r2; // uyvy_B odd
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
488
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
489 p2 = [fp + ARG_lumStride];
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
490 p1 = p0 + p2; // Y bot odd
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];
23581
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
494 r0 = p5;
23327
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
495 p4 = p4 >> 1;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
496 p5 = p5 >> 2;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
497
23581
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
498 r2 = [fp + ARG_chromStride];
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
499 r0 = r0 >> 1;
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
500 r2 = r2 - r0;
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
501 m1 = r2;
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
502
23327
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
503 /* I0,I1 - src input line pointers
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
504 * p0,p1 - luma output line pointers
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
505 * I2 - dstU
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
506 * I3 - dstV
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
507 */
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
508
23582
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
509 lsetup (0f, 1f) lc1 = p4; // H/2
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
510 0: r0 = [i0++] || r2 = [i1++];
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
511 r1 = [i0++] || r3 = [i1++];
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
512 r4 = byteop1p(r1:0, r3:2);
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
513 r5 = byteop1p(r1:0, r3:2) (r);
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
514 lsetup (2f, 3f) lc0 = p5; // W/4
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
515 2: r0 = r0 >> 8(v);
23327
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
516 r1 = r1 >> 8(v);
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
517 r2 = r2 >> 8(v);
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
518 r3 = r3 >> 8(v);
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
519 r0 = bytepack(r0, r1);
23582
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
520 r2 = bytepack(r2, r3) || [p0++] = r0; // yyyy
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
521 r6 = pack(r5.l, r4.l) || [p1++] = r2; // yyyy
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
522 r7 = pack(r5.h, r4.h) || r0 = [i0++] || r2 = [i1++];
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
523 r6 = bytepack(r6, r7) || r1 = [i0++] || r3 = [i1++];
c73cc80ec43a re pipeline loop, to eliminate extra chroma reads
mhoffman
parents: 23581
diff changeset
524 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
525 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
526
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
527 i0 += m0;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
528 i1 += m0;
23581
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
529 i2 += m1;
58deb214b955 correct chroma skewing bug, caused by incorrect stride adjustments
mhoffman
parents: 23454
diff changeset
530 i3 += m1;
23327
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
531 p0 = p0 + p2;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
532 1: p1 = p1 + p2;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
533
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
534 (r7:4,p5:4) = [sp++];
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
535 unlink;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
536 rts;
d7af89e69e92 Blackfin optimized uyvytoyv12 routine. the implementation includes chroma averaging.
mhoffman
parents: 23289
diff changeset
537 DEFUN_END(uyvytoyv12)
23811
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
538
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
539 DEFUN(yuyvtoyv12, mL3, (const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst,
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
540 long width, long height,
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
541 long lumStride, long chromStride, long srcStride)):
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
542 link 0;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
543 [--sp] = (r7:4,p5:4);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
544
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
545 p0 = r1; // Y top even
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
546
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
547 i2 = r2; // *u
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
548 r2 = [fp + ARG_vdst];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
549 i3 = r2; // *v
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
550
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
551 r1 = [fp + ARG_srcStride];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
552 r2 = r0 + r1;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
553 r1 += -8; // i0,i1 is pre read need to correct
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
554 m0 = r1;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
555
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
556 i0 = r0; // uyvy_T even
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
557 i1 = r2; // uyvy_B odd
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
558
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
559 p2 = [fp + ARG_lumStride];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
560 p1 = p0 + p2; // Y bot odd
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
561
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
562 p5 = [fp + ARG_width];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
563 p4 = [fp + ARG_height];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
564 r0 = p5;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
565 p4 = p4 >> 1;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
566 p5 = p5 >> 2;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
567
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
568 r2 = [fp + ARG_chromStride];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
569 r0 = r0 >> 1;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
570 r2 = r2 - r0;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
571 m1 = r2;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
572
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
573 /* I0,I1 - src input line pointers
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
574 * p0,p1 - luma output line pointers
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
575 * I2 - dstU
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
576 * I3 - dstV
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
577 */
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
578
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
579 lsetup (0f, 1f) lc1 = p4; // H/2
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
580 0: r0 = [i0++] || r2 = [i1++];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
581 r1 = [i0++] || r3 = [i1++];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
582 r4 = bytepack(r0, r1);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
583 r5 = bytepack(r2, r3);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
584 lsetup (2f, 3f) lc0 = p5; // W/4
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
585 2: r0 = r0 >> 8(v) || [p0++] = r4; // yyyy-even
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
586 r1 = r1 >> 8(v) || [p1++] = r5; // yyyy-odd
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
587 r2 = r2 >> 8(v);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
588 r3 = r3 >> 8(v);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
589 r4 = byteop1p(r1:0, r3:2);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
590 r5 = byteop1p(r1:0, r3:2) (r);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
591 r6 = pack(r5.l, r4.l);
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
592 r7 = pack(r5.h, r4.h) || r0 = [i0++] || r2 = [i1++];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
593 r6 = bytepack(r6, r7) || r1 = [i0++] || r3 = [i1++];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
594 r4 = bytepack(r0, r1) || w[i2++] = r6.l; // uu
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
595 3: r5 = bytepack(r2, r3) || w[i3++] = r6.h; // vv
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
596
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
597 i0 += m0;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
598 i1 += m0;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
599 i2 += m1;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
600 i3 += m1;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
601 p0 = p0 + p2;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
602 1: p1 = p1 + p2;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
603
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
604 (r7:4,p5:4) = [sp++];
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
605 unlink;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
606 rts;
e801b7c0cbc6 adding blackfin optimized yuyvtoyv12 converter
mhoffman
parents: 23583
diff changeset
607 DEFUN_END(yuyvtoyv12)