diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2022-10-13 11:03:53 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2022-10-13 11:08:06 -0400 |
commit | 418169aff8faf2cf90124cd95dba0af821cea73d (patch) | |
tree | 4fc206af57c9a07fba6cbcb3517fa946a7b84668 /firmware/target/arm/as3525/lcd-fuze.c | |
parent | f9ea1fc79d6aaff9949a5b11ae011b4e04e0e9d9 (diff) | |
download | rockbox-418169aff8faf2cf90124cd95dba0af821cea73d.tar.gz rockbox-418169aff8faf2cf90124cd95dba0af821cea73d.zip |
Revert "Remove YUV blitting functions and LCD modes"
This reverts commit fe6aa21e9eb88f49005863efd2003d0982920048.
Change-Id: I8bb1e5d6c52ed1478002d2140ef494ec5d62b8e3
Diffstat (limited to 'firmware/target/arm/as3525/lcd-fuze.c')
-rw-r--r-- | firmware/target/arm/as3525/lcd-fuze.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/firmware/target/arm/as3525/lcd-fuze.c b/firmware/target/arm/as3525/lcd-fuze.c index b1f62a1c95..a1ccea348d 100644 --- a/firmware/target/arm/as3525/lcd-fuze.c +++ b/firmware/target/arm/as3525/lcd-fuze.c | |||
@@ -197,6 +197,86 @@ static void lcd_window_y(int ymin, int ymax) | |||
197 | lcd_write_reg(R_RAM_ADDR_SET, ymin); | 197 | lcd_write_reg(R_RAM_ADDR_SET, ymin); |
198 | } | 198 | } |
199 | 199 | ||
200 | static unsigned lcd_yuv_options = 0; | ||
201 | |||
202 | void lcd_yuv_set_options(unsigned options) | ||
203 | { | ||
204 | lcd_yuv_options = options; | ||
205 | } | ||
206 | |||
207 | |||
208 | #ifndef BOOTLOADER | ||
209 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */ | ||
210 | extern void lcd_write_yuv420_lines(unsigned char const * const src[3], | ||
211 | int width, | ||
212 | int stride); | ||
213 | extern void lcd_write_yuv420_lines_odither(unsigned char const * const src[3], | ||
214 | int width, | ||
215 | int stride, | ||
216 | int x_screen, /* To align dither pattern */ | ||
217 | int y_screen); | ||
218 | |||
219 | /* Performance function to blit a YUV bitmap directly to the LCD | ||
220 | * src_x, src_y, width and height should be even | ||
221 | * x, y, width and height have to be within LCD bounds | ||
222 | */ | ||
223 | void lcd_blit_yuv(unsigned char * const src[3], | ||
224 | int src_x, int src_y, int stride, | ||
225 | int x, int y, int width, int height) | ||
226 | { | ||
227 | unsigned char const * yuv_src[3]; | ||
228 | off_t z; | ||
229 | |||
230 | /* Sorry, but width and height must be >= 2 or else */ | ||
231 | width &= ~1; | ||
232 | height >>= 1; | ||
233 | |||
234 | z = stride*src_y; | ||
235 | yuv_src[0] = src[0] + z + src_x; | ||
236 | yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1); | ||
237 | yuv_src[2] = src[2] + (yuv_src[1] - src[1]); | ||
238 | |||
239 | lcd_write_reg(R_ENTRY_MODE, R_ENTRY_MODE_VIDEO); | ||
240 | |||
241 | lcd_window_x(x, x + width - 1); | ||
242 | |||
243 | if (lcd_yuv_options & LCD_YUV_DITHER) | ||
244 | { | ||
245 | do | ||
246 | { | ||
247 | lcd_window_y(y, y + 1); | ||
248 | |||
249 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | ||
250 | |||
251 | lcd_write_yuv420_lines_odither(yuv_src, width, stride, x, y); | ||
252 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | ||
253 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
254 | yuv_src[2] += stride >> 1; | ||
255 | y += 2; | ||
256 | } | ||
257 | while (--height > 0); | ||
258 | } | ||
259 | else | ||
260 | { | ||
261 | do | ||
262 | { | ||
263 | lcd_window_y(y, y + 1); | ||
264 | |||
265 | lcd_write_cmd(R_WRITE_DATA_2_GRAM); | ||
266 | |||
267 | lcd_write_yuv420_lines(yuv_src, width, stride); | ||
268 | yuv_src[0] += stride << 1; /* Skip down two luma lines */ | ||
269 | yuv_src[1] += stride >> 1; /* Skip down one chroma line */ | ||
270 | yuv_src[2] += stride >> 1; | ||
271 | y += 2; | ||
272 | } | ||
273 | while (--height > 0); | ||
274 | } | ||
275 | } | ||
276 | |||
277 | #endif | ||
278 | |||
279 | |||
200 | /* Update the display. | 280 | /* Update the display. |
201 | This must be called after all other LCD functions that change the display. */ | 281 | This must be called after all other LCD functions that change the display. */ |
202 | void lcd_update(void) | 282 | void lcd_update(void) |