Browse Source

formatting + cleanup

af/merge-core
Anton Firszov 9 years ago
parent
commit
922fa635bd
  1. 3
      src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs
  2. 3
      src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs
  3. 3
      src/ImageSharp/Formats/Jpeg/Common/Decoder/JpegComponentPostProcessor.cs
  4. 6
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/InputProcessor.cs
  5. 8
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs
  6. 4
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.DataPointers.cs
  7. 13
      src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs
  8. 2
      src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OrigJpegUtils.cs
  9. 0
      src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegConstants.cs
  10. 3
      src/ImageSharp/Memory/Buffer2D.cs

3
src/ImageSharp/Formats/Jpeg/Common/Block8x8.cs

@ -5,8 +5,6 @@ using System.Text;
namespace SixLabors.ImageSharp.Formats.Jpeg.Common
{
using SixLabors.ImageSharp.Memory;
/// <summary>
/// Represents a Jpeg block with <see cref="short"/> coefficiens.
/// </summary>
@ -249,6 +247,5 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common
return result;
}
}
}

3
src/ImageSharp/Formats/Jpeg/Common/Block8x8F.cs

@ -6,12 +6,11 @@ using System.Diagnostics;
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SixLabors.ImageSharp.Memory;
// ReSharper disable InconsistentNaming
namespace SixLabors.ImageSharp.Formats.Jpeg.Common
{
using SixLabors.ImageSharp.Memory;
/// <summary>
/// Represents a Jpeg block with <see cref="float"/> coefficients.
/// </summary>

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

@ -63,8 +63,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder
xBuffer,
yBuffer,
this.blockAreaSize.Width,
this.blockAreaSize.Height
);
this.blockAreaSize.Height);
blockPp.ProcessBlockColorsInto(this.ImagePostProcessor.RawJpeg, this.Component, ref block, destArea);
}

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

@ -62,8 +62,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// If errorCode indicates unexpected EOF, sets <see cref="ReachedEOF"/> to true and returns false.
/// Calls <see cref="DecoderThrowHelper.EnsureNoError"/> and returns true otherwise.
/// </summary>
/// <param name="errorCode">The <see cref="OrigDecoderErrorCode"/></param>
/// <returns><see cref="bool"/> indicating whether everything is OK</returns>
/// <returns>A <see cref="bool"/> indicating whether EOF reached</returns>
public bool CheckEOFEnsureNoError()
{
if (this.LastErrorCode == OrigDecoderErrorCode.UnexpectedEndOfStream)
@ -79,8 +78,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// If errorCode indicates unexpected EOF, sets <see cref="ReachedEOF"/> to true and returns false.
/// Returns true otherwise.
/// </summary>
/// <param name="errorCode">The <see cref="OrigDecoderErrorCode"/></param>
/// <returns><see cref="bool"/> indicating whether everything is OK</returns>
/// <returns>A <see cref="bool"/> indicating whether EOF reached</returns>
public bool CheckEOF()
{
if (this.LastErrorCode == OrigDecoderErrorCode.UnexpectedEndOfStream)

8
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigComponent.cs

@ -3,13 +3,12 @@
using System;
using SixLabors.ImageSharp.Formats.Jpeg.Common;
using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder;
using SixLabors.ImageSharp.Memory;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
{
using SixLabors.ImageSharp.Formats.Jpeg.Common.Decoder;
using SixLabors.Primitives;
/// <inheritdoc cref="IJpegComponent" />
/// <summary>
/// Represents a single color component
@ -67,7 +66,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
// and Y channels subsample, they subsample both horizontally and
// vertically.
// - for YCbCrK, the Y and K channels have full samples.
this.SizeInBlocks = decoder.ImageSizeInMCU.MultiplyBy(this.SamplingFactors);
if (this.Index == 0 || this.Index == 3)
@ -167,7 +165,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
case 1:
{
// Cb.
Size s0 = decoder.Components[0].SamplingFactors;
if (s0.Width % h != 0 || s0.Height % v != 0)
@ -181,7 +178,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
case 2:
{
// Cr.
Size s1 = decoder.Components[1].SamplingFactors;
if (s1.Width != h || s1.Height != v)

4
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.DataPointers.cs

@ -1,12 +1,10 @@
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using Block8x8F = SixLabors.ImageSharp.Formats.Jpeg.Common.Block8x8F;
using SixLabors.ImageSharp.Formats.Jpeg.Common;
namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
{
using SixLabors.ImageSharp.Formats.Jpeg.Common;
/// <content>
/// Conains the definition of <see cref="DataPointers"/>
/// </content>

13
src/ImageSharp/Formats/Jpeg/GolangPort/Components/Decoder/OrigJpegScanDecoder.cs

@ -109,7 +109,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
/// <summary>
/// Read Huffman data from Jpeg scans in <see cref="OrigJpegDecoderCore.InputStream"/>,
/// and decode it as <see cref="Block8x8F"/> into <see cref="OrigJpegDecoderCore.DecodedBlocks"/>.
/// and decode it as <see cref="Block8x8"/> into <see cref="OrigComponent.SpectralBlocks"/>.
///
/// The blocks are traversed one MCU at a time. For 4:2:0 chroma
/// subsampling, there are four Y 8x8 blocks in every 16x16 MCU.
@ -320,7 +320,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
else
{
int zig = this.zigStart;
//OrigDecoderErrorCode errorCode;
if (zig == 0)
{
zig++;
@ -352,7 +352,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
// b[0] = dc[compIndex] << al;
value = this.pointers.Dc[this.ComponentIndex] << this.al;
Block8x8.SetScalarAt(b, 0, (short) value);
Block8x8.SetScalarAt(b, 0, (short)value);
}
if (zig <= this.zigEnd && this.eobRun > 0)
@ -388,11 +388,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
return;
}
//if (!decoder.InputProcessor.CheckEOFEnsureNoError())
//{
// return;
//}
// b[Unzig[zig]] = ac << al;
value = ac << this.al;
Block8x8.SetScalarAt(b, this.pointers.Unzig[zig], (short)value);
@ -435,7 +430,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Components.Decoder
}
/// <summary>
/// Gets the block index used to retieve blocks from in <see cref="OrigJpegDecoderCore.DecodedBlocks"/>
/// Gets the block index used to retieve blocks from in <see cref="OrigComponent.SpectralBlocks"/>
/// </summary>
/// <param name="decoder">The <see cref="OrigJpegDecoderCore"/> instance</param>
/// <returns>The index</returns>

2
src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OldJpegUtils.cs → src/ImageSharp/Formats/Jpeg/GolangPort/Utils/OrigJpegUtils.cs

@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.GolangPort.Utils
/// <summary>
/// Jpeg specific utilities and extension methods
/// </summary>
internal static unsafe class OrigJpegUtils
internal static class OrigJpegUtils
{
/// <summary>
/// Copy a region of an image into dest. De "outlier" area will be stretched out with pixels on the right and bottom of the image.

0
src/ImageSharp/Formats/Jpeg/PdfJsPort/JpegConstants.cs → src/ImageSharp/Formats/Jpeg/PdfJsPort/PdfJsJpegConstants.cs

3
src/ImageSharp/Memory/Buffer2D.cs

@ -2,11 +2,10 @@
// Licensed under the Apache License, Version 2.0.
using System.Runtime.CompilerServices;
using SixLabors.Primitives;
namespace SixLabors.ImageSharp.Memory
{
using SixLabors.Primitives;
/// <summary>
/// Represents a buffer of value type objects
/// interpreted as a 2D region of <see cref="Width"/> x <see cref="Height"/> elements.

Loading…
Cancel
Save