|
|
|
@ -102,74 +102,6 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components |
|
|
|
set => this[(y * 8) + x] = value; |
|
|
|
} |
|
|
|
|
|
|
|
public static bool operator ==(Block8x8 left, Block8x8 right) => left.Equals(right); |
|
|
|
|
|
|
|
public static bool operator !=(Block8x8 left, Block8x8 right) => !left.Equals(right); |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Multiply all elements by a given <see cref="int"/>
|
|
|
|
/// </summary>
|
|
|
|
public static Block8x8 operator *(Block8x8 block, int value) |
|
|
|
{ |
|
|
|
Block8x8 result = block; |
|
|
|
for (int i = 0; i < Size; i++) |
|
|
|
{ |
|
|
|
int val = result[i]; |
|
|
|
val *= value; |
|
|
|
result[i] = (short)val; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Divide all elements by a given <see cref="int"/>
|
|
|
|
/// </summary>
|
|
|
|
public static Block8x8 operator /(Block8x8 block, int value) |
|
|
|
{ |
|
|
|
Block8x8 result = block; |
|
|
|
for (int i = 0; i < Size; i++) |
|
|
|
{ |
|
|
|
int val = result[i]; |
|
|
|
val /= value; |
|
|
|
result[i] = (short)val; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Add an <see cref="int"/> to all elements
|
|
|
|
/// </summary>
|
|
|
|
public static Block8x8 operator +(Block8x8 block, int value) |
|
|
|
{ |
|
|
|
Block8x8 result = block; |
|
|
|
for (int i = 0; i < Size; i++) |
|
|
|
{ |
|
|
|
int val = result[i]; |
|
|
|
val += value; |
|
|
|
result[i] = (short)val; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Subtract an <see cref="int"/> from all elements
|
|
|
|
/// </summary>
|
|
|
|
public static Block8x8 operator -(Block8x8 block, int value) |
|
|
|
{ |
|
|
|
Block8x8 result = block; |
|
|
|
for (int i = 0; i < Size; i++) |
|
|
|
{ |
|
|
|
int val = result[i]; |
|
|
|
val -= value; |
|
|
|
result[i] = (short)val; |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
public static Block8x8 Load(Span<short> data) |
|
|
|
{ |
|
|
|
Unsafe.SkipInit(out Block8x8 result); |
|
|
|
|