mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
imx233/fuze+: implement lcd_blit_yuv (untested)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30207 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1df8072c08
commit
855e3c6f0f
1 changed files with 74 additions and 0 deletions
|
|
@ -18,6 +18,7 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <sys/types.h> /* off_t */
|
||||
#include <string.h>
|
||||
#include "cpu.h"
|
||||
#include "system.h"
|
||||
|
|
@ -35,6 +36,8 @@
|
|||
extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
|
||||
int width, int height);
|
||||
|
||||
static unsigned lcd_yuv_options = 0;
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
static bool lcd_on = false;
|
||||
#endif
|
||||
|
|
@ -517,3 +520,74 @@ void lcd_update_rect(int x, int y, int width, int height)
|
|||
(void) height;
|
||||
lcd_update();
|
||||
}
|
||||
|
||||
void lcd_yuv_set_options(unsigned options)
|
||||
{
|
||||
lcd_yuv_options = options;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
/* Performance function to blit a YUV bitmap directly to the LCD */
|
||||
/* So the LCD_WIDTH is now the height */
|
||||
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)
|
||||
{
|
||||
/* Caches for chroma data so it only need be recaculated every other
|
||||
line */
|
||||
unsigned char const * yuv_src[3];
|
||||
off_t z;
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
if (!lcd_on)
|
||||
return;
|
||||
#endif
|
||||
|
||||
/* Sorry, but width and height must be >= 2 or else */
|
||||
width &= ~1;
|
||||
height >>= 1;
|
||||
|
||||
y = LCD_WIDTH - 1 - y;
|
||||
fb_data *dst = (fb_data*)FRAME + x * LCD_WIDTH + y;
|
||||
|
||||
z = stride*src_y;
|
||||
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(dst, yuv_src, width, stride, y, x);
|
||||
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;
|
||||
dst -= 2;
|
||||
y -= 2;
|
||||
}
|
||||
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;
|
||||
dst -= 2;
|
||||
}
|
||||
while (--height > 0);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue