/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 666 by persson, Sun Jun 19 15:18:59 2005 UTC revision 695 by persson, Sat Jul 16 19:36:23 2005 UTC
# Line 132  namespace { Line 132  namespace {
132      {      {
133          // Note: The 24 bits are truncated to 16 bits for now.          // Note: The 24 bits are truncated to 16 bits for now.
134    
135          // Note: The calculation of the initial value of y is strange          int y, dy, ddy, dddy;
         // and not 100% correct. What should the first two parameters  
         // really be used for? Why are they two? The correct value for  
         // y seems to lie somewhere between the values of the first  
         // two parameters.  
         //  
         // Strange thing #2: The formula in SKIP_ONE gives values for  
         // y that are twice as high as they should be. That's why  
         // COPY_ONE shifts an extra step, and also why y is  
         // initialized with a sum instead of a mean value.  
   
         int y, dy, ddy;  
   
136          const int shift = 8 - truncatedBits;          const int shift = 8 - truncatedBits;
         const int shift1 = shift + 1;  
137    
138  #define GET_PARAMS(params)                              \  #define GET_PARAMS(params)                      \
139          y = (get24(params) + get24((params) + 3));      \          y    = get24(params);                   \
140          dy  = get24((params) + 6);                      \          dy   = y - get24((params) + 3);         \
141          ddy = get24((params) + 9)          ddy  = get24((params) + 6);             \
142            dddy = get24((params) + 9)
143    
144  #define SKIP_ONE(x)                             \  #define SKIP_ONE(x)                             \
145          ddy -= (x);                             \          dddy -= (x);                            \
146          dy -= ddy;                              \          ddy  -= dddy;                           \
147          y -= dy          dy   =  -dy - ddy;                      \
148            y    += dy
149    
150  #define COPY_ONE(x)                             \  #define COPY_ONE(x)                             \
151          SKIP_ONE(x);                            \          SKIP_ONE(x);                            \
152          *pDst = y >> shift1;                    \          *pDst = y >> shift;                     \
153          pDst += dstStep          pDst += dstStep
154    
155          switch (compressionmode) {          switch (compressionmode) {

Legend:
Removed from v.666  
changed lines
  Added in v.695

  ViewVC Help
Powered by ViewVC