diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-03 10:17:41 +0100 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-10-03 13:30:01 +0100 |
commit | fe6aa21e9eb88f49005863efd2003d0982920048 (patch) | |
tree | 11ffde0fdde131f39145542506cf9020dcf384d3 /firmware/target/arm/s5l8700/ipodnano2g | |
parent | b371ff1f4758f6781e2b89f86bd8e65b8585f56e (diff) | |
download | rockbox-fe6aa21e9eb88f49005863efd2003d0982920048.tar.gz rockbox-fe6aa21e9eb88f49005863efd2003d0982920048.zip |
Remove YUV blitting functions and LCD modes
None of this is needed now that mpegplayer is gone.
Change-Id: I360366db8513e4d988021e8d7b7d8eb09930efb8
Diffstat (limited to 'firmware/target/arm/s5l8700/ipodnano2g')
-rw-r--r-- | firmware/target/arm/s5l8700/ipodnano2g/lcd-asm-nano2g.S | 228 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 33 |
2 files changed, 0 insertions, 261 deletions
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-asm-nano2g.S b/firmware/target/arm/s5l8700/ipodnano2g/lcd-asm-nano2g.S index af338eef16..50104a73e8 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-asm-nano2g.S +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-asm-nano2g.S | |||
@@ -65,231 +65,3 @@ lcd_write_line: /* r2 = LCD_BASE */ | |||
65 | bgt .loop | 65 | bgt .loop |
66 | 66 | ||
67 | ldmpc regs=r4-r6 | 67 | ldmpc regs=r4-r6 |
68 | |||
69 | /**************************************************************************** | ||
70 | * extern void lcd_write_yuv420_lines(unsigned char const * const src[3], | ||
71 | * const unsigned LCD_BASE, | ||
72 | * int width, | ||
73 | * int stride); | ||
74 | * | ||
75 | * Conversion from Motion JPEG and MPEG Y'PbPr to RGB is: | ||
76 | * |R| |1.164 0.000 1.596| |Y' - 16| | ||
77 | * |G| = |1.164 -0.391 -0.813| |Pb - 128| | ||
78 | * |B| |1.164 2.018 0.000| |Pr - 128| | ||
79 | * | ||
80 | * Scaled, normalized, rounded and tweaked to yield RGB 565: | ||
81 | * |R| |74 0 101| |Y' - 16| >> 9 | ||
82 | * |G| = |74 -24 -51| |Cb - 128| >> 8 | ||
83 | * |B| |74 128 0| |Cr - 128| >> 9 | ||
84 | * | ||
85 | * Converts two lines from YUV to RGB565 and writes to LCD at once. First loop | ||
86 | * loads Cb/Cr, calculates the chroma offset and saves them to buffer. Within | ||
87 | * the second loop these chroma offset are reloaded from buffer. Within each | ||
88 | * loop two pixels are calculated and written to LCD. | ||
89 | */ | ||
90 | .align 2 | ||
91 | .global lcd_write_yuv420_lines | ||
92 | .type lcd_write_yuv420_lines, %function | ||
93 | lcd_write_yuv420_lines: | ||
94 | /* r0 = src = yuv_src */ | ||
95 | /* r1 = dst = LCD_BASE */ | ||
96 | /* r2 = width */ | ||
97 | /* r3 = stride */ | ||
98 | stmfd sp!, { r4-r10, lr } /* save non-scratch */ | ||
99 | ldmia r0, { r9, r10, r12 } /* r9 = yuv_src[0] = Y'_p */ | ||
100 | /* r10 = yuv_src[1] = Cb_p */ | ||
101 | /* r12 = yuv_src[2] = Cr_p */ | ||
102 | add r3, r9, r3 /* r3 = &ysrc[stride] */ | ||
103 | add r4, r2, r2, asr #1 /* chroma buffer lenght = width/2 *3 */ | ||
104 | mov r4, r4, asl #2 /* use words for str/ldm possibility */ | ||
105 | add r4, r4, #19 /* plus room for 4 additional words, */ | ||
106 | bic r4, r4, #3 /* rounded up to multiples of 4 byte */ | ||
107 | sub sp, sp, r4 /* and allocate on stack */ | ||
108 | stmia sp, {r1-r4} /* LCD_BASE, width, &ysrc[stride], stack_alloc */ | ||
109 | |||
110 | mov r7, r2 /* r7 = loop count */ | ||
111 | add r8, sp, #16 /* chroma buffer */ | ||
112 | add lr, r1, #0x40 /* LCD data port = LCD_BASE + 0x40 */ | ||
113 | |||
114 | /* 1st loop start */ | ||
115 | 10: /* loop start */ | ||
116 | |||
117 | ldrb r0, [r10], #1 /* r0 = *usrc++ = *Cb_p++ */ | ||
118 | ldrb r1, [r12], #1 /* r1 = *vsrc++ = *Cr_p++ */ | ||
119 | |||
120 | sub r0, r0, #128 /* r0 = Cb-128 */ | ||
121 | sub r1, r1, #128 /* r1 = Cr-128 */ | ||
122 | |||
123 | add r2, r1, r1, asl #1 /* r2 = Cr*51 + Cb*24 */ | ||
124 | add r2, r2, r2, asl #4 | ||
125 | add r2, r2, r0, asl #3 | ||
126 | add r2, r2, r0, asl #4 | ||
127 | |||
128 | add r4, r1, r1, asl #2 /* r1 = Cr*101 */ | ||
129 | add r4, r4, r1, asl #5 | ||
130 | add r1, r4, r1, asl #6 | ||
131 | |||
132 | add r1, r1, #256 /* r1 = rv = (r1 + 256) >> 9 */ | ||
133 | mov r1, r1, asr #9 | ||
134 | rsb r2, r2, #128 /* r2 = guv = (-r2 + 128) >> 8 */ | ||
135 | mov r2, r2, asr #8 | ||
136 | add r0, r0, #2 /* r0 = bu = (Cb*128 + 256) >> 9 */ | ||
137 | mov r0, r0, asr #2 | ||
138 | stmia r8!, {r0-r2} /* store r0, r1 and r2 to chroma buffer */ | ||
139 | |||
140 | /* 1st loop, first pixel */ | ||
141 | ldrb r5, [r9], #1 /* r5 = *ysrc++ = *Y'_p++ */ | ||
142 | sub r5, r5, #16 /* r5 = (Y'-16) * 74 */ | ||
143 | add r3, r5, r5, asl #2 | ||
144 | add r5, r3, r5, asl #5 | ||
145 | |||
146 | add r6, r1, r5, asr #8 /* r6 = r = (Y >> 9) + rv */ | ||
147 | add r3, r2, r5, asr #7 /* r3 = g = (Y >> 8) + guv */ | ||
148 | add r4, r0, r5, asr #8 /* r4 = b = (Y >> 9) + bu */ | ||
149 | |||
150 | orr r5, r6, r4 /* check if clamping is needed... */ | ||
151 | orr r5, r5, r3, asr #1 /* ...at all */ | ||
152 | cmp r5, #31 | ||
153 | bls 15f /* -> no clamp */ | ||
154 | cmp r6, #31 /* clamp r */ | ||
155 | mvnhi r6, r6, asr #31 | ||
156 | andhi r6, r6, #31 | ||
157 | cmp r3, #63 /* clamp g */ | ||
158 | mvnhi r3, r3, asr #31 | ||
159 | andhi r3, r3, #63 | ||
160 | cmp r4, #31 /* clamp b */ | ||
161 | mvnhi r4, r4, asr #31 | ||
162 | andhi r4, r4, #31 | ||
163 | 15: /* no clamp */ | ||
164 | |||
165 | /* calculate pixel_1 and save to r4 for later pixel packing */ | ||
166 | orr r4, r4, r3, lsl #5 /* pixel_1 = r<<11 | g<<5 | b */ | ||
167 | orr r4, r4, r6, lsl #11 /* r4 = pixel_1 */ | ||
168 | |||
169 | /* 1st loop, second pixel */ | ||
170 | ldrb r5, [r9], #1 /* r5 = *ysrc++ = *Y'_p++ */ | ||
171 | sub r5, r5, #16 /* r5 = (Y'-16) * 74 */ | ||
172 | add r3, r5, r5, asl #2 | ||
173 | add r5, r3, r5, asl #5 | ||
174 | |||
175 | add r6, r1, r5, asr #8 /* r6 = r = (Y >> 9) + rv */ | ||
176 | add r3, r2, r5, asr #7 /* r3 = g = (Y >> 8) + guv */ | ||
177 | add r5, r0, r5, asr #8 /* r5 = b = (Y >> 9) + bu */ | ||
178 | |||
179 | orr r0, r6, r5 /* check if clamping is needed... */ | ||
180 | orr r0, r0, r3, asr #1 /* ...at all */ | ||
181 | cmp r0, #31 | ||
182 | bls 15f /* -> no clamp */ | ||
183 | cmp r6, #31 /* clamp r */ | ||
184 | mvnhi r6, r6, asr #31 | ||
185 | andhi r6, r6, #31 | ||
186 | cmp r3, #63 /* clamp g */ | ||
187 | mvnhi r3, r3, asr #31 | ||
188 | andhi r3, r3, #63 | ||
189 | cmp r5, #31 /* clamp b */ | ||
190 | mvnhi r5, r5, asr #31 | ||
191 | andhi r5, r5, #31 | ||
192 | 15: /* no clamp */ | ||
193 | |||
194 | /* calculate pixel_2 and pack with pixel_1 before writing */ | ||
195 | orr r5, r5, r3, lsl #5 /* pixel_2 = r<<11 | g<<5 | b */ | ||
196 | orr r5, r5, r6, lsl #11 /* r5 = pixel_2 */ | ||
197 | #ifdef FORCE_FIFO_WAIT | ||
198 | /* wait for FIFO half full */ | ||
199 | .fifo_wait1: | ||
200 | ldr r3, [lr, #-0x24] /* while (LCD_STATUS & 0x08); */ | ||
201 | tst r3, #0x8 | ||
202 | bgt .fifo_wait1 | ||
203 | #endif | ||
204 | stmia lr, {r4,r5} /* write pixel_1 and pixel_2 */ | ||
205 | |||
206 | subs r7, r7, #2 /* check for loop end */ | ||
207 | bgt 10b /* back to beginning */ | ||
208 | /* 1st loop end */ | ||
209 | |||
210 | /* Reload several registers for pointer rewinding for next loop */ | ||
211 | add r8, sp, #16 /* chroma buffer */ | ||
212 | ldmia sp, { r1, r7, r9} /* r1 = LCD_BASE */ | ||
213 | /* r7 = loop count */ | ||
214 | /* r9 = &ysrc[stride] */ | ||
215 | |||
216 | /* 2nd loop start */ | ||
217 | 20: /* loop start */ | ||
218 | /* restore r0 (bu), r1 (rv) and r2 (guv) from chroma buffer */ | ||
219 | ldmia r8!, {r0-r2} | ||
220 | |||
221 | /* 2nd loop, first pixel */ | ||
222 | ldrb r5, [r9], #1 /* r5 = *ysrc++ = *Y'_p++ */ | ||
223 | sub r5, r5, #16 /* r5 = (Y'-16) * 74 */ | ||
224 | add r3, r5, r5, asl #2 | ||
225 | add r5, r3, r5, asl #5 | ||
226 | |||
227 | add r6, r1, r5, asr #8 /* r6 = r = (Y >> 9) + rv */ | ||
228 | add r3, r2, r5, asr #7 /* r3 = g = (Y >> 8) + guv */ | ||
229 | add r4, r0, r5, asr #8 /* r4 = b = (Y >> 9) + bu */ | ||
230 | |||
231 | orr r5, r6, r4 /* check if clamping is needed... */ | ||
232 | orr r5, r5, r3, asr #1 /* ...at all */ | ||
233 | cmp r5, #31 | ||
234 | bls 15f /* -> no clamp */ | ||
235 | cmp r6, #31 /* clamp r */ | ||
236 | mvnhi r6, r6, asr #31 | ||
237 | andhi r6, r6, #31 | ||
238 | cmp r3, #63 /* clamp g */ | ||
239 | mvnhi r3, r3, asr #31 | ||
240 | andhi r3, r3, #63 | ||
241 | cmp r4, #31 /* clamp b */ | ||
242 | mvnhi r4, r4, asr #31 | ||
243 | andhi r4, r4, #31 | ||
244 | 15: /* no clamp */ | ||
245 | /* calculate pixel_1 and save to r4 for later pixel packing */ | ||
246 | orr r4, r4, r3, lsl #5 /* pixel_1 = r<<11 | g<<5 | b */ | ||
247 | orr r4, r4, r6, lsl #11 /* r4 = pixel_1 */ | ||
248 | |||
249 | /* 2nd loop, second pixel */ | ||
250 | ldrb r5, [r9], #1 /* r5 = *ysrc++ = *Y'_p++ */ | ||
251 | sub r5, r5, #16 /* r5 = (Y'-16) * 74 */ | ||
252 | add r3, r5, r5, asl #2 | ||
253 | add r5, r3, r5, asl #5 | ||
254 | |||
255 | add r6, r1, r5, asr #8 /* r6 = r = (Y >> 9) + rv */ | ||
256 | add r3, r2, r5, asr #7 /* r3 = g = (Y >> 8) + guv */ | ||
257 | add r5, r0, r5, asr #8 /* r5 = b = (Y >> 9) + bu */ | ||
258 | |||
259 | orr r0, r6, r5 /* check if clamping is needed... */ | ||
260 | orr r0, r0, r3, asr #1 /* ...at all */ | ||
261 | cmp r0, #31 | ||
262 | bls 15f /* -> no clamp */ | ||
263 | cmp r6, #31 /* clamp r */ | ||
264 | mvnhi r6, r6, asr #31 | ||
265 | andhi r6, r6, #31 | ||
266 | cmp r3, #63 /* clamp g */ | ||
267 | mvnhi r3, r3, asr #31 | ||
268 | andhi r3, r3, #63 | ||
269 | cmp r5, #31 /* clamp b */ | ||
270 | mvnhi r5, r5, asr #31 | ||
271 | andhi r5, r5, #31 | ||
272 | 15: /* no clamp */ | ||
273 | |||
274 | /* calculate pixel_2 and pack with pixel_1 before writing */ | ||
275 | orr r5, r5, r3, lsl #5 /* pixel_2 = r<<11 | g<<5 | b */ | ||
276 | orr r5, r5, r6, lsl #11 /* r5 = pixel_2 */ | ||
277 | #ifdef FORCE_FIFO_WAIT | ||
278 | /* wait for FIFO half full */ | ||
279 | .fifo_wait2: | ||
280 | ldr r3, [lr, #-0x24] /* while (LCD_STATUS & 0x08); */ | ||
281 | tst r3, #0x8 | ||
282 | bgt .fifo_wait2 | ||
283 | #endif | ||
284 | stmia lr, {r4,r5} /* write pixel_1 and pixel_2 */ | ||
285 | |||
286 | subs r7, r7, #2 /* check for loop end */ | ||
287 | bgt 20b /* back to beginning */ | ||
288 | /* 2nd loop end */ | ||
289 | |||
290 | ldr r3, [sp, #12] | ||
291 | add sp, sp, r3 /* deallocate buffer */ | ||
292 | ldmpc regs=r4-r10 /* restore registers */ | ||
293 | |||
294 | .ltorg | ||
295 | .size lcd_write_yuv420_lines, .-lcd_write_yuv420_lines | ||
diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index 13e5c5c1d4..2d630886c9 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | |||
@@ -406,36 +406,3 @@ void lcd_update_rect(int x, int y, int width, int height) | |||
406 | } while (--height > 0 ); | 406 | } while (--height > 0 ); |
407 | } | 407 | } |
408 | } | 408 | } |
409 | |||
410 | /* Line write helper function for lcd_yuv_blit. Writes two lines of yuv420. */ | ||
411 | extern void lcd_write_yuv420_lines(unsigned char const * const src[3], | ||
412 | const unsigned int lcd_baseadress, | ||
413 | int width, | ||
414 | int stride); | ||
415 | |||
416 | /* Blit a YUV bitmap directly to the LCD */ | ||
417 | void lcd_blit_yuv(unsigned char * const src[3], | ||
418 | int src_x, int src_y, int stride, | ||
419 | int x, int y, int width, int height) | ||
420 | { | ||
421 | unsigned int z; | ||
422 | unsigned char const * yuv_src[3]; | ||
423 | |||
424 | width = (width + 1) & ~1; /* ensure width is even */ | ||
425 | |||
426 | lcd_setup_drawing_region(x, y, width, height); | ||
427 | |||
428 | z = stride * src_y; | ||
429 | yuv_src[0] = src[0] + z + src_x; | ||
430 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | ||
431 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | ||
432 | |||
433 | height >>= 1; | ||
434 | |||
435 | do { | ||
436 | lcd_write_yuv420_lines(yuv_src, LCD_BASE, width, stride); | ||
437 | yuv_src[0] += stride << 1; | ||
438 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
439 | yuv_src[2] += stride >> 1; | ||
440 | } while (--height > 0); | ||
441 | } | ||