diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-03-23 16:00:10 +0200 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-03-23 16:00:10 +0200 |
commit | 1f67161fea6beb2ed4c09849abe446c6a880af8a (patch) | |
tree | cffe8116a49f76c8e5d521af9298631e0d2a6130 /src/3rdparty/libwebp/src/enc/frame_enc.c | |
parent | 2dcf2899b022accfef5cede1c2ea3dda2d0d6a4a (diff) | |
parent | c4b95acf2d1da93730c7624033a17f19e239d111 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.9' into tqtc/lts-5.15-opensourcev5.15.9-lts-lgpl
Change-Id: Ieb442937b0cc31e15b39401f2a3234b99751d169
Diffstat (limited to 'src/3rdparty/libwebp/src/enc/frame_enc.c')
-rw-r--r-- | src/3rdparty/libwebp/src/enc/frame_enc.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/3rdparty/libwebp/src/enc/frame_enc.c b/src/3rdparty/libwebp/src/enc/frame_enc.c index af538d8..b93d9e5 100644 --- a/src/3rdparty/libwebp/src/enc/frame_enc.c +++ b/src/3rdparty/libwebp/src/enc/frame_enc.c @@ -778,6 +778,7 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { // Roughly refresh the proba eight times per pass int max_count = (enc->mb_w_ * enc->mb_h_) >> 3; int num_pass_left = enc->config_->pass; + int remaining_progress = 40; // percents const int do_search = enc->do_search_; VP8EncIterator it; VP8EncProba* const proba = &enc->proba_; @@ -805,6 +806,9 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { uint64_t size_p0 = 0; uint64_t distortion = 0; int cnt = max_count; + // The final number of passes is not trivial to know in advance. + const int pass_progress = remaining_progress / (2 + num_pass_left); + remaining_progress -= pass_progress; VP8IteratorInit(enc, &it); SetLoopParams(enc, stats.q); if (is_last_pass) { @@ -832,7 +836,7 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { StoreSideInfo(&it); VP8StoreFilterStats(&it); VP8IteratorExport(&it); - ok = VP8IteratorProgress(&it, 20); + ok = VP8IteratorProgress(&it, pass_progress); } VP8IteratorSaveBoundary(&it); } while (ok && VP8IteratorNext(&it)); @@ -878,7 +882,8 @@ int VP8EncTokenLoop(VP8Encoder* const enc) { ok = VP8EmitTokens(&enc->tokens_, enc->parts_ + 0, (const uint8_t*)proba->coeffs_, 1); } - ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + 20, &enc->percent_); + ok = ok && WebPReportProgress(enc->pic_, enc->percent_ + remaining_progress, + &enc->percent_); return PostLoopFinalize(&it, ok); } |