Mercurial > hg > wm
comparison Meerwald/wavelet.h @ 8:f83ef905a63d
fixing many warnings
increase capacity for coordinates in bruyn
fix some uninit. variables
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Tue, 22 Apr 2008 13:36:05 +0200 |
| parents | be303a3f5ea8 |
| children |
comparison
equal
deleted
inserted
replaced
| 7:2b350281f8b0 | 8:f83ef905a63d |
|---|---|
| 3 #include <stdio.h> | 3 #include <stdio.h> |
| 4 | 4 |
| 5 extern char dbgstr[1000]; | 5 extern char dbgstr[1000]; |
| 6 | 6 |
| 7 /* this are internal functions - don't use 'em! */ | 7 /* this are internal functions - don't use 'em! */ |
| 8 extern void out_dbg_str(const char *str); | 8 void out_dbg_str(const char *str); |
| 9 extern void start_trace(void); | 9 void start_trace(void); |
| 10 extern void stop_trace(void); | 10 void stop_trace(void); |
| 11 extern void flush_trace_file(void); | 11 void flush_trace_file(void); |
| 12 | 12 |
| 13 /* public functions / macros */ | 13 /* public functions / macros */ |
| 14 #define StartTrace | 14 #define StartTrace |
| 15 #define StopTrace | 15 #define StopTrace |
| 16 | 16 |
| 156 (x)<0 || (x)>=(image)->width || (y)<0 || (y)>=(image)->height) \ | 156 (x)<0 || (x)>=(image)->width || (y)<0 || (y)>=(image)->height) \ |
| 157 ? (Pixel*) NULL : (image)->data+((x)+(y)*(image)->width)) | 157 ? (Pixel*) NULL : (image)->data+((x)+(y)*(image)->width)) |
| 158 | 158 |
| 159 /* functions: */ | 159 /* functions: */ |
| 160 | 160 |
| 161 extern IntImage new_intimage(int width, int height); | 161 IntImage new_intimage(int width, int height); |
| 162 extern IntImage load_intimage(char *file, int max_val); | 162 IntImage load_intimage(char *file, int max_val); |
| 163 extern void free_intimage(IntImage img); | 163 void free_intimage(IntImage img); |
| 164 | 164 |
| 165 extern void clear_intimage(IntImage img); | 165 void clear_intimage(IntImage img); |
| 166 extern void copy_into_intimage(IntImage img1,IntImage img2,int x,int y); | 166 void copy_into_intimage(IntImage img1,IntImage img2,int x,int y); |
| 167 extern void copy_part_of_intimage(IntImage img1,IntImage img2,int x,int y); | 167 void copy_part_of_intimage(IntImage img1,IntImage img2,int x,int y); |
| 168 | 168 |
| 169 extern Image new_image(int width, int height); | 169 Image new_image(int width, int height); |
| 170 extern void free_image(Image img); | 170 void free_image(Image img); |
| 171 extern void clear_image(Image img); | 171 void clear_image(Image img); |
| 172 extern void copy_into_image(Image img1,Image img2,int x,int y); | 172 void copy_into_image(Image img1,Image img2,int x,int y); |
| 173 extern void scale_image(Image img,int maximum); | 173 void scale_image(Image img,int maximum); |
| 174 extern void copy_part_of_image(Image img1,Image img2,int x,int y); | 174 void copy_part_of_image(Image img1,Image img2,int x,int y); |
| 175 | 175 |
| 176 extern void copy_part_of_image_into_image( | 176 void copy_part_of_image_into_image( |
| 177 Image dest_img, int dest_x, int dest_y, | 177 Image dest_img, int dest_x, int dest_y, |
| 178 Image src_img, int src_x, int src_y, | 178 Image src_img, int src_x, int src_y, |
| 179 int width, int height); | 179 int width, int height); |
| 180 | 180 |
| 181 | 181 |
| 182 extern int string_to_pixel(char *str, Pixel *p); | 182 int string_to_pixel(char *str, Pixel *p); |
| 183 | 183 |
| 184 extern Image load_image(char *file, int max_val); | 184 Image load_image(char *file, int max_val); |
| 185 extern int save_image_P5(char *file, Image img); | 185 int save_image_P5(char *file, Image img); |
| 186 | 186 |
| 187 extern Image intimage_to_image(IntImage i); | 187 Image intimage_to_image(IntImage i); |
| 188 extern IntImage image_to_intimage(Image i); | 188 IntImage image_to_intimage(Image i); |
| 189 | 189 |
| 190 extern Image_tree new_image_tree(); | 190 Image_tree new_image_tree(); |
| 191 extern void free_image_tree(Image_tree t); | 191 void free_image_tree(Image_tree t); |
| 192 | 192 |
| 193 extern Image get_difference_image(Image image1, Image image2); | 193 Image get_difference_image(Image image1, Image image2); |
| 194 | 194 |
| 195 extern void get_image_infos(Image image, Image_info info); | 195 void get_image_infos(Image image, Image_info info); |
| 196 | 196 |
| 197 extern void get_intimage_infos(IntImage image, IntPixel *min, IntPixel *max, Pixel *avg, Pixel *var); | 197 void get_intimage_infos(IntImage image, IntPixel *min, IntPixel *max, Pixel *avg, Pixel *var); |
| 198 | 198 |
| 199 extern void init_zigzag(Zigzag_data zz, int width, int height); | 199 void init_zigzag(Zigzag_data zz, int width, int height); |
| 200 extern void next_zigzag(Zigzag_data zz); | 200 void next_zigzag(Zigzag_data zz); |
| 201 extern Image get_absolute_image_scaled(Image img); | 201 Image get_absolute_image_scaled(Image img); |
| 202 | 202 |
| 203 /* common macros */ | 203 /* common macros */ |
| 204 | 204 |
| 205 #ifndef MIN | 205 #ifndef MIN |
| 206 #define MIN(a,b) ((a)<(b)?(a):(b)) | 206 #define MIN(a,b) ((a)<(b)?(a):(b)) |
| 219 int start,end; | 219 int start,end; |
| 220 | 220 |
| 221 int len; | 221 int len; |
| 222 } *Filter; | 222 } *Filter; |
| 223 | 223 |
| 224 extern Filter new_filter(int size); | 224 Filter new_filter(int size); |
| 225 | 225 |
| 226 extern int filter_cutoff(Image in, int in_start, int in_len, int in_step, | 226 int filter_cutoff(Image in, int in_start, int in_len, int in_step, |
| 227 Image out, int out_start, int out_len, int out_step, | 227 Image out, int out_start, int out_len, int out_step, |
| 228 Filter f); | 228 Filter f); |
| 229 | 229 |
| 230 extern int filter_inv_cutoff(Image in, int in_start, int in_len, int in_step, | 230 int filter_inv_cutoff(Image in, int in_start, int in_len, int in_step, |
| 231 Image out, int out_start, int out_len, int out_step, | 231 Image out, int out_start, int out_len, int out_step, |
| 232 Filter f); | 232 Filter f); |
| 233 | 233 |
| 234 extern int filter_periodical(Image in, int in_start, int in_len, int in_step, | 234 int filter_periodical(Image in, int in_start, int in_len, int in_step, |
| 235 Image out, int out_start, int out_len, int out_step, | 235 Image out, int out_start, int out_len, int out_step, |
| 236 Filter f); | 236 Filter f); |
| 237 | 237 |
| 238 extern int filter_inv_periodical(Image in, int in_start, int in_len, int in_step, | 238 int filter_inv_periodical(Image in, int in_start, int in_len, int in_step, |
| 239 Image out, int out_start, int out_len, int out_step, | 239 Image out, int out_start, int out_len, int out_step, |
| 240 Filter f); | 240 Filter f); |
| 241 | 241 |
| 242 extern int filter_mirror(Image in, int in_start, int in_len, int in_step, | 242 int filter_mirror(Image in, int in_start, int in_len, int in_step, |
| 243 Image out, int out_start, int out_len, int out_step, | 243 Image out, int out_start, int out_len, int out_step, |
| 244 Filter f); | 244 Filter f); |
| 245 | 245 |
| 246 extern int filter_inv_mirror(Image in, int in_start, int in_len, int in_step, | 246 int filter_inv_mirror(Image in, int in_start, int in_len, int in_step, |
| 247 Image out, int out_start, int out_len, int out_step, | 247 Image out, int out_start, int out_len, int out_step, |
| 248 Filter f); | 248 Filter f); |
| 249 | 249 |
| 250 extern Pixel get_filter_center(Filter f); | 250 Pixel get_filter_center(Filter f); |
| 251 | 251 |
| 252 enum FilterGHType { FTOrtho, FTBiOrtho, FTOther}; | 252 enum FilterGHType { FTOrtho, FTBiOrtho, FTOther}; |
| 253 | 253 |
| 254 typedef struct FilterGHStruct { | 254 typedef struct FilterGHStruct { |
| 255 enum FilterGHType type; | 255 enum FilterGHType type; |
| 261 FilterGH *filter; | 261 FilterGH *filter; |
| 262 int count; | 262 int count; |
| 263 } *AllFilters; | 263 } *AllFilters; |
| 264 | 264 |
| 265 | 265 |
| 266 extern AllFilters load_filters(char *name); | 266 AllFilters load_filters(char *name); |
| 267 | 267 |
| 268 typedef struct SegmentsStruct { | 268 typedef struct SegmentsStruct { |
| 269 int width,height; /* segment width & height*/ | 269 int width,height; /* segment width & height*/ |
| 270 int *data; | 270 int *data; |
| 271 } *Segments; | 271 } *Segments; |
| 274 | 274 |
| 275 enum Information_Cost{threshold,log_energy,entropy,norml,norml2,gauss_markov, | 275 enum Information_Cost{threshold,log_energy,entropy,norml,norml2,gauss_markov, |
| 276 shanon,weak_l,weak_lq,compression_number,compression_numberq, | 276 shanon,weak_l,weak_lq,compression_number,compression_numberq, |
| 277 compression_area,compression_areaq,sdiscrepancy,discrepancy,concentration}; | 277 compression_area,compression_areaq,sdiscrepancy,discrepancy,concentration}; |
| 278 | 278 |
| 279 extern Image_tree wavelettransform(Image original,int level,FilterGH *flt,enum FilterMethod method); | 279 Image_tree wavelettransform(Image original,int level,FilterGH *flt,enum FilterMethod method); |
| 280 extern Image_tree wavelettransform_wp(Image original,int level,FilterGH *flt,enum FilterMethod method); | 280 Image_tree wavelettransform_wp(Image original,int level,FilterGH *flt,enum FilterMethod method); |
| 281 | 281 |
| 282 extern Image_tree best_basis(Image original,int level,FilterGH *flt, | 282 Image_tree best_basis(Image original,int level,FilterGH *flt, |
| 283 enum FilterMethod method,enum Information_Cost cost,double epsilon); | 283 enum FilterMethod method,enum Information_Cost cost,double epsilon); |
| 284 | 284 |
| 285 extern Image_tree best_level(Image original,int maxlevel,int *bestlevel,FilterGH *flt,enum FilterMethod method, | 285 Image_tree best_level(Image original,int maxlevel,int *bestlevel,FilterGH *flt,enum FilterMethod method, |
| 286 enum Information_Cost cost,double epsilon); | 286 enum Information_Cost cost,double epsilon); |
| 287 | 287 |
| 288 extern Image build_image(Image_tree quadtree,int width,int height); | 288 Image build_image(Image_tree quadtree,int width,int height); |
| 289 | 289 |
| 290 extern Image inv_transform(Image_tree quadtree,FilterGH *flt, | 290 Image inv_transform(Image_tree quadtree,FilterGH *flt, |
| 291 enum FilterMethod method); | 291 enum FilterMethod method); |
| 292 | 292 |
| 293 extern Image inv_transform_wp(Image_tree quadtree,FilterGH *flt, | 293 Image inv_transform_wp(Image_tree quadtree,FilterGH *flt, |
| 294 enum FilterMethod method); | 294 enum FilterMethod method); |
| 295 | 295 |
| 296 extern int rec_double(Image_tree dtree,int level,FilterGH *flt,enum FilterMethod method,enum Information_Cost cost,double epsilon); | 296 int rec_double(Image_tree dtree,int level,FilterGH *flt,enum FilterMethod method,enum Information_Cost cost,double epsilon); |
| 297 | 297 |
| 298 extern Image_tree decompose_to_level(Image original,int level,FilterGH *flt,enum FilterMethod method); | 298 Image_tree decompose_to_level(Image original,int level,FilterGH *flt,enum FilterMethod method); |
| 299 | 299 |
| 300 extern decompose_all(Image_tree tree,int maxlevel,FilterGH *flt,enum FilterMethod method, | 300 int decompose_all(Image_tree tree,int maxlevel,FilterGH *flt,enum FilterMethod method, |
| 301 enum Information_Cost cost,double epsilon); | 301 enum Information_Cost cost,double epsilon); |
| 302 | 302 |
| 303 extern int find_deepest_level(int width,int height); | 303 int find_deepest_level(int width,int height); |
| 304 | 304 |
| 305 /*Selective methods*/ | |
| 306 extern int selectiv_tiling1(Image img,Segments seg,int filternumber,char *file, | |
| 307 enum Information_Cost cost,double epsilon); | |
| 308 extern Image inv_selectiv_tiling1(char *file); | |
| 309 | |
| 310 extern int selectiv_tiling2(Image img,Segments seg,int filternumber,char *file, | |
| 311 enum Information_Cost cost,double epsilon); | |
| 312 extern Image inv_selectiv_tiling2(char *file); | |
| 313 | |
| 314 extern int selectiv_quant1(Image img,IntImage area,int filternumber,char *file, | |
| 315 enum Information_Cost cost,double epsilon); | |
| 316 extern Image inv_selectiv_quant1(char *file); | |
| 317 | |
| 318 extern int selectiv_quant2(Image img,IntImage area,int filternumber,char *file, | |
| 319 enum Information_Cost cost,double epsilon); | |
| 320 extern Image inv_selectiv_quant2(char *file); | |
| 321 | |
| 322 extern int selectiv_quant3(Image img,IntImage area,int filternumber,char *file, | |
| 323 enum Information_Cost cost,double epsilon); | |
| 324 extern Image inv_selectiv_quant3(char *file); | |
| 325 | |
| 326 extern smooth_block(Image img,int x,int y, int width,int height); | |
| 327 | |
| 328 extern compute_map(Image_tree tree,IntImage map); | |
| 329 | |
| 330 extern int *pixelarray_to_intarray(Pixel *pdata,int size); | |
| 331 extern Pixel *intarray_to_pixelarray(int *idata,int size); | |
| 332 | 305 |
| 333 #define WAVELET_H | 306 #define WAVELET_H |
| 334 #endif | 307 #endif |
