From b96d8740c9a59a8808d46efe1be22a7a31c4278e Mon Sep 17 00:00:00 2001 From: Urvang Joshi Date: Wed, 18 Apr 2012 08:58:01 +0000 Subject: [PATCH] Need to write a '0' bit at the end of transforms. Also convert an 'if' to 'assert'. Change-Id: Ia1129ad9ddb027c27b4f4fc1da4bbaf53a0a8f76 --- src/enc/vp8l.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/enc/vp8l.c b/src/enc/vp8l.c index eb59e097..a1e29971 100644 --- a/src/enc/vp8l.c +++ b/src/enc/vp8l.c @@ -743,7 +743,7 @@ static int EncodeImageInternal(VP8LBitWriter* const bw, uint16_t** bit_codes = NULL; const int use_2d_locality = 1; int backward_refs_size; - const int use_color_cache = (cache_bits > 0) ? 1 : 0; + const int use_color_cache = (cache_bits > 0); const int color_cache_size = use_color_cache ? (1 << cache_bits) : 0; const int histogram_image_xysize = VP8LSubSampleSize(width, histogram_bits) * VP8LSubSampleSize(height, histogram_bits); @@ -1197,6 +1197,8 @@ int VP8LEncodeImage(const WebPConfig* const config, } } + VP8LWriteBits(&bw, 1, 0); // No more transforms. + // --------------------------------------------------------------------------- // Encode and write the transformed image. @@ -1214,8 +1216,7 @@ int VP8LEncodeImage(const WebPConfig* const config, VP8LBitWriterDestroy(&bw); DeleteVP8LEncoder(enc); if (!ok) { - // TODO(vikasa): err is not set for all error paths. Set default err. - if (err == VP8_ENC_OK) err = VP8_ENC_ERROR_BAD_WRITE; + assert(err != VP8_ENC_OK); WebPEncodingSetError(picture, err); } return ok;