Discussion:
LZMA compression
Matt Campbell
2007-02-12 23:11:01 UTC
Permalink
Hello:

Has anyone considered devising a new RFB encoding which uses LZMA
compression? I think it would be worthwhile, since LZMA typically has a
much better compression ratio than zlib or bzip2. Also, if the LZMA
dictionary is reasonably large, I'm guessing that the compression ratio
will improve significantly after the first few framebuffer updates.
This is only a conjecture at this point, so I was wondering if anyone
has pursued this idea further.

Matt
Alex Pelts
2007-02-13 00:04:04 UTC
Permalink
Does vnc accumulate dictionary between frame updates? I would think not
because you would not be able to join an existing session.
Also things vnc compresses are mostly flat color surfaces which compress
well with most any method.
I found most slowness during vnc session on windows comes not from the
bandwidth but from screen polling. This problem is eliminated with EE or
PE of the vnc with mirror driver.

Don't know if there are any plans to release mirror driver support in
free edition but that would be great. Although prices for PE with yearly
support are very reasonable.

Regards,
Alex
Post by Matt Campbell
Has anyone considered devising a new RFB encoding which uses LZMA
compression? I think it would be worthwhile, since LZMA typically has a
much better compression ratio than zlib or bzip2. Also, if the LZMA
dictionary is reasonably large, I'm guessing that the compression ratio
will improve significantly after the first few framebuffer updates. This
is only a conjecture at this point, so I was wondering if anyone has
pursued this idea further.
Matt
_______________________________________________
VNC-List mailing list
http://www.realvnc.com/mailman/listinfo/vnc-list
Matt Campbell
2007-02-13 00:34:00 UTC
Permalink
Post by Alex Pelts
Does vnc accumulate dictionary between frame updates?
I was referring to the dictionary maintained by the LZMA codec, if VNC
were to use LZMA compression. I noticed that in the ZRLE encoding, a
single zlib stream is maintained for the whole session. I presume the
same thing could be done with LZMA; in that case, the LZMA codec would
maintain a dictionary for the duration of the session.
Post by Alex Pelts
Also things vnc compresses are mostly flat color surfaces which compress
well with most any method.
What about rendered text and multi-colored desktop backgrounds such as
the ever-popular "Bliss" background under Windows XP?
Post by Alex Pelts
I found most slowness during vnc session on windows comes not from the
bandwidth but from screen polling. This problem is eliminated with EE or
PE of the vnc with mirror driver.
What display functionality, if any, does the system disable while the
VNC mirror driver is active?

Matt
Alex Pelts
2007-02-13 02:51:00 UTC
Permalink
I did not know that single stream was maintained. How do new clients
join the session? Is dictionary replicated when new client joins the
session?

Text compresses well because it is just black on white. Multicolored
backgrounds do not but if you running vnc you should turn all of these off.

Personally I make simple color scheme and connect with 256 color mode.
Makes for very good performance. Almost like local screen. Obviously you
cant look at pictures but who would do it over vnc?

VNC mirror driver does not affect any display functionality. It works at
the same level as video card driver. To system it looks just like
another video card.

Regards,
Alex
Post by Matt Campbell
I was referring to the dictionary maintained by the LZMA codec, if VNC
were to use LZMA compression. I noticed that in the ZRLE encoding, a
single zlib stream is maintained for the whole session. I presume the
same thing could be done with LZMA; in that case, the LZMA codec would
maintain a dictionary for the duration of the session.
Post by Alex Pelts
Also things vnc compresses are mostly flat color surfaces which
compress well with most any method.
What about rendered text and multi-colored desktop backgrounds such as
the ever-popular "Bliss" background under Windows XP?
Post by Alex Pelts
I found most slowness during vnc session on windows comes not from the
bandwidth but from screen polling. This problem is eliminated with EE
or PE of the vnc with mirror driver.
What display functionality, if any, does the system disable while the
VNC mirror driver is active?
Matt
_______________________________________________
VNC-List mailing list
http://www.realvnc.com/mailman/listinfo/vnc-list
·· ħþø ··
2007-02-13 03:09:02 UTC
Permalink
Post by Alex Pelts
VNC mirror driver does not affect any display functionality. It works at
the same level as video card driver. To system it looks just like
another video card.
Expanding on that:
http://www.demoforge.com/dfmirage.htm
http://www.tightvnc.org/driver.html
Matt Campbell
2007-02-13 03:26:01 UTC
Permalink
Post by Alex Pelts
I did not know that single stream was maintained. How do new clients
join the session? Is dictionary replicated when new client joins the
session?
In the ZRLE encoding, a zlib stream is maintained for each connected
client. The same would be done for LZMA or any other compression method.

Having given the matter some more thought, I'd like to propose a new
encoding, tentatively called LZMA Cells.

The LZMA Cells encoding:

This encoding divides the rectangle into variable-height rows, each of
which consists of variable-width sub-rectangles called cells. For each
row, the sum of the widths of all cells equals the width of the whole
rectangle. Likewise, the sum of the heights of all rows equals the
height of the whole rectangle. The number of rows and the number of
cells in each row is therefore not explicitly specified in the encoding.

Each cell is represented by raw pixels, using the CPIXEL type as defined
by the ZRLE encoding.

This encoding uses LZMA for compression. A single LZMA stream is
maintained for the duration of the RFB session, so all rectangles must
be encoded and decoded strictly in order.

On the wire, the encoding consists of a four-byte length field followed
by the specified number of bytes of LZMA-compressed data:

U32 length;
U8 lzmaData[length];

The uncompressed representation of the rectangle consists of an
arbitrary number of rows. Each row begins with a field specifying its
height in pixels:

U16 rowHeight;

This field is followed by an arbitrary number of cells. Each cell
consists of a field specifying its width in pixels, followed by the raw
pixel data:

U16 cellWidth;
CPIXEL data[cellWidth * rowHeight];

Rationale:

This encoding emphasizes simplicity and flexibility, leaving most
optimization to the compressor. It does not support palettes or
run-length encoding; a good compression algorithm with a reasonably
large dictionary renders these complications unnecessary. However, it
does use the CPIXEL (compressed pixel) type, because in the common
32-bit true-color pixel format, 8 bits for each pixel are never used.

This encoding attempts to facilitate the division of a large rectangle
into smaller sub-rectangles which contain patterns that the compressor
can recognize and efficiently compress. Because the optimal
sub-rectangle size is subject to change, possibly even within a given
rectangle, and is not necessarily known yet, the encoding allows a
rectangle to be dviided into arbitrarily many sub-rectangles of varying
sizes. Current servers may simply use tiles of fixed size, as in the
Hextile and ZRLE encodings, but requiring this would be short-sighted.
For example, a sophsticated server may be able to optimize the encoding
of rendered text when each glyph has a distinct bounding box (e.g. most
common character sets when italics are not used). If each cell
corresponds to a glyph, the compressor may be able to compress the
rendered text more efficiently than otherwise, especially when
characters or even sequences of characters recur frequently. In the
simpler case of fixed-size tiles, the compressor should be able to
minimize the overhead of repeating the tile width and height.

Thoughts?

Matt
Matt Campbell
2007-02-13 04:32:01 UTC
Permalink
After reading LZMA docs, it appears that it would be better to use the
U32 and PIXEL types in my proposed encoding, instead of U16 and CPIXEL.
This way, assuming the common 32-bit true-color pixel format is used,
the encoding guarantees 32-bit alignment at all levels. According to
the LZMA docs, aligned data helps to improve the compression ratio. So
in this case, premature optimization of the uncompressed stream actually
hurts.

Another factor worth considering is the size of the LZMA dictionary,
which is determined when initializing the compressor. The dilemma here
is that a larger dictionary leads to a better compression ratio,
especially when the data contains much repetition (e.g. many similar
screen redraws), but it also requires more memory on the decompression
end (the viewer in this case). The default dictionary size is 8 MB;
this would require 8 MB of RAM on the viewer end. This is fine for most
desktop systems, but probably not for cell phones, PDA's, etc. -- yet
users of these devices could probably stand to benefit the most from
improved framebuffer compression. Any thoughts on how best to handle
this trade-off?

Matt
·· ħþø ··
2007-02-13 04:53:01 UTC
Permalink
Post by Matt Campbell
Another factor worth considering is the size of the LZMA dictionary,
which is determined when initializing the compressor. The dilemma here
is that a larger dictionary leads to a better compression ratio,
especially when the data contains much repetition (e.g. many similar
screen redraws), but it also requires more memory on the decompression
end (the viewer in this case). The default dictionary size is 8 MB;
this would require 8 MB of RAM on the viewer end. This is fine for most
desktop systems, but probably not for cell phones, PDA's, etc. -- yet
users of these devices could probably stand to benefit the most from
improved framebuffer compression. Any thoughts on how best to handle
this trade-off?
Is there any place in the negotiation process where the viewer could
check how much RAM is available on the client machine, then pass this
along to the server and then a dictionary size is decided upon?
Matt Campbell
2007-02-13 03:29:02 UTC
Permalink
Post by Alex Pelts
VNC mirror driver does not affect any display functionality. It works at
the same level as video card driver. To system it looks just like
another video card.
Has anyone yet tested either the RealVNC mirror driver or DFMirage under
Windows Vista with Aero (a.k.a. Aero Glass) enabled? What effect does
the mirror driver have on Aero, or vice versa?

Matt
James Weatherall
2007-02-14 01:04:00 UTC
Permalink
Hi Matt,

Vista disables the Aero interface and reverts to the standard non-Aero
interface when a mirror video driver is active.

Cheers,
-----Original Message-----
Sent: 12 February 2007 21:28
Subject: Mirror driver (was Re: LZMA compression)
Post by Alex Pelts
VNC mirror driver does not affect any display
functionality. It works at
Post by Alex Pelts
the same level as video card driver. To system it looks just like
another video card.
Has anyone yet tested either the RealVNC mirror driver or
DFMirage under
Windows Vista with Aero (a.k.a. Aero Glass) enabled? What
effect does
the mirror driver have on Aero, or vice versa?
Matt
_______________________________________________
VNC-List mailing list
http://www.realvnc.com/mailman/listinfo/vnc-list
Long, Phillip GOSS
2007-02-13 07:04:01 UTC
Permalink
Post by Matt Campbell
Has anyone considered devising a new RFB encoding which uses LZMA
compression? I think it would be worthwhile, since LZMA typically has
a
Post by Matt Campbell
much better compression ratio than zlib or bzip2. Also, if the LZMA
dictionary is reasonably large, I'm guessing that the compression
ratio
Post by Matt Campbell
will improve significantly after the first few framebuffer updates.
This is only a conjecture at this point, so I was wondering if anyone
has pursued this idea further.
Matt
According to wikipedia (http://en.wikipedia.org/wiki/LZMA), although
LZMA
is open-source (LGPL), "[w]ide use of Microsoft Windows-specific
features
are deeply buried in the source code" and "it has taken a while for a
Unix-compatible version to appear." This would limit portability to
other platforms (Linux and Mac OS-X, among others), so until recently,
LZMA was probably not an option for RealVNC.

Are U offering to add it? :)

--------------------------------------------------------

Goss ... Innovation for Business

NOTICE: This e-mail and any attachment(s) may contain confidential and proprietary information of Goss International Corporation and/or its subsidiaries and may be legally privileged. This e-mail is intended solely for the addressee. If you are not the addressee, dissemination, copying or other use of this e-mail or any of its content is strictly prohibited and may be unlawful. If you are not the intended recipient please inform the sender immediately and destroy the e-mail and any copies. All liability for viruses is excluded to the fullest extent permitted by law. Any views expressed in this message are those of the individual sender. No contract may be construed by this e-mail.
Matt Campbell
2007-02-13 21:34:02 UTC
Permalink
Post by Long, Phillip GOSS
Are U offering to add it? :)
I was, until I realized that the LZMA compressor has nothing equivalent
to zlib's Z_SYNC_FLUSH option, so it's not possible to flush the
compressed stream once a complete rectangle has been written.

So I'm working on a bzip2-based encoding instead.

Matt
Continue reading on narkive:
Loading...