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) { |