"ZYWRLE":Enhanced VNC codec for Motion picture
(English draft version Rev.B:2007/01/23)
(English draft version Rev.A:2006/08/03)
Noriaki Yamazaki:Research & Development Cneter, Hitachi Systems & Services, Ltd.
Table of Contents
Introduction
The lossy codec based on Wavelet transform is frequently used in compression of natural image,
motion picture and audio stream.
But it isn't almost used in Remote Desktop protocol like VNC
because classical lossless run-length codec like ZRLE has high performance in peculiar
image which has big mono color region like desktop image.
The lack of lossy codec cause low performance of motion picture in VNC.
We introduce new codec "ZYWRLE(ZLib YUV Wavelet Run Length Encoding)" which
applied wavelet transform partially and is based on ZRLE.
In this new codec, network traffic reduced to 15%-50% traffic of ZRLE when we play motion picture.
Backgound and Problem Statement
ZRLE
ZRLE : See "RFB Protocol Specification".
Problem of ZRLE:
- In Hi-color(above 32K colors) mode,
- In Natural image,
=> No Palette-lize, No RLE => Raw uncompressed data(Raw tile).
Raw tile rate of ZRLE when motion picture or non motion picture
| Type |
Raw tile (Mbytes) |
Total(Mbytes) |
Raw tile rate(%) |
| Comp. |
Raw |
rate(%) |
| non-motion |
0.085 |
1.14 |
66.02 |
1.7 |
0.13 |
| motion |
125.8 |
117.1 |
292.2 |
29.8 |
32.1 |
For solving problem of ZRLE for motion picture:
=>Reduce Raw tile.
- Decrease using color
- Make many "Run"
- Bias pixel probability
The based theory
YUV-RGB color transform
We use RCT(reversible color transform).
More detail, See JPEG-2000 Specification.
Wavelet transform
More detail, See Signal Processing with Wavelet Transform.
Original lena(RGB565), Wavelet transform level 1, level2. in RGB color space.
We use PLHaar
as the basis of the wavelet.
Important observations of wavelet coefficients
Shapiro says:
- Natural images in general have a low pass spectrum.
When an image is wavelet transformed the energy in the subbands decreases as the scale decreases
(low scale means high resolution), so the wavelet coefficients will, on average,
be smaller in the higher subbands than in the lower subbands.
This shows that progressive encoding is a very natural choice for compressing wavelet transformed images,
since the higher subbands only add detail.(From EZW.)
- Large wavelet coefficients are more important than small wavelet coefficients.
(From EZW.)
- Wavelet coefficients distribute around 0 according to the bell-shaped distribution like Gaussian.
Lets denote the standard deviation of the distribution as σ. By discarding small wavelet coefficients,
the amount of the data can be reduced.
(From Image Compression using the Wavelet Decomposition.)
ZYWRLE Definition
Specification about Wavelet coefficients filtering
- We use Non liner quantization filter.
y=f(x) = sign(x)*round( ((abs(x)/(2^7))^ r )* 2^(o-1) )*2^(8-o)
x=f-1(y) = sign(y)*round( ((abs(y)/(2^7))^(1/r))* 2^(i-1) )*2^(8-i)
( r:power coefficient i:effective MSB in input o:effective MSB in output )
r < 1.0 : Smaller value is more important than larger value.
r > 1.0 : Larger value is more important than smaller value.
r = 1.0 : Liner quantization which is same with EZW style.
r = 0.75 is famous non liner quantization used in MP3 audio codec.
In contrast to audio data, larger value is important in wavelet coefficients.
So, I select r = 2.0 table( quantize is x^2, dequantize sqrt(x) ).
Filter specification(r = 2.0)
| quality |
Wavelet level |
Y Filter |
UV filter |
| Hi |
1 |
o=4 |
o=0 |
| Mid |
2 |
o=2,5 |
o=0,5 |
ZYWRLE Hi-quality:Wavelet:level 1 in YUV, filitering, reconstruction image:Comp.rate=16.3%/PSNR(RGB)=28.000.
ZYWRLE Mid-quality:Wavelet:level 2 in YUV, filitering, reconstruction image:Comp.rate=6.5%/PSNR(RGB)=23.995.
Specification about Wavelet transform
- For PLHaar, Pixel range change to "Odd range(-127<=x<=127)". -128 is converted to -127.
- I used 'interleave' decomposition instead of the famous 'pyramid' decomposition for more speed and less memory.
- 4 sub coefficient Wavelet transform image decompositon Hxy->Hy->Hx->L for apply ZRLE at once.
1 block ZYWRLE enlarged 4 times in Hi/Mid quality.
Note:
Almost block is green or black pixel.
Green pixel means only Y component pixel data.
Black pixel means no data.
These pixels are compressed highly by ZRLE.
Changes From ZRLE
- Only Raw tile is applied Wavelet transform. Other tile(RLE,Packed pixel,Palette) is encoded with original image.
- Raw tile threshold was changed to [w]*[h]*[pixel byte]/(2^level) instead of [w]*[h]*[pixel byte].
- In Raw tile, whole tile image is converted with RCT. and next Wavelet transform.
- Wavelet transformed raw tile was encoded ZRLE recursively.
ZRLE desktop image(1280*1024pixel*16bit)
1/2 Server Side Scaling:640*512pixel(640Kbytes)/80block(1block=64~64dot)
ZYWRLE Hi-quality:YUV-Wavelet-filitering, reconstruction image
ZYWRLE Mid-quality:YUV-Wavelet-filitering, reconstruction image
Note:On left side of the image,
there are distinguishable border line between ZRLE block and ZYWRLE.
But On movie image and "System-kun" image in the browser, we can't see
distinguishable border line.(See Errors in YUV conversion.)
Result of ZYWRLE for desktop image
| quality |
ZYWRLE (bytes(blocks)) |
ZRLE (bytes(blocks)) |
ZLib out/rate (bytes(%)) |
PSNR(YUV) (dB) |
PSNR(RGB) (dB) |
| ZRLE |
0(0) |
156233(80) |
74316(100%) |
∞ |
∞ |
| Hi |
21048(8) |
111797(72) |
64543(86.8%) |
37.41 |
33.05 |
| Mid |
28595(31) |
40404(49) |
41000(55.2%) |
29.98 |
25.66 |
Evalution of ZYWRLE
Compression performance in motion picture
Result of ZYWRLE for motion picture
| quality |
Raw tile(Mbytes) |
Total(Mbytes) |
Raw tile rate(%) |
PSNR(RGB) (dB) |
| Out |
Raw |
rate(%) |
Comp. |
Raw |
rate(%) |
| ZRLE |
125.8 |
125.8 |
100 |
117.1 |
392.2 |
29.8 |
32.1 |
∞ |
| Hi |
53.85 |
167.58 |
32.1 |
52.10 |
370.96 |
14.0 |
45.1 |
28.025 |
| Mid |
31.83 |
264.05 |
12.1 |
20.56 |
378.50 |
5.4 |
69.7 |
23.980 |
- Comp. rate of ZRLE(about 30%) goes to 15%(Hi-quality)/5%(Mid-quality)!
- Low-freq. coefficients is "half(level1)/quarter(level2) reduced resolution" original image.
So, these must be Raw tile and these size is 1/(2*2)=25%, 1/(4*4)=6.25%.
- Remaining Hi-freq. coefficients images go to:
- level1: 75% => 32%-25%=7%(about 10 times!)
- level2: 93.75% => 12.1%-6.25%=5.85%(about 20 times!)
These indicates that Wavlet transform is effective for ZRLE codec with natural image.
Errors in YUV conversion
There are two type errors in YUV conversion.
- For keeping integer range, UV component reduces to half range.( 0 <= Y <= 255, -255 <= UV <= 255 in original RCT.)
- For PLHaar, Pixel range change to "Odd range(-127<=x<=127)". -128 is converted to -127.
For these reasons, YUV conversion includes errors and PSNR indicates bad quality
though there are no distinguishable image distortion.
This error is often distinguishable at border between mono color ZRLE block and ZYWRLE block.
If you convert whole image, the border disappears. But this is not a true resolution and also leads needless processing load.
We need more enhancement about YUV conversion.
YUV conversion only(no Wavelet,filitering)
original lena image, reconstruction image, difference image between both
PSNR(YUV)=37.57, PSNR(RGB)=32.95
Note:
PSNR indicates bad quality though there are no distinguishable difference.
Implemantation of ZYWRLE
Our VNC client for embeded device:"micro-VNC"
PalmOS 5(Sony Clie-UX50), Windows Mobile 5(Sharp W-Zero3), BREW phone(au/Sony ericson W41S), Symbian S60(Nokia 6630)
Reference Implementation(C source code/patch for VNC Servers)
I think that Any VNC server can be applied ZYWRLE easlilly using one of these patch.
License of ZYWRLE
Though ZYWRLE is our intellectual property and was developed for our micro-VNC,
We Hitachi Systems & Services, Ltd. decided make it open source.
You can use it with no fee for commercial and/or non-commercial purpose.
Avobe Reference implementation are released under our BSD-like license.
More detail, see top of zywrletemplate.c.
To Do
ZYWRLE is yet under developement state.
- Research whether we should use YUV conversion or not.
(Is all UV cutting of level 1 too much less quality?)
- Research whether we should use PLHaar or not.
(Selecting Daubechies or 3-5 Lifting may be better.)
- Research best coefficients filter.
(Should we use Non-linar quantizer or not? Which is best param of it?)
All Rights Reserved Copyright (c) 2000-2007, Hitachi Systems & Services, Ltd., RDC(Research & Developement Center)