BenchmarkDotNet=v0.10.3.0, OS=Microsoft Windows 10.0.15063
Processor=Intel(R) Core(TM) i7-6600U CPU 2.60GHz, ProcessorCount=4
Frequency=2742191 Hz, Resolution=364.6719 ns, Timer=TSC
dotnet cli version=1.0.3
[Host] : .NET Core 4.6.25009.03, 64bit RyuJIT
Job-YVBYQX : .NET Core 4.6.25009.03, 64bit RyuJIT
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
// <copyright file="YCbCrToRgbTables.cs" company="James Jackson-South"> | |
// Copyright (c) James Jackson-South and contributors. | |
// Licensed under the Apache License, Version 2.0. | |
// </copyright> | |
namespace ImageSharp.Formats.Jpeg.Components.Decoder | |
{ | |
using System.Runtime.CompilerServices; | |
using ImageSharp.PixelFormats; |
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
using System; | |
using System.IO; | |
using System.Numerics; | |
using System.Reflection; | |
using ImageSharp; | |
using ImageSharp.Processing; | |
namespace Test.ISharp | |
{ | |
class Program |
See below images. TODO: Use contrast checker against output.
BenchmarkDotNet=v0.10.1, OS=Microsoft Windows NT 6.2.9200.0
Processor=Intel(R) Core(TM) i7-6600U CPU 2.60GHz, ProcessorCount=4
Frequency=2742193 Hz, Resolution=364.6716 ns, Timer=TSC
[Host] : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1586.0
DefaultJob : Clr 4.0.30319.42000, 64bit RyuJIT-v4.6.1586.0
Allocated=0 B
WIP improvements made so far in the gif encoder. All the time/memory usage is in the OctreeQuantizer.cs
I don't know what quantizer System.Drawing
uses (Most likely a fixed palette with pre-dithering)
but the quality difference is incomparable.
It'll probably take a better mind than mine to bring the memory usage in the quantizer down further.
P.S ArrayPool<T>
rocks!!!
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
// How do I get these two sets of methods to return the same output value? | |
void Main() | |
{ | |
uint x1 = PackUint(0.5f, 1, 0.5f, 1); | |
byte[] b1 = ToBytes(x1); | |
x1.Dump(); // 4286644096 | |
b1.Dump(); // 128, 255, 128, 255 RIGHT! :) | |
ulong x2 = PackUlong(0.5f, 1, 0.5f, 1); |
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
public class TypeWrapper | |
{ | |
private readonly dynamic dyn; | |
private readonly Dictionary<string, CallSite<Action<CallSite, object, object>>> setters | |
= new Dictionary<string, CallSite<Action<CallSite, object, object>>>(); | |
private readonly Dictionary<string, CallSite<Func<CallSite, object, object>>> getters | |
= new Dictionary<string, CallSite<Func<CallSite, object, object>>>(); | |
public TypeWrapper(object d) |
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
/// <summary> | |
/// Returns a 1x1 pixel Base64 encoded gif from the given image containing a single dominant color. | |
/// </summary> | |
/// <param name="source">The image this method extends.</param> | |
/// <returns>The <see cref="string"/></returns> | |
public static string ToBase64GifPixelString(this Image source) | |
{ | |
// Leave the original image intact | |
using (Image temp = new Image(source)) | |
{ |
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
// -------------------------------------------------------------------------------------------------------------------- | |
// <copyright file="ImageCropperPropertyConverter.cs" company="Deepend"> | |
// Copyright (c) Deepend | |
// </copyright> | |
// <summary> | |
// The image cropper property converter. This allows Ditto to map the image cropper using the built in Umbraco | |
// methods. | |
// </summary> | |
// -------------------------------------------------------------------------------------------------------------------- |