Browse Source

Fix style issues

pull/784/head
Stephan Vedder 8 years ago
parent
commit
b17bda5e9a
  1. 5
      src/ImageSharp/Common/Tuples/Vector4Pair.cs
  2. 9
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs
  3. 9
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs
  4. 9
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs
  5. 3
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs
  6. 6
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs
  7. 9
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs
  8. 3
      src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs
  9. 4
      src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs
  10. 4
      src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

5
src/ImageSharp/Common/Tuples/Vector4Pair.cs

@ -37,9 +37,8 @@ namespace SixLabors.ImageSharp.Tuples
this.B += other.B; this.B += other.B;
} }
/// <summary>. Works only if Ve /// <summary>.
/// Downscale method, specific to Jpeg color conversctor{float}.Count == 4! /// Downscale method, specific to Jpeg color conversion. Works only if Vector{float}.Count == 4! /// TODO: Move it somewhere else.
/// TODO: Move it somewhere else.
/// </summary> /// </summary>
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void RoundAndDownscalePreAvx2(float downscaleFactor) internal void RoundAndDownscalePreAvx2(float downscaleFactor)

9
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromCmyk.cs

@ -25,10 +25,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
var v = new Vector4(0, 0, 0, 1F); var v = new Vector4(0, 0, 0, 1F);
var scale = new Vector4(1 / this.MaximumValue, var scale = new Vector4(
1 / this.MaximumValue, 1 / this.MaximumValue,
1 / this.MaximumValue, 1 / this.MaximumValue,
1F); 1 / this.MaximumValue,
1F);
for (int i = 0; i < result.Length; i++) for (int i = 0; i < result.Length; i++)
{ {

9
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromGrayScale.cs

@ -19,10 +19,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
public override void ConvertToRgba(in ComponentValues values, Span<Vector4> result) public override void ConvertToRgba(in ComponentValues values, Span<Vector4> result)
{ {
var scale = new Vector4(1 / this.MaximumValue, var scale = new Vector4(
1 / this.MaximumValue, 1 / this.MaximumValue,
1 / this.MaximumValue, 1 / this.MaximumValue,
1F); 1 / this.MaximumValue,
1F);
ref float sBase = ref MemoryMarshal.GetReference(values.Component0); ref float sBase = ref MemoryMarshal.GetReference(values.Component0);
ref Vector4 dBase = ref MemoryMarshal.GetReference(result); ref Vector4 dBase = ref MemoryMarshal.GetReference(result);

9
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromRgb.cs

@ -24,10 +24,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
var v = new Vector4(0, 0, 0, 1); var v = new Vector4(0, 0, 0, 1);
var scale = new Vector4(1 / this.MaximumValue, var scale = new Vector4(
1 / this.MaximumValue, 1 / this.MaximumValue,
1 / this.MaximumValue, 1 / this.MaximumValue,
1F); 1 / this.MaximumValue,
1F);
for (int i = 0; i < result.Length; i++) for (int i = 0; i < result.Length; i++)
{ {

3
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimd.cs

@ -28,8 +28,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
ConvertCore(values.Slice(0, simdCount), result.Slice(0, simdCount), this.MaximumValue, this.HalfValue); ConvertCore(values.Slice(0, simdCount), result.Slice(0, simdCount), this.MaximumValue, this.HalfValue);
} }
FromYCbCrBasic.ConvertCore(values.Slice(simdCount, remainder), result.Slice(simdCount, remainder), FromYCbCrBasic.ConvertCore(values.Slice(simdCount, remainder), result.Slice(simdCount, remainder), this.MaximumValue, this.HalfValue);
this.MaximumValue, this.HalfValue);
} }
/// <summary> /// <summary>

6
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYCbCrSimdAvx2.cs

@ -28,12 +28,10 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
int simdCount = result.Length - remainder; int simdCount = result.Length - remainder;
if (simdCount > 0) if (simdCount > 0)
{ {
ConvertCore(values.Slice(0, simdCount), result.Slice(0, simdCount), ConvertCore(values.Slice(0, simdCount), result.Slice(0, simdCount), this.MaximumValue, this.HalfValue);
this.MaximumValue, this.HalfValue);
} }
FromYCbCrBasic.ConvertCore(values.Slice(simdCount, remainder), result.Slice(simdCount, remainder), FromYCbCrBasic.ConvertCore(values.Slice(simdCount, remainder), result.Slice(simdCount, remainder), this.MaximumValue, this.HalfValue);
this.MaximumValue, this.HalfValue);;
} }
/// <summary> /// <summary>

9
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.FromYccK.cs

@ -25,10 +25,11 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
var v = new Vector4(0, 0, 0, 1F); var v = new Vector4(0, 0, 0, 1F);
var scale = new Vector4(1 / this.MaximumValue, var scale = new Vector4(
1 / this.MaximumValue, 1 / this.MaximumValue,
1 / this.MaximumValue, 1 / this.MaximumValue,
1F); 1 / this.MaximumValue,
1F);
for (int i = 0; i < result.Length; i++) for (int i = 0; i < result.Length; i++)
{ {

3
src/ImageSharp/Formats/Jpeg/Components/Decoder/ColorConverters/JpegColorConverter.cs

@ -28,6 +28,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
new FromCmyk(8), new FromCmyk(8),
new FromGrayscale(8), new FromGrayscale(8),
new FromRgb(8), new FromRgb(8),
// 12-bit converters // 12-bit converters
GetYCbCrConverter(12), GetYCbCrConverter(12),
new FromYccK(12), new FromYccK(12),
@ -63,7 +64,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder.ColorConverters
private float MaximumValue { get; } private float MaximumValue { get; }
/// <summary> /// <summary>
/// Gets the maximum value of a sample /// Gets the half of the maximum value of a sample
/// </summary> /// </summary>
private float HalfValue { get; } private float HalfValue { get; }

4
src/ImageSharp/Formats/Jpeg/Components/Decoder/JpegBlockPostProcessor.cs

@ -65,11 +65,13 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
/// Processes 'sourceBlock' producing Jpeg color channel values from spectral values: /// Processes 'sourceBlock' producing Jpeg color channel values from spectral values:
/// - Dequantize /// - Dequantize
/// - Applying IDCT /// - Applying IDCT
/// - Level shift by +128, clip to [0, 255] /// - Level shift by +maximumValue/2, clip to [0, maximumValue]
/// - Copy the resulting color values into 'destArea' scaling up the block by amount defined in <see cref="subSamplingDivisors"/> /// - Copy the resulting color values into 'destArea' scaling up the block by amount defined in <see cref="subSamplingDivisors"/>
/// </summary> /// </summary>
/// <param name="sourceBlock">The source block.</param> /// <param name="sourceBlock">The source block.</param>
/// <param name="destArea">The destination buffer area.</param> /// <param name="destArea">The destination buffer area.</param>
/// <param name="maximumValue">The maximum value derived from the bitdepth.</param>
public void ProcessBlockColorsInto( public void ProcessBlockColorsInto(
ref Block8x8 sourceBlock, ref Block8x8 sourceBlock,
in BufferArea<float> destArea, in BufferArea<float> destArea,

4
src/ImageSharp/Formats/Jpeg/JpegDecoderCore.cs

@ -33,7 +33,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
/// <summary> /// <summary>
/// The only supported precision /// The only supported precision
/// </summary> /// </summary>
public readonly int[] SupportedPrecisions = { 8, 12 }; private readonly int[] supportedPrecisions = { 8, 12 };
/// <summary> /// <summary>
/// The global configuration /// The global configuration
@ -724,7 +724,7 @@ namespace SixLabors.ImageSharp.Formats.Jpeg
this.InputStream.Read(this.temp, 0, remaining); this.InputStream.Read(this.temp, 0, remaining);
// We only support 8-bit and 12-bit precision. // We only support 8-bit and 12-bit precision.
if (!this.SupportedPrecisions.Contains(this.temp[0])) if (!this.supportedPrecisions.Contains(this.temp[0]))
{ {
throw new ImageFormatException("Only 8-Bit and 12-Bit precision supported."); throw new ImageFormatException("Only 8-Bit and 12-Bit precision supported.");
} }

Loading…
Cancel
Save