summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-06-20 13:49:59 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-06-20 13:49:59 +0200
commita2352004304427ac352ac0381b45ba8f6abd04b5 (patch)
treec684e6270420909e12c09f78da8bfc9c610edf2e
parent7f552f80b862d70590891bfc7c4da52ef22c0c9f (diff)
downloadrockbox-a2352004304427ac352ac0381b45ba8f6abd04b5.tar.gz
rockbox-a2352004304427ac352ac0381b45ba8f6abd04b5.zip
zenxfi2: remove lcd yuv blitting code (duplicate from generic)
Change-Id: I2be7d5f9cbc2086673c731e7b76b7d7d6f728f26
-rw-r--r--firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c193
1 files changed, 0 insertions, 193 deletions
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
index 0131a39233..6917ea3f53 100644
--- a/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
+++ b/firmware/target/arm/imx233/creative-zenxfi2/lcd-zenxfi2.c
@@ -32,7 +32,6 @@
32#ifdef HAVE_LCD_ENABLE 32#ifdef HAVE_LCD_ENABLE
33static bool lcd_on; 33static bool lcd_on;
34#endif 34#endif
35static unsigned lcd_yuv_options = 0;
36 35
37static void setup_lcdif(void) 36static void setup_lcdif(void)
38{ 37{
@@ -274,195 +273,3 @@ void lcd_update_rect(int x, int y, int w, int h)
274 } 273 }
275 imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h); 274 imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h);
276} 275}
277
278void lcd_yuv_set_options(unsigned options)
279{
280 lcd_yuv_options = options;
281}
282
283#define YFAC (74)
284#define RVFAC (101)
285#define GUFAC (-24)
286#define GVFAC (-51)
287#define BUFAC (128)
288
289static inline int clamp(int val, int min, int max)
290{
291 if (val < min)
292 val = min;
293 else if (val > max)
294 val = max;
295 return val;
296}
297
298void lcd_blit_yuv(unsigned char * const src[3],
299 int src_x, int src_y, int stride,
300 int x, int y, int width, int height)
301{
302 const unsigned char *ysrc, *usrc, *vsrc;
303 int linecounter;
304 fb_data *dst, *row_end;
305 long z;
306
307 /* width and height must be >= 2 and an even number */
308 width &= ~1;
309 linecounter = height >> 1;
310
311 #if LCD_WIDTH >= LCD_HEIGHT
312 dst = FBADDR(x,y);
313 row_end = dst + width;
314 #else
315 dst = FBADDR(LCD_WIDTH - y - 1,x);
316 row_end = dst + LCD_WIDTH * width;
317 #endif
318
319 z = stride * src_y;
320 ysrc = src[0] + z + src_x;
321 usrc = src[1] + (z >> 2) + (src_x >> 1);
322 vsrc = src[2] + (usrc - src[1]);
323
324 /* stride => amount to jump from end of last row to start of next */
325 stride -= width;
326
327 /* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
328
329 do
330 {
331 do
332 {
333 int y, cb, cr, rv, guv, bu, r, g, b;
334
335 y = YFAC*(*ysrc++ - 16);
336 cb = *usrc++ - 128;
337 cr = *vsrc++ - 128;
338
339 rv = RVFAC*cr;
340 guv = GUFAC*cb + GVFAC*cr;
341 bu = BUFAC*cb;
342
343 r = y + rv;
344 g = y + guv;
345 b = y + bu;
346
347 if ((unsigned)(r | g | b) > 64*256-1)
348 {
349 r = clamp(r, 0, 64*256-1);
350 g = clamp(g, 0, 64*256-1);
351 b = clamp(b, 0, 64*256-1);
352 }
353
354 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
355
356 #if LCD_WIDTH >= LCD_HEIGHT
357 dst++;
358 #else
359 dst += LCD_WIDTH;
360 #endif
361
362 y = YFAC*(*ysrc++ - 16);
363 r = y + rv;
364 g = y + guv;
365 b = y + bu;
366
367 if ((unsigned)(r | g | b) > 64*256-1)
368 {
369 r = clamp(r, 0, 64*256-1);
370 g = clamp(g, 0, 64*256-1);
371 b = clamp(b, 0, 64*256-1);
372 }
373
374 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
375
376 #if LCD_WIDTH >= LCD_HEIGHT
377 dst++;
378 #else
379 dst += LCD_WIDTH;
380 #endif
381 }
382 while (dst < row_end);
383
384 ysrc += stride;
385 usrc -= width >> 1;
386 vsrc -= width >> 1;
387
388 #if LCD_WIDTH >= LCD_HEIGHT
389 row_end += LCD_WIDTH;
390 dst += LCD_WIDTH - width;
391 #else
392 row_end -= 1;
393 dst -= LCD_WIDTH*width + 1;
394 #endif
395
396 do
397 {
398 int y, cb, cr, rv, guv, bu, r, g, b;
399
400 y = YFAC*(*ysrc++ - 16);
401 cb = *usrc++ - 128;
402 cr = *vsrc++ - 128;
403
404 rv = RVFAC*cr;
405 guv = GUFAC*cb + GVFAC*cr;
406 bu = BUFAC*cb;
407
408 r = y + rv;
409 g = y + guv;
410 b = y + bu;
411
412 if ((unsigned)(r | g | b) > 64*256-1)
413 {
414 r = clamp(r, 0, 64*256-1);
415 g = clamp(g, 0, 64*256-1);
416 b = clamp(b, 0, 64*256-1);
417 }
418
419 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
420
421 #if LCD_WIDTH >= LCD_HEIGHT
422 dst++;
423 #else
424 dst += LCD_WIDTH;
425 #endif
426
427 y = YFAC*(*ysrc++ - 16);
428 r = y + rv;
429 g = y + guv;
430 b = y + bu;
431
432 if ((unsigned)(r | g | b) > 64*256-1)
433 {
434 r = clamp(r, 0, 64*256-1);
435 g = clamp(g, 0, 64*256-1);
436 b = clamp(b, 0, 64*256-1);
437 }
438
439 *dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
440
441 #if LCD_WIDTH >= LCD_HEIGHT
442 dst++;
443 #else
444 dst += LCD_WIDTH;
445 #endif
446 }
447 while (dst < row_end);
448
449 ysrc += stride;
450 usrc += stride >> 1;
451 vsrc += stride >> 1;
452
453 #if LCD_WIDTH >= LCD_HEIGHT
454 row_end += LCD_WIDTH;
455 dst += LCD_WIDTH - width;
456 #else
457 row_end -= 1;
458 dst -= LCD_WIDTH*width + 1;
459 #endif
460 }
461 while (--linecounter > 0);
462
463 #if LCD_WIDTH >= LCD_HEIGHT
464 lcd_update_rect(x, y, width, height);
465 #else
466 lcd_update_rect(LCD_WIDTH - y - height, x, height, width);
467 #endif
468}