Tight encoder's configuration tuning.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@335 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/rfb/TightEncoder.cxx b/rfb/TightEncoder.cxx
index b6868e4..e89a560 100644
--- a/rfb/TightEncoder.cxx
+++ b/rfb/TightEncoder.cxx
@@ -30,7 +30,7 @@
 
 // Adjustable parameters.
 // FIXME: Get rid of #defines
-#define TIGHT_JPEG_MIN_RECT_SIZE 2048
+#define TIGHT_JPEG_MIN_RECT_SIZE 1024
 #define TIGHT_DETECT_MIN_WIDTH      8
 #define TIGHT_DETECT_MIN_HEIGHT     8
 
@@ -48,12 +48,12 @@
   {   512,   32,   6, 0, 0, 0,   4,  5 },
   {  2048,   64,   6, 1, 1, 1,   8, 10 },
   {  4096,  128,   8, 3, 3, 2,  24, 15 },
-  {  8192,  256,  12, 5, 5, 3,  32, 25 },
-  { 16384,  512,  12, 6, 6, 4,  32, 37 },
-  { 32768,  512,  12, 7, 7, 5,  32, 50 },
-  { 65536,  512,  16, 7, 7, 6,  48, 60 },
-  { 65536, 1024,  16, 8, 8, 7,  64, 70 },
-  { 65536, 2048,  24, 9, 9, 8,  64, 75 },
+  {  8192,  256,  12, 5, 5, 2,  32, 25 },
+  { 16384,  512,  12, 6, 7, 3,  32, 37 },
+  { 32768,  512,  12, 7, 8, 4,  32, 50 },
+  { 65536, 1024,  16, 7, 8, 5,  32, 60 },
+  { 65536, 1024,  16, 8, 9, 6,  64, 70 },
+  { 65536, 2048,  24, 9, 9, 7,  64, 75 },
   { 65536, 2048,  32, 9, 9, 9,  96, 80 }
 };
 const int TightEncoder::defaultCompressLevel = 6;
diff --git a/rfb/tightEncode.h b/rfb/tightEncode.h
index a6c32ea..71f076e 100644
--- a/rfb/tightEncode.h
+++ b/rfb/tightEncode.h
@@ -360,6 +360,11 @@
   if (s_palMaxColors < 2 && r.area() >= s_pconf->monoMinRectSize) {
     s_palMaxColors = 2;
   }
+  // FIXME: Temporary limitation for switching to JPEG earlier.
+  if (s_palMaxColors > 96 && s_pjconf != NULL) {
+    s_palMaxColors = 96;
+  }
+
   FILL_PALETTE(pixels, r.area());
 
   switch (s_palNumColors) {
@@ -384,12 +389,7 @@
 #if (BPP != 8)
   default:
     // Up to 256 different colors
-    if (s_palNumColors > 96 && s_pjconf != NULL &&
-        DETECT_SMOOTH_IMAGE(pixels, r)) {
-      ENCODE_JPEG_RECT(os, pixels, pf, r);
-    } else {
-      ENCODE_INDEXED_RECT(os, zos, pixels, r);
-    }
+    ENCODE_INDEXED_RECT(os, zos, pixels, r);
 #endif
   }
 }