-
-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into bp/webpimprovements
- Loading branch information
Showing
33 changed files
with
124 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using System.IO; | ||
using BenchmarkDotNet.Attributes; | ||
using SixLabors.ImageSharp.Formats.Jpeg; | ||
using SixLabors.ImageSharp.Tests; | ||
|
||
namespace SixLabors.ImageSharp.Benchmarks.Codecs.Jpeg | ||
{ | ||
public class DecodeJpeg | ||
{ | ||
private JpegDecoder decoder; | ||
|
||
private MemoryStream preloadedImageStream; | ||
|
||
private void GenericSetup(string imageSubpath) | ||
{ | ||
this.decoder = new JpegDecoder(); | ||
byte[] bytes = File.ReadAllBytes(Path.Combine(TestEnvironment.InputImagesDirectoryFullPath, imageSubpath)); | ||
this.preloadedImageStream = new MemoryStream(bytes); | ||
} | ||
|
||
private void GenericBechmark() | ||
{ | ||
this.preloadedImageStream.Position = 0; | ||
using Image img = this.decoder.Decode(Configuration.Default, this.preloadedImageStream); | ||
} | ||
|
||
[GlobalSetup(Target = nameof(JpegBaselineInterleaved444))] | ||
public void SetupBaselineInterleaved444() => | ||
this.GenericSetup(TestImages.Jpeg.Baseline.Winter444_Interleaved); | ||
|
||
[GlobalSetup(Target = nameof(JpegBaselineInterleaved420))] | ||
public void SetupBaselineInterleaved420() => | ||
this.GenericSetup(TestImages.Jpeg.Baseline.Hiyamugi); | ||
|
||
[GlobalSetup(Target = nameof(JpegBaseline400))] | ||
public void SetupBaselineSingleComponent() => | ||
this.GenericSetup(TestImages.Jpeg.Baseline.Jpeg400); | ||
|
||
[GlobalSetup(Target = nameof(JpegProgressiveNonInterleaved420))] | ||
public void SetupProgressiveNoninterleaved420() => | ||
this.GenericSetup(TestImages.Jpeg.Progressive.Winter420_NonInterleaved); | ||
|
||
[GlobalCleanup] | ||
public void Cleanup() | ||
{ | ||
this.preloadedImageStream.Dispose(); | ||
this.preloadedImageStream = null; | ||
} | ||
|
||
[Benchmark(Description = "Baseline 4:4:4 Interleaved")] | ||
public void JpegBaselineInterleaved444() => this.GenericBechmark(); | ||
|
||
[Benchmark(Description = "Baseline 4:2:0 Interleaved")] | ||
public void JpegBaselineInterleaved420() => this.GenericBechmark(); | ||
|
||
[Benchmark(Description = "Baseline 4:0:0 (grayscale)")] | ||
public void JpegBaseline400() => this.GenericBechmark(); | ||
|
||
[Benchmark(Description = "Progressive 4:2:0 Non-Interleaved")] | ||
public void JpegProgressiveNonInterleaved420() => this.GenericBechmark(); | ||
} | ||
} | ||
|
||
|
||
/* | ||
BenchmarkDotNet=v0.13.0, OS=Windows 10.0.19042.1288 (20H2/October2020Update) | ||
Intel Core i7-6700K CPU 4.00GHz (Skylake), 1 CPU, 8 logical and 4 physical cores | ||
.NET SDK=6.0.100-preview.3.21202.5 | ||
[Host] : .NET Core 3.1.18 (CoreCLR 4.700.21.35901, CoreFX 4.700.21.36305), X64 RyuJIT | ||
DefaultJob : .NET Core 3.1.18 (CoreCLR 4.700.21.35901, CoreFX 4.700.21.36305), X64 RyuJIT | ||
| Method | Mean | Error | StdDev | | ||
|------------------------------------ |----------:|----------:|----------:| | ||
| 'Baseline 4:4:4 Interleaved' | 11.781 ms | 0.0737 ms | 0.0654 ms | | ||
| 'Baseline 4:2:0 Interleaved' | 8.688 ms | 0.0345 ms | 0.0306 ms | | ||
| 'Baseline 4:0:0 (grayscale)' | 1.643 ms | 0.0092 ms | 0.0086 ms | | ||
| 'Progressive 4:2:0 Non-Interleaved' | 13.770 ms | 0.0928 ms | 0.0823 ms | | ||
*/ |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
...Images/External/ReferenceOutput/JpegDecoderTests/DecodeBaselineJpeg_jpeg422.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes