diff options
author | Jens Arnold <amiconn@rockbox.org> | 2006-11-04 00:42:18 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2006-11-04 00:42:18 +0000 |
commit | f8b1da2f7bddebc9c7026bd5d106dec118ce70a9 (patch) | |
tree | 474e99488c568355dcd07c497181a11afa0245f9 /firmware/target/coldfire/iaudio/x5/lcd-x5.c | |
parent | 0d8781e2f99ea11298b6a290a979417647a5ce37 (diff) | |
download | rockbox-f8b1da2f7bddebc9c7026bd5d106dec118ce70a9.tar.gz rockbox-f8b1da2f7bddebc9c7026bd5d106dec118ce70a9.zip |
H300, X5: Faster lcd_yuv_blit() using EMAC. Speedup of the function itself at 124MHz: 10.5% on X5, 16.5% on H300. mpegplayer speedup 3..4%
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11429 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iaudio/x5/lcd-x5.c')
-rwxr-xr-x | firmware/target/coldfire/iaudio/x5/lcd-x5.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/lcd-x5.c b/firmware/target/coldfire/iaudio/x5/lcd-x5.c index 698ae477fa..92b9fde2e2 100755 --- a/firmware/target/coldfire/iaudio/x5/lcd-x5.c +++ b/firmware/target/coldfire/iaudio/x5/lcd-x5.c | |||
@@ -429,11 +429,11 @@ void lcd_blit(const fb_data* data, int x, int by, int width, | |||
429 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. | 429 | /* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. |
430 | * y should have two lines of Y back to back. | 430 | * y should have two lines of Y back to back. |
431 | * bu and rv should contain the Cb and Cr data for the two lines of Y. | 431 | * bu and rv should contain the Cb and Cr data for the two lines of Y. |
432 | * Stores bu, guv and rv in repective buffers for use in second line. | 432 | * Needs EMAC set to saturated, signed integer mode. |
433 | */ | 433 | */ |
434 | extern void lcd_write_yuv420_lines(const unsigned char *y, | 434 | extern void lcd_write_yuv420_lines(const unsigned char *y, |
435 | unsigned char *bu, unsigned char *guv, unsigned char *rv, | 435 | const unsigned char *bu, |
436 | int width); | 436 | const unsigned char *rv, int width); |
437 | 437 | ||
438 | /* Performance function to blit a YUV bitmap directly to the LCD | 438 | /* Performance function to blit a YUV bitmap directly to the LCD |
439 | * src_x, src_y, width and height should be even and within the LCD's | 439 | * src_x, src_y, width and height should be even and within the LCD's |
@@ -446,7 +446,6 @@ void lcd_yuv_blit(unsigned char * const src[3], | |||
446 | /* IRAM Y, Cb/bu, guv and Cb/rv buffers. */ | 446 | /* IRAM Y, Cb/bu, guv and Cb/rv buffers. */ |
447 | unsigned char y_ibuf[LCD_WIDTH*2]; | 447 | unsigned char y_ibuf[LCD_WIDTH*2]; |
448 | unsigned char bu_ibuf[LCD_WIDTH/2]; | 448 | unsigned char bu_ibuf[LCD_WIDTH/2]; |
449 | unsigned char guv_ibuf[LCD_WIDTH/2]; | ||
450 | unsigned char rv_ibuf[LCD_WIDTH/2]; | 449 | unsigned char rv_ibuf[LCD_WIDTH/2]; |
451 | const unsigned char *ysrc, *usrc, *vsrc; | 450 | const unsigned char *ysrc, *usrc, *vsrc; |
452 | const unsigned char *ysrc_max; | 451 | const unsigned char *ysrc_max; |
@@ -457,28 +456,29 @@ void lcd_yuv_blit(unsigned char * const src[3], | |||
457 | if (r_entry_mode == R_ENTRY_MODE_SOLID) | 456 | if (r_entry_mode == R_ENTRY_MODE_SOLID) |
458 | hw_dither(true); | 457 | hw_dither(true); |
459 | 458 | ||
460 | width = (width + 1) & ~1; | 459 | width &= ~1; /* stay on the safe side */ |
461 | height = (height + 1) & ~1; | 460 | height &= ~1; |
462 | 461 | ||
463 | /* Set start position and window */ | 462 | /* Set start position and window */ |
464 | lcd_write_reg(R_RAM_ADDR_SET, (x << 8) | (y + y_offset)); | 463 | lcd_write_reg(R_RAM_ADDR_SET, (x << 8) | (y + y_offset)); |
465 | lcd_write_reg(R_VERT_RAM_ADDR_POS, ((x + width - 1) << 8) | x); | 464 | lcd_write_reg(R_VERT_RAM_ADDR_POS, ((x + width - 1) << 8) | x); |
466 | 465 | ||
467 | lcd_begin_write_gram(); | 466 | lcd_begin_write_gram(); |
468 | 467 | ||
469 | ysrc = src[0] + src_y*stride + src_x; | 468 | ysrc = src[0] + src_y * stride + src_x; |
470 | usrc = src[1] + (src_y*stride >> 2) + (src_x >> 1); | 469 | usrc = src[1] + (src_y * stride >> 2) + (src_x >> 1); |
471 | vsrc = src[2] + (usrc - src[1]); | 470 | vsrc = src[2] + (src_y * stride >> 2) + (src_x >> 1); |
472 | ysrc_max = ysrc + height*stride; | 471 | ysrc_max = ysrc + height * stride; |
473 | 472 | ||
473 | coldfire_set_macsr(EMAC_SATURATE); | ||
474 | do | 474 | do |
475 | { | 475 | { |
476 | memcpy(y_ibuf, ysrc, width); | 476 | memcpy(y_ibuf, ysrc, width); |
477 | memcpy(&y_ibuf[width], &ysrc[stride], width); | 477 | memcpy(y_ibuf + width, ysrc + stride, width); |
478 | memcpy(bu_ibuf, usrc, width >> 1); | 478 | memcpy(bu_ibuf, usrc, width >> 1); |
479 | memcpy(rv_ibuf, vsrc, width >> 1); | 479 | memcpy(rv_ibuf, vsrc, width >> 1); |
480 | lcd_write_yuv420_lines(y_ibuf, bu_ibuf, guv_ibuf, rv_ibuf, width); | 480 | lcd_write_yuv420_lines(y_ibuf, bu_ibuf, rv_ibuf, width); |
481 | ysrc += stride << 1; | 481 | ysrc += 2 * stride; |
482 | usrc += stride >> 1; | 482 | usrc += stride >> 1; |
483 | vsrc += stride >> 1; | 483 | vsrc += stride >> 1; |
484 | } | 484 | } |