From b09c8e04a7c66de6033980dcc647f31ba6214858 Mon Sep 17 00:00:00 2001 From: rob Date: Tue, 15 Jul 2008 17:54:58 +0000 Subject: [PATCH] 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 --- apps/plugin.c | 2 +- apps/plugin.h | 4 +- apps/plugins/mpegplayer/mpeg_settings.h | 2 +- firmware/target/arm/lcd-as-memframe.S | 46 ++++++++++-- firmware/target/arm/tcc780x/cowond2/lcd-cowond2.c | 87 ++--------------------- 5 files changed, 48 insertions(+), 93 deletions(-) diff --git a/apps/plugin.c b/apps/plugin.c index b86417021..a220e8c42 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -120,7 +120,7 @@ static const struct plugin_api rockbox_api = { lcd_bitmap_transparent, lcd_blit_yuv, #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ - || defined (IRIVER_H10) + || defined(IRIVER_H10) || defined(COWON_D2) lcd_yuv_set_options, #endif #elif (LCD_DEPTH < 4) && !defined(SIMULATOR) diff --git a/apps/plugin.h b/apps/plugin.h index dfe746342..3ffaafce2 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -206,7 +206,7 @@ struct plugin_api { int src_x, int src_y, int stride, int x, int y, int width, int height); #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ - || defined (IRIVER_H10) + || defined(IRIVER_H10) || defined(COWON_D2) void (*lcd_yuv_set_options)(unsigned options); #endif #elif (LCD_DEPTH < 4) && !defined(SIMULATOR) @@ -395,7 +395,7 @@ struct plugin_api { size_t stack_size, unsigned flags, const char *name IF_PRIO(, int priority) - IF_COP(, unsigned int core)); + IF_COP(, unsigned int core)); void (*thread_exit)(void); void (*thread_wait)(struct thread_entry *thread); #if CONFIG_CODEC == SWCODEC diff --git a/apps/plugins/mpegplayer/mpeg_settings.h b/apps/plugins/mpegplayer/mpeg_settings.h index d00dc197c..71c6db50b 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.h +++ b/apps/plugins/mpegplayer/mpeg_settings.h @@ -6,7 +6,7 @@ #define SETTINGS_FILENAME "mpegplayer.cfg" #if defined(TOSHIBA_GIGABEAT_F) || defined(SANSA_E200) || defined(SANSA_C200) \ - || defined (IRIVER_H10) + || defined(IRIVER_H10) || defined(COWON_D2) #define MPEG_OPTION_DITHERING_ENABLED 1 #endif diff --git a/firmware/target/arm/lcd-as-memframe.S b/firmware/target/arm/lcd-as-memframe.S index 1cd27bdf2..519a8a161 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: @ orr r1, r1, r7, lsl #5 @ r4 |= (g << 5) orr r1, r1, r11, lsl #11 @ r4 = b | (r << 11) -#if LCD_WIDTH < 256 + +#if LCD_WIDTH >= LCD_HEIGHT + strh r1, [r0] @ +#elif LCD_WIDTH < 256 strh r1, [r0], #LCD_WIDTH @ store pixel #else strh r1, [r0] @ @@ -222,7 +225,12 @@ lcd_write_yuv420_lines: @ orr r1, r1, r11, lsl #11 @ r1 = b | (r << 11) orr r1, r1, r7, lsl #5 @ r1 |= (g << 5) -#if LCD_WIDTH < 256 + +#if LCD_WIDTH >= LCD_HEIGHT + add r0, r0, #2*LCD_WIDTH @ + strh r1, [r0] @ store pixel + sub r0, r0, #2*LCD_WIDTH @ +#elif LCD_WIDTH < 256 strh r1, [r0, #-LCD_WIDTH-2] @ store pixel #else strh r1, [r0, #-2] @ @@ -256,7 +264,10 @@ lcd_write_yuv420_lines: @ orr r1, r1, r7, lsl #5 @ r1 = b | (g << 5) orr r1, r1, r11, lsl #11 @ r1 |= (r << 11) -#if LCD_WIDTH < 256 + +#if LCD_WIDTH >= LCD_HEIGHT + strh r1, [r0, #2] +#elif LCD_WIDTH < 256 strh r1, [r0, #LCD_WIDTH]! @ store pixel #else strh r1, [r0] @ @@ -287,12 +298,19 @@ lcd_write_yuv420_lines: @ orr r12, r1, r11, lsl #11 @ r12 = b | (r << 11) orr r12, r12, r7, lsl #5 @ r12 |= (g << 5) + +#if LCD_WIDTH >= LCD_HEIGHT + add r0, r0, #2*LCD_WIDTH + strh r12, [r0, #2] + sub r0, r0, #(2*LCD_WIDTH)-4 +#else strh r12, [r0, #-2] @ store pixel #if LCD_WIDTH < 256 add r0, r0, #2*LCD_WIDTH @ #else add r0, r0, #LCD_WIDTH @ #endif +#endif @ subs r2, r2, #2 @ subtract block from width bgt 10b @ loop line @ @@ -423,7 +441,9 @@ lcd_write_yuv420_lines_odither: orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | orr r1, r11, r1, lsr #10 @ (b >> 10) @ -#if LCD_WIDTH < 256 +#if LCD_WIDTH >= LCD_HEIGHT + strh r1, [r0] @ +#elif LCD_WIDTH < 256 strh r1, [r0], #LCD_WIDTH @ store pixel #else strh r1, [r0] @ @@ -473,7 +493,11 @@ lcd_write_yuv420_lines_odither: orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | orr r1, r11, r1, lsr #10 @ (b >> 10) @ -#if LCD_WIDTH < 256 +#if LCD_WIDTH >= LCD_HEIGHT + add r0, r0, #2*LCD_WIDTH @ + strh r1, [r0] @ store pixel + sub r0, r0, #2*LCD_WIDTH @ +#elif LCD_WIDTH < 256 strh r1, [r0, #-LCD_WIDTH-2] @ store pixel #else strh r1, [r0, #-2] @ store pixel @@ -526,12 +550,14 @@ lcd_write_yuv420_lines_odither: orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | orr r1, r11, r1, lsr #10 @ (b >> 10) @ -#if LCD_WIDTH < 256 +#if LCD_WIDTH >= LCD_HEIGHT + strh r1, [r0, #2] +#elif LCD_WIDTH < 256 strh r1, [r0, #LCD_WIDTH]! @ store pixel #else strh r1, [r0] @ #endif - @ + sub r7, r12, #16 @ r7 = Y = (Y' - 16)*149 add r12, r7, r7, asl #2 @ add r12, r12, r12, asl #4 @ @@ -574,12 +600,18 @@ lcd_write_yuv420_lines_odither: orr r11, r11, r7, lsr #4 @ ((g & 0x7e00) >> 4) | orr r1, r11, r1, lsr #10 @ (b >> 10) @ +#if LCD_WIDTH >= LCD_HEIGHT + add r0, r0, #2*LCD_WIDTH + strh r1, [r0, #2] @ store pixel + sub r0, r0, #(2*LCD_WIDTH-4) +#else strh r1, [r0, #-2] @ store pixel #if LCD_WIDTH < 256 add r0, r0, #2*LCD_WIDTH @ #else add r0, r0, #LCD_WIDTH @ #endif +#endif @ subs r2, r2, #2 @ subtract block from width 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 48ae99ddc..70d823a25 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) } /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ -static void lcd_write_yuv420_lines(fb_data *dst, - unsigned char const * const src[3], - int width, - int stride) -{ - int i = 0; - int y; - int rv, guv, bu; - int cb, cr; - int r, g, b; - unsigned const char *y_p = src[0]; - - for (i = 0; i < width/2; i++) - { - y_p++; - - /* YCbCr -> RGB conversion */ - cb = src[1][i] - 128; - cr = src[2][i] - 128; - - rv = (cr*101 + 56) >> 9; - guv = (128 - cr*51 + cb*24) >> 8; - bu = (cb*128 + 256) >> 9; - - y = (*y_p - 16)*74; - r = (y >> 9) + rv; - g = (y >> 8) + guv; - b = (y >> 9) + bu; - if (r < 0) r = 0; - else if (r > 31) r = 31; - if (g < 0) g = 0; - else if (g > 63) g = 63; - if (b < 0) b = 0; - else if (b > 31) b = 31; - - dst[i*2] = (r << 11) | (g << 5) | b; - - /* YCbCr -> RGB conversion */ - y = (*(y_p+stride) - 16)*74; - r = (y >> 9) + rv; - g = (y >> 8) + guv; - b = (y >> 9) + bu; - if (r < 0) r = 0; - else if (r > 31) r = 31; - if (g < 0) g = 0; - else if (g > 63) g = 63; - if (b < 0) b = 0; - else if (b > 31) b = 31; - - dst[i*2+LCD_FBWIDTH] = (r << 11) | (g << 5) | b; - - y_p++; - - /* YCbCr -> RGB conversion */ - y = (*y_p - 16)*74; - r = (y >> 9) + rv; - g = (y >> 8) + guv; - b = (y >> 9) + bu; - if (r < 0) r = 0; - else if (r > 31) r = 31; - if (g < 0) g = 0; - else if (g > 63) g = 63; - if (b < 0) b = 0; - else if (b > 31) b = 31; - - dst[i*2+1] = (r << 11) | (g << 5) | b; - - /* YCbCr -> RGB conversion */ - y = (*(y_p+stride) - 16)*74; - r = (y >> 9) + rv; - g = (y >> 8) + guv; - b = (y >> 9) + bu; - if (r < 0) r = 0; - else if (r > 31) r = 31; - if (g < 0) g = 0; - else if (g > 63) g = 63; - if (b < 0) b = 0; - else if (b > 31) b = 31; - - dst[i*2+1+LCD_FBWIDTH] = (r << 11) | (g << 5) | b; - } -} +extern void lcd_write_yuv420_lines(fb_data *dst, + unsigned char const * const src[3], + int width, + int stride); + extern void lcd_write_yuv420_lines_odither(fb_data *dst, unsigned char const * const src[3], int width, -- 2.11.4.GIT