diff options
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r-- | firmware/target/coldfire/iaudio/x5/lcd-as-x5.S | 476 |
1 files changed, 207 insertions, 269 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-as-x5.S b/firmware/target/coldfire/iaudio/x5/lcd-as-x5.S index 1a527bb8f3..7c89fb925e 100644 --- a/firmware/target/coldfire/iaudio/x5/lcd-as-x5.S +++ b/firmware/target/coldfire/iaudio/x5/lcd-as-x5.S | |||
@@ -40,316 +40,254 @@ | |||
40 | * |G| = |1.000000 -0.334136 -0.714136| |Pb| | 40 | * |G| = |1.000000 -0.334136 -0.714136| |Pb| |
41 | * |B| |1.000000 1.772000 0.000000| |Pr| | 41 | * |B| |1.000000 1.772000 0.000000| |Pr| |
42 | * Scaled, normalized, rounded and tweaked to yield RGB 666: | 42 | * Scaled, normalized, rounded and tweaked to yield RGB 666: |
43 | * |R| |74 0 102| |Y' - 16| / 256 | 43 | * |R| |74 0 101| |Y' - 16| / 256 |
44 | * |G| = |74 -25 -52| |Cb - 128| / 256 | 44 | * |G| = |74 -24 -51| |Cb - 128| / 256 |
45 | * |B| |74 129 0| |Cr - 128| / 256 | 45 | * |B| |74 128 0| |Cr - 128| / 256 |
46 | */ | 46 | */ |
47 | .align 2 | 47 | .align 2 |
48 | .global lcd_write_yuv420_lines | 48 | .global lcd_write_yuv420_lines |
49 | .type lcd_write_yuv420_lines,@function | 49 | .type lcd_write_yuv420_lines,@function |
50 | lcd_write_yuv420_lines: | 50 | lcd_write_yuv420_lines: |
51 | lea.l (-40,%sp),%sp /* free up some registers */ | 51 | lea.l (-36,%sp),%sp /* free up some registers */ |
52 | movem.l %d2-%d7/%a2-%a5,(%sp) | 52 | movem.l %d2-%d6/%a2-%a5,(%sp) |
53 | 53 | ||
54 | lea.l 0xf0008002,%a0 /* LCD data port */ | 54 | lea.l 0xf0008002,%a0 /* LCD data port */ |
55 | move.l (40+4,%sp),%a1 /* Y data */ | 55 | movem.l (36+4,%sp),%a1-%a5 /* Y data, Cb data, guv storage, Cr data, width */ |
56 | move.l (40+8,%sp),%a2 /* Cb data */ | 56 | lea.l (%a1,%a5),%a5 /* end address */ |
57 | move.l (40+12,%sp),%a3 /* guv storage */ | ||
58 | move.l (40+16,%sp),%a4 /* Cr data */ | ||
59 | move.l (40+20,%sp),%d0 /* width */ | ||
60 | lea.l (%a1,%d0.l),%a5 /* end address */ | ||
61 | 57 | ||
62 | .yuv_line_loop1: | 58 | .yuv_line_loop1: |
63 | /** Write first pixel **/ | 59 | /** Write first pixel **/ |
64 | clr.l %d1 /* get y component */ | 60 | clr.l %d1 /* get bu component */ |
65 | move.b (%a1)+,%d1 | 61 | move.b (%a2),%d1 |
66 | subq.l #8,%d1 | 62 | clr.l %d3 /* get rv component */ |
67 | subq.l #8,%d1 | 63 | move.b (%a4),%d3 |
68 | moveq.l #74,%d6 | 64 | moveq.l #-128,%d0 |
69 | muls.w %d6,%d1 | 65 | add.l %d0,%d1 |
70 | asr.l #8,%d1 | 66 | add.l %d0,%d3 |
71 | 67 | ||
72 | clr %d2 /* get bu component */ | 68 | move.l %d1,%d2 /* %d2 = cb component for guv */ |
73 | move.b (%a2),%d2 | 69 | asr.l #1,%d1 /* %d1 = 128 * (Cb - 128) / 256 */ |
74 | moveq.l #-128,%d6 | 70 | move.b %d1,(%a2)+ /* save bu for next line */ |
75 | add.l %d6,%d2 | 71 | moveq.l #-24,%d0 /* multiply first term of guv */ |
76 | move.l %d2,%d3 /* %d3 = cb component for guv */ | 72 | muls.w %d0,%d2 |
77 | move.w #129,%d6 | 73 | moveq.l #-51,%d0 /* multiply second term of guv */ |
78 | muls.w %d6,%d2 | 74 | muls.w %d3,%d0 |
75 | add.l %d0,%d2 | ||
79 | asr.l #8,%d2 | 76 | asr.l #8,%d2 |
80 | move.b %d2,(%a2)+ /* save bu for next line */ | 77 | move.b %d2,(%a3)+ /* save guv for next line */ |
81 | 78 | moveq.l #101,%d0 | |
82 | moveq.l #-25,%d6 /* multiply first term of guv */ | 79 | muls.w %d0,%d3 |
83 | muls.w %d6,%d3 | 80 | asr.l #8,%d3 |
84 | 81 | move.b %d3,(%a4)+ /* save rv for next line */ | |
85 | clr %d4 /* get rv component */ | 82 | |
86 | move.b (%a4),%d4 | 83 | clr.l %d4 /* get y component */ |
87 | moveq.l #-128,%d6 | 84 | move.b (%a1)+,%d4 |
88 | add.l %d6,%d4 | 85 | moveq.l #74,%d0 |
89 | move.l %d4,%d7 /* %d7 = cr component for guv */ | 86 | muls.w %d0,%d4 |
90 | moveq.l #102,%d6 | ||
91 | muls.w %d6,%d4 | ||
92 | asr.l #8,%d4 | 87 | asr.l #8,%d4 |
93 | move.b %d4,(%a4)+ /* save rv for next line */ | 88 | subq.l #4,%d4 |
89 | move.l %d4,%d5 | ||
90 | move.l %d4,%d6 | ||
91 | /* : %d4,%d5,%d6 = Y, %d1 = bu, %d2 = guv, %d3 = rv */ | ||
94 | 92 | ||
95 | moveq.l #-52,%d6 /* multiply second term of guv */ | 93 | add.l %d3,%d4 /* get r */ |
96 | muls.w %d6,%d7 | 94 | add.l %d2,%d5 /* get g */ |
97 | add.l %d7,%d3 | 95 | add.l %d1,%d6 /* get b */ |
98 | asr.l #8,%d3 | 96 | |
99 | move.b %d3,(%a3)+ /* save guv for next line */ | 97 | move.l %d6,%d0 /* is clamping needed? */ |
100 | /* : %d1 = Y, %d2 = bu, %d3 = guv, %d4 = rv */ | 98 | or.l %d5,%d0 |
101 | 99 | or.l %d4,%d0 | |
102 | move.l %d1,%d5 /* get r */ | 100 | asr.l #6,%d0 |
103 | add.l %d4,%d5 | ||
104 | move.l %d1,%d6 /* get g */ | ||
105 | add.l %d3,%d6 | ||
106 | move.l %d1,%d7 /* get b */ | ||
107 | add.l %d2,%d7 | ||
108 | |||
109 | move.l %d7,%d1 /* is clamping needed? */ | ||
110 | or.l %d6,%d1 | ||
111 | or.l %d5,%d1 | ||
112 | asr.l #6,%d1 | ||
113 | beq.b .yuv_no_clamp1 /* values in range: skip clamping */ | 101 | beq.b .yuv_no_clamp1 /* values in range: skip clamping */ |
114 | bpl.b .yuv_r63_test1 /* no negative values: skip to high bounds checks */ | 102 | moveq.l #63, %d0 |
115 | .yuv_r0_test1: | 103 | cmp.l %d0, %d4 |
116 | clr.l %d1 /* check for any values < 0 */ | 104 | bls.s .yuv_red_ok1 |
117 | cmp.l %d1,%d5 | 105 | spl.b %d4 |
118 | bgt.b .yuv_g0_test1 | 106 | and.l %d0, %d4 |
119 | clr.l %d5 | 107 | .yuv_red_ok1: |
120 | .yuv_g0_test1: | 108 | cmp.l %d0, %d5 |
121 | cmp.l %d1,%d6 | 109 | bls.s .yuv_green_ok1 |
122 | bgt.b .yuv_b0_test1 | 110 | spl.b %d5 |
123 | clr.l %d6 | 111 | and.l %d0, %d5 |
124 | .yuv_b0_test1: | 112 | .yuv_green_ok1: |
125 | cmp.l %d1,%d7 | 113 | cmp.l %d0, %d6 |
126 | bgt.b .yuv_r63_test1 | 114 | bls.s .yuv_blue_ok1 |
127 | clr.l %d7 | 115 | spl.b %d6 |
128 | .yuv_r63_test1: /* check for any values > 63 */ | 116 | and.l %d0, %d6 |
129 | moveq.l #63,%d1 | 117 | .yuv_blue_ok1: |
130 | cmp.l %d1,%d5 | ||
131 | blt.b .yuv_g63_test1 | ||
132 | move.l %d1,%d5 | ||
133 | .yuv_g63_test1: | ||
134 | cmp.l %d1,%d6 | ||
135 | blt.b .yuv_b63_test1 | ||
136 | move.l %d1,%d6 | ||
137 | .yuv_b63_test1: | ||
138 | cmp.l %d1,%d7 | ||
139 | blt.b .yuv_no_clamp1 | ||
140 | move.l %d1,%d7 | ||
141 | .yuv_no_clamp1: | 118 | .yuv_no_clamp1: |
142 | /* : %d5 = R, %d6 = G, %d7 = B */ | 119 | /* : %d4 = R, %d5 = G, %d6 = B */ |
143 | 120 | ||
144 | move.l %d6,%d1 /* save g for lower 9 bits */ | 121 | move.l %d5,%d0 /* save g for lower 9 bits */ |
145 | lsl.l #3,%d5 /* R << 3 */ | 122 | lsl.l #3,%d4 /* R << 3 */ |
146 | lsr.l #3,%d1 /* G >> 3 */ | 123 | lsr.l #3,%d0 /* G >> 3 */ |
147 | or.l %d5,%d1 | 124 | or.l %d4,%d0 |
148 | move.w %d1,(%a0) /* |00000000|000000000|0000000r|rrrrrggg| */ | 125 | move.w %d0,(%a0) /* |00000000|000000000|0000000r|rrrrrggg| */ |
149 | lsl.l #6,%d6 /* B << 6 */ | 126 | lsl.l #6,%d5 /* B << 6 */ |
150 | or.l %d6,%d7 /* |00000000|000000000|0000gggg|ggbbbbbb| */ | 127 | or.l %d5,%d6 /* |00000000|000000000|0000gggg|ggbbbbbb| */ |
151 | move.w %d7,(%a0) | 128 | move.w %d6,(%a0) |
152 | 129 | ||
153 | /** Write second pixel **/ | 130 | /** Write second pixel **/ |
154 | clr %d1 | ||
155 | move.b (%a1)+,%d1 /* get y component */ | ||
156 | subq.l #8,%d1 | ||
157 | subq.l #8,%d1 | ||
158 | moveq.l #74,%d6 | ||
159 | muls.w %d6,%d1 | ||
160 | asr.l #8,%d1 | ||
161 | /* : %d1 = Y, %d2 = bu, %d3 = guv, %d4 = rv */ | ||
162 | |||
163 | /* Add Y + each chroma component (can clobber %d2-%d4 values now) */ | ||
164 | add.l %d1,%d4 /* get r */ | ||
165 | add.l %d1,%d3 /* get g */ | ||
166 | add.l %d1,%d2 /* get b */ | ||
167 | |||
168 | move.l %d2,%d1 /* is clamping needed? */ | ||
169 | or.l %d3,%d1 | ||
170 | or.l %d4,%d1 | ||
171 | asr.l #6,%d1 | ||
172 | beq.b .yuv_no_clamp2 /* values in range: skip clamping */ | ||
173 | bpl.b .yuv_r63_test2 /* no negative values: skip to high bounds checks */ | ||
174 | .yuv_r0_test2: | ||
175 | clr.l %d1 /* check for any values < 0 */ | ||
176 | cmp.l %d1,%d4 | ||
177 | bgt.b .yuv_g0_test2 | ||
178 | clr.l %d4 | 131 | clr.l %d4 |
179 | .yuv_g0_test2: | 132 | move.b (%a1)+,%d4 /* get y component */ |
180 | cmp.l %d1,%d3 | 133 | moveq.l #74,%d0 |
181 | bgt.b .yuv_b0_test2 | 134 | muls.w %d0,%d4 |
182 | clr.l %d3 | 135 | asr.l #8,%d4 |
183 | .yuv_b0_test2: | 136 | subq.l #4,%d4 |
184 | cmp.l %d1,%d2 | 137 | /* : %d4 = Y, %d1 = bu, %d2 = guv, %d3 = rv */ |
185 | bgt.b .yuv_r63_test2 | 138 | |
186 | clr.l %d2 | 139 | /* Add Y + each chroma component (can clobber %d1-%d3 values now) */ |
187 | .yuv_r63_test2: /* check for any values > 63 */ | 140 | add.l %d4,%d3 /* get r */ |
188 | moveq.l #63,%d1 | 141 | add.l %d4,%d2 /* get g */ |
189 | cmp.l %d1,%d4 | 142 | add.l %d4,%d1 /* get b */ |
190 | blt.b .yuv_g63_test2 | 143 | |
191 | move.l %d1,%d4 | 144 | move.l %d1,%d0 /* is clamping needed? */ |
192 | .yuv_g63_test2: | 145 | or.l %d2,%d0 |
193 | cmp.l %d1,%d3 | 146 | or.l %d3,%d0 |
194 | blt.b .yuv_b63_test2 | 147 | asr.l #6,%d0 |
195 | move.l %d1,%d3 | 148 | beq.b .yuv_no_clamp2 /* values in range: skip clamping */ |
196 | .yuv_b63_test2: | 149 | moveq.l #63, %d0 |
197 | cmp.l %d1,%d2 | 150 | cmp.l %d0, %d3 |
198 | blt.b .yuv_no_clamp2 | 151 | bls.s .yuv_red_ok2 |
199 | move.l %d1,%d2 | 152 | spl.b %d3 |
153 | and.l %d0, %d3 | ||
154 | .yuv_red_ok2: | ||
155 | cmp.l %d0, %d2 | ||
156 | bls.s .yuv_green_ok2 | ||
157 | spl.b %d2 | ||
158 | and.l %d0, %d2 | ||
159 | .yuv_green_ok2: | ||
160 | cmp.l %d0, %d1 | ||
161 | bls.s .yuv_blue_ok2 | ||
162 | spl.b %d1 | ||
163 | and.l %d0, %d1 | ||
164 | .yuv_blue_ok2: | ||
200 | .yuv_no_clamp2: | 165 | .yuv_no_clamp2: |
201 | /* : %d4 = R, %d3 = G, %d2 = B */ | 166 | /* : %d3 = R, %d2 = G, %d1 = B */ |
202 | 167 | ||
203 | move.l %d3,%d1 /* save g for lower 9 bits */ | 168 | move.l %d2,%d0 /* save g for lower 9 bits */ |
204 | lsl.l #3,%d4 /* R << 3 */ | 169 | lsl.l #3,%d3 /* R << 3 */ |
205 | lsr.l #3,%d1 /* G >> 3 */ | 170 | lsr.l #3,%d0 /* G >> 3 */ |
206 | or.l %d4,%d1 /* |00000000|000000000|0000000r|rrrrrggg| */ | 171 | or.l %d3,%d0 /* |00000000|000000000|0000000r|rrrrrggg| */ |
172 | move.w %d0,(%a0) | ||
173 | lsl.l #6,%d2 /* G << 6 */ | ||
174 | or.l %d2,%d1 /* |00000000|000000000|0000gggg|ggbbbbbb| */ | ||
207 | move.w %d1,(%a0) | 175 | move.w %d1,(%a0) |
208 | lsl.l #6,%d3 /* G << 6 */ | ||
209 | or.l %d3,%d2 /* |00000000|000000000|0000gggg|ggbbbbbb| */ | ||
210 | move.w %d2,(%a0) | ||
211 | 176 | ||
212 | cmp.l %a1,%a5 /* run %a1 up to end of line */ | 177 | cmp.l %a1,%a5 /* run %a1 up to end of line */ |
213 | bhi.w .yuv_line_loop1 | 178 | bhi.w .yuv_line_loop1 |
214 | 179 | ||
215 | /* Rewind chroma pointers */ | 180 | /* Rewind chroma pointers */ |
216 | move.l (40+8,%sp),%a2 /* bu data */ | 181 | movem.l (36+8, %sp), %a2-%a5 /* bu data, guv data, rv data, width */ |
217 | move.l (40+12,%sp),%a3 /* guv data */ | 182 | lea.l (%a1, %a5), %a5 /* next end address */ |
218 | move.l (40+16,%sp),%a4 /* rv data */ | ||
219 | lea.l (%a5,%d0),%a5 /* next end address */ | ||
220 | 183 | ||
221 | .yuv_line_loop2: | 184 | .yuv_line_loop2: |
222 | clr %d1 | 185 | move.b (%a2)+,%d1 /* read save chromas and sign extend */ |
223 | move.b (%a1)+,%d1 /* get y component */ | 186 | extb.l %d1 |
224 | subq.l #8,%d1 | 187 | move.b (%a3)+,%d2 |
225 | subq.l #8,%d1 | ||
226 | moveq.l #74,%d6 | ||
227 | muls.w %d6,%d1 | ||
228 | asr.l #8,%d1 | ||
229 | |||
230 | move.b (%a2)+,%d2 /* read save chromas and sign extend */ | ||
231 | extb.l %d2 | 188 | extb.l %d2 |
232 | move.b (%a3)+,%d3 | 189 | move.b (%a4)+,%d3 |
233 | extb.l %d3 | 190 | extb.l %d3 |
234 | move.b (%a4)+,%d4 | 191 | |
235 | extb.l %d4 | 192 | clr.l %d4 |
236 | /* : %d1 = Y, %d2 = bu, %d3 = guv, %d4 = rv */ | 193 | move.b (%a1)+,%d4 /* get y component */ |
237 | 194 | moveq.l #74,%d0 | |
238 | move.l %d1,%d5 /* get r */ | 195 | muls.w %d0,%d4 |
239 | add.l %d4,%d5 | 196 | asr.l #8,%d4 |
240 | move.l %d1,%d6 /* get g */ | 197 | subq.l #4,%d4 |
241 | add.l %d3,%d6 | 198 | move.l %d4,%d5 |
242 | move.l %d1,%d7 /* get b */ | 199 | move.l %d4,%d6 |
243 | add.l %d2,%d7 | 200 | /* : %d4,%d5,%d6 = Y, %d1 = bu, %d2 = guv, %d3 = rv */ |
244 | 201 | ||
245 | move.l %d7,%d1 /* is clamping needed? */ | 202 | add.l %d3,%d4 /* get r */ |
246 | or.l %d6,%d1 | 203 | add.l %d2,%d5 /* get g */ |
247 | or.l %d5,%d1 | 204 | add.l %d1,%d6 /* get b */ |
248 | asr.l #6,%d1 | 205 | |
206 | move.l %d6,%d0 /* is clamping needed? */ | ||
207 | or.l %d5,%d0 | ||
208 | or.l %d4,%d0 | ||
209 | asr.l #6,%d0 | ||
249 | beq.b .yuv_no_clamp3 /* values in range: skip clamping */ | 210 | beq.b .yuv_no_clamp3 /* values in range: skip clamping */ |
250 | bpl.b .yuv_r63_test3 /* no negative values: skip to high bounds checks */ | 211 | moveq.l #63, %d0 |
251 | .yuv_r0_test3: | 212 | cmp.l %d0, %d4 |
252 | clr.l %d1 /* check for any values < 0 */ | 213 | bls.s .yuv_red_ok3 |
253 | cmp.l %d1,%d5 | 214 | spl.b %d4 |
254 | bgt.b .yuv_g0_test3 | 215 | and.l %d0, %d4 |
255 | clr.l %d5 | 216 | .yuv_red_ok3: |
256 | .yuv_g0_test3: | 217 | cmp.l %d0, %d5 |
257 | cmp.l %d1,%d6 | 218 | bls.s .yuv_green_ok3 |
258 | bgt.b .yuv_b0_test3 | 219 | spl.b %d5 |
259 | clr.l %d6 | 220 | and.l %d0, %d5 |
260 | .yuv_b0_test3: | 221 | .yuv_green_ok3: |
261 | cmp.l %d1,%d7 | 222 | cmp.l %d0, %d6 |
262 | bgt.b .yuv_r63_test3 | 223 | bls.s .yuv_blue_ok3 |
263 | clr.l %d7 | 224 | spl.b %d6 |
264 | .yuv_r63_test3: /* check for any values > 63 */ | 225 | and.l %d0, %d6 |
265 | moveq.l #63,%d1 | 226 | .yuv_blue_ok3: |
266 | cmp.l %d1,%d5 | ||
267 | blt.b .yuv_g63_test3 | ||
268 | move.l %d1,%d5 | ||
269 | .yuv_g63_test3: | ||
270 | cmp.l %d1,%d6 | ||
271 | blt.b .yuv_b63_test3 | ||
272 | move.l %d1,%d6 | ||
273 | .yuv_b63_test3: | ||
274 | cmp.l %d1,%d7 | ||
275 | blt.b .yuv_no_clamp3 | ||
276 | move.l %d1,%d7 | ||
277 | .yuv_no_clamp3: | 227 | .yuv_no_clamp3: |
278 | /* : %d5 = R, %d6 = G, %d7 = B */ | 228 | /* : %d4 = R, %d5 = G, %d6 = B */ |
279 | 229 | ||
280 | move.l %d6,%d1 /* save g for lower 9 bits */ | 230 | move.l %d5,%d0 /* save g for lower 9 bits */ |
281 | lsl.l #3,%d5 /* R << 3 */ | 231 | lsl.l #3,%d4 /* R << 3 */ |
282 | lsr.l #3,%d1 /* G >> 3 */ | 232 | lsr.l #3,%d0 /* G >> 3 */ |
283 | or.l %d5,%d1 | 233 | or.l %d4,%d0 |
284 | move.w %d1,(%a0) /* |00000000|000000000|0000000r|rrrrrggg| */ | 234 | move.w %d0,(%a0) /* |00000000|000000000|0000000r|rrrrrggg| */ |
285 | lsl.l #6,%d6 /* B << 6 */ | 235 | lsl.l #6,%d5 /* B << 6 */ |
286 | or.l %d6,%d7 /* |00000000|000000000|0000gggg|ggbbbbbb| */ | 236 | or.l %d5,%d6 /* |00000000|000000000|0000gggg|ggbbbbbb| */ |
287 | move.w %d7,(%a0) | 237 | move.w %d6,(%a0) |
288 | 238 | ||
289 | /** Write second pixel **/ | 239 | /** Write second pixel **/ |
290 | clr %d1 | ||
291 | move.b (%a1)+,%d1 /* get y component */ | ||
292 | subq.l #8,%d1 | ||
293 | subq.l #8,%d1 | ||
294 | moveq.l #74,%d6 | ||
295 | muls.w %d6,%d1 | ||
296 | asr.l #8,%d1 | ||
297 | /* : %d1 = Y, %d2 = bu, %d3 = guv, %d4 = rv */ | ||
298 | |||
299 | /* Add Y + each chroma component (can clobber %d2-%d4 values now) */ | ||
300 | add.l %d1,%d4 /* get r */ | ||
301 | add.l %d1,%d3 /* get g */ | ||
302 | add.l %d1,%d2 /* get b */ | ||
303 | |||
304 | move.l %d2,%d1 /* is clamping needed? */ | ||
305 | or.l %d3,%d1 | ||
306 | or.l %d4,%d1 | ||
307 | asr.l #6,%d1 | ||
308 | beq.b .yuv_no_clamp4 /* values in range: skip clamping */ | ||
309 | bpl.b .yuv_r63_test4 /* no negative values: skip to high bounds checks */ | ||
310 | .yuv_r0_test4: | ||
311 | clr.l %d1 /* check for any values < 0 */ | ||
312 | cmp.l %d1,%d4 | ||
313 | bgt.b .yuv_g0_test4 | ||
314 | clr.l %d4 | 240 | clr.l %d4 |
315 | .yuv_g0_test4: | 241 | move.b (%a1)+,%d4 /* get y component */ |
316 | cmp.l %d1,%d3 | 242 | moveq.l #74,%d0 |
317 | bgt.b .yuv_b0_test4 | 243 | muls.w %d0,%d4 |
318 | clr.l %d3 | 244 | asr.l #8,%d4 |
319 | .yuv_b0_test4: | 245 | subq.l #4,%d4 |
320 | cmp.l %d1,%d2 | 246 | /* : %d4 = Y, %d1 = bu, %d2 = guv, %d3 = rv */ |
321 | bgt.b .yuv_r63_test4 | 247 | |
322 | clr.l %d2 | 248 | /* Add Y + each chroma component (can clobber %d1-%d3 values now) */ |
323 | .yuv_r63_test4: /* check for any values > 63 */ | 249 | add.l %d4,%d3 /* get r */ |
324 | moveq.l #63,%d1 | 250 | add.l %d4,%d2 /* get g */ |
325 | cmp.l %d1,%d4 | 251 | add.l %d4,%d1 /* get b */ |
326 | blt.b .yuv_g63_test4 | 252 | |
327 | move.l %d1,%d4 | 253 | move.l %d1,%d0 /* is clamping needed? */ |
328 | .yuv_g63_test4: | 254 | or.l %d2,%d0 |
329 | cmp.l %d1,%d3 | 255 | or.l %d3,%d0 |
330 | blt.b .yuv_b63_test4 | 256 | asr.l #6,%d0 |
331 | move.l %d1,%d3 | 257 | beq.b .yuv_no_clamp4 /* values in range: skip clamping */ |
332 | .yuv_b63_test4: | 258 | moveq.l #63, %d0 |
333 | cmp.l %d1,%d2 | 259 | cmp.l %d0, %d3 |
334 | blt.b .yuv_no_clamp4 | 260 | bls.s .yuv_red_ok4 |
335 | move.l %d1,%d2 | 261 | spl.b %d3 |
262 | and.l %d0, %d3 | ||
263 | .yuv_red_ok4: | ||
264 | cmp.l %d0, %d2 | ||
265 | bls.s .yuv_green_ok4 | ||
266 | spl.b %d2 | ||
267 | and.l %d0, %d2 | ||
268 | .yuv_green_ok4: | ||
269 | cmp.l %d0, %d1 | ||
270 | bls.s .yuv_blue_ok4 | ||
271 | spl.b %d1 | ||
272 | and.l %d0, %d1 | ||
273 | .yuv_blue_ok4: | ||
336 | .yuv_no_clamp4: | 274 | .yuv_no_clamp4: |
337 | /* : %d4 = R, %d3 = G, %d2 = B */ | 275 | /* : %d3 = R, %d2 = G, %d1 = B */ |
338 | 276 | ||
339 | move.l %d3,%d1 /* save g for lower 9 bits */ | 277 | move.l %d2,%d0 /* save g for lower 9 bits */ |
340 | lsl.l #3,%d4 /* R << 3 */ | 278 | lsl.l #3,%d3 /* R << 3 */ |
341 | lsr.l #3,%d1 /* G >> 3 */ | 279 | lsr.l #3,%d0 /* G >> 3 */ |
342 | or.l %d4,%d1 /* |00000000|000000000|0000000r|rrrrrggg| */ | 280 | or.l %d3,%d0 /* |00000000|000000000|0000000r|rrrrrggg| */ |
281 | move.w %d0,(%a0) | ||
282 | lsl.l #6,%d2 /* G << 6 */ | ||
283 | or.l %d2,%d1 /* |00000000|000000000|0000gggg|ggbbbbbb| */ | ||
343 | move.w %d1,(%a0) | 284 | move.w %d1,(%a0) |
344 | lsl.l #6,%d3 /* G << 6 */ | ||
345 | or.l %d3,%d2 /* |00000000|000000000|0000gggg|ggbbbbbb| */ | ||
346 | move.w %d2,(%a0) | ||
347 | 285 | ||
348 | cmp.l %a1,%a5 /* run %a0 up to end of line */ | 286 | cmp.l %a1,%a5 /* run %a0 up to end of line */ |
349 | bhi.w .yuv_line_loop2 | 287 | bhi.w .yuv_line_loop2 |
350 | 288 | ||
351 | movem.l (%sp),%d2-%d7/%a2-%a5 | 289 | movem.l (%sp),%d2-%d6/%a2-%a5 |
352 | lea.l (40,%sp),%sp /* restore registers */ | 290 | lea.l (36,%sp),%sp /* restore registers */ |
353 | 291 | ||
354 | rts | 292 | rts |
355 | /* end lcd_write_yuv420_lines */ | 293 | /* end lcd_write_yuv420_lines */ |