forked from len0rd/rockbox
Clean up the #ifdefs surrounding the definition of lcd_yuv_blit() and add an initial (untested) implementation for the Gigabeat
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10541 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
2c002d894d
commit
7fe7427de8
3 changed files with 104 additions and 10 deletions
|
|
@ -200,10 +200,7 @@ static void rockbox_draw_frame (vo_instance_t * instance,
|
||||||
(void)id;
|
(void)id;
|
||||||
(void)instance;
|
(void)instance;
|
||||||
|
|
||||||
#if (CONFIG_LCD == LCD_IPODCOLOR || CONFIG_LCD == LCD_IPODNANO \
|
#if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR)
|
||||||
|| CONFIG_LCD == LCD_H300 || CONFIG_LCD == LCD_IPODVIDEO \
|
|
||||||
|| CONFIG_LCD == LCD_X5) \
|
|
||||||
&& !defined(SIMULATOR)
|
|
||||||
rb->lcd_yuv_blit(buf,
|
rb->lcd_yuv_blit(buf,
|
||||||
0,0,image_width,
|
0,0,image_width,
|
||||||
output_x,output_y,output_width,output_height);
|
output_x,output_y,output_width,output_height);
|
||||||
|
|
|
||||||
|
|
@ -71,10 +71,8 @@ extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string,
|
||||||
int style);
|
int style);
|
||||||
extern void lcd_icon(int icon, bool enable);
|
extern void lcd_icon(int icon, bool enable);
|
||||||
|
|
||||||
#if CONFIG_LCD == LCD_IPODCOLOR || CONFIG_LCD == LCD_IPODNANO \
|
#if defined(HAVE_LCD_COLOR) && !defined(SIMULATOR)
|
||||||
|| CONFIG_LCD == LCD_H300 || CONFIG_LCD == LCD_IPODVIDEO \
|
extern void lcd_yuv_blit(unsigned char * const src[3],
|
||||||
|| CONFIG_LCD == LCD_X5
|
|
||||||
void lcd_yuv_blit(unsigned char * const src[3],
|
|
||||||
int src_x, int src_y, int stride,
|
int src_x, int src_y, int stride,
|
||||||
int x, int y, int width, int height);
|
int x, int y, int width, int height);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -29,3 +29,102 @@ void lcd_update(void)
|
||||||
{
|
{
|
||||||
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CSUB_X 2
|
||||||
|
#define CSUB_Y 2
|
||||||
|
|
||||||
|
#define RYFAC (31*257)
|
||||||
|
#define GYFAC (63*257)
|
||||||
|
#define BYFAC (31*257)
|
||||||
|
#define RVFAC 11170 /* 31 * 257 * 1.402 */
|
||||||
|
#define GVFAC (-11563) /* 63 * 257 * -0.714136 */
|
||||||
|
#define GUFAC (-5572) /* 63 * 257 * -0.344136 */
|
||||||
|
#define BUFAC 14118 /* 31 * 257 * 1.772 */
|
||||||
|
|
||||||
|
#define ROUNDOFFS (127*257)
|
||||||
|
|
||||||
|
/* Performance function to blit a YUV bitmap directly to the LCD */
|
||||||
|
void lcd_yuv_blit(unsigned char * const src[3],
|
||||||
|
int src_x, int src_y, int stride,
|
||||||
|
int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
fb_data *dst, *dst_end;
|
||||||
|
|
||||||
|
width = (width + 1) & ~1;
|
||||||
|
|
||||||
|
dst = (fb_data*)FRAME + LCD_WIDTH * y + x;
|
||||||
|
dst_end = dst + LCD_WIDTH * height;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
fb_data *dst_row = dst;
|
||||||
|
fb_data *row_end = dst_row + width;
|
||||||
|
const unsigned char *ysrc = src[0] + stride * src_y + src_x;
|
||||||
|
int y, u, v;
|
||||||
|
int red, green, blue;
|
||||||
|
unsigned rbits, gbits, bbits;
|
||||||
|
|
||||||
|
/* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
|
||||||
|
const unsigned char *usrc = src[1] + (stride/CSUB_X) * (src_y/CSUB_Y)
|
||||||
|
+ (src_x/CSUB_X);
|
||||||
|
const unsigned char *vsrc = src[2] + (stride/CSUB_X) * (src_y/CSUB_Y)
|
||||||
|
+ (src_x/CSUB_X);
|
||||||
|
int xphase = src_x % CSUB_X;
|
||||||
|
int rc, gc, bc;
|
||||||
|
|
||||||
|
u = *usrc++ - 128;
|
||||||
|
v = *vsrc++ - 128;
|
||||||
|
rc = RVFAC * v + ROUNDOFFS;
|
||||||
|
gc = GVFAC * v + GUFAC * u + ROUNDOFFS;
|
||||||
|
bc = BUFAC * u + ROUNDOFFS;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
y = *ysrc++;
|
||||||
|
red = RYFAC * y + rc;
|
||||||
|
green = GYFAC * y + gc;
|
||||||
|
blue = BYFAC * y + bc;
|
||||||
|
|
||||||
|
if ((unsigned)red > (RYFAC*255+ROUNDOFFS))
|
||||||
|
{
|
||||||
|
if (red < 0)
|
||||||
|
red = 0;
|
||||||
|
else
|
||||||
|
red = (RYFAC*255+ROUNDOFFS);
|
||||||
|
}
|
||||||
|
if ((unsigned)green > (GYFAC*255+ROUNDOFFS))
|
||||||
|
{
|
||||||
|
if (green < 0)
|
||||||
|
green = 0;
|
||||||
|
else
|
||||||
|
green = (GYFAC*255+ROUNDOFFS);
|
||||||
|
}
|
||||||
|
if ((unsigned)blue > (BYFAC*255+ROUNDOFFS))
|
||||||
|
{
|
||||||
|
if (blue < 0)
|
||||||
|
blue = 0;
|
||||||
|
else
|
||||||
|
blue = (BYFAC*255+ROUNDOFFS);
|
||||||
|
}
|
||||||
|
rbits = ((unsigned)red) >> 16 ;
|
||||||
|
gbits = ((unsigned)green) >> 16 ;
|
||||||
|
bbits = ((unsigned)blue) >> 16 ;
|
||||||
|
*dst_row++ = (rbits << 11) | (gbits << 5) | bbits;
|
||||||
|
|
||||||
|
if (++xphase >= CSUB_X)
|
||||||
|
{
|
||||||
|
u = *usrc++ - 128;
|
||||||
|
v = *vsrc++ - 128;
|
||||||
|
rc = RVFAC * v + ROUNDOFFS;
|
||||||
|
gc = GVFAC * v + GUFAC * u + ROUNDOFFS;
|
||||||
|
bc = BUFAC * u + ROUNDOFFS;
|
||||||
|
xphase = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (dst_row < row_end);
|
||||||
|
|
||||||
|
src_y++;
|
||||||
|
dst += LCD_WIDTH;
|
||||||
|
}
|
||||||
|
while (dst < dst_end);
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue