Remove less-than-256-colors indexed limit for small rects
This commit is contained in:
@@ -1181,38 +1181,13 @@ uint8_t EncodeManager::getEncoderType(const Rect& rect, const PixelBuffer *pb,
|
|||||||
const PixelBuffer *scaledpb, const Rect& scaledrect) const
|
const PixelBuffer *scaledpb, const Rect& scaledrect) const
|
||||||
{
|
{
|
||||||
struct RectInfo info;
|
struct RectInfo info;
|
||||||
unsigned int divisor, maxColours;
|
unsigned int maxColours = 256;
|
||||||
PixelBuffer *ppb;
|
PixelBuffer *ppb;
|
||||||
Encoder *encoder;
|
Encoder *encoder;
|
||||||
|
|
||||||
bool useRLE;
|
bool useRLE;
|
||||||
EncoderType type;
|
EncoderType type;
|
||||||
|
|
||||||
// FIXME: This is roughly the algorithm previously used by the Tight
|
|
||||||
// encoder. It seems a bit backwards though, that higher
|
|
||||||
// compression setting means spending less effort in building
|
|
||||||
// a palette. It might be that they figured the increase in
|
|
||||||
// zlib setting compensated for the loss.
|
|
||||||
if (conn->cp.compressLevel == -1)
|
|
||||||
divisor = 2 * 8;
|
|
||||||
else
|
|
||||||
divisor = conn->cp.compressLevel * 8;
|
|
||||||
if (divisor < 4)
|
|
||||||
divisor = 4;
|
|
||||||
|
|
||||||
maxColours = rect.area()/divisor;
|
|
||||||
|
|
||||||
// Special exception inherited from the Tight encoder
|
|
||||||
if (activeEncoders[encoderFullColour] == encoderTightJPEG) {
|
|
||||||
if ((conn->cp.compressLevel != -1) && (conn->cp.compressLevel < 2))
|
|
||||||
maxColours = 24;
|
|
||||||
else
|
|
||||||
maxColours = 96;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxColours < 2)
|
|
||||||
maxColours = 2;
|
|
||||||
|
|
||||||
encoder = encoders[activeEncoders[encoderIndexedRLE]];
|
encoder = encoders[activeEncoders[encoderIndexedRLE]];
|
||||||
if (maxColours > encoder->maxPaletteSize)
|
if (maxColours > encoder->maxPaletteSize)
|
||||||
maxColours = encoder->maxPaletteSize;
|
maxColours = encoder->maxPaletteSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user