Преглед на файлове

img2twit: remove contrast enhancement.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@3539 92316355-f0b4-4df1-b90c-862c8a59935f
master
sam преди 15 години
родител
ревизия
51036f828a
променени са 1 файла, в които са добавени 10 реда и са изтрити 20 реда
  1. +10
    -20
      examples/img2twit.cpp

+ 10
- 20
examples/img2twit.cpp Целия файл

@@ -526,7 +526,7 @@ static inline void set_point(int index, float x, float y, float r,
}

static inline void get_point(int index, float *x, float *y, float *r,
float *g, float *b, float *s, bool final = false)
float *g, float *b, float *s)
{
int dx, dy;

@@ -538,18 +538,9 @@ static inline void get_point(int index, float *x, float *y, float *r,
*y = (fy + dy) * RANGE_Y /*+ 0.5 * (index & 1)*/;
*x = (fx + dx) * RANGE_X /*+ 0.5 * (index & 1)*/;

if(final)
{
*r = int2fullrange(points[index].r, RANGE_R);
*g = int2fullrange(points[index].g, RANGE_G);
*b = int2fullrange(points[index].b, RANGE_B);
}
else
{
*r = int2midrange(points[index].r, RANGE_R);
*g = int2midrange(points[index].g, RANGE_G);
*b = int2midrange(points[index].b, RANGE_B);
}
*r = int2fullrange(points[index].r, RANGE_R);
*g = int2fullrange(points[index].g, RANGE_G);
*b = int2fullrange(points[index].b, RANGE_B);

*s = int2fullrange(points[index].s, RANGE_S);
}
@@ -694,8 +685,7 @@ static void apply_op(uint8_t op, point_t *val)
}
}

static void render(pipi_image_t *dst,
int rx, int ry, int rw, int rh, bool final)
static void render(pipi_image_t *dst, int rx, int ry, int rw, int rh)
{
int lookup[dw * RANGE_X * 2 * dh * RANGE_Y * 2];
pipi_pixels_t *p = pipi_get_pixels(dst, PIPI_PIXELS_RGBA_F32);
@@ -751,7 +741,7 @@ static void render(pipi_image_t *dst,
int index = lookup[(int)(fx * 2)
+ dw * RANGE_X * 2 * (int)(fy * 2)];

get_point(index, &fx, &fy, &fr, &fg, &fb, &fs, final);
get_point(index, &fx, &fy, &fr, &fg, &fb, &fs);

//float k = pow((*it).second * (1.0 + fs), 1.2);
float k = (*it).second * (1.00f + fs);
@@ -1150,7 +1140,7 @@ int main(int argc, char *argv[])

/* Render what we just computed */
tmp = pipi_new(dw * RANGE_X, dh * RANGE_Y);
render(tmp, 0, 0, dw * RANGE_X, dh * RANGE_Y, false);
render(tmp, 0, 0, dw * RANGE_X, dh * RANGE_Y);
error = pipi_measure_rmsd(src, tmp);

if(DEBUG_MODE)
@@ -1208,7 +1198,7 @@ int main(int argc, char *argv[])
}

render(scrap, zonex * RANGE_X, zoney * RANGE_Y,
zonew * RANGE_X, zoneh * RANGE_Y, false);
zonew * RANGE_X, zoneh * RANGE_Y);

double newerr = pipi_measure_rmsd(src, scrap);

@@ -1226,7 +1216,7 @@ int main(int argc, char *argv[])
char buf[128];
sprintf(buf, "twit%08i.bmp", success);
tmp = pipi_new(width, height);
render(tmp, 0, 0, width, height, true);
render(tmp, 0, 0, width, height);
pipi_save(tmp, buf);
pipi_free(tmp);
}
@@ -1364,7 +1354,7 @@ int main(int argc, char *argv[])

/* Render these points to a new image */
dst = pipi_new(width, height);
render(dst, 0, 0, width, height, true);
render(dst, 0, 0, width, height);

/* Save image and bail out */
pipi_save(dst, dstname);


Зареждане…
Отказ
Запис