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

@ -66,9 +66,18 @@ void VP8IteratorInit(VP8Encoder* const enc, VP8EncIterator* const it) {
it->yuv_out2_ = enc->yuv_out2_;
it->yuv_p_ = enc->yuv_p_;
it->lf_stats_ = enc->lf_stats_;
it->percent0_ = enc->percent_;
VP8IteratorReset(it);
}
int VP8IteratorProgress(const VP8EncIterator* const it, int delta) {
if (delta && it->enc_->pic_->progress_hook) {
const int percent = it->percent0_ + delta * it->y_ / (it->enc_->mb_h_ - 1);
return WebPReportProgress(it->enc_, percent);
}
return 1;
}
//------------------------------------------------------------------------------
// Import the source samples into the cache. Takes care of replicating
// boundary pixels if necessary.