Browse Source

Fix VP8 issue with quality 20 and method 2: UseSkipProba was ignored

pull/1552/head
Brian Popow 6 years ago
parent
commit
a3bf97b54e
  1. 7
      src/ImageSharp/Formats/WebP/Lossy/Vp8Encoder.cs
  2. 3
      src/ImageSharp/Formats/WebP/Lossy/Vp8MacroBlockInfo.cs

7
src/ImageSharp/Formats/WebP/Lossy/Vp8Encoder.cs

@ -400,9 +400,14 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
it.InitFilter(); it.InitFilter();
do do
{ {
bool dontUseSkip = !this.Proba.UseSkipProba;
var info = new Vp8ModeScore(); var info = new Vp8ModeScore();
it.Import(y, u, v, yStride, uvStride, width, height, false); it.Import(y, u, v, yStride, uvStride, width, height, false);
if (!this.Decimate(it, info, this.rdOptLevel))
// Warning! order is important: first call VP8Decimate() and
// *then* decide how to code the skip decision if there's one.
if (!this.Decimate(it, info, this.rdOptLevel) || dontUseSkip)
{ {
this.CodeResiduals(it, info); this.CodeResiduals(it, info);
} }

3
src/ImageSharp/Formats/WebP/Lossy/Vp8MacroBlockInfo.cs

@ -1,8 +1,11 @@
// Copyright (c) Six Labors. // Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0. // Licensed under the Apache License, Version 2.0.
using System.Diagnostics;
namespace SixLabors.ImageSharp.Formats.WebP.Lossy namespace SixLabors.ImageSharp.Formats.WebP.Lossy
{ {
[DebuggerDisplay("Type: {MacroBlockType}, Alpha: {Alpha}, UvMode: {UvMode}")]
internal class Vp8MacroBlockInfo internal class Vp8MacroBlockInfo
{ {
public Vp8MacroBlockType MacroBlockType { get; set; } public Vp8MacroBlockType MacroBlockType { get; set; }

Loading…
Cancel
Save