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

Reimplemented Jpeg postprocessor logic + fixed bugs in stream parsing #322

Merged
merged 81 commits into from
Sep 3, 2017

Conversation

antonfirsov
Copy link
Member

@antonfirsov antonfirsov commented Sep 2, 2017

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Should fix stability and memory issues #224 #214 #178 #159 #151 and provide better accuracy (#245 #155) without significant performance drop. For some images it produces almost identical results to libjpeg-turbo (run CompareJpegDecoders_Baseline() for comparison results).

Copy link
Member

@tocsoft tocsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good to me, just a tiny (not worth blocking) thing around const vs readonly static

{
#pragma warning disable SA1310 // FieldNamesMustNotContainUnderscore
private static readonly float C_1_175876 = 1.175876f;
private static readonly float C_1_175876 = 1.175875602f;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't theses be better as const values instead of readonly static ones?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, worked with this code a lot but haven't spotted this all the time! I think this is because these values were originally defined as Vector4.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can fix that as we optimize post beta.

@JimBobSquarePants
Copy link
Member

Very happy with this as is. Well done @antonfirsov on this and in getting real tests in there.

Will help out post beta to introduce more constants into the decoding process. E X I F, A d o b e etc and any optimization I can get my head around.

@JimBobSquarePants
Copy link
Member

BenchmarkDotNet=v0.10.9, OS=Windows 10 Redstone 2 (10.0.15063)
Processor=Intel Core i7-6600U CPU 2.60GHz (Skylake), ProcessorCount=4
Frequency=2742191 Hz, Resolution=364.6719 ns, Timer=TSC
.NET Core SDK=2.0.0
  [Host]     : .NET Core 1.1.2 (Framework 4.6.25211.01), 64bit RyuJIT
  DefaultJob : .NET Core 1.1.2 (Framework 4.6.25211.01), 64bit RyuJIT


            Method |     Mean |    Error |   StdDev | Allocated |
------------------ |---------:|---------:|---------:|----------:|
 'ImageSharp Jpeg' | 143.0 ms | 2.778 ms | 3.307 ms |   7.87 KB |

Just leaving the above so we have a known reference point to optimize from.

@antonfirsov antonfirsov merged commit 1799cd4 into beta-1 Sep 3, 2017
@tocsoft tocsoft deleted the jpeg-lab branch September 14, 2017 18:23
antonfirsov added a commit to antonfirsov/ImageSharp that referenced this pull request Nov 11, 2019
Reimplemented Jpeg postprocessor logic + fixed bugs in stream parsing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants