cosmetic
This commit is contained in:
parent
7679fabae9
commit
2f1f51671c
11
Lib/operat.c
11
Lib/operat.c
@ -108,11 +108,10 @@ int Image_luminance(Image_Desc *src, Image_Desc *dst, int factor)
|
|||||||
int foo;
|
int foo;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, factor);
|
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, factor);
|
||||||
#endif
|
|
||||||
|
|
||||||
fprintf(stderr, "luminance factor: %d %f\n", factor, (float)factor / 256.0);
|
fprintf(stderr, "luminance factor: %d %f\n", factor, (float)factor / 256.0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
@ -154,11 +153,11 @@ int *cumlr, *cumlg, *cumlb;
|
|||||||
long cr, cg, cb, s;
|
long cr, cg, cb, s;
|
||||||
|
|
||||||
if (yoyo != 0) {
|
if (yoyo != 0) {
|
||||||
fprintf(stderr, "%s: yoyo is %d\n", __func__, yoyo);
|
fprintf(stderr, "%s: yoyo is %d ?\n", __func__, yoyo);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) ) {
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
fprintf(stderr, "Image Egalise RGB: images are differents %d\n", foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +177,7 @@ cr = cg = cb = 0L;
|
|||||||
s = (src->width * src->height);
|
s = (src->width * src->height);
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "Image Egalise 0: surface = %ld\n", s);
|
fprintf(stderr, "%s: surface = %ld\n", __func__, s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (foo=0; foo<256; foo++) {
|
for (foo=0; foo<256; foo++) {
|
||||||
|
74
Lib/tele_2.c
74
Lib/tele_2.c
@ -14,16 +14,19 @@
|
|||||||
/*
|
/*
|
||||||
* comme au bon vieux temps...
|
* comme au bon vieux temps...
|
||||||
*/
|
*/
|
||||||
int
|
int Image_TV_old(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
|
||||||
Image_TV_old(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
int x, y, v1, v2;
|
int x, y, v1, v2;
|
||||||
int resteY;
|
int resteY;
|
||||||
int sigma;
|
int sigma;
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
#if DEBUG_LEVEL
|
||||||
{
|
fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__,
|
||||||
|
src, dst, p1, p2, p3);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
@ -36,13 +39,11 @@ resteY /= 2; /* half for the top, half for the bottom */
|
|||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, "%s : height %d reste Y %d\n", __func__, src->height, resteY);
|
fprintf(stderr, "%s : height %d reste Y %d\n", __func__, src->height, resteY);
|
||||||
fprintf(stderr, "%s : %d %d %d -> %d\n", __func__, p1, p2, p3, sigma);
|
fprintf(stderr, "%s : %d %d %d -> %d\n", __func__, p1, p2, p3, sigma);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (y=resteY; y<src->height-resteY-1; y+=3)
|
for (y=resteY; y<src->height-resteY-1; y+=3) {
|
||||||
{
|
for (x=0; x<src->width; x++) {
|
||||||
for (x=0; x<src->width; x++)
|
|
||||||
{
|
|
||||||
v1 = ( Image_R_pixel(src, x, y) +
|
v1 = ( Image_R_pixel(src, x, y) +
|
||||||
Image_R_pixel(src, x, y+1) +
|
Image_R_pixel(src, x, y+1) +
|
||||||
Image_R_pixel(src, x, y+2) +
|
Image_R_pixel(src, x, y+2) +
|
||||||
@ -68,20 +69,17 @@ return FUNC_IS_BETA;
|
|||||||
/*
|
/*
|
||||||
* this is juste a wrapper function - need more work...
|
* this is juste a wrapper function - need more work...
|
||||||
*/
|
*/
|
||||||
int
|
int Image_TV_veryold(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
|
||||||
Image_TV_veryold(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
|
|
||||||
{
|
{
|
||||||
int foo;
|
int foo;
|
||||||
|
|
||||||
/* 15 janvier 2007: chasse au coredump... */
|
/* 15 janvier 2007: chasse au coredump... */
|
||||||
if ( (src->magic!=MAGIC_OF_IMAGE) || (dst->magic!=MAGIC_OF_IMAGE) )
|
if ( (src->magic!=MAGIC_OF_IMAGE) || (dst->magic!=MAGIC_OF_IMAGE) ) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Image TV veryold: bad image descriptor\n");
|
fprintf(stderr, "Image TV veryold: bad image descriptor\n");
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
{
|
|
||||||
fprintf(stderr, "Image TV veryold: images are differents %d\n", foo);
|
fprintf(stderr, "Image TV veryold: images are differents %d\n", foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
@ -95,16 +93,19 @@ return FUNC_IS_ALPHA;
|
|||||||
/*
|
/*
|
||||||
* new 10 novembre 2013, in mixart-myrys
|
* new 10 novembre 2013, in mixart-myrys
|
||||||
*/
|
*/
|
||||||
int
|
int Image_TV_pix_0(Image_Desc *src, Image_Desc *dst, int w, int h, int grey)
|
||||||
Image_TV_pix_0(Image_Desc *src, Image_Desc *dst, int w, int h, int grey)
|
|
||||||
{
|
{
|
||||||
int foo, ox, oy;
|
int foo, ox, oy;
|
||||||
int x, y, r, g, b;
|
int x, y, r, g, b;
|
||||||
int xmax, ymax;
|
int xmax, ymax;
|
||||||
Image_Rect zone;
|
Image_Rect zone;
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
#if DEBUG_LEVEL
|
||||||
{
|
fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__,
|
||||||
|
src, dst, w, h, grey);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
@ -113,8 +114,7 @@ if ( (foo=Image_compare_desc(src, dst)) )
|
|||||||
fprintf(stderr, "%s : w %d h %d grey %d\n", __func__, w, h, grey);
|
fprintf(stderr, "%s : w %d h %d grey %d\n", __func__, w, h, grey);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (0==h || 0==w)
|
if (0==h || 0==w) {
|
||||||
{
|
|
||||||
return BAD_PARAMETER;
|
return BAD_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,11 +127,9 @@ fprintf(stderr, "%s : offsets = %d %d\n", __func__, ox, oy);
|
|||||||
#endif
|
#endif
|
||||||
Image_clear(dst, grey, grey, grey);
|
Image_clear(dst, grey, grey, grey);
|
||||||
|
|
||||||
for (x=ox; x<xmax; x+=w)
|
for (x=ox; x<xmax; x+=w) {
|
||||||
{
|
|
||||||
zone.x = x + (w/2);
|
zone.x = x + (w/2);
|
||||||
for (y=oy; y<ymax; y+=h)
|
for (y=oy; y<ymax; y+=h) {
|
||||||
{
|
|
||||||
zone.y = y + (h/2);
|
zone.y = y + (h/2);
|
||||||
r = src->Rpix[y][x] & 0xfe;
|
r = src->Rpix[y][x] & 0xfe;
|
||||||
g = src->Gpix[y][x] & 0xfe;
|
g = src->Gpix[y][x] & 0xfe;
|
||||||
@ -154,8 +152,12 @@ int x, y, v1, v2, r, g, b;
|
|||||||
int xmax, ymax;
|
int xmax, ymax;
|
||||||
Image_Rect zone;
|
Image_Rect zone;
|
||||||
|
|
||||||
if ( (foo=Image_compare_desc(src, dst)) )
|
#if DEBUG_LEVEL
|
||||||
{
|
fprintf(stderr, ">>> %s ( %p %p %d %d %d )\n", __func__,
|
||||||
|
src, dst, w, h, p3);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( (foo=Image_compare_desc(src, dst)) ) {
|
||||||
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
@ -164,8 +166,7 @@ if ( (foo=Image_compare_desc(src, dst)) )
|
|||||||
fprintf(stderr, "%s : w %d h %d g%d\n", __func__, w, h, p3);
|
fprintf(stderr, "%s : w %d h %d g%d\n", __func__, w, h, p3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((0==h) || (0==w))
|
if ((0==h) || (0==w)) {
|
||||||
{
|
|
||||||
return BAD_PARAMETER;
|
return BAD_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,11 +176,9 @@ xmax = src->width - w;
|
|||||||
ymax = src->height - h;
|
ymax = src->height - h;
|
||||||
v1 = v2 = 0;
|
v1 = v2 = 0;
|
||||||
|
|
||||||
for (x=0; x<xmax; x+=w)
|
for (x=0; x<xmax; x+=w) {
|
||||||
{
|
|
||||||
zone.x = x;
|
zone.x = x;
|
||||||
for (y=0; y<ymax; y+=h)
|
for (y=0; y<ymax; y+=h) {
|
||||||
{
|
|
||||||
zone.y = y;
|
zone.y = y;
|
||||||
r = src->Rpix[y][x];
|
r = src->Rpix[y][x];
|
||||||
g = src->Gpix[y][x];
|
g = src->Gpix[y][x];
|
||||||
@ -221,8 +220,7 @@ fprintf(stderr, "%s: largeur %d, taille %d\n", __func__, src->width, taille);
|
|||||||
|
|
||||||
Image_gray_noise_0(dst, 20, 60);
|
Image_gray_noise_0(dst, 20, 60);
|
||||||
|
|
||||||
for (y=0; y<src->height; y++)
|
for (y=0; y<src->height; y++) {
|
||||||
{
|
|
||||||
switch (rand()%3) {
|
switch (rand()%3) {
|
||||||
case 0 :
|
case 0 :
|
||||||
memcpy((dst->Rpix[y]), src->Rpix[y], taille);
|
memcpy((dst->Rpix[y]), src->Rpix[y], taille);
|
||||||
@ -262,8 +260,7 @@ Image_clear(dst, 60, 60, 60); /* XXX necessaire ? */
|
|||||||
|
|
||||||
idx = rand() % 42;
|
idx = rand() % 42;
|
||||||
|
|
||||||
for (y=0; y<src->height; y++)
|
for (y=0; y<src->height; y++) {
|
||||||
{
|
|
||||||
if (0==mode) {
|
if (0==mode) {
|
||||||
tri = (idx + y) % 3;
|
tri = (idx + y) % 3;
|
||||||
}
|
}
|
||||||
@ -273,8 +270,7 @@ for (y=0; y<src->height; y++)
|
|||||||
#if DEBUG_LEVEL > 1
|
#if DEBUG_LEVEL > 1
|
||||||
fprintf(stderr, " %5d -> %d\n", y, tri);
|
fprintf(stderr, " %5d -> %d\n", y, tri);
|
||||||
#endif
|
#endif
|
||||||
switch (tri)
|
switch (tri) {
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
for (x=0; x<(src->width)-1; x++) {
|
for (x=0; x<(src->width)-1; x++) {
|
||||||
v = (src->Rpix[y][x] + src->Rpix[y][x+1]);
|
v = (src->Rpix[y][x] + src->Rpix[y][x+1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user