From 418169aff8faf2cf90124cd95dba0af821cea73d Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Thu, 13 Oct 2022 11:03:53 -0400 Subject: Revert "Remove YUV blitting functions and LCD modes" This reverts commit fe6aa21e9eb88f49005863efd2003d0982920048. Change-Id: I8bb1e5d6c52ed1478002d2140ef494ec5d62b8e3 --- .../target/arm/s5l8700/ipodnano2g/lcd-nano2g.c | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c') diff --git a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c index 2d630886c9..13e5c5c1d4 100644 --- a/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c +++ b/firmware/target/arm/s5l8700/ipodnano2g/lcd-nano2g.c @@ -406,3 +406,36 @@ void lcd_update_rect(int x, int y, int width, int height) } while (--height > 0 ); } } + +/* Line write helper function for lcd_yuv_blit. Writes two lines of yuv420. */ +extern void lcd_write_yuv420_lines(unsigned char const * const src[3], + const unsigned int lcd_baseadress, + int width, + int stride); + +/* Blit a YUV bitmap directly to the LCD */ +void lcd_blit_yuv(unsigned char * const src[3], + int src_x, int src_y, int stride, + int x, int y, int width, int height) +{ + unsigned int z; + unsigned char const * yuv_src[3]; + + width = (width + 1) & ~1; /* ensure width is even */ + + lcd_setup_drawing_region(x, y, width, height); + + z = stride * src_y; + yuv_src[0] = src[0] + z + src_x; + yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); + yuv_src[2] = src[2] + (yuv_src[1] - src[1]); + + height >>= 1; + + do { + lcd_write_yuv420_lines(yuv_src, LCD_BASE, width, stride); + yuv_src[0] += stride << 1; + yuv_src[1] += stride >> 1; /* Skip down one chroma line */ + yuv_src[2] += stride >> 1; + } while (--height > 0); +} -- cgit v1.2.3