Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vectorized 4:2:0 subsampling leads to artifacts during Jpeg encoding. #1549

Closed
4 tasks done
JimBobSquarePants opened this issue Feb 13, 2021 · 4 comments · Fixed by #1551
Closed
4 tasks done

Vectorized 4:2:0 subsampling leads to artifacts during Jpeg encoding. #1549

JimBobSquarePants opened this issue Feb 13, 2021 · 4 comments · Fixed by #1551

Comments

@JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive issue title
  • I have verified that I am running the latest version of ImageSharp
  • I have verified if the problem exist in both DEBUG and RELEASE mode
  • I have searched open and closed issues to ensure it has not already been reported

Description

Issue originally identified by @jrdiver in #1547 Thanks for that!

The new vectorized subsampling algorithm introduced in #1517 by @tkp1n is creating artifacts in our jpeg output. Unfortunately our regression tests did not capture the issue.

v1.0.3-alpha.0.28

fb

v1.0.3-alpha.0.29

fb - Copy

Steps to Reproduce

Simply resaving the input image is enough ensuring the quality is low enough to trigger 4:2:0 subsampling.

using (var image = Image.Load(Path.Combine(inPath, "fb.jpg")))
{
    image.Save(Path.Combine(outPath, "fb.jpg"), new JpegEncoder { Quality = 75 });
}

System Configuration

  • ImageSharp version: v1.0.3-alpha.0.29
  • Other ImageSharp packages and versions: NA
  • Environment (Operating system, version and so on): All
  • .NET Framework version: NET Core 3.1+
  • Additional information:
@antonfirsov
Copy link
Member

I'm not sure quality matters here. This is the output EncodeBaseline_WorksWithDifferentSizes_Rgba32_TestPattern600x400_Ratio420-Q100.jpeg which should run with Quality=100 if everything is correct:

image

@JimBobSquarePants
Copy link
Member Author

Quality just triggers the subsampling when < 91 so yes, explicitly setting the property would be enough.

@antonfirsov
Copy link
Member

This should have been caught by our tests. Opened #1550.

@tkp1n any chance you can take a look?

@tkp1n
Copy link
Contributor

tkp1n commented Feb 14, 2021

I found the issue.. expect a PR coming soon

@brianpopow brianpopow linked a pull request Feb 14, 2021 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants