Compare commits
	
		
			3 Commits
		
	
	
		
			6c92cca12c
			...
			5845ab7962
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					5845ab7962 | ||
| 
						 | 
					0e79b3e8fa | ||
| 
						 | 
					1b5186f4b3 | 
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@ -86,4 +86,6 @@ experiment/*.pnm
 | 
			
		||||
experiment/*.o
 | 
			
		||||
experiment/muxplanes
 | 
			
		||||
experiment/movepixels
 | 
			
		||||
experiment/tcache
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -92,6 +92,7 @@ FimgFilter3x3	lowpass = {
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
FimgFilter3x3	hipass = {
 | 
			
		||||
	/* there was a bug with this filter */
 | 
			
		||||
		{
 | 
			
		||||
		-1.0,	-1.0,	-1.0,
 | 
			
		||||
		-1.0,	 9.0,	-1.0,
 | 
			
		||||
@ -101,6 +102,7 @@ FimgFilter3x3	hipass = {
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
FimgFilter3x3	diagonal = {
 | 
			
		||||
	/* there was a bug with this filter */
 | 
			
		||||
		{
 | 
			
		||||
		4.0,	1.0,	0.0,
 | 
			
		||||
		1.0,	0.0,	-1.0,
 | 
			
		||||
@ -354,8 +356,9 @@ switch (idFx) {
 | 
			
		||||
		retval = des_bords_sombres_a(image, 160);
 | 
			
		||||
		break;
 | 
			
		||||
	case CR_bsombrb:			/* experiment ! */
 | 
			
		||||
		retval = des_bords_sombres_b(image, 160);
 | 
			
		||||
		retval = des_bords_sombres_b(image, 100);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	case CR_vsglitch:
 | 
			
		||||
		/* please make this function more tweakable */
 | 
			
		||||
		retval = vertical_singlitch(image, 290+rand()%45,
 | 
			
		||||
 | 
			
		||||
@ -54,9 +54,11 @@ static int pixel_trinitron(FloatImg *pimg, int pos[4], float *fvals)
 | 
			
		||||
{
 | 
			
		||||
int		x, y, pline, off;
 | 
			
		||||
 | 
			
		||||
fimg_clear_rectangle(pimg, pos);
 | 
			
		||||
 | 
			
		||||
for (y=pos[1]; y<pos[1]+pos[3]; y++) {
 | 
			
		||||
	pline = y*pimg->width;
 | 
			
		||||
	for (x=pos[0]+2; x<pos[0]+pos[2]-2; x++) {
 | 
			
		||||
	for (x=pos[0]+2; x<(pos[0]+pos[2]-2); x++) {
 | 
			
		||||
		off = pline + x;
 | 
			
		||||
		/* wtf i'm doing here ? */
 | 
			
		||||
		pimg->R[off] = fvals[0];
 | 
			
		||||
@ -320,21 +322,39 @@ return 0;
 | 
			
		||||
/* -------------------------------------------------------------- */
 | 
			
		||||
/* nouveau Mon 10 May 2021 08:46:02 PM CEST
 | 
			
		||||
 *	chez Eric 1KA						*/
 | 
			
		||||
int des_bords_sombres_b(FloatImg *pimg, int offset)
 | 
			
		||||
int des_bords_sombres_b(FloatImg *pimg, int nbre)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
int		idx, x, foo;
 | 
			
		||||
float		coef, *fptr;
 | 
			
		||||
#if DEBUG_LEVEL
 | 
			
		||||
fprintf(stderr, ">>> %s ( %p %d )\n", __func__, pimg, offset);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
if (offset<0 || offset>=pimg->width) {
 | 
			
		||||
	fprintf(stderr, "%s: offset %d is bad\n", __func__, offset);
 | 
			
		||||
	return -66;
 | 
			
		||||
for (idx=0; idx<nbre; idx++) {
 | 
			
		||||
 | 
			
		||||
	coef = (float)idx / (float)nbre;
 | 
			
		||||
 | 
			
		||||
	fptr = pimg->R + (idx*pimg->width);
 | 
			
		||||
	for (x=0; x<pimg->width; x++) *fptr++ *= coef;
 | 
			
		||||
	fptr = pimg->G + (idx*pimg->width);
 | 
			
		||||
	for (x=0; x<pimg->width; x++) *fptr++ *= coef;
 | 
			
		||||
	fptr = pimg->B + (idx*pimg->width);
 | 
			
		||||
	for (x=0; x<pimg->width; x++) *fptr++ *= coef;
 | 
			
		||||
 | 
			
		||||
	foo = (pimg->height-idx) - 1;
 | 
			
		||||
	fptr = pimg->R + (foo*pimg->width);
 | 
			
		||||
	// fprintf(stderr, "%5d   %9.3f    %p\n", foo, coef, fptr);
 | 
			
		||||
	for (x=0; x<pimg->width; x++) *fptr++ *= coef;
 | 
			
		||||
	fptr = pimg->G + (foo*pimg->width);
 | 
			
		||||
	for (x=0; x<pimg->width; x++) *fptr++ *= coef;
 | 
			
		||||
	fptr = pimg->B + (foo*pimg->width);
 | 
			
		||||
	for (x=0; x<pimg->width; x++) *fptr++ *= coef;
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "ERROR: %s not implemented\n", __func__);
 | 
			
		||||
// fprintf(stderr, "WARNING: %s badly implemented\n", __func__);
 | 
			
		||||
 | 
			
		||||
return -1;
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/* -------------------------------------------------------------- */
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
@ -5,10 +5,12 @@
 | 
			
		||||
 | 
			
		||||
COPT = -Wall -fpic -g -DDEBUG_LEVEL=1 -lm
 | 
			
		||||
DEPS = ../floatimg.h  ../libfloatimg.a Makefile
 | 
			
		||||
LIBS = -ltiff -lpnglite -lcfitsio
 | 
			
		||||
LIBS = ../libfloatimg.a -ltiff -lpnglite -lcfitsio
 | 
			
		||||
 | 
			
		||||
all:	assemblage extracteur muxplanes movepixels
 | 
			
		||||
 | 
			
		||||
# ---------------------------------------------------------
 | 
			
		||||
 | 
			
		||||
assemblage:	assemblage.c ${DEPS} 
 | 
			
		||||
	gcc $(COPT) $< ../libfloatimg.a ${LIBS} -o $@
 | 
			
		||||
 | 
			
		||||
@ -16,7 +18,20 @@ extracteur:	extracteur.c ${DEPS}
 | 
			
		||||
	gcc $(COPT) $<  ../libfloatimg.a ${LIBS} -o $@
 | 
			
		||||
 | 
			
		||||
muxplanes:	muxplanes.c ${DEPS}
 | 
			
		||||
	gcc $(COPT) $<  ../libfloatimg.a ${LIBS} -o $@
 | 
			
		||||
	gcc $(COPT) $<   ${LIBS} -o $@
 | 
			
		||||
 | 
			
		||||
movepixels:	movepixels.c ${DEPS}
 | 
			
		||||
	gcc $(COPT) $<  ../libfloatimg.a ${LIBS} -o $@
 | 
			
		||||
 | 
			
		||||
# ---------------------------------------------------------
 | 
			
		||||
#			CACHE ENGINE
 | 
			
		||||
 | 
			
		||||
cachengn.o:	cachengn.c cachengn.h Makefile
 | 
			
		||||
	gcc $(COPT) -c $< 
 | 
			
		||||
 | 
			
		||||
tcache.o:	tcache.c cachengn.h Makefile
 | 
			
		||||
	gcc $(COPT) -c $< 
 | 
			
		||||
 | 
			
		||||
tcache:		tcache.o cachengn.o Makefile
 | 
			
		||||
	gcc $(COPT) tcache.o cachengn.o $(LIBS) -o $@
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								experiment/cachengn.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								experiment/cachengn.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
/*
 | 
			
		||||
 *		the chache engine - code
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include  <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include  "cachengn.h"
 | 
			
		||||
 | 
			
		||||
/* ------------------------------------------------------------ */
 | 
			
		||||
 | 
			
		||||
void cachengn_print_version(int k)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
printf("this is the version ZERO !!!\n");
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* ------------------------------------------------------------ */
 | 
			
		||||
							
								
								
									
										5
									
								
								experiment/cachengn.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								experiment/cachengn.h
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,5 @@
 | 
			
		||||
/*
 | 
			
		||||
 *		the chache engine - header
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
void cachengn_print_version(int k);
 | 
			
		||||
							
								
								
									
										18
									
								
								experiment/tcache.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								experiment/tcache.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
/*
 | 
			
		||||
 *		tests du systeme de cache
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include  <stdio.h>
 | 
			
		||||
 | 
			
		||||
#include  "cachengn.h"
 | 
			
		||||
 | 
			
		||||
/* ------------------------------------------------------------ */
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
fprintf(stderr, "Test of the cache engin - %s %s\n", __DATE__, __TIME__);
 | 
			
		||||
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/* ------------------------------------------------------------ */
 | 
			
		||||
 | 
			
		||||
@ -4,7 +4,7 @@
 | 
			
		||||
 *	http://la.buvette.org/photos/cumul
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#define		FIMG_VERSION	157
 | 
			
		||||
#define		FIMG_VERSION	160
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *	in memory descriptor
 | 
			
		||||
@ -108,6 +108,7 @@ typedef struct {
 | 
			
		||||
 | 
			
		||||
int fimg_killborders(FloatImg *img);
 | 
			
		||||
int fimg_lissage_2x2(FloatImg *img);
 | 
			
		||||
int fimg_show_filter(char *title, FimgFilter3x3 *filtr);
 | 
			
		||||
int fimg_filter_3x3(FloatImg *s, FloatImg *d, FimgFilter3x3 *filtr);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -248,6 +249,7 @@ int parse_rectangle(char *str, FimgArea51 *r, int notused);
 | 
			
		||||
int format_from_extension(char *fname);
 | 
			
		||||
char * extension_from_format(int fmt);
 | 
			
		||||
 | 
			
		||||
int fimg_clear_rectangle(FloatImg *pimg, int rect[4]);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -7,7 +7,7 @@ COPT = -Wall -fpic -g -no-pie  -DDEBUG_LEVEL=0
 | 
			
		||||
DEPS = ../floatimg.h Makefile
 | 
			
		||||
 | 
			
		||||
OBJS = fimg-png.o fimg-tiff.o misc-plots.o filtrage.o utils.o	\
 | 
			
		||||
	fimg-libpnm.o rampes.o 					\
 | 
			
		||||
	fimg-libpnm.o rampes.o rectangle.o			\
 | 
			
		||||
	sfx0.o sfx1.o sfx2.o sfx3.o sfx4.o			\
 | 
			
		||||
	geometry.o rotate.o fimg-openexr.o			\
 | 
			
		||||
	equalize.o fimg-fits.o saturation.o histogram.o		\
 | 
			
		||||
@ -37,6 +37,9 @@ tests.o:	tests.c tests.h $(DEPS)
 | 
			
		||||
 | 
			
		||||
# ###
 | 
			
		||||
 | 
			
		||||
rectangle.o:		rectangle.c  $(DEPS)
 | 
			
		||||
	gcc $(COPT) -c $<
 | 
			
		||||
 | 
			
		||||
decomprgb.o:		decomprgb.c  $(DEPS)
 | 
			
		||||
	gcc $(COPT) -c $<
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										38
									
								
								funcs/rectangle.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								funcs/rectangle.c
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,38 @@
 | 
			
		||||
/*
 | 
			
		||||
 *			R E C T A N G L E
 | 
			
		||||
 *		This is an eternal WIP, sorry...
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include  <stdio.h>
 | 
			
		||||
#include  <stdlib.h>
 | 
			
		||||
#include  <stdint.h>
 | 
			
		||||
#include  <string.h>
 | 
			
		||||
 | 
			
		||||
#include  <math.h>
 | 
			
		||||
 | 
			
		||||
#include  "../floatimg.h"
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int fimg_clear_rectangle(FloatImg *pi, int coo[4])
 | 
			
		||||
{
 | 
			
		||||
int		line, off;
 | 
			
		||||
 | 
			
		||||
#if DEBUG_LEVEL
 | 
			
		||||
fprintf(stderr, ">>> %s ( %p %p )\n", __func__, pi, coo);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* please add boudary checks */
 | 
			
		||||
 | 
			
		||||
for (line=0; line<coo[3]; line++) {
 | 
			
		||||
	off = (line+coo[1])*pi->width + coo[0];
 | 
			
		||||
	// fprintf(stderr, "line %3d   off %8d\n", line, off);
 | 
			
		||||
	/* Kaboum ! */
 | 
			
		||||
	memset(pi->R + off, 0, coo[2]*sizeof(float));
 | 
			
		||||
	memset(pi->G + off, 0, coo[2]*sizeof(float));
 | 
			
		||||
	memset(pi->B + off, 0, coo[2]*sizeof(float));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
return -1;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
 | 
			
		||||
@ -24,7 +24,7 @@ enum nCmd { Equalize=1, Rotate, Sfx0, F3x3, MIRE, Wfits, Wpng, Wtiff,
 | 
			
		||||
			Histo, Hsv, Classif, Ctr2x2, Qsortrgb,
 | 
			
		||||
			Displace, ReadPNG, Plasmas, Hilight, OpenEXR,
 | 
			
		||||
			Geometrie, FileType, Mirror, KillRGB,
 | 
			
		||||
			Pixelize,SplitLevel,DecompRgbz  };
 | 
			
		||||
			Pixelize,SplitLevel,DecompRgbz, Rectangle  };
 | 
			
		||||
typedef struct {
 | 
			
		||||
	char	*name;
 | 
			
		||||
	int	Cmd;
 | 
			
		||||
@ -56,6 +56,7 @@ Command commands[] = {
 | 
			
		||||
	{ "pixelize",	Pixelize	},
 | 
			
		||||
	{ "spltlvl",	SplitLevel	},
 | 
			
		||||
	{ "decomprgbz",	DecompRgbz	},
 | 
			
		||||
	{ "rectangle",  Rectangle	},
 | 
			
		||||
	{ NULL,		0		}
 | 
			
		||||
	} ;
 | 
			
		||||
 | 
			
		||||
@ -233,6 +234,10 @@ switch(opt) {
 | 
			
		||||
	case DecompRgbz:
 | 
			
		||||
		foo = essai_decomprgb(filename, outfile);
 | 
			
		||||
		break;
 | 
			
		||||
	case Rectangle:
 | 
			
		||||
		essai_rectangle(outfile, 0);
 | 
			
		||||
		break;
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
		fprintf(stderr, "'%s' is a bad command\n", command);
 | 
			
		||||
		exit(1);
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,31 @@
 | 
			
		||||
 | 
			
		||||
extern int		verbosity;
 | 
			
		||||
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int essai_rectangle(char *outf, int k)
 | 
			
		||||
{
 | 
			
		||||
FloatImg	img;
 | 
			
		||||
int		foo;
 | 
			
		||||
int		rect[4];
 | 
			
		||||
 | 
			
		||||
foo = fimg_create(&img, 320, 240, FIMG_TYPE_RGB);
 | 
			
		||||
 | 
			
		||||
fimg_drand48(&img, 1.0);
 | 
			
		||||
 | 
			
		||||
rect[0] = 100;		rect[1] = 100;
 | 
			
		||||
rect[2] = 32;		rect[3] = 16;
 | 
			
		||||
 | 
			
		||||
foo = fimg_clear_rectangle(&img, rect);
 | 
			
		||||
 | 
			
		||||
foo = fimg_export_picture(&img, outf, 0);
 | 
			
		||||
if (foo) {
 | 
			
		||||
	fprintf(stderr, "%s : err %d saving result\n", __func__, foo);
 | 
			
		||||
	return foo;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
fimg_destroy(&img);
 | 
			
		||||
return 0;
 | 
			
		||||
}
 | 
			
		||||
/* --------------------------------------------------------------------- */
 | 
			
		||||
int essai_killrgb(char *inf, char *outf)
 | 
			
		||||
{
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user