diff --git a/src/enc/syntax.c b/src/enc/syntax.c index 40efa63b..a788f3c3 100644 --- a/src/enc/syntax.c +++ b/src/enc/syntax.c @@ -86,24 +86,13 @@ static void PutSegmentHeader(VP8BitWriter* const bw, int s; VP8PutBitUniform(bw, hdr->update_map_); if (VP8PutBitUniform(bw, update_data)) { - const int base_quant = enc->base_quant_; - const int base_strength = enc->filter_hdr_.level_; - VP8PutBitUniform(bw, hdr->absolute_delta_); + // we always use absolute values, not relative ones + VP8PutBitUniform(bw, 1); // (segment_feature_mode = 1. Paragraph 9.3.) for (s = 0; s < NUM_MB_SEGMENTS; ++s) { - if (hdr->absolute_delta_) { - VP8PutSignedValue(bw, enc->dqm_[s].quant_, 7); - } else { - const int delta = enc->dqm_[s].quant_ - base_quant; - VP8PutSignedValue(bw, delta, 7); - } + VP8PutSignedValue(bw, enc->dqm_[s].quant_, 7); } for (s = 0; s < NUM_MB_SEGMENTS; ++s) { - if (hdr->absolute_delta_) { - VP8PutSignedValue(bw, enc->dqm_[s].fstrength_, 6); - } else { - const int delta = enc->dqm_[s].fstrength_ - base_strength; - VP8PutSignedValue(bw, delta, 6); - } + VP8PutSignedValue(bw, enc->dqm_[s].fstrength_, 6); } } if (hdr->update_map_) { diff --git a/src/enc/vp8enci.h b/src/enc/vp8enci.h index 4593d564..25f50eed 100644 --- a/src/enc/vp8enci.h +++ b/src/enc/vp8enci.h @@ -159,9 +159,6 @@ typedef struct { int num_segments_; // Actual number of segments. 1 segment only = unused. int update_map_; // whether to update the segment map or not. // must be 0 if there's only 1 segment. - int absolute_delta_; // if true, segments' filter strength and quantizers - // are not transmitted relatively to - // VP8FilterHeader::level_ and base_quant_ int size_; // bit-cost for transmitting the segment map } VP8SegmentHeader; diff --git a/src/enc/webpenc.c b/src/enc/webpenc.c index ca2dfd13..5ca445ef 100644 --- a/src/enc/webpenc.c +++ b/src/enc/webpenc.c @@ -55,7 +55,6 @@ static void ResetSegmentHeader(VP8Encoder* const enc) { VP8SegmentHeader* const hdr = &enc->segment_hdr_; hdr->num_segments_ = enc->config_->segments; hdr->update_map_ = (hdr->num_segments_ > 1); - hdr->absolute_delta_ = 1; hdr->size_ = 0; } @@ -285,7 +284,9 @@ int WebPEncode(const WebPConfig* const config, WebPPicture* const pic) { return 0; // bad params if (!WebPValidateConfig(config)) return 0; // invalid config. - if (pic->width <= 0 || pic->height <= 0 || pic->y == NULL) + if (pic->width <= 0 || pic->height <= 0) + return 0; // invalid parameters + if (pic->y == NULL || pic->u == NULL || pic->v == NULL) return 0; // invalid parameters if (pic->width >= MAX_DIMENSION || pic->height >= MAX_DIMENSION) return 0; // image is too big