not ready for prime time

This commit is contained in:
tth
2021-04-28 00:21:45 +02:00
parent 821377f666
commit bcc534a54d
12 changed files with 50 additions and 36 deletions

View File

@@ -1,5 +1,5 @@
/*
* FloatImg library from tTh - ugly code inside
* FloatImg library from tTh - really ugly code inside
*/
#include <stdio.h>
@@ -7,7 +7,7 @@
#include "../floatimg.h"
/* -------------------------------------------------------------- */
/* global vars from main
/* global vars exported from main
*/
extern int verbosity;
@@ -28,7 +28,6 @@ if (FIMG_TYPE_RGB != img->type) {
for (y=0; y<img->height; y++) {
p = y * img->width; /* first pixel of the row */
for (x=0; x<img->width; x++) {
gr = (img->R[p] + img->G[p] + img->R[p]) / 3.0;
@@ -36,15 +35,12 @@ for (y=0; y<img->height; y++) {
img->R[p] = ((gr * mix) + (img->R[p] * (1.0-mix))) / 2.0;
img->G[p] = ((gr * mix) + (img->G[p] * (1.0-mix))) / 2.0;
img->B[p] = ((gr * mix) + (img->B[p] * (1.0-mix))) / 2.0;
p++; /* next pixel in the row */
}
}
return 0;
}
/* -------------------------------------------------------------- */
/*
* The third parameter was a six value array with min and max
@@ -60,7 +56,6 @@ if (FIMG_TYPE_RGB != s->type) {
}
sz = s->width * s->height;
for (idx=0; idx<sz; idx++) {
d->R[idx] = s->R[idx] - coefs[0];
d->G[idx] = s->G[idx] - coefs[2];
@@ -69,10 +64,10 @@ for (idx=0; idx<sz; idx++) {
return 0;
}
/* -------------------------------------------------------------- */
/*
* I think that this function is fully buggy
* I think that this function is fully buggy, and need
* more explanations.
*/
int fimg_auto_shift_to_zero(FloatImg *src, FloatImg *dst)
{
@@ -80,6 +75,10 @@ float coefs[6];
int foo;
float minima = 1e7; /* magic value ? */
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, src, dst);
#endif
if (FIMG_TYPE_RGB != src->type) {
fprintf(stderr, "%s: bad image type %d\n", __func__, src->type);
return -6;