This commit is contained in:
tTh 2022-09-23 13:28:02 +02:00
parent 7679fabae9
commit 2f1f51671c
2 changed files with 40 additions and 45 deletions

View File

@ -108,11 +108,10 @@ int Image_luminance(Image_Desc *src, Image_Desc *dst, int factor)
int foo;
int x, y;
#if DEBUG_LEVEL > 1
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__, src, dst, factor);
#endif
fprintf(stderr, "luminance factor: %d %f\n", factor, (float)factor / 256.0);
#endif
if ( (foo=Image_compare_desc(src, dst)) ) {
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
@ -154,11 +153,11 @@ int *cumlr, *cumlg, *cumlb;
long cr, cg, cb, s;
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)) ) {
fprintf(stderr, "Image Egalise RGB: images are differents %d\n", foo);
fprintf(stderr, "%s: images are differents %d\n", __func__, foo);
return foo;
}
@ -178,7 +177,7 @@ cr = cg = cb = 0L;
s = (src->width * src->height);
#if DEBUG_LEVEL
fprintf(stderr, "Image Egalise 0: surface = %ld\n", s);
fprintf(stderr, "%s: surface = %ld\n", __func__, s);
#endif
for (foo=0; foo<256; foo++) {

View File

@ -14,16 +14,19 @@
/*
* comme au bon vieux temps...
*/
int
Image_TV_old(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
int Image_TV_old(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
{
int foo;
int x, y, v1, v2;
int resteY;
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);
return foo;
}
@ -36,13 +39,11 @@ resteY /= 2; /* half for the top, half for the bottom */
#if DEBUG_LEVEL
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
for (y=resteY; y<src->height-resteY-1; y+=3)
{
for (x=0; x<src->width; x++)
{
for (y=resteY; y<src->height-resteY-1; y+=3) {
for (x=0; x<src->width; x++) {
v1 = ( Image_R_pixel(src, x, y) +
Image_R_pixel(src, x, y+1) +
Image_R_pixel(src, x, y+2) +
@ -68,20 +69,17 @@ return FUNC_IS_BETA;
/*
* this is juste a wrapper function - need more work...
*/
int
Image_TV_veryold(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
int Image_TV_veryold(Image_Desc *src, Image_Desc *dst, int p1, int p2, int p3)
{
int foo;
/* 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");
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);
return foo;
}
@ -95,16 +93,19 @@ return FUNC_IS_ALPHA;
/*
* new 10 novembre 2013, in mixart-myrys
*/
int
Image_TV_pix_0(Image_Desc *src, Image_Desc *dst, int w, int h, int grey)
int Image_TV_pix_0(Image_Desc *src, Image_Desc *dst, int w, int h, int grey)
{
int foo, ox, oy;
int x, y, r, g, b;
int xmax, ymax;
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);
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);
#endif
if (0==h || 0==w)
{
if (0==h || 0==w) {
return BAD_PARAMETER;
}
@ -127,11 +127,9 @@ fprintf(stderr, "%s : offsets = %d %d\n", __func__, ox, oy);
#endif
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);
for (y=oy; y<ymax; y+=h)
{
for (y=oy; y<ymax; y+=h) {
zone.y = y + (h/2);
r = src->Rpix[y][x] & 0xfe;
g = src->Gpix[y][x] & 0xfe;
@ -154,8 +152,12 @@ int x, y, v1, v2, r, g, b;
int xmax, ymax;
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);
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);
#endif
if ((0==h) || (0==w))
{
if ((0==h) || (0==w)) {
return BAD_PARAMETER;
}
@ -175,11 +176,9 @@ xmax = src->width - w;
ymax = src->height - h;
v1 = v2 = 0;
for (x=0; x<xmax; x+=w)
{
for (x=0; x<xmax; x+=w) {
zone.x = x;
for (y=0; y<ymax; y+=h)
{
for (y=0; y<ymax; y+=h) {
zone.y = y;
r = src->Rpix[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);
for (y=0; y<src->height; y++)
{
for (y=0; y<src->height; y++) {
switch (rand()%3) {
case 0 :
memcpy((dst->Rpix[y]), src->Rpix[y], taille);
@ -262,8 +260,7 @@ Image_clear(dst, 60, 60, 60); /* XXX necessaire ? */
idx = rand() % 42;
for (y=0; y<src->height; y++)
{
for (y=0; y<src->height; y++) {
if (0==mode) {
tri = (idx + y) % 3;
}
@ -273,8 +270,7 @@ for (y=0; y<src->height; y++)
#if DEBUG_LEVEL > 1
fprintf(stderr, " %5d -> %d\n", y, tri);
#endif
switch (tri)
{
switch (tri) {
case 0:
for (x=0; x<(src->width)-1; x++) {
v = (src->Rpix[y][x] + src->Rpix[y][x+1]);