summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Purchase <shotofadds@rockbox.org>2008-07-15 17:54:58 +0000
committerRob Purchase <shotofadds@rockbox.org>2008-07-15 17:54:58 +0000
commitadb6a00c59371e202edba06d19f950f422b688ee (patch)
treee852e9340d9d3a567467bc8ded6b55b64820b316
parentbda60d18d8d2cc48eb39b37665809abb31116b55 (diff)
downloadrockbox-adb6a00c59371e202edba06d19f950f422b688ee.tar.gz
rockbox-adb6a00c59371e202edba06d19f950f422b688ee.zip
Update lcd-as-memframe.S to only rotate YUV data for portrait LCDs (and remove the D2's temporary C implementation). Enable MpegPlayer dithering option for D2.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18055 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c2
-rw-r--r--apps/plugin.h4
-rw-r--r--apps/plugins/mpegplayer/mpeg_settings.h2
-rw-r--r--firmware/target/arm/lcd-as-memframe.S46
-rw-r--r--firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c87
5 files changed, 48 insertions, 93 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index b864170218..a220e8c429 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -120,7 +120,7 @@ static const struct plugin_api rockbox_api = {
120 lcd_bitmap_transparent, 120 lcd_bitmap_transparent,
121 lcd_blit_yuv, 121 lcd_blit_yuv,
122#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ 122#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \
123 || defined (IRIVER_H10) 123 || defined(IRIVER_H10) || defined(COWON_D2)
124 lcd_yuv_set_options, 124 lcd_yuv_set_options,
125#endif 125#endif
126#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) 126#elif (LCD_DEPTH < 4) && !defined(SIMULATOR)
diff --git a/apps/plugin.h b/apps/plugin.h
index dfe746342e..3ffaafce2f 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -206,7 +206,7 @@ struct plugin_api {
206 int src_x, int src_y, int stride, 206 int src_x, int src_y, int stride,
207 int x, int y, int width, int height); 207 int x, int y, int width, int height);
208#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ 208#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \
209 || defined (IRIVER_H10) 209 || defined(IRIVER_H10) || defined(COWON_D2)
210 void (*lcd_yuv_set_options)(unsigned options); 210 void (*lcd_yuv_set_options)(unsigned options);
211#endif 211#endif
212#elif (LCD_DEPTH < 4) && !defined(SIMULATOR) 212#elif (LCD_DEPTH < 4) && !defined(SIMULATOR)
@@ -395,7 +395,7 @@ struct plugin_api {
395 size_t stack_size, unsigned flags, 395 size_t stack_size, unsigned flags,
396 const char *name 396 const char *name
397 IF_PRIO(, int priority) 397 IF_PRIO(, int priority)
398 IF_COP(, unsigned int core)); 398 IF_COP(, unsigned int core));
399 void (*thread_exit)(void); 399 void (*thread_exit)(void);
400 void (*thread_wait)(struct thread_entry *thread); 400 void (*thread_wait)(struct thread_entry *thread);
401#if CONFIG_CODEC == SWCODEC 401#if CONFIG_CODEC == SWCODEC
diff --git a/apps/plugins/mpegplayer/mpeg_settings.h b/apps/plugins/mpegplayer/mpeg_settings.h
index d00dc197cb..71c6db50b0 100644
--- a/apps/plugins/mpegplayer/mpeg_settings.h
+++ b/apps/plugins/mpegplayer/mpeg_settings.h
@@ -6,7 +6,7 @@
6#define SETTINGS_FILENAME "mpegplayer.cfg" 6#define SETTINGS_FILENAME "mpegplayer.cfg"
7 7
8#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ 8#if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \
9 || defined (IRIVER_H10) 9 || defined(IRIVER_H10) || defined(COWON_D2)
10#define MPEG_OPTION_DITHERING_ENABLED 1 10#define MPEG_OPTION_DITHERING_ENABLED 1
11#endif 11#endif
12 12
diff --git a/firmware/target/arm/lcd-as-memframe.S b/firmware/target/arm/lcd-as-memframe.S
index 1cd27bdf28..519a8a1615 100644
--- a/firmware/target/arm/lcd-as-memframe.S
+++ b/firmware/target/arm/lcd-as-memframe.S
@@ -189,7 +189,10 @@ lcd_write_yuv420_lines:
189 @ 189 @
190 orr r1, r1, r7, lsl #5 @ r4 |= (g << 5) 190 orr r1, r1, r7, lsl #5 @ r4 |= (g << 5)
191 orr r1, r1, r11, lsl #11 @ r4 = b | (r << 11) 191 orr r1, r1, r11, lsl #11 @ r4 = b | (r << 11)
192#if LCD_WIDTH < 256 192
193#if LCD_WIDTH >= LCD_HEIGHT
194 strh r1, [r0] @
195#elif LCD_WIDTH < 256
193 strh r1, [r0], #LCD_WIDTH @ store pixel 196 strh r1, [r0], #LCD_WIDTH @ store pixel
194#else 197#else
195 strh r1, [r0] @ 198 strh r1, [r0] @
@@ -222,7 +225,12 @@ lcd_write_yuv420_lines:
222 @ 225 @
223 orr r1, r1, r11, lsl #11 @ r1 = b | (r << 11) 226 orr r1, r1, r11, lsl #11 @ r1 = b | (r << 11)
224 orr r1, r1, r7, lsl #5 @ r1 |= (g << 5) 227 orr r1, r1, r7, lsl #5 @ r1 |= (g << 5)
225#if LCD_WIDTH < 256 228
229#if LCD_WIDTH >= LCD_HEIGHT
230 add r0, r0, #2*LCD_WIDTH @
231 strh r1, [r0] @ store pixel
232 sub r0, r0, #2*LCD_WIDTH @
233#elif LCD_WIDTH < 256
226 strh r1, [r0, #-LCD_WIDTH-2] @ store pixel 234 strh r1, [r0, #-LCD_WIDTH-2] @ store pixel
227#else 235#else
228 strh r1, [r0, #-2] @ 236 strh r1, [r0, #-2] @
@@ -256,7 +264,10 @@ lcd_write_yuv420_lines:
256 @ 264 @
257 orr r1, r1, r7, lsl #5 @ r1 = b | (g << 5) 265 orr r1, r1, r7, lsl #5 @ r1 = b | (g << 5)
258 orr r1, r1, r11, lsl #11 @ r1 |= (r << 11) 266 orr r1, r1, r11, lsl #11 @ r1 |= (r << 11)
259#if LCD_WIDTH < 256 267
268#if LCD_WIDTH >= LCD_HEIGHT
269 strh r1, [r0, #2]
270#elif LCD_WIDTH < 256
260 strh r1, [r0, #LCD_WIDTH]! @ store pixel 271 strh r1, [r0, #LCD_WIDTH]! @ store pixel
261#else 272#else
262 strh r1, [r0] @ 273 strh r1, [r0] @
@@ -287,12 +298,19 @@ lcd_write_yuv420_lines:
287 @ 298 @
288 orr r12, r1, r11, lsl #11 @ r12 = b | (r << 11) 299 orr r12, r1, r11, lsl #11 @ r12 = b | (r << 11)
289 orr r12, r12, r7, lsl #5 @ r12 |= (g << 5) 300 orr r12, r12, r7, lsl #5 @ r12 |= (g << 5)
301
302#if LCD_WIDTH >= LCD_HEIGHT
303 add r0, r0, #2*LCD_WIDTH
304 strh r12, [r0, #2]
305 sub r0, r0, #(2*LCD_WIDTH)-4
306#else
290 strh r12, [r0, #-2] @ store pixel 307 strh r12, [r0, #-2] @ store pixel
291#if LCD_WIDTH < 256 308#if LCD_WIDTH < 256
292 add r0, r0, #2*LCD_WIDTH @ 309 add r0, r0, #2*LCD_WIDTH @
293#else 310#else
294 add r0, r0, #LCD_WIDTH @ 311 add r0, r0, #LCD_WIDTH @
295#endif 312#endif
313#endif
296 @ 314 @
297 subs r2, r2, #2 @ subtract block from width 315 subs r2, r2, #2 @ subtract block from width
298 bgt 10b @ loop line @ 316 bgt 10b @ loop line @
@@ -423,7 +441,9 @@ lcd_write_yuv420_lines_odither:
423 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 441 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
424 orr r1, r11, r1, lsr #10 @ (b >> 10) 442 orr r1, r11, r1, lsr #10 @ (b >> 10)
425 @ 443 @
426#if LCD_WIDTH < 256 444#if LCD_WIDTH >= LCD_HEIGHT
445 strh r1, [r0] @
446#elif LCD_WIDTH < 256
427 strh r1, [r0], #LCD_WIDTH @ store pixel 447 strh r1, [r0], #LCD_WIDTH @ store pixel
428#else 448#else
429 strh r1, [r0] @ 449 strh r1, [r0] @
@@ -473,7 +493,11 @@ lcd_write_yuv420_lines_odither:
473 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 493 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
474 orr r1, r11, r1, lsr #10 @ (b >> 10) 494 orr r1, r11, r1, lsr #10 @ (b >> 10)
475 @ 495 @
476#if LCD_WIDTH < 256 496#if LCD_WIDTH >= LCD_HEIGHT
497 add r0, r0, #2*LCD_WIDTH @
498 strh r1, [r0] @ store pixel
499 sub r0, r0, #2*LCD_WIDTH @
500#elif LCD_WIDTH < 256
477 strh r1, [r0, #-LCD_WIDTH-2] @ store pixel 501 strh r1, [r0, #-LCD_WIDTH-2] @ store pixel
478#else 502#else
479 strh r1, [r0, #-2] @ store pixel 503 strh r1, [r0, #-2] @ store pixel
@@ -526,12 +550,14 @@ lcd_write_yuv420_lines_odither:
526 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 550 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
527 orr r1, r11, r1, lsr #10 @ (b >> 10) 551 orr r1, r11, r1, lsr #10 @ (b >> 10)
528 @ 552 @
529#if LCD_WIDTH < 256 553#if LCD_WIDTH >= LCD_HEIGHT
554 strh r1, [r0, #2]
555#elif LCD_WIDTH < 256
530 strh r1, [r0, #LCD_WIDTH]! @ store pixel 556 strh r1, [r0, #LCD_WIDTH]! @ store pixel
531#else 557#else
532 strh r1, [r0] @ 558 strh r1, [r0] @
533#endif 559#endif
534 @ 560
535 sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 561 sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149
536 add r12, r7, r7, asl #2 @ 562 add r12, r7, r7, asl #2 @
537 add r12, r12, r12, asl #4 @ 563 add r12, r12, r12, asl #4 @
@@ -574,12 +600,18 @@ lcd_write_yuv420_lines_odither:
574 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | 600 orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) |
575 orr r1, r11, r1, lsr #10 @ (b >> 10) 601 orr r1, r11, r1, lsr #10 @ (b >> 10)
576 @ 602 @
603#if LCD_WIDTH >= LCD_HEIGHT
604 add r0, r0, #2*LCD_WIDTH
605 strh r1, [r0, #2] @ store pixel
606 sub r0, r0, #(2*LCD_WIDTH-4)
607#else
577 strh r1, [r0, #-2] @ store pixel 608 strh r1, [r0, #-2] @ store pixel
578#if LCD_WIDTH < 256 609#if LCD_WIDTH < 256
579 add r0, r0, #2*LCD_WIDTH @ 610 add r0, r0, #2*LCD_WIDTH @
580#else 611#else
581 add r0, r0, #LCD_WIDTH @ 612 add r0, r0, #LCD_WIDTH @
582#endif 613#endif
614#endif
583 @ 615 @
584 subs r2, r2, #2 @ subtract block from width 616 subs r2, r2, #2 @ subtract block from width
585 bgt 10b @ loop line @ 617 bgt 10b @ loop line @
diff --git a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
index 48ae99ddcd..70d823a25b 100644
--- a/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
+++ b/firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c
@@ -359,88 +359,11 @@ void lcd_yuv_set_options(unsigned options)
359} 359}
360 360
361/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ 361/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
362static void lcd_write_yuv420_lines(fb_data *dst, 362extern void lcd_write_yuv420_lines(fb_data *dst,
363 unsigned char const * const src[3], 363 unsigned char const * const src[3],
364 int width, 364 int width,
365 int stride) 365 int stride);
366{ 366
367 int i = 0;
368 int y;
369 int rv, guv, bu;
370 int cb, cr;
371 int r, g, b;
372 unsigned const char *y_p = src[0];
373
374 for (i = 0; i < width/2; i++)
375 {
376 y_p++;
377
378 /* YCbCr -> RGB conversion */
379 cb = src[1][i] - 128;
380 cr = src[2][i] - 128;
381
382 rv = (cr*101 + 56) >> 9;
383 guv = (128 - cr*51 + cb*24) >> 8;
384 bu = (cb*128 + 256) >> 9;
385
386 y = (*y_p - 16)*74;
387 r = (y >> 9) + rv;
388 g = (y >> 8) + guv;
389 b = (y >> 9) + bu;
390 if (r < 0) r = 0;
391 else if (r > 31) r = 31;
392 if (g < 0) g = 0;
393 else if (g > 63) g = 63;
394 if (b < 0) b = 0;
395 else if (b > 31) b = 31;
396
397 dst[i*2] = (r << 11) | (g << 5) | b;
398
399 /* YCbCr -> RGB conversion */
400 y = (*(y_p+stride) - 16)*74;
401 r = (y >> 9) + rv;
402 g = (y >> 8) + guv;
403 b = (y >> 9) + bu;
404 if (r < 0) r = 0;
405 else if (r > 31) r = 31;
406 if (g < 0) g = 0;
407 else if (g > 63) g = 63;
408 if (b < 0) b = 0;
409 else if (b > 31) b = 31;
410
411 dst[i*2+LCD_FBWIDTH] = (r << 11) | (g << 5) | b;
412
413 y_p++;
414
415 /* YCbCr -> RGB conversion */
416 y = (*y_p - 16)*74;
417 r = (y >> 9) + rv;
418 g = (y >> 8) + guv;
419 b = (y >> 9) + bu;
420 if (r < 0) r = 0;
421 else if (r > 31) r = 31;
422 if (g < 0) g = 0;
423 else if (g > 63) g = 63;
424 if (b < 0) b = 0;
425 else if (b > 31) b = 31;
426
427 dst[i*2+1] = (r << 11) | (g << 5) | b;
428
429 /* YCbCr -> RGB conversion */
430 y = (*(y_p+stride) - 16)*74;
431 r = (y >> 9) + rv;
432 g = (y >> 8) + guv;
433 b = (y >> 9) + bu;
434 if (r < 0) r = 0;
435 else if (r > 31) r = 31;
436 if (g < 0) g = 0;
437 else if (g > 63) g = 63;
438 if (b < 0) b = 0;
439 else if (b > 31) b = 31;
440
441 dst[i*2+1+LCD_FBWIDTH] = (r << 11) | (g << 5) | b;
442 }
443}
444extern void lcd_write_yuv420_lines_odither(fb_data *dst, 367extern void lcd_write_yuv420_lines_odither(fb_data *dst,
445 unsigned char const * const src[3], 368 unsigned char const * const src[3],
446 int width, 369 int width,