mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Make histo_bits and transform_bits function of quality.
Change-Id: Ic34e40853604811abc63a38e09d6a01961649efc
This commit is contained in:
parent
149b5098a9
commit
412222c88c
@ -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;
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ typedef struct {
|
||||
|
||||
// Encoding parameters derived from quality parameter.
|
||||
int use_lz77_;
|
||||
int palette_bits_;
|
||||
int histo_bits_;
|
||||
int transform_bits_;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user