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

Much Faster sRGB Companding #1481

Merged
merged 8 commits into from
Dec 22, 2020
Merged

Much Faster sRGB Companding #1481

merged 8 commits into from
Dec 22, 2020

Conversation

JimBobSquarePants
Copy link
Member

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

Updates the bulk sRGB Companding method to use the similar LUT approach as MagicScaler (thanks @saucecontrol ! )

Results are awesome. Massive speedup in real world scenarios.

companding

I noticed some oddities (I'd previously introduced) in the existing unit tests during the work which I cleaned up also.

@JimBobSquarePants JimBobSquarePants added this to the 1.1.0 milestone Dec 18, 2020
@JimBobSquarePants JimBobSquarePants requested a review from a team December 18, 2020 11:24
@JimBobSquarePants JimBobSquarePants added this to To Do in ImageSharp via automation Dec 18, 2020
@JimBobSquarePants JimBobSquarePants moved this from To Do to In progress in ImageSharp Dec 18, 2020
@antonfirsov
Copy link
Member

@saucecontrol can we use this approach for pixel blending? Seems cheaper than #1433.

@codecov
Copy link

codecov bot commented Dec 18, 2020

Codecov Report

Merging #1481 (5659148) into master (611ff85) will increase coverage by 0.03%.
The diff coverage is 97.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1481      +/-   ##
==========================================
+ Coverage   83.48%   83.52%   +0.03%     
==========================================
  Files         741      741              
  Lines       32575    32664      +89     
  Branches     3652     3661       +9     
==========================================
+ Hits        27194    27281      +87     
- Misses       4668     4669       +1     
- Partials      713      714       +1     
Flag Coverage Δ
unittests 83.52% <97.16%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ImageSharp/PixelFormats/Utils/Vector4Converters.cs 100.00% <ø> (ø)
...ssing/Processors/Transforms/Resize/ResizeWorker.cs 98.73% <50.00%> (-0.02%) ⬇️
src/ImageSharp/Common/Helpers/Numerics.cs 96.99% <60.00%> (-0.82%) ⬇️
...mageSharp/ColorSpaces/Companding/SRgbCompanding.cs 100.00% <100.00%> (ø)
...ssing/Processors/Transforms/Resize/ResizeKernel.cs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 611ff85...5659148. Read the comment docs.

Copy link
Member

@antonfirsov antonfirsov left a comment

Choose a reason for hiding this comment

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

Let's make the lazy code thread-safe + a major concern regarding tests.

Can't comment on the SIMD code (too much time to review properly), but I trust the test coverage as usual.

@saucecontrol
Copy link
Contributor

@saucecontrol can we use this approach for pixel blending? Seems cheaper than #1433.

Yep, I use it for all my linear pixel conversions. It also works great in combination with fixed-point math, which I still use as a fallback on non-RyuJIT netfx. In that case, you can have a 15-bit LUT with direct lookups and no interpolation.

@JimBobSquarePants JimBobSquarePants merged commit 5ab593f into master Dec 22, 2020
ImageSharp automation moved this from In progress to Done Dec 22, 2020
@JimBobSquarePants JimBobSquarePants deleted the js/faster-resize branch December 22, 2020 16:33
JimBobSquarePants added a commit that referenced this pull request Mar 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
ImageSharp
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants