add cos010 to tga_equalize
This commit is contained in:
@@ -10,48 +10,53 @@
|
||||
/*::------------------------------------------------------------------::*/
|
||||
/*
|
||||
* new: Fri Sep 15 20:18:35 UTC 2023
|
||||
* inspired by the sam func in FloatImg
|
||||
* inspired by the same func in FloatImg
|
||||
*/
|
||||
int Image_egalise_cos01(Image_Desc *source, Image_Desc *but, int k)
|
||||
{
|
||||
int lut[256], uc;
|
||||
int idx, foo;
|
||||
/* int x, y, pix; */
|
||||
int lut[256], uc, idx, foo;
|
||||
float fidx;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
||||
source, but, k);
|
||||
#endif
|
||||
|
||||
if ( (foo=Image_compare_desc(source, but)) ) {
|
||||
fprintf(stderr, "%s: images not compatible, %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
|
||||
for (idx=0; idx<256; idx++) {
|
||||
fidx = (float)idx / 255.0;
|
||||
uc = (unsigned char)(255.0*(0.5 - 0.5 * cos(3.141592654*fidx)));
|
||||
lut[idx] = uc;
|
||||
/* printf("%7d %7d\n", idx, uc); */
|
||||
}
|
||||
Image_LUT_mono(source, but, lut);
|
||||
|
||||
/*
|
||||
* old original code, replaced...
|
||||
*
|
||||
for (y=0; y<source->height; y++) {
|
||||
for (x=0; x<source->width; x++) {
|
||||
return FUNC_IS_BETA;
|
||||
}
|
||||
/*::------------------------------------------------------------------::*/
|
||||
int Image_egalise_cos010(Image_Desc *source, Image_Desc *but, int k)
|
||||
{
|
||||
int lut[256], uc, idx, foo;
|
||||
float fidx;
|
||||
|
||||
pix = source->Rpix[y][x];
|
||||
but->Rpix[y][x] = lut[pix];
|
||||
pix = source->Gpix[y][x];
|
||||
but->Gpix[y][x] = lut[pix];
|
||||
pix = source->Bpix[y][x];
|
||||
but->Bpix[y][x] = lut[pix];
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p %p %d )\n", __func__,
|
||||
source, but, k);
|
||||
#endif
|
||||
|
||||
}
|
||||
if ( (foo=Image_compare_desc(source, but)) ) {
|
||||
fprintf(stderr, "%s: images not compatible, %d\n", __func__, foo);
|
||||
return foo;
|
||||
}
|
||||
for (idx=0; idx<256; idx++) {
|
||||
fidx = (float)idx / 255.0;
|
||||
uc = (unsigned char)(255.0*(0.5 - 0.5 * cos(3.141592654*fidx*2.0)));
|
||||
lut[idx] = uc;
|
||||
/* printf("%7d %7d\n", idx, uc); */
|
||||
}
|
||||
*
|
||||
* ... by a func from 'calculs.c'
|
||||
*/
|
||||
Image_LUT_mono(source, but, lut);
|
||||
|
||||
return FUNC_IS_BETA;
|
||||
|
||||
Reference in New Issue
Block a user