VNC Compression ---------------------------------------------------------------------------- Dave DeBarr (debarr@mitre.org) Tue, 04 Aug 1998 22:44:32 -0400 * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] * Next message: Yoshifumi R. Shimizu: "Re: A request on WinVNC" * Previous message: Scotty Hudson: "vncserver on SCO OpenServer" * Next in thread: brihall@bigfoot.com: "RE: VNC Compression" ---------------------------------------------------------------------------- I used the zlib source code (distributed with the VNC software) to add compression capabilities to the VNC 3.3.2r2 UNIX source code. Here's the basic logic... vncviewer: if the user specifies "-zlib" as a command line argument then add *rfbEncodingZlib* to the list of preferred encodings endif Xvnc: if the client has requested *rfbEncodingZlib* then write the entire rfbFramebufferUpdate message to a temporary buffer if the message is larger than 1024 bytes then compress the message and send it as an *rfbCompressedUpdate* else send the uncompressed rfbFramebufferUpdate endif else send the rfbFramebufferUpdate as normal endif The COMPRESSION_LEVEL macro (defined in "include/vnczlib.h") controls the compression level. It must be between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all. -- Here's some debug output from a sample session: % ./vncviewer -zlib vector2:1 rfb update: compressed = 12926 bytes, uncompressed = 299717 bytes (-95.69%) rfb update: compressed = 940 bytes, uncompressed = 1939 bytes (-51.52%) rfb update: compressed = 1000 bytes, uncompressed = 1443 bytes (-30.70%) rfb update: compressed = 283548 bytes, uncompressed = 539009 bytes (-47.39%) rfb update: compressed = 2218 bytes, uncompressed = 3258 bytes (-31.92%) rfb update: compressed = 14085 bytes, uncompressed = 229120 bytes (-93.85%) rfb update: compressed = 1008 bytes, uncompressed = 2011 bytes (-49.88%) rfb update: compressed = 294093 bytes, uncompressed = 477068 bytes (-38.35%) rfb update: compressed = 818 bytes, uncompressed = 1190 bytes (-31.26%) rfb update: compressed = 1751 bytes, uncompressed = 5830 bytes (-69.97%) rfb update: compressed = 5664 bytes, uncompressed = 9234 bytes (-38.66%) rfb update: compressed = 406 bytes, uncompressed = 1025 bytes (-60.39%) rfb update: compressed = 5727 bytes, uncompressed = 304995 bytes (-98.12%) rfb update: compressed = 2702 bytes, uncompressed = 3862 bytes (-30.04%) rfb update: compressed = 1003 bytes, uncompressed = 10144 bytes (-90.11%) rfb update: compressed = 15025 bytes, uncompressed = 657875 bytes (-97.72%) rfb update: compressed = 885 bytes, uncompressed = 1054 bytes (-16.03%) rfb update: compressed = 1326 bytes, uncompressed = 6336 bytes (-79.07%) rfb update: compressed = 8031 bytes, uncompressed = 19344 bytes (-58.48%) rfb update: compressed = 1556 bytes, uncompressed = 4135 bytes (-62.37%) rfb update: compressed = 967 bytes, uncompressed = 2843 bytes (-65.99%) rfb update: compressed = 1656 bytes, uncompressed = 3354 bytes (-50.63%) rfb update: compressed = 1100 bytes, uncompressed = 2917 bytes (-62.29%) rfb update: compressed = 907 bytes, uncompressed = 2661 bytes (-65.92%) rfb update: compressed = 1065 bytes, uncompressed = 2968 bytes (-64.12%) -- I have attached a patch file with my sample zlib encoding implementation. Please feel free to use/modify this code. Here are some sample patch instructions... 1. Unzip/untar "vnc-3.3.2r2_unixsrc.tgz" to a directory named "vnc-3.3.2r2". 2. Change directory to the parent directory for "vnc-3.3.2r2". 3. Unzip "vnczlib.diff.gz" to the current directory. 4. Use "patch -p0 < vnczlib.diff" to update the UNIX source tree; then compile as usual. ---------------------------------------------------------------------------- * application/octet-stream attachment: vnczlib.diff.gz -- Dave DeBarr MITRE; Room S4149, Mail Stop W548 11493 Sunset Hills Road; Reston, VA 20190 Voice (703) 883-6544; Fax (703) 883-3308 --------------------------------------------------------------------- The VNC mailing list - see http://www.orl.co.uk/vnc/intouch.html --------------------------------------------------------------------- ---------------------------------------------------------------------------- * Next message: Yoshifumi R. Shimizu: "Re: A request on WinVNC" * Previous message: Scotty Hudson: "vncserver on SCO OpenServer" * Next in thread: brihall@bigfoot.com: "RE: VNC Compression" ---------------------------------------------------------------------------- This archive was generated by hypermail 2.0b2 on Wed Feb 03 1999 - 15:35:36 GMT