forked from len0rd/rockbox
Do the clamping a little better.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13254 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0d032d1fa1
commit
72e6dd5e0c
1 changed files with 16 additions and 19 deletions
|
@ -31,9 +31,6 @@ extern struct plugin_api* rb;
|
||||||
#include "mpeg2.h"
|
#include "mpeg2.h"
|
||||||
#include "video_out.h"
|
#include "video_out.h"
|
||||||
|
|
||||||
#define CSUB_X 2
|
|
||||||
#define CSUB_Y 2
|
|
||||||
|
|
||||||
static int image_width;
|
static int image_width;
|
||||||
static int image_height;
|
static int image_height;
|
||||||
static int image_chroma_x;
|
static int image_chroma_x;
|
||||||
|
@ -119,11 +116,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
|
||||||
g = y + guv;
|
g = y + guv;
|
||||||
b = y + bu;
|
b = y + bu;
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 63*256)
|
if ((unsigned)(r | g | b) > 64*256-1)
|
||||||
{
|
{
|
||||||
r = clamp(r, 0, 63*256);
|
r = clamp(r, 0, 64*256-1);
|
||||||
g = clamp(g, 0, 63*256);
|
g = clamp(g, 0, 64*256-1);
|
||||||
b = clamp(b, 0, 63*256);
|
b = clamp(b, 0, 64*256-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
||||||
|
@ -139,11 +136,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
|
||||||
g = y + guv;
|
g = y + guv;
|
||||||
b = y + bu;
|
b = y + bu;
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 63*256)
|
if ((unsigned)(r | g | b) > 64*256-1)
|
||||||
{
|
{
|
||||||
r = clamp(r, 0, 63*256);
|
r = clamp(r, 0, 64*256-1);
|
||||||
g = clamp(g, 0, 63*256);
|
g = clamp(g, 0, 64*256-1);
|
||||||
b = clamp(b, 0, 63*256);
|
b = clamp(b, 0, 64*256-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
||||||
|
@ -184,11 +181,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
|
||||||
g = y + guv;
|
g = y + guv;
|
||||||
b = y + bu;
|
b = y + bu;
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 63*256)
|
if ((unsigned)(r | g | b) > 64*256-1)
|
||||||
{
|
{
|
||||||
r = clamp(r, 0, 63*256);
|
r = clamp(r, 0, 64*256-1);
|
||||||
g = clamp(g, 0, 63*256);
|
g = clamp(g, 0, 64*256-1);
|
||||||
b = clamp(b, 0, 63*256);
|
b = clamp(b, 0, 64*256-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
||||||
|
@ -204,11 +201,11 @@ static void yuv_bitmap_part(unsigned char * const src[3],
|
||||||
g = y + guv;
|
g = y + guv;
|
||||||
b = y + bu;
|
b = y + bu;
|
||||||
|
|
||||||
if ((unsigned)(r | g | b) > 63*256)
|
if ((unsigned)(r | g | b) > 64*256-1)
|
||||||
{
|
{
|
||||||
r = clamp(r, 0, 63*256);
|
r = clamp(r, 0, 64*256-1);
|
||||||
g = clamp(g, 0, 63*256);
|
g = clamp(g, 0, 64*256-1);
|
||||||
b = clamp(b, 0, 63*256);
|
b = clamp(b, 0, 64*256-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
*dst = LCD_RGBPACK_LCD(r >> 9, g >> 8, b >> 9);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue