annotate Meerwald/wavelet.h @ 16:4987db85cfae

fix another scanf() warning
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Mon, 30 Jun 2008 21:03:40 +0200
parents f83ef905a63d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
1 #ifndef WAVELET_H
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
2
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
3 #include <stdio.h>
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
4
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
5 extern char dbgstr[1000];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
6
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
7 /* this are internal functions - don't use 'em! */
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
8 void out_dbg_str(const char *str);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
9 void start_trace(void);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
10 void stop_trace(void);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
11 void flush_trace_file(void);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
12
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
13 /* public functions / macros */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
14 #define StartTrace
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
15 #define StopTrace
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
16
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
17 #define Trace(str)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
18 #define TraceVar(str,var)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
19
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
20 #define Entering
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
21 #define Leaving
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
22 #define LeavingErr
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
23 #define FlushTrace
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
24
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
25 #define Warning(str)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
26
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
27 #define PreCondition(exp,str)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
28 #define PostCondition(exp,str)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
29
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
30 /* Note that if an error is added, an errormessage for this specific
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
31 error must also be added. Otherwise no appropriate message can
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
32 be displayed in an error window. ( Then "Unknown error ocurred"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
33 will be displayed.)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
34 The errormessage must be added to the case-construct in the
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
35 procedure err_GetErrorMessage
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
36 */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
37
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
38 typedef enum
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
39 {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
40 Error_NoError, /* No Error has happened. */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
41 Error_NotImplemented, /* A needed part has not (yet) been
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
42 implemented */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
43 Error_AssertionFailed, /* An assertion, pre- or postcondition failed.
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
44 Occurs only in buggy programs. */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
45 Error_NotEnoughMemory, /* We can't allocate the memory we need. */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
46
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
47 Error_Limitation, /* Some limitation exceeded, e.g. a string
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
48 variable is too short */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
49
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
50
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
51 Error_CantOpenFile, /* The file cannot be opened */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
52 Error_CantCreateFile,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
53 Error_CantWriteIntoFile,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
54 Error_CantCloseFile,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
55 Error_WrongFileFormat,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
56
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
57 Error_WidthOrHeightZero,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
58 Error_CompressedZeroContent,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
59 Error_OriginalZeroContent,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
60
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
61 Error_InternalError
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
62
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
63 }Error;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
64
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
65
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
66 /************************************************************************/
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
67 /* Functionname: err_simple_message */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
68 /* -------------------------------------------------------------------- */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
69 /* Parameter: */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
70 /* char *: string that contains information about an */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
71 /* error the user should know. */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
72 /* -------------------------------------------------------------------- */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
73 /* Description: */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
74 /* Prints error messages for the user. */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
75 /************************************************************************/
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
76 void err_SimpleMessage(char *message);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
77
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
78 /************************************************************************/
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
79 /* Functionname: err_get_message */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
80 /* -------------------------------------------------------------------- */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
81 /* Return value: Errormessage for this specific error. */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
82 /* Parameter: */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
83 /* Error err: Error whose errormessage should be returned */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
84 /* -------------------------------------------------------------------- */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
85 /* Description: */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
86 /************************************************************************/
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
87 char * err_GetErrorMessage(Error err);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
88
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
89 #include <stddef.h>
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
90
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
91 typedef double Pixel;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
92
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
93 typedef struct Image_struct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
94 Pixel *data;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
95 int width,height;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
96
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
97 /* redundant, for our fun only :-) */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
98 Pixel min_val,max_val; /* range of pixel-values in data */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
99 /* [min_val..max_val] */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
100 int size; /* = width * height */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
101 int bpp; /* bits per pixel of original image */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
102 } *Image;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
103
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
104 typedef unsigned int IntPixel;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
105
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
106 typedef struct IntImage_struct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
107 IntPixel *data;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
108 int width, height;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
109
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
110 /* redundant, for our fun only :-) */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
111 IntPixel min_val,max_val; /* range of values in data */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
112 /* [min_val..max_val] */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
113 int size; /* = width * height */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
114 int bpp; /* bits per pixel of original image */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
115 } *IntImage;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
116
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
117 typedef struct Image_tree_struct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
118 double entropy;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
119 struct Image_tree_struct *coarse,*horizontal,*vertical,*diagonal,*doubletree;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
120 Image image;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
121 int level;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
122 int flag;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
123
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
124 void *codec_data;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
125 IntImage significance_map;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
126 } *Image_tree;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
127
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
128 typedef struct Image_info_struct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
129 Pixel min,max,mean,var,rms;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
130 } *Image_info;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
131
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
132 enum zigzag_direction {zigzag_up,zigzag_down,zigzag_right,zigzag_left};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
133
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
134 typedef struct Zigzag_data_struct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
135 int x,y,w,h;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
136 enum zigzag_direction dir;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
137 } *Zigzag_data;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
138
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
139 #define get_intpixel(image,x,y) ( ((image)==NULL || \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
140 (x)<0 || (x)>=(image)->width || (y)<0 || (y)>=(image)->height) \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
141 ? (IntPixel) 0 : (image)->data[(x)+(y)*(image)->width])
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
142
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
143 #define set_intpixel(image,x,y,val) if (!((image)==NULL || \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
144 (x)<0 || (x)>=(image)->width || (y)<0 || (y)>=(image)->height)) \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
145 (image)->data[(x)+(y)*(image)->width]=(IntPixel) (val)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
146
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
147 #define get_pixel(image,x,y) ( ((image)==NULL || \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
148 (x)<0 || (x)>=(image)->width || (y)<0 || (y)>=(image)->height) \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
149 ? (Pixel) 0 : (image)->data[(x)+(y)*(image)->width])
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
150
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
151 #define set_pixel(image,x,y,val) if (!((image)==NULL || \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
152 (x)<0 || (x)>=(image)->width || (y)<0 || (y)>=(image)->height)) \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
153 (image)->data[(x)+(y)*(image)->width]=(Pixel) (val)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
154
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
155 #define get_pixel_adr(image,x,y) ( ((image)==NULL || \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
156 (x)<0 || (x)>=(image)->width || (y)<0 || (y)>=(image)->height) \
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
157 ? (Pixel*) NULL : (image)->data+((x)+(y)*(image)->width))
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
158
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
159 /* functions: */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
160
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
161 IntImage new_intimage(int width, int height);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
162 IntImage load_intimage(char *file, int max_val);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
163 void free_intimage(IntImage img);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
164
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
165 void clear_intimage(IntImage img);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
166 void copy_into_intimage(IntImage img1,IntImage img2,int x,int y);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
167 void copy_part_of_intimage(IntImage img1,IntImage img2,int x,int y);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
168
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
169 Image new_image(int width, int height);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
170 void free_image(Image img);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
171 void clear_image(Image img);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
172 void copy_into_image(Image img1,Image img2,int x,int y);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
173 void scale_image(Image img,int maximum);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
174 void copy_part_of_image(Image img1,Image img2,int x,int y);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
175
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
176 void copy_part_of_image_into_image(
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
177 Image dest_img, int dest_x, int dest_y,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
178 Image src_img, int src_x, int src_y,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
179 int width, int height);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
180
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
181
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
182 int string_to_pixel(char *str, Pixel *p);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
183
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
184 Image load_image(char *file, int max_val);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
185 int save_image_P5(char *file, Image img);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
186
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
187 Image intimage_to_image(IntImage i);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
188 IntImage image_to_intimage(Image i);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
189
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
190 Image_tree new_image_tree();
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
191 void free_image_tree(Image_tree t);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
192
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
193 Image get_difference_image(Image image1, Image image2);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
194
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
195 void get_image_infos(Image image, Image_info info);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
196
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
197 void get_intimage_infos(IntImage image, IntPixel *min, IntPixel *max, Pixel *avg, Pixel *var);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
198
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
199 void init_zigzag(Zigzag_data zz, int width, int height);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
200 void next_zigzag(Zigzag_data zz);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
201 Image get_absolute_image_scaled(Image img);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
202
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
203 /* common macros */
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
204
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
205 #ifndef MIN
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
206 #define MIN(a,b) ((a)<(b)?(a):(b))
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
207 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
208
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
209 #ifndef MAX
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
210 #define MAX(a,b) ((a)>(b)?(a):(b))
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
211 #endif
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
212
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
213 enum FilterType { FTNoSymm, FTSymm, FTAntiSymm};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
214
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
215 typedef struct FilterStruct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
216 enum FilterType type;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
217 int hipass;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
218 Pixel * data;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
219 int start,end;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
220
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
221 int len;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
222 } *Filter;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
223
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
224 Filter new_filter(int size);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
225
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
226 int filter_cutoff(Image in, int in_start, int in_len, int in_step,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
227 Image out, int out_start, int out_len, int out_step,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
228 Filter f);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
229
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
230 int filter_inv_cutoff(Image in, int in_start, int in_len, int in_step,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
231 Image out, int out_start, int out_len, int out_step,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
232 Filter f);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
233
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
234 int filter_periodical(Image in, int in_start, int in_len, int in_step,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
235 Image out, int out_start, int out_len, int out_step,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
236 Filter f);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
237
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
238 int filter_inv_periodical(Image in, int in_start, int in_len, int in_step,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
239 Image out, int out_start, int out_len, int out_step,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
240 Filter f);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
241
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
242 int filter_mirror(Image in, int in_start, int in_len, int in_step,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
243 Image out, int out_start, int out_len, int out_step,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
244 Filter f);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
245
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
246 int filter_inv_mirror(Image in, int in_start, int in_len, int in_step,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
247 Image out, int out_start, int out_len, int out_step,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
248 Filter f);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
249
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
250 Pixel get_filter_center(Filter f);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
251
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
252 enum FilterGHType { FTOrtho, FTBiOrtho, FTOther};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
253
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
254 typedef struct FilterGHStruct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
255 enum FilterGHType type;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
256 Filter g, h, gi, hi;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
257 char *name;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
258 } *FilterGH;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
259
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
260 typedef struct AllFilterStruct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
261 FilterGH *filter;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
262 int count;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
263 } *AllFilters;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
264
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
265
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
266 AllFilters load_filters(char *name);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
267
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
268 typedef struct SegmentsStruct {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
269 int width,height; /* segment width & height*/
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
270 int *data;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
271 } *Segments;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
272
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
273 enum FilterMethod{cutoff,inv_cutoff,periodical,inv_periodical,mirror,inv_mirror};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
274
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
275 enum Information_Cost{threshold,log_energy,entropy,norml,norml2,gauss_markov,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
276 shanon,weak_l,weak_lq,compression_number,compression_numberq,
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
277 compression_area,compression_areaq,sdiscrepancy,discrepancy,concentration};
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
278
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
279 Image_tree wavelettransform(Image original,int level,FilterGH *flt,enum FilterMethod method);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
280 Image_tree wavelettransform_wp(Image original,int level,FilterGH *flt,enum FilterMethod method);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
281
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
282 Image_tree best_basis(Image original,int level,FilterGH *flt,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
283 enum FilterMethod method,enum Information_Cost cost,double epsilon);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
284
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
285 Image_tree best_level(Image original,int maxlevel,int *bestlevel,FilterGH *flt,enum FilterMethod method,
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
286 enum Information_Cost cost,double epsilon);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
287
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
288 Image build_image(Image_tree quadtree,int width,int height);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
289
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
290 Image inv_transform(Image_tree quadtree,FilterGH *flt,
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
291 enum FilterMethod method);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
292
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
293 Image inv_transform_wp(Image_tree quadtree,FilterGH *flt,
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
294 enum FilterMethod method);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
295
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
296 int rec_double(Image_tree dtree,int level,FilterGH *flt,enum FilterMethod method,enum Information_Cost cost,double epsilon);
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
297
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
298 Image_tree decompose_to_level(Image original,int level,FilterGH *flt,enum FilterMethod method);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
299
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
300 int decompose_all(Image_tree tree,int maxlevel,FilterGH *flt,enum FilterMethod method,
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
301 enum Information_Cost cost,double epsilon);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
302
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
303 int find_deepest_level(int width,int height);
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
304
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
305
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
306 #define WAVELET_H
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
307 #endif

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