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

Jpeg downscaling decoding #2076

Merged
merged 34 commits into from
Jul 17, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
36180c6
playground
Mar 19, 2022
11220a3
Replaced absurdly complicated math from JpegComponentPostProcessor
Mar 19, 2022
afbf44b
Infrastructure
Mar 21, 2022
017919a
First working prototype, not optimized
Mar 22, 2022
5cca314
Added playground benchmarks
Mar 22, 2022
a10be09
Resizing converter no longer depends on avx converter only
Mar 23, 2022
1ce994a
Unified spectral conversion for direct and downscaled routines
Mar 25, 2022
4e17b69
Added second stage to the resizing decoding
Mar 26, 2022
f4d5f1a
Chroma subsampling for downscaling decoder
Mar 26, 2022
282e593
Update playground
Mar 26, 2022
8192ff2
Initial processor implementation, code base for tests
Mar 29, 2022
52f507d
Separated scaled IDCT methods
Apr 1, 2022
6eceb6c
Moved quantization table initialization to component post processors
Apr 1, 2022
03407f1
4x4 implementation, tests
Apr 2, 2022
1050cf2
Fixed bug leading to gray images after decoding
Apr 12, 2022
9575a24
Fix compilation error
Apr 12, 2022
c57ca1b
Merge branch 'main' into dp/jpeg-downscaling-decode
Apr 12, 2022
12776f0
IDCT resizing modes
Apr 23, 2022
7057245
Code cleanup, removed invalid second pass logic, marked scaled decodi…
Apr 26, 2022
bfbfdfa
Added tests for out jpeg image size getter method
Apr 30, 2022
b943f80
Restored Program.cs
Apr 30, 2022
bb82e27
Merge branch 'main' into dp/jpeg-downscaling-decode
May 1, 2022
6747339
Docs & review fixes
May 1, 2022
1aff245
Merge branch 'dp/jpeg-downscaling-decode' of https://github.com/br3ak…
May 1, 2022
f011dcc
Unsafe.Add fix
May 1, 2022
3feb7f6
Merge branch 'main' of https://github.com/SixLabors/ImageSharp into d…
May 1, 2022
95c56b0
Small bug fixes, ready for merging
May 1, 2022
ed86426
Updated load-resize-save benchmark, deleted obsolete benchmarks
May 1, 2022
9f35b78
Merge branch 'main' into dp/jpeg-downscaling-decode
May 2, 2022
2896faf
Merge branch 'main' into dp/jpeg-downscaling-decode
brianpopow May 17, 2022
3f16a68
Merge branch 'main' into dp/jpeg-downscaling-decode
Jun 26, 2022
9851315
Added resizing benchmark results
Jun 26, 2022
d0de191
Merge remote-tracking branch 'upstream/main' into dp/jpeg-downscaling…
JimBobSquarePants Jul 16, 2022
7a9cf87
Fix headers
JimBobSquarePants Jul 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added resizing benchmark results
  • Loading branch information
Dmitry Pentin committed Jun 26, 2022
commit 985131598d3fad8d78522b85303c5bfbe1997c6a
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static Size CalculateResultingImageSize(Size size, Size? targetSize, out
int fullBlocksWidth = (int)((uint)size.Width / blockNativePixelSize);
int fullBlocksHeight = (int)((uint)size.Height / blockNativePixelSize);

// & (blockNativePixelSize - 1) is Numerics.Modulo8(), basically
int blockWidthRemainder = size.Width & (blockNativePixelSize - 1);
int blockHeightRemainder = size.Height & (blockNativePixelSize - 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void ForEachImage(Action<string> action, int maxDegreeOfParallelism)

public int[] ParallelismValues { get; } =
{
Environment.ProcessorCount,
// Environment.ProcessorCount,
// Environment.ProcessorCount / 2,
// Environment.ProcessorCount / 4,
1
Expand Down Expand Up @@ -71,3 +71,24 @@ private void ForEachImage(Action<string> action, int maxDegreeOfParallelism)
public void NetVips(int maxDegreeOfParallelism) => this.ForEachImage(this.runner.NetVipsResize, maxDegreeOfParallelism);
}
}

/*
BenchmarkDotNet=v0.13.0, OS=Windows 10.0.19044
Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.300
[Host] : .NET 6.0.5 (6.0.522.21309), X64 RyuJIT
ShortRun : .NET 6.0.5 (6.0.522.21309), X64 RyuJIT

Job=ShortRun IterationCount=3 LaunchCount=1
WarmupCount=3

| Method | maxDegreeOfParallelism | Mean | Error | StdDev | Ratio | RatioSD | Gen 0 | Gen 1 | Gen 2 | Allocated |
|----------------------------- |----------------------- |-----------:|------------:|----------:|------:|--------:|------:|------:|------:|----------:|
| SystemDrawing | 1 | 3,624.2 ms | 721.39 ms | 39.54 ms | 3.30 | 0.04 | - | - | - | 12 KB |
| ImageSharp | 1 | 1,098.4 ms | 45.64 ms | 2.50 ms | 1.00 | 0.00 | - | - | - | 717 KB |
| Magick | 1 | 4,089.8 ms | 905.06 ms | 49.61 ms | 3.72 | 0.04 | - | - | - | 43 KB |
| MagicScaler | 1 | 888.0 ms | 168.33 ms | 9.23 ms | 0.81 | 0.01 | - | - | - | 105 KB |
| SkiaBitmap | 1 | 2,934.4 ms | 2,023.43 ms | 110.91 ms | 2.67 | 0.10 | - | - | - | 43 KB |
| SkiaBitmapDecodeToTargetSize | 1 | 892.3 ms | 115.54 ms | 6.33 ms | 0.81 | 0.01 | - | - | - | 48 KB |
| NetVips | 1 | 806.8 ms | 86.23 ms | 4.73 ms | 0.73 | 0.01 | - | - | - | 42 KB |
*/