diff options
Diffstat (limited to 'firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c')
-rw-r--r-- | firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c index ab7c91437c..91b2eae986 100644 --- a/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c +++ b/firmware/target/arm/s3c2440/gigabeat-fx/lcd-meg-fx.c | |||
@@ -9,6 +9,7 @@ | |||
9 | 9 | ||
10 | static volatile bool lcd_on = true; | 10 | static volatile bool lcd_on = true; |
11 | volatile bool lcd_poweroff = false; | 11 | volatile bool lcd_poweroff = false; |
12 | static unsigned lcd_yuv_options = 0; | ||
12 | /* | 13 | /* |
13 | ** These are imported from lcd-16bit.c | 14 | ** These are imported from lcd-16bit.c |
14 | */ | 15 | */ |
@@ -248,11 +249,22 @@ void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, | |||
248 | ); | 249 | ); |
249 | } | 250 | } |
250 | 251 | ||
252 | void lcd_yuv_set_options(unsigned options) | ||
253 | { | ||
254 | lcd_yuv_options = options; | ||
255 | } | ||
256 | |||
251 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | 257 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ |
252 | extern void lcd_write_yuv420_lines(fb_data *dst, | 258 | extern void lcd_write_yuv420_lines(fb_data *dst, |
253 | unsigned char const * const src[3], | 259 | unsigned char const * const src[3], |
254 | int width, | 260 | int width, |
255 | int stride); | 261 | int stride); |
262 | extern void lcd_write_yuv420_lines_odither(fb_data *dst, | ||
263 | unsigned char const * const src[3], | ||
264 | int width, | ||
265 | int stride, | ||
266 | int x_screen, /* To align dither pattern */ | ||
267 | int y_screen); | ||
256 | /* Performance function to blit a YUV bitmap directly to the LCD */ | 268 | /* Performance function to blit a YUV bitmap directly to the LCD */ |
257 | /* For the Gigabeat - show it rotated */ | 269 | /* For the Gigabeat - show it rotated */ |
258 | /* So the LCD_WIDTH is now the height */ | 270 | /* So the LCD_WIDTH is now the height */ |
@@ -272,22 +284,39 @@ void lcd_yuv_blit(unsigned char * const src[3], | |||
272 | width &= ~1; | 284 | width &= ~1; |
273 | height >>= 1; | 285 | height >>= 1; |
274 | 286 | ||
275 | fb_data *dst = (fb_data*)FRAME + x * LCD_WIDTH + (LCD_WIDTH - y) - 1; | 287 | y = LCD_WIDTH - 1 - y; |
288 | fb_data *dst = (fb_data*)FRAME + x * LCD_WIDTH + y; | ||
276 | 289 | ||
277 | z = stride*src_y; | 290 | z = stride*src_y; |
278 | yuv_src[0] = src[0] + z + src_x; | 291 | yuv_src[0] = src[0] + z + src_x; |
279 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | 292 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); |
280 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | 293 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); |
281 | 294 | ||
282 | do | 295 | if (lcd_yuv_options & LCD_YUV_DITHER) |
296 | { | ||
297 | do | ||
298 | { | ||
299 | lcd_write_yuv420_lines_odither(dst, yuv_src, width, stride, y, x); | ||
300 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | ||
301 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
302 | yuv_src[2] += stride >> 1; | ||
303 | dst -= 2; | ||
304 | y -= 2; | ||
305 | } | ||
306 | while (--height > 0); | ||
307 | } | ||
308 | else | ||
283 | { | 309 | { |
284 | lcd_write_yuv420_lines(dst, yuv_src, width, stride); | 310 | do |
285 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | 311 | { |
286 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | 312 | lcd_write_yuv420_lines(dst, yuv_src, width, stride); |
287 | yuv_src[2] += stride >> 1; | 313 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ |
288 | dst -= 2; | 314 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ |
315 | yuv_src[2] += stride >> 1; | ||
316 | dst -= 2; | ||
317 | } | ||
318 | while (--height > 0); | ||
289 | } | 319 | } |
290 | while (--height > 0); | ||
291 | } | 320 | } |
292 | 321 | ||
293 | void lcd_set_contrast(int val) { | 322 | void lcd_set_contrast(int val) { |