comparison Meerwald/wavelet.c @ 20:bd669312f068

suppress warnings, fix link errors
author Peter Meerwald-Stadler <pmeerw@pmeerw.net>
date Sat, 28 Jan 2023 23:54:58 +0100
parents f83ef905a63d
children
comparison
equal deleted inserted replaced
19:0fffb6f03ebf 20:bd669312f068
88 IntImage load_intimage(char *file, int max_val) 88 IntImage load_intimage(char *file, int max_val)
89 { 89 {
90 IntImage img; 90 IntImage img;
91 FILE *fp; 91 FILE *fp;
92 IntPixel *data; 92 IntPixel *data;
93 int width, height, i, max, ch1, ch2; 93 int width, height, i, ch1, ch2;
94 94
95 fp=fopen(file,"rb"); 95 fp=fopen(file,"rb");
96 if (fp==NULL) goto error; 96 if (fp==NULL) goto error;
97 97
98 ch1=getc(fp); 98 ch1=getc(fp);
100 if (ch1!='P' || (ch2!='5' && ch2!='2')) goto error1; 100 if (ch1!='P' || (ch2!='5' && ch2!='2')) goto error1;
101 101
102 width=read_int(fp); 102 width=read_int(fp);
103 height=read_int(fp); 103 height=read_int(fp);
104 if ((width==0) || (height==0) ) goto error1; 104 if ((width==0) || (height==0) ) goto error1;
105 max=read_int(fp); 105 read_int(fp);
106 106
107 img=new_intimage(width,height); 107 img=new_intimage(width,height);
108 108
109 img->bpp=8; 109 img->bpp=8;
110 110
1553 Image_tree best_basis(Image original,int level,FilterGH *flt, 1553 Image_tree best_basis(Image original,int level,FilterGH *flt,
1554 enum FilterMethod method,enum Information_Cost cost,double epsilon) 1554 enum FilterMethod method,enum Information_Cost cost,double epsilon)
1555 1555
1556 { Image_tree tree; 1556 { Image_tree tree;
1557 Image img; 1557 Image img;
1558 int min,max_level,e; 1558 int min,max_level;
1559 1559
1560 tree=new_image_tree(); 1560 tree=new_image_tree();
1561 if(!tree) goto error; 1561 if(!tree) goto error;
1562 1562
1563 img=new_image(original->width,original->height); 1563 img=new_image(original->width,original->height);
1570 min=original->width; 1570 min=original->width;
1571 if (original->height<min) min=original->height; 1571 if (original->height<min) min=original->height;
1572 max_level=log10((float) min/best_basis_min)/log10(2); 1572 max_level=log10((float) min/best_basis_min)/log10(2);
1573 if (max_level>level) max_level=level; 1573 if (max_level>level) max_level=level;
1574 1574
1575 e=compute_best(tree,0,max_level,flt,method,cost,epsilon); 1575 compute_best(tree,0,max_level,flt,method,cost,epsilon);
1576 1576
1577 if (!tree->image) free(img); 1577 if (!tree->image) free(img);
1578 1578
1579 return tree; 1579 return tree;
1580 1580

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.