1 --- waili-19990723.orig/include/waili/Lifting.h
2 +++ waili-19990723/include/waili/Lifting.h
3 @@ -35,6 +35,10 @@ class Lifting {
8 + virtual void Lift_bin(int type) const = 0;
9 + virtual void ILift_bin(int type) const = 0;
11 // Lifting Steps (Full Rounding)
12 virtual void Lift_L1R1_FR(int primal, const s16 b[2], const u16 a)
14 @@ -109,6 +113,12 @@ class LiftChannelR : public Lifting {
15 LiftChannelR(NTChannel *lowpass, NTChannel *highpass);
16 virtual ~LiftChannelR();
20 + virtual void Lift_bin(int type) const ;
21 + virtual void ILift_bin(int type) const ;
24 // Lifting Steps (Full Rounding)
25 virtual void Lift_L1R1_FR(int primal, const s16 b[2], const u16 a)
27 @@ -179,6 +189,14 @@ class LiftChannelC : public Lifting {
28 LiftChannelC(NTChannel *lowpass, NTChannel *highpass);
29 virtual ~LiftChannelC();
34 + virtual void Lift_bin(int type) const;
35 + virtual void ILift_bin(int type) const;
39 // Lifting Steps (Full Rounding)
40 virtual void Lift_L1R1_FR(int primal, const s16 b[2], const u16 a)
42 --- waili-19990723.orig/include/waili/Wavelet.h
43 +++ waili-19990723/include/waili/Wavelet.h
45 #define LIFTING_OPTIMIZE_STEPS 1 // Use optimized lifting steps
48 +// Unique private IDs
51 + ID_CDF_1_1 = 1, ID_CDF_1_3 = 2, ID_CDF_1_5 = 3,
52 + ID_CDF_2_2 = 4, ID_CDF_2_4 = 5, ID_CDF_2_6 = 6,
53 + ID_CDF_4_2 = 7, ID_CDF_4_4 = 8, ID_CDF_4_6 = 9,
54 + ID_CRF_13_7 = 100, ID_SWE_13_7 = 101
59 // ----------------------------------------------------------------------------
61 @@ -62,29 +72,21 @@ class Wavelet {
62 int GetShiftH(void) const;
64 // Unique private IDs for different Wavelets
65 - u8 GetID(void) const;
66 - static Wavelet *CreateFromID(u8 id);
67 + Wavelet_ID GetID(void) const { return ID; };
69 + static Wavelet *CreateFromID(Wavelet_ID id);
72 int GStart, GEnd, HStart, HEnd;
76 - // Unique private IDs
79 - ID_CDF_1_1 = 1, ID_CDF_1_3 = 2, ID_CDF_1_5 = 3,
80 - ID_CDF_2_2 = 4, ID_CDF_2_4 = 5, ID_CDF_2_6 = 6,
81 - ID_CDF_4_2 = 7, ID_CDF_4_4 = 8, ID_CDF_4_6 = 9,
82 - ID_CRF_13_7 = 100, ID_SWE_13_7 = 101
88 static const char *rcsid;
92 // ----------------------------------------------------------------------------
95 @@ -337,7 +339,6 @@ class Wavelet_CRF_13_7 : public Wavelet
96 // Lifting steps on Channels
97 virtual void CakeWalk(Lifting &lifting) const;
98 virtual void ICakeWalk(Lifting &lifting) const;
101 static const s16 D1b[4];
102 static const u16 D1a;
103 @@ -367,6 +368,9 @@ class Wavelet_SWE_13_7 : public Wavelet
104 static const char *rcsid;
107 +/////////////////////////////////////////////////////////////
109 +#include "waili/Wavelet_bin.h"
111 /////////////////////////////////////////////////////////////////////////////
113 @@ -405,11 +409,6 @@ inline int Wavelet::GetShiftH(void) cons
117 -inline u8 Wavelet::GetID(void) const
122 inline Wavelet_Lazy::Wavelet_Lazy()
125 --- waili-19990723.orig/include/waili/Blit.h
126 +++ waili-19990723/include/waili/Blit.h
127 @@ -102,7 +102,7 @@ inline void FillRect(Type *dst, u_int dw
129 template <class Type>
130 inline void FillRect(Type *dst, u_int dw, u_int dx, u_int dy, u_int cols,
131 - u_int rows, Type value)
132 + u_int rows, Type value )
134 FillRect(dst+dy*dw+dx, dw, cols, rows, value);
136 @@ -121,7 +121,7 @@ inline void ClearRect(Type *dst, u_int d
138 template <class Type>
139 inline void ClearRect(Type *dst, u_int dw, u_int dx, u_int dy, u_int cols,
141 + u_int rows, Type value)
143 ClearRect(dst+dy*dw+dx, dw, cols, rows, value);
145 --- waili-19990723.orig/include/waili/Storage.h
146 +++ waili-19990723/include/waili/Storage.h
147 @@ -87,6 +87,7 @@ class Stream {
148 void Write(const f32 &x);
149 void Write(const f64 &x);
151 + int Feof() { return feof(File); };
152 void Puts(const char *s);
153 void Printf(const char *fmt, ...)
155 @@ -94,8 +95,9 @@ class Stream {
167 +++ waili-19990723/include/waili/Wavelet_gain.h
170 +double *wavelet_gaussian_variance_gain_by_type(TransformType type);
172 +double *wavelet_gaussian_variance_gain(Channel *C);
174 +double *wavelet_uniform_maximum_gain_by_type(int type);
176 --- waili-19990723.orig/include/waili/Channel.h
177 +++ waili-19990723/include/waili/Channel.h
178 @@ -34,8 +34,8 @@ enum TransformType {
181 struct TransformDescriptor {
182 - u8 type; // TransformType
183 - u8 filter; // Wavelet_IDs
184 + TransformType type; // TransformType
185 + Wavelet_ID filter; // Wavelet_IDs
189 @@ -62,13 +62,16 @@ class Channel {
192 u_int GetCols(void) const;
193 - u_int GetRows(void) const;
194 + u_int GetRows(void) const;
195 int GetOffsetX(void) const;
196 int GetOffsetY(void) const;
197 virtual void GetMask(u_int &maskx, u_int &masky) const = 0;
198 virtual u_int GetDepth(void) const = 0;
199 + virtual u_int GetSubbands(void) const = 0;
200 virtual double Psnr(const Channel &channel, PixType maxval = 255)
202 + virtual double MSE(const Channel &channel)
204 virtual u64 *FullHistogram(PixType &min, PixType &max, u64 &numpixels)
206 double Entropy(void) const;
207 @@ -76,6 +79,7 @@ class Channel {
209 virtual PixType &operator()(u_int c, u_int r) = 0;
210 virtual PixType operator()(u_int c, u_int r) const = 0;
211 + virtual PixType *pixaddr(u_int c, u_int r) = 0;
212 virtual void Clear(void) = 0;
213 virtual void Resize(u_int cols, u_int rows);
214 virtual Channel *Clone(void) const = 0;
215 --- waili-19990723.orig/include/waili/NTChannel.h
216 +++ waili-19990723/include/waili/NTChannel.h
217 @@ -49,6 +49,7 @@ class NTChannel : public Channel {
219 virtual void GetMask(u_int &maskx, u_int &masky) const;
220 virtual u_int GetDepth(void) const;
221 + u_int GetSubbands(void) const { return 0; };
222 void GetMinMax(PixType &min, PixType &max, u_int smoothing = 0) const;
223 u64 *Histogram(PixType min, PixType max) const;
224 virtual u64 *FullHistogram(PixType &min, PixType &max, u64 &numpixels)
225 @@ -57,6 +58,7 @@ class NTChannel : public Channel {
227 virtual PixType &operator()(u_int c, u_int r);
228 virtual PixType operator()(u_int c, u_int r) const;
229 + PixType *pixaddr(u_int c, u_int r);
230 virtual void Clear(void);
231 virtual void Resize(u_int cols, u_int rows);
232 virtual NTChannel *Clone(void) const;
233 @@ -151,6 +153,16 @@ inline PixType &NTChannel::operator()(u_
234 return(Data[r*Cols+c]);
237 +inline PixType *NTChannel::pixaddr(u_int c, u_int r)
240 + assert(Data != NULL);
243 +#endif // BOUNDS_CHECK
244 + return( &(Data[r*Cols+c]));
247 inline PixType NTChannel::operator()(u_int c, u_int r) const
250 --- waili-19990723.orig/include/waili/Util.h
251 +++ waili-19990723/include/waili/Util.h
252 @@ -63,7 +63,7 @@ void DumpMemoryStatus(void);
253 template <class Type>
254 inline Type Min(Type x, Type y)
257 +#ifdef __GNUG_DEPRECATED__
259 #else /* !__GNUG__ */
260 return(x < y ? x : y);
261 @@ -73,7 +73,7 @@ inline Type Min(Type x, Type y)
262 template <class Type>
263 inline Type Max(Type x, Type y)
266 +#ifdef __GNUG_DEPRECATED__
268 #else /* !__GNUG__ */
269 return(x > y ? x : y);
271 +++ waili-19990723/include/waili/Wavelet_bin.h
275 +class Wavelet_Binary : public Wavelet {
279 + // Lifting steps on Channels
280 + void CakeWalk(Lifting &lifting) const ;
281 + void ICakeWalk(Lifting &lifting) const ;
282 + Wavelet_Binary *Clone(void) const;
285 + static const char *rcsid;
288 --- waili-19990723.orig/include/waili/Image.h
289 +++ waili-19990723/include/waili/Image.h
291 #define WAILI_IMAGE_H
299 @@ -76,7 +76,7 @@ class Image {
302 Channel*& operator[](u_int channel);
303 - const Channel*& operator[](u_int channel) const;
304 + Channel*& operator[](u_int channel) const;
305 PixType& operator()(u_int c, u_int r, u_int ch = 0);
306 const PixType operator()(u_int c, u_int r, u_int ch = 0) const;
308 @@ -136,12 +136,12 @@ inline Image::Image()
309 inline Image::Image(u_int channels)
310 : NumChannels(channels), Channels(NULL)
312 - Channels = new (Channel *)[NumChannels];
313 + Channels = new Channel *[NumChannels];
314 ::Clear(Channels, NumChannels);
318 -inline Channel*& Image::operator[](u_int channel)
319 +inline Channel*& Image::operator[](u_int channel) const
322 assert(channel < NumChannels);
323 @@ -149,7 +149,7 @@ inline Channel*& Image::operator[](u_int
324 return(Channels[channel]);
327 -inline const Channel*& Image::operator[](u_int channel) const
328 +inline Channel*& Image::operator[](u_int channel)
331 assert(channel < NumChannels);
332 --- waili-19990723.orig/include/waili/LChannel.h
333 +++ waili-19990723/include/waili/LChannel.h
334 @@ -54,6 +54,7 @@ class LChannel : public Channel {
337 virtual u_int GetDepth(void) const;
338 + u_int GetSubbands(void) const;
339 virtual TransformType GetTransformType(void) const = 0;
340 TransformDescriptor *GetTransform(void) const;
341 virtual u64 *FullHistogram(PixType &min, PixType &max, u64 &numpixels)
342 @@ -64,7 +65,7 @@ class LChannel : public Channel {
344 virtual void Clear(void);
345 Channel* &operator[](SubBand band);
346 - const Channel* &operator[](SubBand band) const;
347 + Channel* &operator[](SubBand band) const;
348 virtual LChannel *Clone(void) const = 0;
350 // Wavelet Transforms
351 @@ -140,6 +141,11 @@ inline u_int LChannel::GetDepth(void) co
352 return(1+SubBands[0]->GetDepth());
355 +inline u_int LChannel::GetSubbands(void) const
357 + return NumSubBands;
360 inline int LChannel::GetShift(SubBand band)
362 assert((u_int)band < NumSubBands);
363 @@ -149,14 +155,14 @@ inline int LChannel::GetShift(SubBand ba
364 inline Channel* &LChannel::operator[](SubBand band)
366 assert((u_int)band < NumSubBands);
367 - assert(SubBands[band] != NULL);
368 + //assert(SubBands[band] != NULL);
369 return(SubBands[band]);
372 -inline const Channel* &LChannel::operator[](SubBand band) const
373 +inline Channel* &LChannel::operator[](SubBand band) const
375 assert((u_int)band < NumSubBands);
376 - assert(SubBands[band] != NULL);
377 + //assert(SubBands[band] != NULL);
378 return(SubBands[band]);
381 --- waili-19990723.orig/include/waili/LChannelCR.h
382 +++ waili-19990723/include/waili/LChannelCR.h
383 @@ -53,6 +53,8 @@ class LChannelCR : public LChannel {
385 virtual PixType &operator()(u_int c, u_int r);
386 virtual PixType operator()(u_int c, u_int r) const;
387 + PixType *pixaddr(u_int c, u_int r);
389 virtual void Resize(u_int cols, u_int rows);
390 virtual LChannelCR *Clone(void) const;
391 virtual void SetOffsetX(int offx);
392 @@ -184,6 +186,29 @@ inline PixType LChannelCR::operator()(u_
393 return((*channel)(c, r));
396 +inline PixType *LChannelCR::pixaddr(u_int c, u_int r)
398 + u_int band = SubBand_LL;
403 +#endif // BOUNDS_CHECK
404 + if (r >= GetRlow()) {
406 + band += SubBand_HL;
408 + if (c >= GetClow()) {
410 + band += SubBand_LH;
412 + channel = SubBands[band];
414 + assert(channel != NULL);
415 +#endif // BOUNDS_CHECK
416 + return channel->pixaddr(c, r);
419 inline LChannelCR *LChannelCR::Clone(void) const
421 return(new LChannelCR(*this));
422 --- waili-19990723.orig/include/waili/LChannelC.h
423 +++ waili-19990723/include/waili/LChannelC.h
424 @@ -49,6 +49,8 @@ class LChannelC : public LChannel {
426 virtual PixType &operator()(u_int c, u_int r);
427 virtual PixType operator()(u_int c, u_int r) const;
428 + PixType *pixaddr(u_int c, u_int r);
430 virtual void Resize(u_int cols, u_int rows);
431 virtual LChannelC *Clone(void) const;
432 virtual void SetOffsetX(int offx);
433 @@ -156,6 +158,25 @@ inline PixType LChannelC::operator()(u_i
434 return((*channel)(c, r));
437 +inline PixType *LChannelC::pixaddr(u_int c, u_int r)
443 +#endif // BOUNDS_CHECK
445 + channel = SubBands[0];
448 + channel = SubBands[1];
451 + assert(channel != NULL);
452 +#endif // BOUNDS_CHECK
453 + return channel->pixaddr(c, r);
456 inline LChannelC *LChannelC::Clone(void) const
458 return(new LChannelC(*this));
459 --- waili-19990723.orig/include/waili/Makefile
460 +++ waili-19990723/include/waili/Makefile
461 @@ -39,7 +39,8 @@ RCSOBJS = Blit.h \
471 @@ -48,3 +49,10 @@ depend: $(RCSOBJS)
474 include ../../Rules.make
476 +# ----------------------------------------- Installation
478 +# You're going to have to be root to do this!
480 + $(INSTALL) -d $(DESTDIR)$(PREFIX)/include/waili
481 + $(INSTALL) -m 644 $(RCSOBJS) $(DESTDIR)$(PREFIX)/include/waili
482 --- waili-19990723.orig/include/waili/LChannelR.h
483 +++ waili-19990723/include/waili/LChannelR.h
484 @@ -49,6 +49,8 @@ class LChannelR : public LChannel {
486 virtual PixType &operator()(u_int c, u_int r);
487 virtual PixType operator()(u_int c, u_int r) const;
488 + PixType *pixaddr(u_int c, u_int r);
490 virtual void Resize(u_int cols, u_int rows);
491 virtual LChannelR *Clone(void) const;
492 virtual void SetOffsetX(int offx);
493 @@ -156,6 +158,27 @@ inline PixType LChannelR::operator()(u_i
494 return((*channel)(c, r));
498 +inline PixType *LChannelR::pixaddr(u_int c, u_int r)
504 +#endif // BOUNDS_CHECK
506 + channel = SubBands[0];
509 + channel = SubBands[1];
512 + assert(channel != NULL);
513 +#endif // BOUNDS_CHECK
514 + return channel->pixaddr(c, r);
518 inline LChannelR *LChannelR::Clone(void) const
520 return(new LChannelR(*this));
521 --- waili-19990723.orig/include/waili/Types.h
522 +++ waili-19990723/include/waili/Types.h
523 @@ -58,5 +58,8 @@ typedef double f64; /* 64 bit floating
528 +typedef unsigned int u_int;
531 #endif // WAILI_TYPES_H
532 --- waili-19990723.orig/test/Proof.C
533 +++ waili-19990723/test/Proof.C
534 @@ -131,7 +131,7 @@ int main(int argc, char *argv[])
537 Wavelet *wavelet = Wavelet::CreateCDF(np, nd);
538 - u8 id = wavelet->GetID();
539 + Wavelet_ID id = wavelet->GetID();
541 channels = im1.GetChannels();
543 --- waili-19990723.orig/test/Demo.C
544 +++ waili-19990723/test/Demo.C
547 // Simple Interactive Demo
549 -// $Id: Demo.C,v 4.6.2.3.2.1 1999/07/20 16:16:19 geert Exp $
550 +// $Id: Demo.C,v 1.1 2001/05/21 15:33:03 andrea Exp andrea $
552 // Copyright (C) 1996-1999 Department of Computer Science, K.U.Leuven, Belgium
554 @@ -172,7 +172,7 @@ static void DeleteArgs(int argc, const c
558 - * Partial strcasecmp() (s1 may be an abbreviation for s2)
559 + * Partial strcasecmp () (s1 may be an abbreviation for s2)
562 static int PartStrCaseCmp(const char *s1, const char *s2)
563 @@ -193,16 +193,46 @@ static int PartStrCaseCmp(const char *s1
567 +static int do_it(const struct Command &c , int argc, const char *argv[])
572 + c.Function(argc-1, argv+1);
574 + catch (char *message) { fprintf(stderr,"EXCEPTION %s\n",message); }
576 + catch (char message[]) { fprintf(stderr,"EXCEPTION %s\n",message); }
578 + catch (std::exception e) { fprintf(stderr,"EXCEPTION %s\n",e.what());};
582 static int ExecCommand(const struct Command commands[], u_int numcommands,
583 int argc, const char *argv[])
586 - for (u_int i = 0; i < numcommands; i++)
587 - if (PartStrCaseCmp(argv[0], commands[i].Name)) {
588 - commands[i].Function(argc-1, argv+1);
595 + for (u_int i = 0; i < numcommands; i++) {
596 + /* exact match, for short commands */
597 + if ( strcmp(argv[0], commands[i].Name) == 0) {
598 + return do_it(commands[i],argc,argv);
600 + if (PartStrCaseCmp(argv[0], commands[i].Name)) {
603 + "Command abbreviation is ambiguous: '%s' or '%s'?\n",
604 + commands[ci].Name,commands[i].Name );
610 + return do_it(commands[ci],argc,argv);
616 static void Do_NotYetImplemented(int, const char **)
617 @@ -245,9 +275,11 @@ static int NoWavelet(void)
619 void Do_Help(int, const char **)
623 " Help, ? Display this help\n"
624 " Quit, eXit Terminate program\n"
625 + " New <width> <height> <channels>\n"
626 + " Creates a new empty image\n"
627 " Load <image> Load an image\n"
628 " Save <image> Save an image\n"
629 " View View the current image\n"
630 @@ -269,7 +301,9 @@ void Do_Help(int, const char **)
631 " Histogram <level> <subband> <channel>\n"
632 " View the histogram of a subband\n"
633 " Entropy Calculate the first-order entropy in bits per pixel\n"
634 - " Yuv Convert from RGB to YUVr (or vice versa)\n"
635 + " Yuv Convert from RGB to YUVr\n"
636 + " Rgb Convert from YUVr to RGB\n"
637 + " Quantize <lev>.. Quantizes the channels \n"
641 @@ -293,8 +327,33 @@ void Do_Load(int argc, const char *argv[
646 +void Do_New(int argc, const char *argv[])
649 + fputs("Invalid arguments\n", stderr);
652 + u_int w = atoi(argv[0]);
653 + u_int h = atoi(argv[1]);
654 + u_int ch = atoi(argv[2]);
657 + if(ImageLoaded) MyImage.~Image();
659 + here below will automatically free the memory in
660 + MyImage before doing the =
662 + MyImage=Image(w,h,ch);
668 void Do_Save(int argc, const char *argv[])
674 File = new char[strlen(argv[0])+1];
675 @@ -307,15 +366,93 @@ void Do_Save(int argc, const char *argv[
676 MyImage.Export(File);
680 +void Do_Quantize(int argc, const char *argv[])
685 + if (argc >= MyImage.GetChannels()) {
686 + for (u_int ch = 0; ch < MyImage.GetChannels(); ch++) {
687 + int levels=(int)atof(argv[ch]);
689 + fputs("Specify positive number\n", stderr);
692 + for (u_int r = 0; r < MyImage[ch]->GetRows(); r++)
693 + for (u_int c = 0; c < MyImage[ch]->GetCols(); c++)
695 + (*MyImage[ch])(c, r) =
696 + levels * (s16)rint ( (*MyImage[ch])(c, r) /levels ) ;
702 + fputs("Specify number(s) for quantization of channels\n", stderr);
708 +#include "sol/Compress.H"
710 +void Do_Compress(int argc, const char *argv[])
717 + fputs("Specify file and quantization\n", stderr);
722 + File = new char[strlen(argv[0])+1];
723 + strcpy(File, argv[0]);
726 + q=(int)atof(argv[1]);
728 + Compress(&MyImage,File,q);
731 +void Do_Decompress(int argc, const char *argv[])
735 + fputs("Specify file\n", stderr);
740 + File = new char[strlen(argv[0])+1];
741 + strcpy(File, argv[0]);
745 + if(ImageLoaded) MyImage.~Image();
747 + here below will automatically free the memory in
748 + MyImage before doing the =
751 + Decompress(File,& MyImage);
756 void Do_View(int, const char **)
759 + /* WHO THE HELL MADE THIS STRING SIZE =32!!!!! I LOST 3 DAYS ON THIS!!!*/
766 const char *filename = TmpFileName();
767 MyImage.Export(filename);
768 - sprintf(command, "xv %s &", filename);
769 + sprintf(command, "if which xv >/dev/null ; then xv %s & else display %s & fi", filename,filename);
773 @@ -530,7 +667,7 @@ void Do_Psnr(int, const char **)
776 for (u_int ch = 0; ch < MyImage.GetChannels(); ch++)
777 - printf("Channel %d: %f dB\n", ch, MyImage[ch]->Psnr(*(*Backup)[ch]));
778 + printf("Channel %d: %g dB\n", ch, MyImage[ch]->Psnr(*(*Backup)[ch]));
781 void Do_Threshold(int argc, const char *argv[])
782 @@ -601,7 +738,7 @@ void Do_Histogram(int argc, const char *
783 Channel *channel = MyImage[ch];
785 if (subband != SubBand_LL) {
786 - fputs("Subband must be 0 for this level\n", stderr);
787 + fprintf(stderr,"Subband must be %d for this level\n",SubBand_LL );
791 @@ -646,7 +783,7 @@ void Do_Histogram(int argc, const char *
792 stream.Printf("plot [%d:%d]\"%s\" title \"Level %d Subband %d [%d:%d]\" "
794 min, max, plotdata, level, subband, min, max);
795 - stream.Puts("pause -1\n");
796 + stream.Puts("pause 120\n");
799 sprintf(command, "xterm -iconic -ut -T gnuplot -e gnuplot -name \"Level "
800 @@ -665,16 +802,29 @@ void Do_Entropy(int, const char **)
802 static bool is_yuv = false;
804 +void Do_RGB(int, const char **)
810 + { MyImage.Convert(IT_RGB, IT_YUVr); is_yuv = false; }
812 + printf("Image is already rgb\n");
815 void Do_YUV(int, const char **)
821 - MyImage.Convert(IT_RGB, IT_YUVr);
822 + printf("Image is already yuv\n");
825 MyImage.Convert(IT_YUVr, IT_RGB);
831 const struct Command Commands[] = {
832 @@ -684,6 +834,7 @@ const struct Command Commands[] = {
839 { "wavelet", Do_Wavelet },
840 @@ -699,6 +850,14 @@ const struct Command Commands[] = {
841 { "histogram", Do_Histogram },
842 { "entropy", Do_Entropy },
845 + { "quantize", Do_Quantize}
849 + { "compress", Do_Compress },
850 + { "decompress", Do_Decompress }
855 @@ -717,17 +876,66 @@ static void ParseCommandLine(char *line)
856 DeleteArgs(argc, argv);
860 +#include <sys/ioctl.h>
861 +#include <sys/termios.h>
862 +#include "readline/readline.h"
863 +#include "readline/history.h"
873 + if( ioctl(0, TCGETS, &ti))
876 +#ifdef RL_READLINE_VERSION
879 + read_history (".wailiDemo_history");
884 + fputs("Please enter your commands (`help' for help)\n\n", stdout);
886 - fputs("Please enter your commands (`help' for help)\n\n", stderr);
887 + /* main interactive loop */
889 - fprintf(stderr, "demo> ");
890 - line = ReadCommandLine();
891 - ParseCommandLine(line);
892 - } while (!ExitFlag);
893 +#ifdef RL_READLINE_VERSION
895 + line = readline("demo> ");
896 + if (line && line[0])
897 + add_history (line);
900 + line=(char *)calloc( MAX_CMD_LINE,1);
901 + fgets(line, MAX_CMD_LINE, stdin);
905 + fprintf(stdout, "demo> ");
906 + line=(char *)calloc( MAX_CMD_LINE,1);
907 + fgets(line, MAX_CMD_LINE, stdin);
909 + if(line && line[0]) {
910 + int l=strlen(line);
911 + char *tok; char *stringp=line;
912 + if (line[l-1]=='\n')
915 + tok=strsep(&stringp,";");
916 + ParseCommandLine(tok);
921 + } while (!ExitFlag && line);
923 +#ifdef RL_READLINE_VERSION
925 + write_history (".wailiDemo_history");
929 --- waili-19990723.orig/test/Example.C
930 +++ waili-19990723/test/Example.C
931 @@ -39,7 +39,7 @@ int main(void)
932 // Transform the image using the Cohen-Daubechies-Feauveau
933 // (2, 2) biorthogonal wavelets
934 Wavelet *wavelet = Wavelet::CreateCDF(2, 2);
935 - u8 id = wavelet->GetID();
936 + Wavelet_ID id = wavelet->GetID();
938 TransformDescriptor transform[] = {
940 --- waili-19990723.orig/test/Test.C
941 +++ waili-19990723/test/Test.C
942 @@ -117,7 +117,7 @@ int main(int argc, char *argv[])
945 Wavelet *wavelet = Wavelet::CreateCDF(np, nd);
946 - u8 id = wavelet->GetID();
947 + Wavelet_ID id = wavelet->GetID();
949 channels = im1.GetChannels();
950 printf("%dx%dx%d picture\n", im1.GetCols(0), im1.GetRows(0), channels);
951 --- waili-19990723.orig/test/Makefile
952 +++ waili-19990723/test/Makefile
953 @@ -28,31 +28,39 @@ ALL = Example Demo Proof Rangecheck Tes
956 Example: Example.o $(DEPLIBS)
957 - $(CXX) -o Example Example.o $(LFLAGS)
958 + $(LIBTOOLLD) $(CXX) -o Example Example.o $(LFLAGS)
960 Demo: Demo.o $(DEPLIBS)
961 - $(CXX) -o Demo Demo.o $(LFLAGS)
962 + $(LIBTOOLLD) $(CXX) -lreadline -o Demo Demo.o $(LFLAGS)
964 Proof: Proof.o $(DEPLIBS)
965 - $(CXX) -o Proof Proof.o $(LFLAGS)
966 + $(LIBTOOLLD) $(CXX) -o Proof Proof.o $(LFLAGS)
968 Test: Test.o $(DEPLIBS)
969 - $(CXX) -o Test Test.o $(LFLAGS)
970 + $(LIBTOOLLD) $(CXX) -o Test Test.o $(LFLAGS)
972 Rangecheck: Rangecheck.o $(DEPLIBS)
973 - $(CXX) -o Rangecheck Rangecheck.o $(LFLAGS)
974 + $(LIBTOOLLD) $(CXX) -o Rangecheck Rangecheck.o $(LFLAGS)
976 Histogram: Histogram.o $(DEPLIBS)
977 - $(CXX) -o Histogram Histogram.o $(LFLAGS)
978 + $(LIBTOOLLD) $(CXX) -o Histogram Histogram.o $(LFLAGS)
983 - $(CXX) $(CFLAGS) -M -E *.C > .depend
990 - rm -f .depend *.o $(ALL) result.pgm out.pgm out.ppm reco.pgm \
992 + rm -f .depend *.o *.d $(ALL) .wailiDemo_history \
993 + result.pgm out.pgm out.ppm reco.pgm reco.ppm
998 include ../Rules.make
1002 + $(INSTALL) -d $(DESTDIR)$(PREFIX)/lib/$(PACKAGE)/test/
1003 + $(LIBTOOLINSTALL) $(INSTALL) $(ALL) $(DESTDIR)$(PREFIX)/lib/$(PACKAGE)/test/
1004 --- waili-19990723.orig/lib/LChannel.C
1005 +++ waili-19990723/lib/LChannel.C
1007 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1010 -#include <waili/Channel.h>
1013 -#include <stream.h>
1014 +#include <iostream>
1017 -#include <waili/Util.h>
1018 +#include "waili/Channel.h"
1019 +#include "waili/Util.h"
1022 const char *LChannel::rcsid = "$Id: LChannel.C,v 4.5.2.2.2.1 1999/07/20 16:15:49 geert Exp $";
1023 --- waili-19990723.orig/lib/Wavelet_CDF_1_x.C
1024 +++ waili-19990723/lib/Wavelet_CDF_1_x.C
1026 // $Id: Wavelet_CDF_1_x.C,v 4.1.4.1 1999/07/20 16:15:52 geert Exp $
1029 -#include <waili/Util.h>
1030 -#include <waili/Channel.h>
1031 +#include "waili/Util.h"
1032 +#include "waili/Channel.h"
1035 const char *Wavelet_CDF_1_x::rcsid = "$Id: Wavelet_CDF_1_x.C,v 4.1.4.1 1999/07/20 16:15:52 geert Exp $";
1037 +++ waili-19990723/lib/myLifting.C
1040 +#include "waili/Channel.h"
1041 +#include "waili/Util.h"
1044 +#define XOR(A,B) ((( (A) +128) ^ ( (B) +128)) -128)
1046 +void LiftChannelR::Lift_bin(int type ) const
1048 + PixType *even = Even, *odd = Odd, b;
1050 + for (u_int i = 0; i < Rows; i++) {
1052 + for (u_int j = 0; j < Codd; j++) {
1053 + //even[j] = even[j] ;
1054 + odd[j] = XOR(even[j], odd[j]) ;
1057 + for (u_int j = 0; j < Codd; j++) {
1058 + b=XOR(even[j], odd[j]);
1059 + even[j] = odd[j] ;
1070 +void LiftChannelR::ILift_bin(int type ) const
1072 + PixType *even = Even, b;
1073 + PixType *odd = Odd;
1075 + for (u_int i = 0; i < Rows; i++) {
1077 + for (u_int j = 0; j < Codd; j++) {
1078 + //odd[j] = even[j] ^ odd[j] ;
1079 + odd[j] = XOR(even[j], odd[j]) ;
1081 + for (u_int j = 0; j < Codd; j++) {
1082 + b=XOR(even[j], odd[j]) ;
1083 + odd[j] = even[j] ;
1091 +void LiftChannelC::Lift_bin(int type ) const
1093 + PixType *even = Even;
1094 + PixType *odd = Odd;
1096 + for (u_int i = 0; i < Rodd; i++) {
1097 + for (u_int j = 0; j < Cols; j++)
1098 + odd[j] = XOR(even[j], odd[j]) ;
1104 +void LiftChannelC::ILift_bin(int type ) const
1106 + PixType *even = Even;
1107 + PixType *odd = Odd;
1109 + for (u_int i = 0; i < Rodd; i++) {
1110 + for (u_int j = 0; j < Cols; j++)
1111 + odd[j] = XOR(even[j], odd[j]) ;
1118 --- waili-19990723.orig/lib/LChannelR.C
1119 +++ waili-19990723/lib/LChannelR.C
1121 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1124 -#include <waili/Channel.h>
1125 -#include <waili/Util.h>
1127 -#include <stream.h>
1128 +#include <iostream>
1131 +#include "waili/Channel.h"
1132 +#include "waili/Util.h"
1135 const char *LChannelR::rcsid = "$Id: LChannelR.C,v 4.6.2.1.2.1 1999/07/20 16:15:51 geert Exp $";
1137 --- waili-19990723.orig/lib/Image.C
1138 +++ waili-19990723/lib/Image.C
1143 -#include <waili/Image.h>
1144 -#include <waili/Util.h>
1145 -#include <waili/Blit.h>
1147 -#include <waili/Timer.h>
1148 -#include <waili/Storage.h>
1149 -#include <waili/Color.h>
1152 +#include "waili/Image.h"
1153 +#include "waili/Util.h"
1154 +#include "waili/Blit.h"
1156 +#include "waili/Timer.h"
1157 +#include "waili/Storage.h"
1158 +#include "waili/Color.h"
1162 @@ -43,7 +45,7 @@ const char *Image::rcsid = "$Id: Image.C
1163 Image::Image(u_int cols, u_int rows, u_int channels)
1164 : NumChannels(channels), Channels(NULL)
1166 - Channels = new (Channel *)[NumChannels];
1167 + Channels = new Channel *[NumChannels];
1168 for (u_int ch = 0; ch < NumChannels; ch++)
1169 Channels[ch] = new NTChannel(cols, rows);
1171 @@ -51,15 +53,15 @@ Image::Image(u_int cols, u_int rows, u_i
1172 Image::Image(const u_int cols[], const u_int rows[], u_int channels)
1173 : NumChannels(channels), Channels(NULL)
1175 - Channels = new (Channel *)[NumChannels];
1176 + Channels = new Channel *[NumChannels];
1177 for (u_int ch = 0; ch < NumChannels; ch++)
1178 Channels[ch] = new NTChannel(cols[ch], rows[ch]);
1181 -Image::Image(const Channel &channel, u_int channels = 1)
1182 +Image::Image(const Channel &channel, u_int channels)
1183 : NumChannels(channels), Channels(NULL)
1185 - Channels = new (Channel *)[NumChannels];
1186 + Channels = new Channel *[NumChannels];
1187 for (u_int ch = 0; ch < NumChannels; ch++)
1188 Channels[ch] = channel.Clone();
1190 @@ -67,7 +69,7 @@ Image::Image(const Channel &channel, u_i
1191 Image::Image(const Channel *channel[], u_int channels)
1192 : NumChannels(channels), Channels(NULL)
1194 - Channels = new (Channel *)[NumChannels];
1195 + Channels = new Channel *[NumChannels];
1196 for (u_int ch = 0; ch < NumChannels; ch++)
1197 Channels[ch] = channel[ch]->Clone();
1199 @@ -75,7 +77,7 @@ Image::Image(const Channel *channel[], u
1200 Image::Image(const Image &im)
1201 : NumChannels(im.NumChannels), Channels(NULL)
1203 - Channels = new (Channel *)[NumChannels];
1204 + Channels = new Channel *[NumChannels];
1205 for (u_int ch = 0; ch < NumChannels; ch++)
1206 Channels[ch] = im.Channels[ch]->Clone();
1208 @@ -84,7 +86,7 @@ Image::Image(u_int cols, u_int rows, con
1209 u_int depth, u_int channels)
1210 : NumChannels(channels), Channels(NULL)
1212 - Channels = new (Channel *)[NumChannels];
1213 + Channels = new Channel *[NumChannels];
1214 for (u_int ch = 0; ch < NumChannels; ch++)
1215 Channels[ch] = Channel::CreateFromDescriptor(cols, rows, transform,
1217 @@ -165,8 +167,8 @@ void Image::Export(const char *filename,
1221 -static u8 GetRealChar(Stream &stream);
1222 -static u_int GetNumber(Stream &stream);
1223 +//static u8 GetRealChar(std::ifstream &stream);
1224 +//static u_int GetNumber(std::ifstream &stream);
1227 // Import an Image from a File in the PNM (PGM or PPM) Format
1228 @@ -174,16 +176,17 @@ static u_int GetNumber(Stream &stream);
1229 ImageType Image::ImportPNM(const char *filename)
1232 - Stream stream(filename, "r");
1233 + std::ifstream stream(filename, std::ios::in | std::ios::binary);
1234 u_int cols, rows, channels;
1237 + unsigned char d, magic;
1240 - stream.Read(magic);
1242 - Die("%s: Not a PNM file\n", __FUNCTION__);
1243 - stream.Read(magic);
1246 + stream.getline(str,5);
1247 + if (str[0] != 'P')
1248 + Die("%s: Not a PNM file, magic is '%c' \n", __FUNCTION__,str[0]);
1251 case '1': // PBM ASCII
1252 case '4': // PBM Raw
1253 @@ -208,22 +211,33 @@ ImageType Image::ImportPNM(const char *f
1254 Die("%s: Not a PNM file\n", __FUNCTION__);
1257 - cols = GetNumber(stream);
1258 - rows = GetNumber(stream);
1259 - GetNumber(stream);
1260 + stream.getline(str,255);
1261 + while(str[0]=='#' || str[0] == '\n' )
1262 + stream.getline(str,255);
1264 + sscanf(str,"%d %d", &cols, &rows);
1266 + stream.getline(str,255);
1267 + while(str[0]=='#' || str[0] == '\n' )
1268 + stream.getline(str,255);
1270 + if ( strcmp(str,"255") && strcmp(str,"255\n") )
1271 + Die("%s: PNM file has '%s' != '255' \n", __FUNCTION__,str);
1273 Resize(cols, rows, channels);
1275 for (r = 0; r < rows; r++)
1276 for (c = 0; c < cols; c++)
1277 for (ch = 0; ch < channels; ch++) {
1280 (*this)(c, r, ch) = (PixType)(d-128);
1283 - for (r = 0; r < rows; r++)
1284 - for (c = 0; c < cols; c++)
1285 - for (ch = 0; ch < channels; ch++)
1286 - (*this)(c, r, ch) = (PixType)(GetNumber(stream)-128);
1287 + Die(" ascii PNM not implemented");
1288 + // for (r = 0; r < rows; r++)
1289 + // for (c = 0; c < cols; c++)
1290 + // for (ch = 0; ch < channels; ch++)
1291 + // (*this)(c, r, ch) = (PixType)(GetNumber(stream)-128);
1295 @@ -380,8 +394,8 @@ ImageType Image::ImportTIFF(const char *
1297 void Image::ExportPNM(const char *filename, int raw)
1299 - Stream stream(filename, "w");
1301 + std::fstream stream(filename, std::ios::binary | std::ios::out);
1302 + unsigned char magic, d;
1304 u_int cols = GetCols(0);
1305 u_int rows = GetRows(0);
1306 @@ -406,9 +420,8 @@ void Image::ExportPNM(const char *filena
1310 - stream.Printf("P%c\n%d %d\n255", magic, cols, rows);
1311 + stream << 'P' << magic << "\n" << cols << ' ' << rows << "\n255\n";
1313 - stream.Write((u8)'\n');
1314 for (u_int r = 0; r < rows; r++)
1315 for (u_int c = 0; c < cols; c++)
1316 for (u_int ch = 0; ch < channels; ch++) {
1317 @@ -419,7 +432,7 @@ void Image::ExportPNM(const char *filena
1326 @@ -434,13 +447,13 @@ void Image::ExportPNM(const char *filena
1330 + stream << (u_int)d;
1332 - stream.Printf("\n%4d", (u_int)d);
1336 - stream.Printf(" %4d", (u_int)d);
1339 - stream.Write((u8)'\n');
1344 @@ -719,42 +732,42 @@ conversion_not_supported:
1348 - // Read the Next Character from a PNM File and Care about Comments
1349 +// // Read the Next Character from a PNM File and Care about Comments
1351 -static u8 GetRealChar(Stream &stream)
1355 - for (stream.Read(c); c == '#'; stream.Read(c))
1358 - while (c != '\n');
1363 - // Skip Leading Whitespace and Read an ASCII Number from a PNM File
1365 -static u_int GetNumber(Stream &stream)
1371 - c = GetRealChar(stream);
1372 - while ((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n'));
1374 - if ((c >= '0') && (c <= '9')) {
1375 - value = 10*value+(c-'0');
1376 - c = GetRealChar(stream);
1379 - if ((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n'))
1381 - Die("%s: Not a number\n", __FUNCTION__);
1385 +// static u8 GetRealChar(std::ifstream &stream)
1389 +// for (c=stream.get(); c == '#'; )
1392 +// while (c != '\n');
1397 +// // Skip Leading Whitespace and Read an ASCII Number from a PNM File
1399 +// static u_int GetNumber(std::ifstream &stream)
1401 +// u_int value = 0;
1405 +// c = GetRealChar(stream);
1406 +// while ((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n'));
1408 +// if ((c >= '0') && (c <= '9')) {
1409 +// value = 10*value+(c-'0');
1410 +// c = GetRealChar(stream);
1413 +// if ((c == ' ') || (c == '\t') || (c == '\r') || (c == '\n'))
1415 +// Die("%s: Not a number\n", __FUNCTION__);
1421 // ---------------------------------------------------------------------------
1422 @@ -769,7 +782,7 @@ void Image::Resize(u_int cols, u_int row
1423 delete Channels[ch];
1425 NumChannels = channels;
1426 - Channels = new (Channel *)[NumChannels];
1427 + Channels = new Channel *[NumChannels];
1428 for (u_int ch = 0; ch < NumChannels; ch++)
1429 Channels[ch] = new NTChannel(cols, rows);
1431 @@ -781,7 +794,7 @@ Image& Image::operator=(const Image &im)
1432 delete Channels[ch];
1434 NumChannels = im.NumChannels;
1435 - Channels = new (Channel *)[NumChannels];
1436 + Channels = new Channel *[NumChannels];
1437 for (u_int ch = 0; ch < NumChannels; ch++)
1438 Channels[ch] = im[ch]->Clone();
1440 @@ -790,7 +803,7 @@ Image& Image::operator=(const Image &im)
1442 void Image::InsertChannel(const Channel &data, u_int channel)
1444 - Channel **newChannels = new (Channel *)[++NumChannels];
1445 + Channel **newChannels = new Channel *[++NumChannels];
1446 for (u_int ch = 0; ch < channel; ch++)
1447 newChannels[ch] = Channels[ch];
1448 for (u_int ch = channel+1; ch < NumChannels; ch++)
1449 @@ -802,7 +815,7 @@ void Image::InsertChannel(const Channel
1451 void Image::DeleteChannel(u_int channel)
1453 - Channel **newChannels = new (Channel *)[--NumChannels];
1454 + Channel **newChannels = new Channel *[--NumChannels];
1455 for (u_int ch = 0; ch < channel; ch++)
1456 newChannels[ch] = Channels[ch];
1457 for (u_int ch = channel; ch < NumChannels; ch++)
1458 --- waili-19990723.orig/lib/Color.C
1459 +++ waili-19990723/lib/Color.C
1464 -#include <waili/Color.h>
1465 -#include <waili/Util.h>
1466 +#include "waili/Color.h"
1467 +#include "waili/Util.h"
1470 const char *ColorSpace::rcsid = "$Id: Color.C,v 4.0.2.1.2.1 1999/07/20 16:15:49 geert Exp $";
1471 --- waili-19990723.orig/lib/Channel.C
1472 +++ waili-19990723/lib/Channel.C
1474 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1477 -#include <waili/Channel.h>
1478 +#include "waili/Channel.h"
1480 -#include <iostream.h>
1481 +#include <iostream>
1484 +/* needed on Debian > 2.2 */
1488 const char *Channel::rcsid = "$Id: Channel.C,v 4.4.2.2.2.1 1999/07/20 16:15:49 geert Exp $";
1490 @@ -75,17 +78,26 @@ double Channel::Psnr(const Channel &chan
1491 if (Cols != channel.GetCols() || Rows != channel.GetRows())
1494 + double mse=MSE(channel);
1497 + double rmse=sqrt(mse);
1498 + double psnr = 20.0*log10(maxval/rmse);
1502 +double Channel::MSE(const Channel &channel) const
1504 + if (Cols != channel.GetCols() || Rows != channel.GetRows())
1508 for (u_int r = 0; r < Rows; r++)
1509 for (u_int c = 0; c < Cols; c++) {
1510 int d = (*this)(c, r)-channel(c, r);
1515 - double rmse = sqrt((double)ss/(double)(Cols*Rows));
1516 - double psnr = 20.0*log10(maxval/rmse);
1518 + return ((double)ss/(double)(Cols*Rows));
1521 double Channel::Entropy(void) const
1523 +++ waili-19990723/lib/Wavelet_bin.C
1528 +#include <limits.h>
1530 +#include "waili/Lifting.h"
1531 +#include "waili/Wavelet.h"
1533 +void Wavelet_Binary::CakeWalk(Lifting &lifting) const
1535 + lifting.Lift_bin(0);
1538 +void Wavelet_Binary::ICakeWalk(Lifting &lifting) const
1540 + lifting.ILift_bin(0);
1543 +Wavelet_Binary::Wavelet_Binary()
1548 +Wavelet_Binary *Wavelet_Binary::Clone(void) const
1550 + return(new Wavelet_Binary(*this));
1552 --- waili-19990723.orig/lib/Storage.C
1553 +++ waili-19990723/lib/Storage.C
1560 +#include "winsock.h"
1562 #include <netinet/in.h>
1565 -#include <waili/Util.h>
1566 -#include <waili/Storage.h>
1567 +#include <sys/param.h>
1570 +#include "waili/Storage.h"
1571 +#include "waili/Util.h"
1573 const char *Stream::rcsid = "$Id: Storage.C,v 4.0.2.2.2.1 1999/07/20 16:15:52 geert Exp $";
1576 @@ -144,6 +151,9 @@ void Stream::Printf(const char *fmt, ...
1578 // Endianness-aware Routines
1583 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && defined(LITTLE_ENDIAN)
1584 #if BYTE_ORDER == BIG_ENDIAN
1585 #define WAILI_BIG_ENDIAN
1586 @@ -154,6 +164,7 @@ void Stream::Printf(const char *fmt, ...
1587 #define WAILI_BIG_ENDIAN
1588 #elif defined(__LITTLE_ENDIAN) || defined(_LITTLE_ENDIAN)
1589 #define WAILI_LITTLE_ENDIAN
1592 #if !defined(WAILI_BIG_ENDIAN) && !defined(WAILI_LITTLE_ENDIAN)
1593 #error Please fix me
1594 --- waili-19990723.orig/lib/Wavelet_CDF_2_x.C
1595 +++ waili-19990723/lib/Wavelet_CDF_2_x.C
1597 // $Id: Wavelet_CDF_2_x.C,v 4.2.2.1.2.1 1999/07/20 16:15:52 geert Exp $
1600 -#include <waili/Util.h>
1601 -#include <waili/Channel.h>
1602 +#include "waili/Util.h"
1603 +#include "waili/Channel.h"
1606 const char *Wavelet_CDF_2_x::rcsid = "$Id: Wavelet_CDF_2_x.C,v 4.2.2.1.2.1 1999/07/20 16:15:52 geert Exp $";
1607 --- waili-19990723.orig/lib/LChannelCR.C
1608 +++ waili-19990723/lib/LChannelCR.C
1610 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1613 -#include <waili/Channel.h>
1614 -#include <waili/Util.h>
1616 -#include <stream.h>
1617 +#include <iostream>
1620 +#include "waili/Channel.h"
1621 +#include "waili/Util.h"
1625 const char *LChannelCR::rcsid = "$Id: LChannelCR.C,v 4.6.2.1.2.1 1999/07/20 16:15:50 geert Exp $";
1627 --- waili-19990723.orig/lib/Wavelet_CDF_4_x.C
1628 +++ waili-19990723/lib/Wavelet_CDF_4_x.C
1630 // $Id: Wavelet_CDF_4_x.C,v 4.2.2.1.2.1 1999/07/20 16:15:52 geert Exp $
1633 -#include <waili/Util.h>
1634 -#include <waili/Channel.h>
1635 +#include "waili/Util.h"
1636 +#include "waili/Channel.h"
1639 const char *Wavelet_CDF_4_x::rcsid = "$Id: Wavelet_CDF_4_x.C,v 4.2.2.1.2.1 1999/07/20 16:15:52 geert Exp $";
1640 --- waili-19990723.orig/lib/Wavelet_JPEG2000.C
1641 +++ waili-19990723/lib/Wavelet_JPEG2000.C
1643 // $Id: Wavelet_JPEG2000.C,v 5.1.2.1.2.1 1999/07/20 16:15:53 geert Exp $
1646 -#include <waili/Wavelet.h>
1647 +#include "waili/Wavelet.h"
1650 // Biorthogonal CRF (13, 7)
1651 --- waili-19990723.orig/lib/Wavelet.C
1652 +++ waili-19990723/lib/Wavelet.C
1654 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1657 -#include <waili/Util.h>
1658 -#include <waili/Channel.h>
1659 +#include "waili/Util.h"
1660 +#include "waili/Channel.h"
1664 @@ -483,7 +483,7 @@ Wavelet *Wavelet::CreateCDF(u_int np, u_
1666 // Create a Wavelet from an ID
1668 -Wavelet *Wavelet::CreateFromID(u8 id)
1669 +Wavelet *Wavelet::CreateFromID(Wavelet_ID id)
1673 --- waili-19990723.orig/lib/Util.C
1674 +++ waili-19990723/lib/Util.C
1679 +#include <string.h>
1681 -#include <waili/Types.h>
1682 -#include <waili/Util.h>
1683 +#include "waili/Types.h"
1684 +#include "waili/Util.h"
1686 +#include "exception"
1690 +static char ERRSTR[512];
1692 void Die(const char *fmt, ...)
1699 va_start(args, fmt);
1700 - vfprintf(stderr, fmt, args);
1701 + vsnprintf(ERRSTR+strlen(ERRSTR), 512, fmt, args);
1704 + fprintf(stderr,ERRSTR);
1705 + //exception e;//=new exception();
1714 +++ waili-19990723/lib/myLifting.C,v
1720 + andrea:1.1; strict;
1725 +date 2001.09.16.20.24.12; author andrea; state Exp;
1741 +void LiftChannelR::Lift_bin(int type ) const
1743 + PixType *even = Even, *odd = Odd, b;
1745 + for (u_int i = 0; i < Rows; i++) {
1747 + for (u_int j = 0; j < Codd; j++) {
1748 + //even[j] = even[j] ;
1749 + odd[j] = even[j] ^ odd[j] ;
1752 + for (u_int j = 0; j < Codd; j++) {
1753 + b=even[j] ^ odd[j];
1754 + even[j] = odd[j] ;
1765 +void LiftChannelR::ILift_bin(int type ) const
1767 + PixType *even = Even, b;
1768 + PixType *odd = Odd;
1770 + for (u_int i = 0; i < Rows; i++) {
1772 + for (u_int j = 0; j < Codd; j++) {
1773 + odd[j] = even[j] ^ odd[j] ;
1775 + for (u_int j = 0; j < Codd; j++) {
1776 + b=even[j] ^ odd[j];
1777 + odd[j] = even[j] ;
1785 +void LiftChannelC::Lift_bin(int type ) const
1787 + PixType *even = Even;
1788 + PixType *odd = Odd;
1790 + for (u_int i = 0; i < Rodd; i++) {
1791 + for (u_int j = 0; j < Cols; j++)
1792 + odd[j] = 64 * ( (even[j] >0) ^ (odd[j] >0));
1793 + for (u_int j = 0; j < Cols; j++)
1794 + even[j] = 64 * ( (even[j] >0) );
1800 +void LiftChannelC::ILift_bin(int type ) const
1802 + PixType *even = Even;
1803 + PixType *odd = Odd;
1805 + for (u_int i = 0; i < Rodd; i++) {
1806 + for (u_int j = 0; j < Cols; j++)
1807 + odd[j] = 64 * ( (even[j] >0) ^ (odd[j] >0));
1815 --- waili-19990723.orig/lib/NTChannel.C
1816 +++ waili-19990723/lib/NTChannel.C
1818 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1821 -#include <waili/Channel.h>
1822 -#include <waili/Util.h>
1824 -#include <stream.h>
1825 +#include <iostream>
1828 +#include "waili/Channel.h"
1829 +#include "waili/Util.h"
1832 const char *NTChannel::rcsid = "$Id: NTChannel.C,v 4.12.2.3.2.1 1999/07/20 16:15:51 geert Exp $";
1834 @@ -163,8 +164,10 @@ s32 *NTChannel::Correlate(const NTChanne
1835 void NTChannel::Enhance(f32 m)
1837 for (u_int r = 0; r < Rows; r++)
1838 - for (u_int c = 0; c < Cols; c++)
1839 - (*this)(c, r) = PixType(m*(*this)(c, r));
1840 + for (u_int c = 0; c < Cols; c++) {
1841 + f32 v=(*this)(c, r);
1842 + (*this)(c, r) = PixType( floor(m*v+0.5) );
1846 void NTChannel::Enhance(int m, u_int shift)
1847 @@ -391,7 +394,7 @@ void NTChannel::Destroy(void)
1848 Cols = Rows = OffsetX = OffsetY = 0;
1851 -void NTChannel::GetMinMax(PixType &min, PixType &max, u_int smoothing = 0) const
1852 +void NTChannel::GetMinMax(PixType &min, PixType &max, u_int smoothing) const
1855 Die("%s: Smoothing isn't implemented yet!\n", __FUNCTION__);
1856 --- waili-19990723.orig/lib/LChannelC.C
1857 +++ waili-19990723/lib/LChannelC.C
1859 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1862 -#include <waili/Channel.h>
1863 -#include <waili/Util.h>
1865 -#include <stream.h>
1866 +#include <iostream>
1869 +#include "waili/Channel.h"
1870 +#include "waili/Util.h"
1873 const char *LChannelC::rcsid = "$Id: LChannelC.C,v 4.6.2.1.2.1 1999/07/20 16:15:49 geert Exp $";
1876 +++ waili-19990723/lib/Wavelet_gain.C
1879 +#include "waili/Wavelet.h"
1880 +#include "waili/Channel.h"
1881 +#include <stdlib.h>
1883 +double *wavelet_gaussian_variance_gain_by_type(u8 type)
1888 + { static double g[2]={ 0.647, 1.647 }; return g;}
1892 + { static double g[2]={ 0.50, 2.00 };return g;}
1896 + { static double g[2]={ 0.71, 1.50 };return g;}
1898 + { static double g[2]={ 1.90, 4.43 };return g;}
1901 + { static double g[2]={ 1.63, 4.43 };return g;}
1902 + default: { abort(); static double g[2]={ 1.0, 1.0 }; return g;}
1907 +double *wavelet_gaussian_variance_gain(Channel *C)
1909 + TransformType t= ((LChannel *)C)->GetTransformType();
1910 + TransformDescriptor *td=((LChannel *)C)->GetTransform();
1911 + //assert ( t == td->type);
1912 + double *gg=wavelet_gaussian_variance_gain_by_type(td->filter);
1913 + if ( t == TT_ColsRows) {
1914 + double *g=new double[4];
1915 + g[0]= gg[0] * gg[0]; g[1]=g[2]= (gg[0]*gg[1]); g[3]= gg[1] * gg[1];
1917 + } else { double *g=new double[4]; g[0]= gg[0]; g[1]=gg[1]; return g;}
1920 +double *wavelet_uniform_maximum_gain(int type)
1923 + case 100: //ID_CRF_13_7
1924 + case 101: //ID_SWE_13_7
1925 + { static double g[2]={ 1.45, 2.2 }; return g;}
1926 + case 1://ID_CDF_1_1
1927 + case 2:// ID_CDF_1_
1928 + case 3://ID_CDF_1_5
1929 + { static double g[2]={ 1.2, 2.0 };return g;}
1930 + case 4://ID_CDF_2_2 = 4
1931 + case 5://ID_CDF_2_4
1932 + case 6://ID_CDF_2_6
1933 + { static double g[2]={ 1.5, 2.0 };return g;}
1934 + case 7://ID_CDF_4_2
1935 + { static double g[2]={ 2.2, 3.8 };return g;}
1936 + case 8://ID_CDF_4_4
1937 + case 9://ID_CDF_4_6
1938 + { static double g[2]={ 2.3, 3.8 };return g;}
1939 + default: { static double g[2]={ 1.0, 1.0 }; return g;}
1944 --- waili-19990723.orig/lib/Timer.C
1945 +++ waili-19990723/lib/Timer.C
1947 #include <sys/times.h>
1950 -#include <waili/Timer.h>
1951 +#include "waili/Timer.h"
1954 -#if defined(sun) && !defined(CLK_TCK) // SunOS
1956 +#if defined(sun) && !defined(CLOCKS_PER_SEC) // SunOS
1957 +#define CLOCKS_PER_SEC 60
1961 @@ -100,7 +100,7 @@ f32 Timer::GetReal(void) const
1965 - return((f32)real/CLK_TCK);
1966 + return((f32)real/CLOCKS_PER_SEC);
1970 @@ -116,7 +116,7 @@ f32 Timer::GetUser(void) const
1974 - return((f32)user/CLK_TCK);
1975 + return((f32)user/CLOCKS_PER_SEC);
1979 @@ -132,7 +132,7 @@ f32 Timer::GetSystem(void) const
1983 - return((f32)system/CLK_TCK);
1984 + return((f32)system/CLOCKS_PER_SEC);
1988 @@ -175,8 +175,8 @@ void Timer::Toc(void)
1991 fprintf(stderr, "Real = %10.3f User = %10.3f System = %10.3f\n",
1992 - (f32)t.Real/CLK_TCK, (f32)t.User/CLK_TCK,
1993 - (f32)t.System/CLK_TCK);
1994 + (f32)t.Real/CLOCKS_PER_SEC, (f32)t.User/CLOCKS_PER_SEC,
1995 + (f32)t.System/CLOCKS_PER_SEC);
1999 --- waili-19990723.orig/lib/Lifting.C
2000 +++ waili-19990723/lib/Lifting.C
2002 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2005 -#include <waili/Channel.h>
2006 +#include "waili/Channel.h"
2007 +#include "waili/Util.h"
2010 const char *Lifting::rcsid = "$Id: Lifting.C,v 4.5.2.1.2.1 1999/07/20 16:15:51 geert Exp $";