Unify the API between VP8BitWriter and VP8LBitWriter

BitReader will be next...

Change-Id: Icd9e7ab2e3890131e664c0523627d9b8c5399a74
This commit is contained in:
Pascal Massimino
2014-10-23 15:35:16 +02:00
parent f7ada560ce
commit 5b90d8fe42
6 changed files with 84 additions and 83 deletions

View File

@ -77,7 +77,7 @@ static int EncodeLossless(const uint8_t* const data, int width, int height,
WebPPictureFree(&picture);
ok = ok && !bw->error_;
if (!ok) {
VP8LBitWriterDestroy(bw);
VP8LBitWriterWipeOut(bw);
return 0;
}
return 1;
@ -133,10 +133,10 @@ static int EncodeAlphaInternal(const uint8_t* const data, int width, int height,
if (output_size > data_size) {
// compressed size is larger than source! Revert to uncompressed mode.
method = ALPHA_NO_COMPRESSION;
VP8LBitWriterDestroy(&tmp_bw);
VP8LBitWriterWipeOut(&tmp_bw);
}
} else {
VP8LBitWriterDestroy(&tmp_bw);
VP8LBitWriterWipeOut(&tmp_bw);
return 0;
}
}
@ -156,7 +156,7 @@ static int EncodeAlphaInternal(const uint8_t* const data, int width, int height,
ok = ok && VP8BitWriterAppend(&result->bw, output, output_size);
if (method != ALPHA_NO_COMPRESSION) {
VP8LBitWriterDestroy(&tmp_bw);
VP8LBitWriterWipeOut(&tmp_bw);
}
ok = ok && !result->bw.error_;
result->score = VP8BitWriterSize(&result->bw);