libjpeg-turbo / libjpeg-turbo

Main libjpeg-turbo repository
https://libjpeg-turbo.org
Other
3.75k stars 1.02k forks source link

Image artifacts after updating to 3.0 #741

Open mattleibow opened 9 months ago

mattleibow commented 9 months ago

Have you searched the existing issues (both open and closed) in the libjpeg-turbo issue tracker to ensure that this bug report is not a duplicate? Yes

Does this bug report describe one of the two known and unsolvable issues with the JPEG format? No

Clear and concise description of the bug:

I am using skia to encode jpegs and all is OK in the 2.x series. However, once updating to 3.x I am getting invalid output files. Now I know this is the worst bug where I say I am using layers of tech and not even tried yet with plain libjpeg-turbo but was wondering if the issues I am getting opened my ring some bells before I start diving into this.

Reports are saying there are some invalid bytes in the files: image

For example in this comment: https://github.com/mono/SkiaSharp/issues/2643#issuecomment-1817481971

image

Steps to reproduce the bug (using only libjpeg-turbo): Not yet done, but I am working on it

Image(s) needed in order to reproduce the bug (if applicable): Any image that is read and then re-encoded.

Expected behavior: No artifacts

Observed behavior: Artifacts

Platform(s) (compiler version, operating system version, CPU) on which the bug was observed: Seems to be arm64. Reported on iOS and Android, and I am getting this on my arm64 mac.

libjpeg-turbo release(s), commit(s), or branch(es) in which the bug was observed (always test the tip of the main branch or the latest stable pre-release to verify that the bug hasn't already been fixed): 3.0.0, 3.0.1 and main

If the bug is a regression, the specific commit that introduced the regression (use git bisect to determine this): TBD

Additional information:

Dodgy report, I know. As a software dev myself I know I just am being a pain. But, I need something to link to and work on as I try get my code reverted. I will try isolate the issue but hopefully the jpeg community has an "aha" moment.

dcommander commented 9 months ago

I am the sole developer of libjpeg-turbo, so there isn't really a "community" to answer bug reports. They all fall upon me. There isn't enough information yet to be actionable on my part. I need to understand how the downstream software is using libjpeg-turbo. There weren't any changes between 2.1.x and 3.0.x that would readily explain this.

mattleibow commented 9 months ago

OK, thanks. I will try get a sample using the layers of APIs on top. Maybe skia has a bug in the way they are using things - or it may be that we are using the wrong 12- or 16- bit something. Or my compiler flags.

dcommander commented 9 months ago

3.0.2 is overdue, so the sooner you can determine whether this is actually a libjpeg-turbo bug, the better.

dcommander commented 5 months ago

@mattleibow Any update on this issue?