Implement progress report (and user abort)

New cwebp flag is -progress

Change-Id: Ied872cca13f512036860783bbee1bdbccad72768
This commit is contained in:
Pascal Massimino
2011-12-01 02:24:50 -08:00
committed by James Zern
parent eda520a92e
commit 30971c9e95
14 changed files with 160 additions and 47 deletions

View File

@ -339,6 +339,7 @@ static void MBAnalyze(VP8EncIterator* const it,
// this stage.
int VP8EncAnalyze(VP8Encoder* const enc) {
int ok = 1;
int alphas[256] = { 0 };
VP8EncIterator it;
@ -347,12 +348,13 @@ int VP8EncAnalyze(VP8Encoder* const enc) {
do {
VP8IteratorImport(&it);
MBAnalyze(&it, alphas, &enc->uv_alpha_);
ok = VP8IteratorProgress(&it, 20);
// Let's pretend we have perfect lossless reconstruction.
} while (VP8IteratorNext(&it, it.yuv_in_));
} while (ok && VP8IteratorNext(&it, it.yuv_in_));
enc->uv_alpha_ /= enc->mb_w_ * enc->mb_h_;
AssignSegments(enc, alphas);
if (ok) AssignSegments(enc, alphas);
return 1;
return ok;
}
#if defined(__cplusplus) || defined(c_plusplus)