Make histo_bits and transform_bits function of quality.

Change-Id: Ic34e40853604811abc63a38e09d6a01961649efc
This commit is contained in:
Vikas Arora 2012-04-24 08:46:24 +00:00 committed by James Zern
parent 149b5098a9
commit 412222c88c
2 changed files with 6 additions and 5 deletions

View File

@ -997,6 +997,7 @@ static WebPEncodingError WriteImage(VP8LEncoder* const enc,
static VP8LEncoder* InitVP8LEncoder(const WebPConfig* const config,
WebPPicture* const picture) {
int sampling_bits = 9 - (((int)config->quality + 8) >> 4);
VP8LEncoder* enc = (VP8LEncoder*)malloc(sizeof(*enc));
if (enc == NULL) {
WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY);
@ -1007,11 +1008,12 @@ static VP8LEncoder* InitVP8LEncoder(const WebPConfig* const config,
enc->config_ = config;
enc->pic_ = picture;
enc->use_lz77_ = 1;
enc->palette_bits_ = 7;
// TODO: Use config.quality to initialize histo_bits_ and transform_bits_.
enc->histo_bits_ = 4;
enc->transform_bits_ = 4;
if (sampling_bits > 8) sampling_bits = 8;
if (sampling_bits < 3) sampling_bits = 3;
enc->histo_bits_ = sampling_bits;
enc->transform_bits_ = sampling_bits;
return enc;
}

View File

@ -45,7 +45,6 @@ typedef struct {
// Encoding parameters derived from quality parameter.
int use_lz77_;
int palette_bits_;
int histo_bits_;
int transform_bits_;