force "-pass 6" if -psnr or -size is used but -pass isn't.

This is to prevent users shooting in the foot using -psnr or
-size alone and not getting the expected result.

Change-Id: I67a3289e4ec0a2a813c98807f2ec5e600f52dc63
This commit is contained in:
Pascal Massimino
2016-02-13 10:22:32 +01:00
parent 3ef1ce98b9
commit 4ed650a13d
2 changed files with 12 additions and 3 deletions

View File

@ -972,6 +972,11 @@ int main(int argc, const char *argv[]) {
" encoding. Ignoring this option!\n");
}
}
// If a target size or PSNR was given, but somehow the -pass option was
// omitted, force a reasonable value.
if (config.target_size > 0 || config.target_PSNR > 0) {
if (config.pass == 1) config.pass = 6;
}
if (!WebPValidateConfig(&config)) {
fprintf(stderr, "Error! Invalid configuration.\n");