mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
Remove YUV blitting functions and LCD modes
None of this is needed now that mpegplayer is gone. Change-Id: I360366db8513e4d988021e8d7b7d8eb09930efb8
This commit is contained in:
parent
b371ff1f47
commit
fe6aa21e9e
54 changed files with 3 additions and 9638 deletions
|
|
@ -379,195 +379,6 @@ static inline int clamp(int val, int min, int max)
|
|||
return val;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
/*
|
||||
* weak attribute doesn't work for win32 as of gcc 4.6.2 and binutils 2.21.52
|
||||
* When building win32 simulators, we won't be using an optimized version of
|
||||
* lcd_blit_yuv(), so just don't use the weak attribute.
|
||||
*/
|
||||
__attribute__((weak))
|
||||
#endif
|
||||
void lcd_yuv_set_options(unsigned options)
|
||||
{
|
||||
(void)options;
|
||||
}
|
||||
|
||||
/* Draw a partial YUV colour bitmap */
|
||||
#ifndef _WIN32
|
||||
__attribute__((weak))
|
||||
#endif
|
||||
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 = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
|
||||
|
||||
#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 = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
|
||||
|
||||
#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 = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
|
||||
|
||||
#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 = FB_RGBPACK(r >> 6, g >> 6, b >> 6);
|
||||
|
||||
#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
|
||||
}
|
||||
|
||||
/* Fill a rectangle with a gradient. This function draws only the partial
|
||||
* gradient. It assumes the original gradient is src_height high and skips
|
||||
* the first few rows. This is useful for drawing only the bottom half of
|
||||
|
|
|
|||
|
|
@ -110,101 +110,3 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
}
|
||||
}
|
||||
#endif /* LCD_OPTIMIZED_UPDATE_RECT */
|
||||
|
||||
|
||||
/*** YUV functions ***/
|
||||
static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
|
||||
|
||||
|
||||
/* Line write helper function for lcd_yuv_blit. Write two lines of yuv420. */
|
||||
extern void lcd_write_yuv420_lines(fb_data *dst,
|
||||
unsigned char const * const src[3],
|
||||
int width,
|
||||
int stride);
|
||||
extern void lcd_write_yuv420_lines_odither(fb_data *dst,
|
||||
unsigned char const * const src[3],
|
||||
int width,
|
||||
int stride,
|
||||
int x_screen, /* To align dither pattern */
|
||||
int y_screen);
|
||||
|
||||
void lcd_yuv_set_options(unsigned options)
|
||||
{
|
||||
lcd_yuv_options = options;
|
||||
}
|
||||
|
||||
#ifndef LCD_OPTIMIZED_BLIT_YUV
|
||||
/* Performance function to blit a YUV bitmap directly to the LCD
|
||||
* src_x, src_y, width and height should be even and within the LCD's
|
||||
* boundaries.
|
||||
*
|
||||
* For portrait LCDs, show it rotated counterclockwise by 90 degrees
|
||||
*/
|
||||
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)
|
||||
{
|
||||
/* Macrofy the bits that change between orientations */
|
||||
#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
|
||||
#define LCD_FRAMEBUF_ADDR_ORIENTED(col, row) \
|
||||
LCD_FRAMEBUF_ADDR(row, col)
|
||||
#define lcd_write_yuv420_lines_odither_oriented(dst, src, w, s, col, row) \
|
||||
lcd_write_yuv420_lines_odither(dst, src, w, s, row, col)
|
||||
#define YUV_NEXTLINE() dst -= 2
|
||||
#define YUV_DITHER_NEXTLINE() dst -= 2, y -= 2
|
||||
#else
|
||||
#define LCD_FRAMEBUF_ADDR_ORIENTED(col, row) \
|
||||
LCD_FRAMEBUF_ADDR(col, row)
|
||||
#define lcd_write_yuv420_lines_odither_oriented(dst, src, w, s, col, row) \
|
||||
lcd_write_yuv420_lines_odither(dst, src, w, s, col, row)
|
||||
#define YUV_NEXTLINE() dst += 2*LCD_FBWIDTH
|
||||
#define YUV_DITHER_NEXTLINE() dst += 2*LCD_FBWIDTH, y += 2
|
||||
#endif
|
||||
|
||||
if (!lcd_write_enabled())
|
||||
return;
|
||||
|
||||
/* Sorry, but width and height must be >= 2 or else */
|
||||
width &= ~1;
|
||||
height >>= 1;
|
||||
|
||||
#if CONFIG_ORIENTATION == SCREEN_PORTRAIT
|
||||
/* Adjust portrait coordinates to make (0, 0) the upper right corner */
|
||||
y = LCD_WIDTH - 1 - y;
|
||||
#endif
|
||||
|
||||
fb_data *dst = LCD_FRAMEBUF_ADDR_ORIENTED(x, y);
|
||||
int z = stride*src_y;
|
||||
|
||||
unsigned char const * yuv_src[3];
|
||||
yuv_src[0] = src[0] + z + src_x;
|
||||
yuv_src[1] = src[1] + (z >> 2) + (src_x >> 1);
|
||||
yuv_src[2] = src[2] + (yuv_src[1] - src[1]);
|
||||
|
||||
if (lcd_yuv_options & LCD_YUV_DITHER)
|
||||
{
|
||||
do
|
||||
{
|
||||
lcd_write_yuv420_lines_odither_oriented(dst, yuv_src, width,
|
||||
stride, x, y);
|
||||
yuv_src[0] += stride << 1; /* Skip down two luma lines */
|
||||
yuv_src[1] += stride >> 1; /* Skip down one chroma line */
|
||||
yuv_src[2] += stride >> 1;
|
||||
YUV_DITHER_NEXTLINE();
|
||||
}
|
||||
while (--height > 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
lcd_write_yuv420_lines(dst, yuv_src, width, stride);
|
||||
yuv_src[0] += stride << 1; /* Skip down two luma lines */
|
||||
yuv_src[1] += stride >> 1; /* Skip down one chroma line */
|
||||
yuv_src[2] += stride >> 1;
|
||||
YUV_NEXTLINE();
|
||||
}
|
||||
while (--height > 0);
|
||||
}
|
||||
}
|
||||
#endif /* LCD_OPTIMIZED_BLIT_YUV */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue