#define ZYWRLE_QUANTIZE
#undef ZYWRLE_ANALYZE
#undef ZYWRLE_SYNTHESIZE
#define ZYWRLE_ANALYZE __RFB_CONCAT3E(zywrleAnalyze,BPP,END_FIX)
#define ZYWRLE_SYNTHESIZE __RFB_CONCAT3E(zywrleSynthesize,BPP,END_FIX)
#define ZYWRLE_RGBYUV __RFB_CONCAT3E(zywrleRGBYUV,BPP,END_FIX)
#define ZYWRLE_YUVRGB __RFB_CONCAT3E(zywrleYUVRGB,BPP,END_FIX)
#define ZYWRLE_YMASK __RFB_CONCAT2E(ZYWRLE_YMASK,BPP)
#define ZYWRLE_UVMASK __RFB_CONCAT2E(ZYWRLE_UVMASK,BPP)
#define ZYWRLE_LOAD_PIXEL __RFB_CONCAT2E(ZYWRLE_LOAD_PIXEL,BPP)
#define ZYWRLE_SAVE_PIXEL __RFB_CONCAT2E(ZYWRLE_SAVE_PIXEL,BPP)
#undef S_0
#undef S_1
#undef L_0
#undef L_1
#undef L_2
#if ZYWRLE_ENDIAN == ENDIAN_BIG
# define S_0 1
# define S_1 0
# define L_0 3
# define L_1 2
# define L_2 1
#else
# define S_0 0
# define S_1 1
# define L_0 0
# define L_1 1
# define L_2 2
#endif
#define ZYWRLE_YMASK15 0xFFFFFFF8
#define ZYWRLE_UVMASK15 0xFFFFFFF8
#define ZYWRLE_LOAD_PIXEL15(pSrc,R,G,B) { \
R = (((unsigned char*)pSrc)[S_1]<< 1)& 0xF8; \
G = ((((unsigned char*)pSrc)[S_1]<< 6)|(((unsigned char*)pSrc)[S_0]>> 2))& 0xF8; \
B = (((unsigned char*)pSrc)[S_0]<< 3)& 0xF8; \
}
#define ZYWRLE_SAVE_PIXEL15(pDst,R,G,B) { \
R &= 0xF8; \
G &= 0xF8; \
B &= 0xF8; \
((unsigned char*)pDst)[S_1] = (unsigned char)( (R>>1)|(G>>6) ); \
((unsigned char*)pDst)[S_0] = (unsigned char)(((B>>3)|(G<<2))& 0xFF); \
}
#define ZYWRLE_YMASK16 0xFFFFFFFC
#define ZYWRLE_UVMASK16 0xFFFFFFF8
#define ZYWRLE_LOAD_PIXEL16(pSrc,R,G,B) { \
R = ((unsigned char*)pSrc)[S_1] & 0xF8; \
G = ((((unsigned char*)pSrc)[S_1]<< 5)|(((unsigned char*)pSrc)[S_0]>> 3))& 0xFC; \
B = (((unsigned char*)pSrc)[S_0]<< 3)& 0xF8; \
}
#define ZYWRLE_SAVE_PIXEL16(pDst,R,G,B) { \
R &= 0xF8; \
G &= 0xFC; \
B &= 0xF8; \
((unsigned char*)pDst)[S_1] = (unsigned char)( R |(G>>5) ); \
((unsigned char*)pDst)[S_0] = (unsigned char)(((B>>3)|(G<<3))& 0xFF); \
}
#define ZYWRLE_YMASK32 0xFFFFFFFF
#define ZYWRLE_UVMASK32 0xFFFFFFFF
#define ZYWRLE_LOAD_PIXEL32(pSrc,R,G,B) { \
R = ((unsigned char*)pSrc)[L_2]; \
G = ((unsigned char*)pSrc)[L_1]; \
B = ((unsigned char*)pSrc)[L_0]; \
}
#define ZYWRLE_SAVE_PIXEL32(pDst,R,G,B) { \
((unsigned char*)pDst)[L_2] = (unsigned char)R; \
((unsigned char*)pDst)[L_1] = (unsigned char)G; \
((unsigned char*)pDst)[L_0] = (unsigned char)B; \
}
#ifndef ZYWRLE_ONCE
#define ZYWRLE_ONCE
#ifdef WIN32
#define InlineX __inline
#else
# ifndef __STRICT_ANSI__
# define InlineX inline
# else
# define InlineX
# endif
#endif
#ifdef ZYWRLE_ENCODE
# ifndef ZYWRLE_QUANTIZE
const static unsigned int zywrleParam[3][3]={
{0x0000F000,0x00000000,0x00000000},
{0x0000C000,0x00F0F0F0,0x00000000},
{0x0000C000,0x00C0C0C0,0x00F0F0F0},
};
# else
static const signed char zywrleConv[4][256]={
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 32,
32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32,
48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 56, 56, 56, 56, 56,
56, 56, 56, 56, 64, 64, 64, 64,
64, 64, 64, 64, 72, 72, 72, 72,
72, 72, 72, 72, 80, 80, 80, 80,
80, 80, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 96, 96,
96, 96, 96, 104, 104, 104, 104, 104,
104, 104, 104, 104, 104, 112, 112, 112,
112, 112, 112, 112, 112, 112, 120, 120,
120, 120, 120, 120, 120, 120, 120, 120,
0, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -112, -112, -112, -112, -112,
-112, -112, -112, -112, -104, -104, -104, -104,
-104, -104, -104, -104, -104, -104, -96, -96,
-96, -96, -96, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -80,
-80, -80, -80, -80, -80, -72, -72, -72,
-72, -72, -72, -72, -72, -64, -64, -64,
-64, -64, -64, -64, -64, -56, -56, -56,
-56, -56, -56, -56, -56, -56, -48, -48,
-48, -48, -48, -48, -48, -48, -48, -48,
-48, -32, -32, -32, -32, -32, -32, -32,
-32, -32, -32, -32, -32, -32, -32, -32,
-32, -32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48,
48, 48, 48, 48, 48, 48, 48, 48,
64, 64, 64, 64, 64, 64, 64, 64,
64, 64, 64, 64, 64, 64, 64, 64,
80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
104, 104, 104, 104, 104, 104, 104, 104,
104, 104, 104, 112, 112, 112, 112, 112,
112, 112, 112, 112, 120, 120, 120, 120,
120, 120, 120, 120, 120, 120, 120, 120,
0, -120, -120, -120, -120, -120, -120, -120,
-120, -120, -120, -120, -120, -112, -112, -112,
-112, -112, -112, -112, -112, -112, -104, -104,
-104, -104, -104, -104, -104, -104, -104, -104,
-104, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -80, -80, -80, -80,
-80, -80, -80, -80, -80, -80, -80, -80,
-80, -64, -64, -64, -64, -64, -64, -64,
-64, -64, -64, -64, -64, -64, -64, -64,
-64, -48, -48, -48, -48, -48, -48, -48,
-48, -48, -48, -48, -48, -48, -48, -48,
-48, -48, -48, -48, -48, -48, -48, -48,
-48, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
},
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
88, 88, 88, 88, 88, 88, 88, 88,
0, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88,
-88, -88, -88, -88, -88, -88, -88, -88,
-88, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
}
};
const static signed char* zywrleParam[3][3][3]={
{{zywrleConv[0],zywrleConv[2],zywrleConv[0]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]}},
{{zywrleConv[0],zywrleConv[3],zywrleConv[0]},{zywrleConv[1],zywrleConv[1],zywrleConv[1]},{zywrleConv[0],zywrleConv[0],zywrleConv[0]}},
{{zywrleConv[0],zywrleConv[3],zywrleConv[0]},{zywrleConv[2],zywrleConv[2],zywrleConv[2]},{zywrleConv[1],zywrleConv[1],zywrleConv[1]}},
};
# endif
#endif
static InlineX void Harr(signed char* pX0, signed char* pX1)
{
int X0 = (int)*pX0, X1 = (int)*pX1;
int orgX0 = X0, orgX1 = X1;
if ((X0 ^ X1) & 0x80) {
X1 += X0;
if (((X1^orgX1)&0x80)==0) {
X0 -= X1;
}
} else {
X0 -= X1;
if (((X0 ^ orgX0) & 0x80) == 0) {
X1 += X0;
}
}
*pX0 = (signed char)X1;
*pX1 = (signed char)X0;
}
static InlineX void WaveletLevel(int* data, int size, int l, int SkipPixel)
{
int s, ofs;
signed char* pX0;
signed char* end;
pX0 = (signed char*)data;
s = (8<<l)*SkipPixel;
end = pX0+(size>>(l+1))*s;
s -= 2;
ofs = (4<<l)*SkipPixel;
while (pX0 < end) {
Harr(pX0, pX0+ofs);
pX0++;
Harr(pX0, pX0+ofs);
pX0++;
Harr(pX0, pX0+ofs);
pX0 += s;
}
}
#define InvWaveletLevel(d,s,l,pix) WaveletLevel(d,s,l,pix)
#ifdef ZYWRLE_ENCODE
# ifndef ZYWRLE_QUANTIZE
static InlineX void FilterWaveletSquare(int* pBuf, int width, int height, int level, int l)
{
int r, s;
int x, y;
int* pH;
const unsigned int* pM;
pM = &(zywrleParam[level-1][l]);
s = 2<<l;
for (r = 1; r < 4; r++) {
pH = pBuf;
if (r & 0x01)
pH += s>>1;
if (r & 0x02)
pH += (s>>1)*width;
for (y = 0; y < height / s; y++) {
for (x = 0; x < width / s; x++) {
if (((signed char*)pH)[0] & 0x80)
((signed char*)pH)[0] += ~((signed char*)pM)[0];
if (((signed char*)pH)[1] & 0x80)
((signed char*)pH)[1] += ~((signed char*)pM)[1];
if (((signed char*)pH)[2] & 0x80)
((signed char*)pH)[2] += ~((signed char*)pM)[2];
*pH &= *pM;
pH += s;
}
pH += (s-1)*width;
}
}
}
# else
static InlineX void FilterWaveletSquare(int* pBuf, int width, int height, int level, int l)
{
int r, s;
int x, y;
int* pH;
const signed char** pM;
pM = zywrleParam[level-1][l];
s = 2<<l;
for (r = 1; r < 4; r++) {
pH = pBuf;
if (r & 0x01)
pH += s>>1;
if (r & 0x02)
pH += (s>>1)*width;
for (y = 0; y < height / s; y++) {
for (x = 0; x < width / s; x++) {
((signed char*)pH)[0] = pM[0][((unsigned char*)pH)[0]];
((signed char*)pH)[1] = pM[1][((unsigned char*)pH)[1]];
((signed char*)pH)[2] = pM[2][((unsigned char*)pH)[2]];
pH += s;
}
pH += (s-1)*width;
}
}
}
# endif
static InlineX void Wavelet(int* pBuf, int width, int height, int level)
{
int l, s;
int* pTop;
int* pEnd;
for (l = 0; l < level; l++) {
pTop = pBuf;
pEnd = pBuf+height*width;
s = width<<l;
while (pTop < pEnd) {
WaveletLevel(pTop, width, l, 1);
pTop += s;
}
pTop = pBuf;
pEnd = pBuf+width;
s = 1<<l;
while (pTop < pEnd) {
WaveletLevel(pTop, height,l, width);
pTop += s;
}
FilterWaveletSquare(pBuf, width, height, level, l);
}
}
#endif
#ifdef ZYWRLE_DECODE
static InlineX void InvWavelet(int* pBuf, int width, int height, int level)
{
int l, s;
int* pTop;
int* pEnd;
for (l = level - 1; l >= 0; l--) {
pTop = pBuf;
pEnd = pBuf+width;
s = 1<<l;
while (pTop < pEnd) {
InvWaveletLevel(pTop, height,l, width);
pTop += s;
}
pTop = pBuf;
pEnd = pBuf+height*width;
s = width<<l;
while (pTop < pEnd) {
InvWaveletLevel(pTop, width, l, 1);
pTop += s;
}
}
}
#endif
#define ZYWRLE_LOAD_COEFF(pSrc,R,G,B) { \
R = ((signed char*)pSrc)[2]; \
G = ((signed char*)pSrc)[1]; \
B = ((signed char*)pSrc)[0]; \
}
#define ZYWRLE_SAVE_COEFF(pDst,R,G,B) { \
((signed char*)pDst)[2] = (signed char)R; \
((signed char*)pDst)[1] = (signed char)G; \
((signed char*)pDst)[0] = (signed char)B; \
}
#define ROUND(x) (((x)<0)?0:(((x)>255)?255:(x)))
#define ZYWRLE_RGBYUV1(R,G,B,Y,U,V,ymask,uvmask) { \
Y = (R+(G<<1)+B)>>2; \
U = B-G; \
V = R-G; \
Y -= 128; \
U >>= 1; \
V >>= 1; \
Y &= ymask; \
U &= uvmask; \
V &= uvmask; \
if (Y == -128) \
Y += (0xFFFFFFFF-ymask+1); \
if (U == -128) \
U += (0xFFFFFFFF-uvmask+1); \
if (V == -128) \
V += (0xFFFFFFFF-uvmask+1); \
}
#define ZYWRLE_YUVRGB1(R,G,B,Y,U,V) { \
Y += 128; \
U <<= 1; \
V <<= 1; \
G = Y-((U+V)>>2); \
B = U+G; \
R = V+G; \
G = ROUND(G); \
B = ROUND(B); \
R = ROUND(R); \
}
#define INC_PTR(data) \
data++; \
if( data-pData >= (w+uw) ){ \
data += scanline-(w+uw); \
pData = data; \
}
#define ZYWRLE_TRANSFER_COEFF(pBuf,data,r,w,h,scanline,level,TRANS) \
pH = pBuf; \
s = 2<<level; \
if (r & 0x01) \
pH += s>>1; \
if (r & 0x02) \
pH += (s>>1)*w; \
pEnd = pH+h*w; \
while (pH < pEnd) { \
pLine = pH+w; \
while (pH < pLine) { \
TRANS \
INC_PTR(data) \
pH += s; \
} \
pH += (s-1)*w; \
}
#define ZYWRLE_PACK_COEFF(pBuf,data,r,width,height,scanline,level) \
ZYWRLE_TRANSFER_COEFF(pBuf,data,r,width,height,scanline,level,ZYWRLE_LOAD_COEFF(pH,R,G,B);ZYWRLE_SAVE_PIXEL(data,R,G,B);)
#define ZYWRLE_UNPACK_COEFF(pBuf,data,r,width,height,scanline,level) \
ZYWRLE_TRANSFER_COEFF(pBuf,data,r,width,height,scanline,level,ZYWRLE_LOAD_PIXEL(data,R,G,B);ZYWRLE_SAVE_COEFF(pH,R,G,B);)
#define ZYWRLE_SAVE_UNALIGN(data,TRANS) \
pTop = pBuf+w*h; \
pEnd = pBuf + (w+uw)*(h+uh); \
while (pTop < pEnd) { \
TRANS \
INC_PTR(data) \
pTop++; \
}
#define ZYWRLE_LOAD_UNALIGN(data,TRANS) \
pTop = pBuf+w*h; \
if (uw) { \
pData= data + w; \
pEnd = (int*)(pData+ h*scanline); \
while (pData < (PIXEL_T*)pEnd) { \
pLine = (int*)(pData + uw); \
while (pData < (PIXEL_T*)pLine) { \
TRANS \
pData++; \
pTop++; \
} \
pData += scanline-uw; \
} \
} \
if (uh) { \
pData= data + h*scanline; \
pEnd = (int*)(pData+ uh*scanline); \
while (pData < (PIXEL_T*)pEnd) { \
pLine = (int*)(pData + w); \
while (pData < (PIXEL_T*)pLine) { \
TRANS \
pData++; \
pTop++; \
} \
pData += scanline-w; \
} \
} \
if (uw && uh) { \
pData= data + w+ h*scanline; \
pEnd = (int*)(pData+ uh*scanline); \
while (pData < (PIXEL_T*)pEnd) { \
pLine = (int*)(pData + uw); \
while (pData < (PIXEL_T*)pLine) { \
TRANS \
pData++; \
pTop++; \
} \
pData += scanline-uw; \
} \
}
static InlineX void zywrleCalcSize(int* pW, int* pH, int level)
{
*pW &= ~((1<<level)-1);
*pH &= ~((1<<level)-1);
}
#endif
#ifndef CPIXEL
#ifdef ZYWRLE_ENCODE
static InlineX void ZYWRLE_RGBYUV(int* pBuf, PIXEL_T* data, int width, int height, int scanline)
{
int R, G, B;
int Y, U, V;
int* pLine;
int* pEnd;
pEnd = pBuf+height*width;
while (pBuf < pEnd) {
pLine = pBuf+width;
while (pBuf < pLine) {
ZYWRLE_LOAD_PIXEL(data,R,G,B);
ZYWRLE_RGBYUV1(R,G,B,Y,U,V,ZYWRLE_YMASK,ZYWRLE_UVMASK);
ZYWRLE_SAVE_COEFF(pBuf,V,Y,U);
pBuf++;
data++;
}
data += scanline-width;
}
}
#endif
#ifdef ZYWRLE_DECODE
static InlineX void ZYWRLE_YUVRGB(int* pBuf, PIXEL_T* data, int width, int height, int scanline) {
int R, G, B;
int Y, U, V;
int* pLine;
int* pEnd;
pEnd = pBuf+height*width;
while (pBuf < pEnd) {
pLine = pBuf+width;
while (pBuf < pLine) {
ZYWRLE_LOAD_COEFF(pBuf,V,Y,U);
ZYWRLE_YUVRGB1(R,G,B,Y,U,V);
ZYWRLE_SAVE_PIXEL(data,R,G,B);
pBuf++;
data++;
}
data += scanline-width;
}
}
#endif
#ifdef ZYWRLE_ENCODE
PIXEL_T* ZYWRLE_ANALYZE(PIXEL_T* dst, PIXEL_T* src, int w, int h, int scanline, int level, int* pBuf) {
int l;
int uw = w;
int uh = h;
int* pTop;
int* pEnd;
int* pLine;
PIXEL_T* pData;
int R, G, B;
int s;
int* pH;
zywrleCalcSize(&w, &h, level);
if (w == 0 || h == 0)
return NULL;
uw -= w;
uh -= h;
pData = dst;
ZYWRLE_LOAD_UNALIGN(src,*(PIXEL_T*)pTop=*pData;)
ZYWRLE_RGBYUV(pBuf, src, w, h, scanline);
Wavelet(pBuf, w, h, level);
for (l = 0; l < level; l++) {
ZYWRLE_PACK_COEFF(pBuf, dst, 3, w, h, scanline, l);
ZYWRLE_PACK_COEFF(pBuf, dst, 2, w, h, scanline, l);
ZYWRLE_PACK_COEFF(pBuf, dst, 1, w, h, scanline, l);
if (l == level - 1) {
ZYWRLE_PACK_COEFF(pBuf, dst, 0, w, h, scanline, l);
}
}
ZYWRLE_SAVE_UNALIGN(dst,*dst=*(PIXEL_T*)pTop;)
return dst;
}
#endif
#ifdef ZYWRLE_DECODE
PIXEL_T* ZYWRLE_SYNTHESIZE(PIXEL_T* dst, PIXEL_T* src, int w, int h, int scanline, int level, int* pBuf)
{
int l;
int uw = w;
int uh = h;
int* pTop;
int* pEnd;
int* pLine;
PIXEL_T* pData;
int R, G, B;
int s;
int* pH;
zywrleCalcSize(&w, &h, level);
if (w == 0 || h == 0)
return NULL;
uw -= w;
uh -= h;
pData = src;
for (l = 0; l < level; l++) {
ZYWRLE_UNPACK_COEFF(pBuf, src, 3, w, h, scanline, l);
ZYWRLE_UNPACK_COEFF(pBuf, src, 2, w, h, scanline, l);
ZYWRLE_UNPACK_COEFF(pBuf, src, 1, w, h, scanline, l);
if (l == level - 1) {
ZYWRLE_UNPACK_COEFF(pBuf, src, 0, w, h, scanline, l);
}
}
ZYWRLE_SAVE_UNALIGN(src,*(PIXEL_T*)pTop=*src;)
InvWavelet(pBuf, w, h, level);
ZYWRLE_YUVRGB(pBuf, dst, w, h, scanline);
ZYWRLE_LOAD_UNALIGN(dst,*pData=*(PIXEL_T*)pTop;)
return src;
}
#endif
#endif
#undef ZYWRLE_RGBYUV
#undef ZYWRLE_YUVRGB
#undef ZYWRLE_LOAD_PIXEL
#undef ZYWRLE_SAVE_PIXEL