mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Change the rule of picking UV mode in MBAnalyzeBestUVMode()
Pick the mode with the smallest alpha. It only affects m0, in which case the mode decision is not re-examined later in VP8Decimate(). Tests on some natural content png images show PSNR increase as well as visual quality improvement. Change-Id: Iea997e718cd7477160fa05eb7cfb35f4cec2fa9a
This commit is contained in:
parent
bfff0bf329
commit
1377ac2ec1
@ -330,6 +330,7 @@ static int MBAnalyzeBestIntra4Mode(VP8EncIterator* const it,
|
|||||||
|
|
||||||
static int MBAnalyzeBestUVMode(VP8EncIterator* const it) {
|
static int MBAnalyzeBestUVMode(VP8EncIterator* const it) {
|
||||||
int best_alpha = DEFAULT_ALPHA;
|
int best_alpha = DEFAULT_ALPHA;
|
||||||
|
int smallest_alpha = 0;
|
||||||
int best_mode = 0;
|
int best_mode = 0;
|
||||||
const int max_mode = MAX_UV_MODE;
|
const int max_mode = MAX_UV_MODE;
|
||||||
int mode;
|
int mode;
|
||||||
@ -345,6 +346,10 @@ static int MBAnalyzeBestUVMode(VP8EncIterator* const it) {
|
|||||||
alpha = GetAlpha(&histo);
|
alpha = GetAlpha(&histo);
|
||||||
if (IS_BETTER_ALPHA(alpha, best_alpha)) {
|
if (IS_BETTER_ALPHA(alpha, best_alpha)) {
|
||||||
best_alpha = alpha;
|
best_alpha = alpha;
|
||||||
|
}
|
||||||
|
// The best prediction mode tends to be the one with the smallest alpha.
|
||||||
|
if (mode == 0 || alpha < smallest_alpha) {
|
||||||
|
smallest_alpha = alpha;
|
||||||
best_mode = mode;
|
best_mode = mode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user