Need to write a '0' bit at the end of transforms.

Also convert an 'if' to 'assert'.

Change-Id: Ia1129ad9ddb027c27b4f4fc1da4bbaf53a0a8f76
This commit is contained in:
Urvang Joshi 2012-04-18 08:58:01 +00:00 committed by James Zern
parent 54dad7e553
commit b96d8740c9

View File

@ -743,7 +743,7 @@ static int EncodeImageInternal(VP8LBitWriter* const bw,
uint16_t** bit_codes = NULL; uint16_t** bit_codes = NULL;
const int use_2d_locality = 1; const int use_2d_locality = 1;
int backward_refs_size; 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 color_cache_size = use_color_cache ? (1 << cache_bits) : 0;
const int histogram_image_xysize = VP8LSubSampleSize(width, histogram_bits) * const int histogram_image_xysize = VP8LSubSampleSize(width, histogram_bits) *
VP8LSubSampleSize(height, 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. // Encode and write the transformed image.
@ -1214,8 +1216,7 @@ int VP8LEncodeImage(const WebPConfig* const config,
VP8LBitWriterDestroy(&bw); VP8LBitWriterDestroy(&bw);
DeleteVP8LEncoder(enc); DeleteVP8LEncoder(enc);
if (!ok) { if (!ok) {
// TODO(vikasa): err is not set for all error paths. Set default err. assert(err != VP8_ENC_OK);
if (err == VP8_ENC_OK) err = VP8_ENC_ERROR_BAD_WRITE;
WebPEncodingSetError(picture, err); WebPEncodingSetError(picture, err);
} }
return ok; return ok;