mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-19 06:10:01 +01:00
fixed possible divide by zero in pencil sketch
git-svn-id: svn://code.dyne.org/veejay/trunk@617 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
@@ -63,9 +63,7 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b);
|
|||||||
|
|
||||||
static uint8_t _pcf_lghtn(uint8_t a, uint8_t b, int t_max)
|
static uint8_t _pcf_lghtn(uint8_t a, uint8_t b, int t_max)
|
||||||
{
|
{
|
||||||
uint8_t p = (a > b ? a : b );
|
return (a > b ? a : b );
|
||||||
// if( p >= 16 || p <= t_max) p = 16 ; else p = 240;
|
|
||||||
return p;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t _pcf_dneg2(uint8_t a,uint8_t b, int t_max)
|
static uint8_t _pcf_dneg2(uint8_t a,uint8_t b, int t_max)
|
||||||
@@ -86,6 +84,8 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b);
|
|||||||
static uint8_t _pcf_max(uint8_t a,uint8_t b, int t_max)
|
static uint8_t _pcf_max(uint8_t a,uint8_t b, int t_max)
|
||||||
{
|
{
|
||||||
int p = ( (b > a) ? b : a);
|
int p = ( (b > a) ? b : a);
|
||||||
|
if( p <= 0 )
|
||||||
|
return 0;
|
||||||
p = ( 255 - ((255 - b) * (255 - b)) / p);
|
p = ( 255 - ((255 - b) * (255 - b)) / p);
|
||||||
// if( p >= 16 || p <= t_max) p = 16 ; else p = 240;
|
// if( p >= 16 || p <= t_max) p = 16 ; else p = 240;
|
||||||
return (uint8_t)p;
|
return (uint8_t)p;
|
||||||
@@ -93,6 +93,8 @@ typedef uint8_t (*_pcbcr) (uint8_t a, uint8_t b);
|
|||||||
|
|
||||||
static uint8_t _pcf_pq(uint8_t a,uint8_t b, int t_max)
|
static uint8_t _pcf_pq(uint8_t a,uint8_t b, int t_max)
|
||||||
{
|
{
|
||||||
|
if(a <= 0 ) a=16;
|
||||||
|
if(b <= 0 ) b=16;
|
||||||
int p = 255 - ((255-a) * (255-a)) / a;
|
int p = 255 - ((255-a) * (255-a)) / a;
|
||||||
int q = 255 - ((255-b) * (255-b)) / b;
|
int q = 255 - ((255-b) * (255-b)) / b;
|
||||||
p = ( 255 - ((255-p) * (255 - a)) / q);
|
p = ( 255 - ((255-p) * (255 - a)) / q);
|
||||||
|
|||||||
Reference in New Issue
Block a user