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

Add AVX2 version of GetResidualCost and SSE2 version of SetCoeffs #1902

Merged
merged 7 commits into from
Dec 21, 2021

Conversation

brianpopow
Copy link
Collaborator

@brianpopow brianpopow commented Dec 20, 2021

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 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

This PR adds a AVX2 version of GetResidualCost and SSE2 version of SetCoeffs, which is used during webp lossy encoding.

Related to #1786

Profiling results:

master

GetResidualCosts

SetCoeffs

PR

GetResidualCostsAvx

SetCoeffsSse2

The performance gain from GetResidualCost is a bit underwhelming, but its not nothing either.

@codecov
Copy link

codecov bot commented Dec 20, 2021

Codecov Report

Merging #1902 (6e4d4fe) into master (4cb36e6) will increase coverage by 0%.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1902   +/-   ##
======================================
  Coverage      87%     87%           
======================================
  Files         961     961           
  Lines       50990   51034   +44     
  Branches     6319    6324    +5     
======================================
+ Hits        44747   44793   +46     
  Misses       5202    5202           
+ Partials     1041    1039    -2     
Flag Coverage Δ
unittests 87% <100%> (+<1%) ⬆️

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

Impacted Files Coverage Δ
src/ImageSharp/Formats/Webp/Lossy/Vp8Residual.cs 100% <100%> (ø)
src/ImageSharp/Formats/Webp/Lossy/QuantEnc.cs 97% <0%> (+<1%) ⬆️
src/ImageSharp/Formats/Webp/Lossy/Vp8Histogram.cs 100% <0%> (+2%) ⬆️

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 4cb36e6...6e4d4fe. Read the comment docs.


#if SUPPORTS_RUNTIME_INTRINSICS
[Fact]
public void RunEncodeLossy_WithPeakImage_WithHardwareIntrinsics_Works() => FeatureTestRunner.RunWithHwIntrinsicsFeature(RunEncodeLossy_WithPeakImage, HwIntrinsics.AllowAll);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Note: I could not figure out how to write a single test for GetResidualCost, it would be rather complicated. Instead i have decided to do lossy encoding test with and without hardware intrinsics

Copy link
Member

@JimBobSquarePants JimBobSquarePants left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@brianpopow brianpopow merged commit 1adb6b4 into master Dec 21, 2021
@brianpopow brianpopow deleted the bp/getResidualCostSse2 branch December 21, 2021 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants