Browse Source

Tight encoder's configuration tuning.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@335 3789f03b-4d11-0410-bbf8-ca57d06f2519
tags/v0.0.90
Constantin Kaplinsky 18 years ago
parent
commit
95ff53a0c7
2 changed files with 13 additions and 13 deletions
  1. 7
    7
      rfb/TightEncoder.cxx
  2. 6
    6
      rfb/tightEncode.h

+ 7
- 7
rfb/TightEncoder.cxx View File

@@ -30,7 +30,7 @@ using namespace rfb;

// 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 @@ const TIGHT_CONF TightEncoder::conf[10] = {
{ 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;

+ 6
- 6
rfb/tightEncode.h View File

@@ -360,6 +360,11 @@ void TIGHT_ENCODE (const Rect& r, rdr::OutStream *os,
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 @@ void TIGHT_ENCODE (const Rect& r, rdr::OutStream *os,
#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
}
}

Loading…
Cancel
Save