forked from len0rd/rockbox
zenxfi2: remove lcd yuv blitting code (duplicate from generic)
Change-Id: I2be7d5f9cbc2086673c731e7b76b7d7d6f728f26
This commit is contained in:
parent
7f552f80b8
commit
a235200430
1 changed files with 0 additions and 193 deletions
|
@ -32,7 +32,6 @@
|
||||||
#ifdef HAVE_LCD_ENABLE
|
#ifdef HAVE_LCD_ENABLE
|
||||||
static bool lcd_on;
|
static bool lcd_on;
|
||||||
#endif
|
#endif
|
||||||
static unsigned lcd_yuv_options = 0;
|
|
||||||
|
|
||||||
static void setup_lcdif(void)
|
static void setup_lcdif(void)
|
||||||
{
|
{
|
||||||
|
@ -274,195 +273,3 @@ void lcd_update_rect(int x, int y, int w, int h)
|
||||||
}
|
}
|
||||||
imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h);
|
imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lcd_yuv_set_options(unsigned options)
|
|
||||||
{
|
|
||||||
lcd_yuv_options = options;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define YFAC (74)
|
|
||||||
#define RVFAC (101)
|
|
||||||
#define GUFAC (-24)
|
|
||||||
#define GVFAC (-51)
|
|
||||||
#define BUFAC (128)
|
|
||||||
|
|
||||||
static inline int clamp(int val, int min, int max)
|
|
||||||
{
|
|
||||||
if (val < min)
|
|
||||||
val = min;
|
|
||||||
else if (val > max)
|
|
||||||
val = max;
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
const unsigned char *ysrc, *usrc, *vsrc;
|
|
||||||
int linecounter;
|
|
||||||
fb_data *dst, *row_end;
|
|
||||||
long z;
|
|
||||||
|
|
||||||
/* width and height must be >= 2 and an even number */
|
|
||||||
width &= ~1;
|
|
||||||
linecounter = height >> 1;
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
dst = FBADDR(x,y);
|
|
||||||
row_end = dst + width;
|
|
||||||
#else
|
|
||||||
dst = FBADDR(LCD_WIDTH - y - 1,x);
|
|
||||||
row_end = dst + LCD_WIDTH * width;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
z = stride * src_y;
|
|
||||||
ysrc = src[0] + z + src_x;
|
|
||||||
usrc = src[1] + (z >> 2) + (src_x >> 1);
|
|
||||||
vsrc = src[2] + (usrc - src[1]);
|
|
||||||
|
|
||||||
/* stride => amount to jump from end of last row to start of next */
|
|
||||||
stride -= width;
|
|
||||||
|
|
||||||
/* upsampling, YUV->RGB conversion and reduction to RGB565 in one go */
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
do
|
|
||||||
{
|
|
||||||
int y, cb, cr, rv, guv, bu, r, g, b;
|
|
||||||
|
|
||||||
y = YFAC*(*ysrc++ - 16);
|
|
||||||
cb = *usrc++ - 128;
|
|
||||||
cr = *vsrc++ - 128;
|
|
||||||
|
|
||||||
rv = RVFAC*cr;
|
|
||||||
guv = GUFAC*cb + GVFAC*cr;
|
|
||||||
bu = BUFAC*cb;
|
|
||||||
|
|
||||||
r = y + rv;
|
|
||||||
g = y + guv;
|
|
||||||
b = y + bu;
|
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 64*256-1)
|
|
||||||
{
|
|
||||||
r = clamp(r, 0, 64*256-1);
|
|
||||||
g = clamp(g, 0, 64*256-1);
|
|
||||||
b = clamp(b, 0, 64*256-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
dst++;
|
|
||||||
#else
|
|
||||||
dst += LCD_WIDTH;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
y = YFAC*(*ysrc++ - 16);
|
|
||||||
r = y + rv;
|
|
||||||
g = y + guv;
|
|
||||||
b = y + bu;
|
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 64*256-1)
|
|
||||||
{
|
|
||||||
r = clamp(r, 0, 64*256-1);
|
|
||||||
g = clamp(g, 0, 64*256-1);
|
|
||||||
b = clamp(b, 0, 64*256-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
dst++;
|
|
||||||
#else
|
|
||||||
dst += LCD_WIDTH;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
while (dst < row_end);
|
|
||||||
|
|
||||||
ysrc += stride;
|
|
||||||
usrc -= width >> 1;
|
|
||||||
vsrc -= width >> 1;
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
row_end += LCD_WIDTH;
|
|
||||||
dst += LCD_WIDTH - width;
|
|
||||||
#else
|
|
||||||
row_end -= 1;
|
|
||||||
dst -= LCD_WIDTH*width + 1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
int y, cb, cr, rv, guv, bu, r, g, b;
|
|
||||||
|
|
||||||
y = YFAC*(*ysrc++ - 16);
|
|
||||||
cb = *usrc++ - 128;
|
|
||||||
cr = *vsrc++ - 128;
|
|
||||||
|
|
||||||
rv = RVFAC*cr;
|
|
||||||
guv = GUFAC*cb + GVFAC*cr;
|
|
||||||
bu = BUFAC*cb;
|
|
||||||
|
|
||||||
r = y + rv;
|
|
||||||
g = y + guv;
|
|
||||||
b = y + bu;
|
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 64*256-1)
|
|
||||||
{
|
|
||||||
r = clamp(r, 0, 64*256-1);
|
|
||||||
g = clamp(g, 0, 64*256-1);
|
|
||||||
b = clamp(b, 0, 64*256-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
dst++;
|
|
||||||
#else
|
|
||||||
dst += LCD_WIDTH;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
y = YFAC*(*ysrc++ - 16);
|
|
||||||
r = y + rv;
|
|
||||||
g = y + guv;
|
|
||||||
b = y + bu;
|
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 64*256-1)
|
|
||||||
{
|
|
||||||
r = clamp(r, 0, 64*256-1);
|
|
||||||
g = clamp(g, 0, 64*256-1);
|
|
||||||
b = clamp(b, 0, 64*256-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
dst++;
|
|
||||||
#else
|
|
||||||
dst += LCD_WIDTH;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
while (dst < row_end);
|
|
||||||
|
|
||||||
ysrc += stride;
|
|
||||||
usrc += stride >> 1;
|
|
||||||
vsrc += stride >> 1;
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
row_end += LCD_WIDTH;
|
|
||||||
dst += LCD_WIDTH - width;
|
|
||||||
#else
|
|
||||||
row_end -= 1;
|
|
||||||
dst -= LCD_WIDTH*width + 1;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
while (--linecounter > 0);
|
|
||||||
|
|
||||||
#if LCD_WIDTH >= LCD_HEIGHT
|
|
||||||
lcd_update_rect(x, y, width, height);
|
|
||||||
#else
|
|
||||||
lcd_update_rect(LCD_WIDTH - y - height, x, height, width);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue