mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-19 07:20:02 +02:00
rebalance method tools (-m) for methods [0..4]
(methods 5 and 6 are still untouched). Methods #0 and #1 got much faster Method #2 gets vastly improved in quality Method #3 is noticeably faster for little lower quality Method #4 (default) is 10-20% faster for comparable quality + update the internal doc about the methods' tools. Example of speed difference: Time to encode picture: Method | Before | After -m 0 | 1.272s | 0.517s -m 1 | 1.295s | 0.623s -m 2 | 2.217s | 0.834s -m 3 | 2.816s | 2.243s -m 4 | 3.235s | 3.014s -m 5 | 3.668s | 3.654s -m 6 | 8.296s | 8.235s Change-Id: Ic41fda5de65066b3a6586cb8ae1ebb0206d47fe0
This commit is contained in:
@ -811,9 +811,10 @@ static int OneStatPass(VP8Encoder* const enc, float q, VP8RDLevel rd_opt,
|
||||
static const int dqs[] = { 20, 15, 10, 8, 6, 4, 2, 1, 0 };
|
||||
|
||||
int VP8StatLoop(VP8Encoder* const enc) {
|
||||
const int method = enc->method_;
|
||||
const int do_search =
|
||||
(enc->config_->target_size > 0 || enc->config_->target_PSNR > 0);
|
||||
const int fast_probe = (enc->method_ < 2 && !do_search);
|
||||
const int fast_probe = ((method == 0 || method == 3) && !do_search);
|
||||
float q = enc->config_->quality;
|
||||
const int max_passes = enc->config_->pass;
|
||||
const int task_percent = 20;
|
||||
@ -824,12 +825,18 @@ int VP8StatLoop(VP8Encoder* const enc) {
|
||||
|
||||
// Fast mode: quick analysis pass over few mbs. Better than nothing.
|
||||
nb_mbs = enc->mb_w_ * enc->mb_h_;
|
||||
if (fast_probe && nb_mbs > 100) nb_mbs = 100;
|
||||
if (fast_probe) {
|
||||
if (method == 3) { // we need more stats for method 3 to be reliable.
|
||||
nb_mbs = (nb_mbs > 200) ? nb_mbs >> 1 : 100;
|
||||
} else {
|
||||
nb_mbs = (nb_mbs > 200) ? nb_mbs >> 2 : 50;
|
||||
}
|
||||
}
|
||||
|
||||
// No target size: just do several pass without changing 'q'
|
||||
if (!do_search) {
|
||||
for (pass = 0; pass < max_passes; ++pass) {
|
||||
const VP8RDLevel rd_opt = (enc->method_ > 2) ? RD_OPT_BASIC : RD_OPT_NONE;
|
||||
const VP8RDLevel rd_opt = (method >= 3) ? RD_OPT_BASIC : RD_OPT_NONE;
|
||||
if (!OneStatPass(enc, q, rd_opt, nb_mbs, NULL, percent_per_pass)) {
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user