-
-
Notifications
You must be signed in to change notification settings - Fork 852
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
Jpeg decoder mcu size fix #1845
Jpeg decoder mcu size fix #1845
Conversation
@@ -65,26 +62,26 @@ public override void InjectFrameData(JpegFrame frame, IRawJpegData jpegData) | |||
MemoryAllocator allocator = this.configuration.MemoryAllocator; | |||
|
|||
// iteration data | |||
IJpegComponent c0 = frame.Components[0]; | |||
int majorBlockWidth = frame.Components.Max((component) => component.SizeInBlocks.Width); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How’s the perf using Max here? We’ve avoided Linq everywhere in the codecs AFAIK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering it's from 1 to 4 elements and it executes only once I don't think it will matter but I will run benchmarks just to be sure.
@@ -151,6 +151,7 @@ private void ParseBaselineData() | |||
if (this.componentsCount == this.frame.ComponentCount) | |||
{ | |||
this.ParseBaselineDataInterleaved(); | |||
this.spectralConverter.CommitConversion(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before this PR spectral converter did some magic to determine if image was converted based on number off processed rows. But someone wise once said: "explicit is better than implicit" so I've decided to create a separate method to 'seal' conversion. It doesn't look so OOPish but at least it's more readable IMO.
Codecov Report
@@ Coverage Diff @@
## master #1845 +/- ##
======================================
Coverage 87% 87%
======================================
Files 937 937
Lines 48420 48423 +3
Branches 6054 6056 +2
======================================
+ Hits 42222 42225 +3
Misses 5192 5192
Partials 1006 1006
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Fresh benchmarks Master
PR
While progressive 420 is indeed slower by almost 1.5% baseline 420 is faster by 2.7% without any particular reasons. I believe it's a noise, performance shouldn't be affected by LINQ calls, especially by 4 element array. Edit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Your additional comments make sense
Prerequisites
Description
This PR fixes a bug described in #1816 (comment).
Basically, it removes dependency on the 'first component' during decoding because jpegs can have lower luma sampling than chroma. This bug can be spotted with image from current test image base - jpeg422.jpg. This is a decoded image from current master code:
Current PR produces almost ideal image - diff is 0.0013% compared to PhotoShop png reference:
I've also added this image to the decoder test suit.