summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio/x5/lcd-x5.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/iaudio/x5/lcd-x5.c')
-rwxr-xr-xfirmware/target/coldfire/iaudio/x5/lcd-x5.c28
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 */
434extern void lcd_write_yuv420_lines(const unsigned char *y, 434extern 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 }