summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s5l8702/ipod6g/lcd-6g.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/lcd-6g.c')
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/lcd-6g.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/lcd-6g.c b/firmware/target/arm/s5l8702/ipod6g/lcd-6g.c
index e1406549f4..14647a5697 100644
--- a/firmware/target/arm/s5l8702/ipod6g/lcd-6g.c
+++ b/firmware/target/arm/s5l8702/ipod6g/lcd-6g.c
@@ -530,3 +530,49 @@ void lcd_update_rect(int x, int y, int width, int height)
530 530
531 displaylcd_dma(pixels); 531 displaylcd_dma(pixels);
532} 532}
533
534/* Line write helper function for lcd_yuv_blit. Writes two lines of yuv420. */
535extern void lcd_write_yuv420_lines(unsigned char const * const src[3],
536 uint16_t* outbuf,
537 int width,
538 int stride);
539
540/* Blit a YUV bitmap directly to the LCD */
541void lcd_blit_yuv(unsigned char * const src[3],
542 int src_x, int src_y, int stride,
543 int x, int y, int width, int height) ICODE_ATTR;
544void lcd_blit_yuv(unsigned char * const src[3],
545 int src_x, int src_y, int stride,
546 int x, int y, int width, int height)
547{
548 unsigned int z;
549 unsigned char const * yuv_src[3];
550
551#ifdef HAVE_LCD_SLEEP
552 if (!lcd_active()) return;
553#endif
554
555 width = (width + 1) & ~1; /* ensure width is even */
556
557 int pixels = width * height;
558 uint16_t* out = lcd_dblbuf[0];
559
560 z = stride * src_y;
561 yuv_src[0] = src[0] + z + src_x;
562 yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
563 yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
564
565 displaylcd_setup(x, y, width, height);
566
567 height >>= 1;
568
569 do {
570 lcd_write_yuv420_lines(yuv_src, out, width, stride);
571 yuv_src[0] += stride << 1;
572 yuv_src[1] += stride >> 1; /* Skip down one chroma line */
573 yuv_src[2] += stride >> 1;
574 out += width << 1;
575 } while (--height);
576
577 displaylcd_dma(pixels);
578}