Browse Source

Temporary Vortex

af/merge-core
Anton Firszov 8 years ago
parent
commit
59f1f0fc05
  1. 2
      src/ImageSharp.Drawing/Paths/ShapeRegion.cs
  2. 4
      src/ImageSharp/Common/Extensions/SimdUtils.cs
  3. 6
      src/ImageSharp/Common/Helpers/ParallelFor.cs
  4. 2
      src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs
  5. 2
      src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs
  6. 2
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs
  7. 2
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigHuffmanTree.cs
  8. 2
      src/ImageSharp/Memory/Buffer2D{T}.cs
  9. 2
      src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs
  10. 2
      tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs
  11. 8
      tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

2
src/ImageSharp.Drawing/Paths/ShapeRegion.cs

@ -47,7 +47,7 @@ namespace SixLabors.ImageSharp.Drawing
var start = new PointF(this.Bounds.Left - 1, y);
var end = new PointF(this.Bounds.Right + 1, y);
// TODO: This is a temporal workaround because of the lack of Span<T> API-s on IPath. We should use MemoryManager.Allocate() here!
// TODO: This is a temporary workaround because of the lack of Span<T> API-s on IPath. We should use MemoryManager.Allocate() here!
PointF[] innerBuffer = new PointF[buffer.Length];
int count = this.Shape.FindIntersections(start, end, innerBuffer, 0);

4
src/ImageSharp/Common/Extensions/SimdUtils.cs

@ -83,7 +83,7 @@ namespace SixLabors.ImageSharp
Vector<float> magick = new Vector<float>(32768.0f);
Vector<float> scale = new Vector<float>(255f) / new Vector<float>(256f);
// need to copy to a temporal struct, because
// need to copy to a temporary struct, because
// SimdUtils.Octet.OfUInt32 temp = Unsafe.As<Vector<float>, SimdUtils.Octet.OfUInt32>(ref x)
// does not work. TODO: This might be a CoreClr bug, need to ask/report
var temp = default(Octet.OfUInt32);
@ -124,7 +124,7 @@ namespace SixLabors.ImageSharp
Vector<float> magick = new Vector<float>(32768.0f);
Vector<float> scale = new Vector<float>(255f) / new Vector<float>(256f);
// need to copy to a temporal struct, because
// need to copy to a temporary struct, because
// SimdUtils.Octet.OfUInt32 temp = Unsafe.As<Vector<float>, SimdUtils.Octet.OfUInt32>(ref x)
// does not work. TODO: This might be a CoreClr bug, need to ask/report
var temp = default(Octet.OfUInt32);

6
src/ImageSharp/Common/Helpers/ParallelFor.cs

@ -18,8 +18,8 @@ namespace SixLabors.ImageSharp
}
/// <summary>
/// Helper method to execute Parallel.For with temporal worker buffer in an optimized way.
/// The buffer will be only instantiated for each worker Task, the contents are not cleaned automatically.
/// Helper method to execute Parallel.For with temporary worker buffer shared between executing tasks.
/// The buffer is not guaranteed to be clean!
/// </summary>
/// <typeparam name="T">The value type of the buffer</typeparam>
/// <param name="fromInclusive">The start index, inclusive.</param>
@ -27,7 +27,7 @@ namespace SixLabors.ImageSharp
/// <param name="configuration">The <see cref="Configuration"/> used for getting the <see cref="MemoryManager"/> and <see cref="ParallelOptions"/></param>
/// <param name="bufferLength">The length of the requested parallel buffer</param>
/// <param name="body">The delegate that is invoked once per iteration.</param>
public static void WithTemporalBuffer<T>(
public static void WithTemporaryBuffer<T>(
int fromInclusive,
int toExclusive,
Configuration configuration,

2
src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs

@ -45,7 +45,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder
public IJpegComponent Component { get; }
/// <summary>
/// Gets the temporal working buffer of color values.
/// Gets the temporary working buffer of color values.
/// </summary>
public Buffer2D<float> ColorBuffer { get; }

2
src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegImagePostProcessor.cs

@ -74,7 +74,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder
public int NumberOfPostProcessorSteps { get; }
/// <summary>
/// Gets the size of the temporal buffers we need to allocate into <see cref="JpegComponentPostProcessor.ColorBuffer"/>.
/// Gets the size of the temporary buffers we need to allocate into <see cref="JpegComponentPostProcessor.ColorBuffer"/>.
/// </summary>
public Size PostProcessorBufferSize { get; }

2
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs

@ -46,7 +46,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
public Stream InputStream { get; }
/// <summary>
/// Gets the temporal buffer, same instance as <see cref="OrigJpegDecoderCore.Temp"/>
/// Gets the temporary buffer, same instance as <see cref="OrigJpegDecoderCore.Temp"/>
/// </summary>
public byte[] Temp { get; }

2
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigHuffmanTree.cs

@ -107,7 +107,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// Internal part of the DHT processor, whatever does it mean
/// </summary>
/// <param name="inputProcessor">The decoder instance</param>
/// <param name="defineHuffmanTablesData">The temporal buffer that holds the data that has been read from the Jpeg stream</param>
/// <param name="defineHuffmanTablesData">The temporary buffer that holds the data that has been read from the Jpeg stream</param>
/// <param name="remaining">Remaining bits</param>
public void ProcessDefineHuffmanTablesMarkerLoop(
ref InputProcessor inputProcessor,

2
src/ImageSharp/Memory/Buffer2D{T}.cs

@ -72,7 +72,7 @@ namespace SixLabors.ImageSharp.Memory
/// <summary>
/// Swap the contents (<see cref="Buffer"/>, <see cref="Width"/>, <see cref="Height"/>) of the two buffers.
/// Useful to transfer the contents of a temporal <see cref="Buffer2D{T}"/> to a persistent <see cref="ImageFrame{TPixel}.PixelBuffer"/>
/// Useful to transfer the contents of a temporary <see cref="Buffer2D{T}"/> to a persistent <see cref="ImageFrame{TPixel}.PixelBuffer"/>
/// </summary>
/// <param name="a">The first buffer</param>
/// <param name="b">The second buffer</param>

2
src/ImageSharp/Processing/Processors/Transforms/ResizeProcessor.cs

@ -128,7 +128,7 @@ namespace SixLabors.ImageSharp.Processing.Processors
{
firstPassPixels.Buffer.Clear();
ParallelFor.WithTemporalBuffer(
ParallelFor.WithTemporaryBuffer(
0,
sourceRectangle.Bottom,
configuration,

2
tests/ImageSharp.Tests/Formats/Jpg/Utils/ReferenceImplementations.LLM_FloatingPoint_DCT.cs

@ -131,7 +131,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg.Utils
/// <summary>
/// Original: https://github.com/norishigefukushima/dct_simd/blob/master/dct/dct8x8_simd.cpp#L239
/// Applyies IDCT transformation on "s" copying transformed values to "d", using temporal block "temp"
/// Applyies IDCT transformation on "s" copying transformed values to "d", using temporary block "temp"
/// </summary>
/// <param name="s"></param>
/// <param name="d"></param>

8
tests/ImageSharp.Tests/TestUtilities/TestImageExtensions.cs

@ -254,7 +254,7 @@ namespace SixLabors.ImageSharp.Tests
testOutputDetails,
appendPixelTypeToFileName);
var temporalFrameImages = new List<Image<TPixel>>();
var temporaryFrameImages = new List<Image<TPixel>>();
IImageDecoder decoder = TestEnvironment.GetReferenceDecoder(frameFiles[0]);
@ -266,14 +266,14 @@ namespace SixLabors.ImageSharp.Tests
}
var tempImage = Image.Load<TPixel>(path, decoder);
temporalFrameImages.Add(tempImage);
temporaryFrameImages.Add(tempImage);
}
Image<TPixel> firstTemp = temporalFrameImages[0];
Image<TPixel> firstTemp = temporaryFrameImages[0];
var result = new Image<TPixel>(firstTemp.Width, firstTemp.Height);
foreach (Image<TPixel> fi in temporalFrameImages)
foreach (Image<TPixel> fi in temporaryFrameImages)
{
result.Frames.AddFrame(fi.Frames.RootFrame);
fi.Dispose();

Loading…
Cancel
Save