integration of halfsizing
This commit is contained in:
		
							parent
							
								
									2b26645b49
								
							
						
					
					
						commit
						23ce4cd337
					
				| @ -2,7 +2,7 @@ | |||||||
|  *	floatimg.h |  *	floatimg.h | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #define		FIMG_VERSION	90 | #define		FIMG_VERSION	91 | ||||||
| 
 | 
 | ||||||
| /*
 | /*
 | ||||||
|  *	in memory descriptor |  *	in memory descriptor | ||||||
|  | |||||||
| @ -4,6 +4,7 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include  <stdio.h> | #include  <stdio.h> | ||||||
|  | #include  <stdlib.h> | ||||||
| 
 | 
 | ||||||
| #include  "../floatimg.h" | #include  "../floatimg.h" | ||||||
| 
 | 
 | ||||||
| @ -40,12 +41,12 @@ for (y=0; y<hd; y++) { | |||||||
| 	for (x=0; x<wd; x++) { | 	for (x=0; x<wd; x++) { | ||||||
| 		foo = fimg_get_rgb(src, x*2, y*2, pixel); | 		foo = fimg_get_rgb(src, x*2, y*2, pixel); | ||||||
| 		if (foo) { | 		if (foo) { | ||||||
| 			fprintf(stderr, "%s: err get %d\n", foo); | 			fprintf(stderr, "%s: err get %d\n", __func__, foo); | ||||||
| 			abort(); | 			abort(); | ||||||
| 			} | 			} | ||||||
| 		foo = fimg_plot_rgb(dst, x, y, pixel[0], pixel[1], pixel[2]); | 		foo = fimg_plot_rgb(dst, x, y, pixel[0], pixel[1], pixel[2]); | ||||||
| 		if (foo) { | 		if (foo) { | ||||||
| 			fprintf(stderr, "%s: err plot %d\n", foo); | 			fprintf(stderr, "%s: err plot %d\n", __func__, foo); | ||||||
| 			abort(); | 			abort(); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|  | |||||||
							
								
								
									
										32
									
								
								funcs/t.c
									
									
									
									
									
								
							
							
						
						
									
										32
									
								
								funcs/t.c
									
									
									
									
									
								
							| @ -10,6 +10,8 @@ | |||||||
| 
 | 
 | ||||||
| int		verbosity; | int		verbosity; | ||||||
| 
 | 
 | ||||||
|  | float		global_fvalue; | ||||||
|  | 
 | ||||||
| /* --------------------------------------------------------------------- */ | /* --------------------------------------------------------------------- */ | ||||||
| int essai_geometrie(char *infile) | int essai_geometrie(char *infile) | ||||||
| { | { | ||||||
| @ -35,7 +37,7 @@ if (foo) { | |||||||
| 	return -2; | 	return -2; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| fimg_describe(&result, "result after halfsize"); | if (verbosity) fimg_describe(&result, "result after halfsize"); | ||||||
| 
 | 
 | ||||||
| foo = fimg_save_as_pnm(&result, "something.pnm", 0); | foo = fimg_save_as_pnm(&result, "something.pnm", 0); | ||||||
| 
 | 
 | ||||||
| @ -57,12 +59,23 @@ else	{ | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| foo = fimg_save_as_pnm(&fimg, "something.pnm", 0); | foo = fimg_save_as_pnm(&fimg, "something.pnm", 0); | ||||||
| 
 | if (foo) { | ||||||
|  | 	fprintf(stderr, "%s: err save %d\n", __func__, foo); | ||||||
|  | 	return -6; | ||||||
|  | 	} | ||||||
| foo = fimg_killcolors_a(&fimg, 0.0); | foo = fimg_killcolors_a(&fimg, 0.0); | ||||||
| foo = fimg_save_as_pnm(&fimg, "colorskilled-a.pnm", 0); | foo = fimg_save_as_pnm(&fimg, "colorskilled-a.pnm", 0); | ||||||
|  | if (foo) { | ||||||
|  | 	fprintf(stderr, "%s: err save %d\n", __func__, foo); | ||||||
|  | 	return -6; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| foo = fimg_killcolors_b(&fimg, 0.0); | foo = fimg_killcolors_b(&fimg, 0.0); | ||||||
| foo = fimg_save_as_pnm(&fimg, "colorskilled-b.pnm", 0); | foo = fimg_save_as_pnm(&fimg, "colorskilled-b.pnm", 0); | ||||||
|  | if (foo) { | ||||||
|  | 	fprintf(stderr, "%s: err save %d\n", __func__, foo); | ||||||
|  | 	return -6; | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| return 0; | return 0; | ||||||
| @ -159,11 +172,24 @@ return 0; | |||||||
| /* --------------------------------------------------------------------- */ | /* --------------------------------------------------------------------- */ | ||||||
| int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | ||||||
| { | { | ||||||
| int		foo; | int		foo, opt; | ||||||
| 
 | 
 | ||||||
| puts("++++++++++++++++++++++++++++++++"); | puts("++++++++++++++++++++++++++++++++"); | ||||||
| 
 | 
 | ||||||
|  | global_fvalue = 1.0; | ||||||
|  | 
 | ||||||
|  | while ((opt = getopt(argc, argv, "hk:v")) != -1) { | ||||||
|  | 	switch(opt) { | ||||||
|  | 		// case 'h':	help(0);			break;
 | ||||||
|  | 		case 'k':	global_fvalue = atof(optarg);	break; | ||||||
|  | 		case 'v':	verbosity++;			break; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
| foo = essai_geometrie("foo.fimg"); | foo = essai_geometrie("foo.fimg"); | ||||||
|  | if (foo) { | ||||||
|  | 	fprintf(stderr, "************ %d\n", foo); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| return 0; | return 0; | ||||||
| } | } | ||||||
|  | |||||||
| @ -19,7 +19,7 @@ typedef struct { | |||||||
| 	int		nbarg; | 	int		nbarg; | ||||||
| 	} Fx; | 	} Fx; | ||||||
| 
 | 
 | ||||||
| enum fxid { Fx_cos01, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0 }; | enum fxid { Fx_cos01, Fx_cos010, Fx_pow2, Fx_sqrt, Fx_gray0, Fx_halfsz0 }; | ||||||
| 
 | 
 | ||||||
| Fx fx_list[] = { | Fx fx_list[] = { | ||||||
| 	{ "cos01",		Fx_cos01,	0 }, | 	{ "cos01",		Fx_cos01,	0 }, | ||||||
| @ -27,6 +27,7 @@ Fx fx_list[] = { | |||||||
| 	{ "pow2",		Fx_pow2,	0 }, | 	{ "pow2",		Fx_pow2,	0 }, | ||||||
| 	{ "sqrt",		Fx_sqrt,	0 }, | 	{ "sqrt",		Fx_sqrt,	0 }, | ||||||
| 	{ "gray0",		Fx_gray0,	0 }, | 	{ "gray0",		Fx_gray0,	0 }, | ||||||
|  | 	{ "halfsz0",		Fx_halfsz0,	0 }, | ||||||
| 	{ NULL,			0,	0 } | 	{ NULL,			0,	0 } | ||||||
| 	}; | 	}; | ||||||
| 
 | 
 | ||||||
| @ -112,6 +113,10 @@ switch (act) { | |||||||
| 		fimg_to_gray(&src); fimg_copy_data(&src, &dest); | 		fimg_to_gray(&src); fimg_copy_data(&src, &dest); | ||||||
| 								break; | 								break; | ||||||
| 
 | 
 | ||||||
|  | 	case Fx_halfsz0: | ||||||
|  | 		fprintf(stderr, "not implemented\n"); | ||||||
|  | 		return -3; | ||||||
|  | 
 | ||||||
| 	default: | 	default: | ||||||
| 		fprintf(stderr, "*** %s : %d is bad action\n", __func__, act); | 		fprintf(stderr, "*** %s : %d is bad action\n", __func__, act); | ||||||
| 		break; | 		break; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user