Browse Source

Fix warnings

pull/1552/head
Brian Popow 6 years ago
parent
commit
7badb8c349
  1. 274
      src/ImageSharp/Formats/WebP/Lossy/Vp8EncIterator.cs
  2. 27
      src/ImageSharp/Formats/WebP/Lossy/Vp8Encoder.cs
  3. 10
      src/ImageSharp/Formats/WebP/Lossy/Vp8Matrix.cs
  4. 24
      src/ImageSharp/Formats/WebP/Lossy/Vp8ModeScore.cs
  5. 18
      src/ImageSharp/Formats/WebP/Lossy/Vp8SegmentInfo.cs
  6. 12
      src/ImageSharp/Formats/WebP/WebPLookupTables.cs

274
src/ImageSharp/Formats/WebP/Lossy/Vp8EncIterator.cs

@ -152,9 +152,9 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
public int Y { get; set; }
/// <summary>
/// Gets or sets the input samples.
/// Gets the input samples.
/// </summary>
public byte[] YuvIn { get; set; }
public byte[] YuvIn { get; }
/// <summary>
/// Gets or sets the output samples.
@ -167,39 +167,39 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
public byte[] YuvOut2 { get; set; }
/// <summary>
/// Gets or sets the scratch buffer for prediction.
/// Gets the scratch buffer for prediction.
/// </summary>
public byte[] YuvP { get; set; }
public byte[] YuvP { get; }
/// <summary>
/// Gets or sets the left luma samples.
/// Gets the left luma samples.
/// </summary>
public byte[] YLeft { get; set; }
public byte[] YLeft { get; }
/// <summary>
/// Gets or sets the left uv samples.
/// Gets the left uv samples.
/// </summary>
public byte[] UvLeft { get; set; }
public byte[] UvLeft { get; }
/// <summary>
/// Gets or sets the top luma samples at position 'X'.
/// Gets the top luma samples at position 'X'.
/// </summary>
public IMemoryOwner<byte> YTop { get; set; }
public IMemoryOwner<byte> YTop { get; }
/// <summary>
/// Gets or sets the top u/v samples at position 'X', packed as 16 bytes.
/// Gets the top u/v samples at position 'X', packed as 16 bytes.
/// </summary>
public IMemoryOwner<byte> UvTop { get; set; }
public IMemoryOwner<byte> UvTop { get; }
/// <summary>
/// Gets or sets the intra mode predictors (4x4 blocks).
/// Gets the intra mode predictors (4x4 blocks).
/// </summary>
public IMemoryOwner<byte> Preds { get; set; }
public IMemoryOwner<byte> Preds { get; }
/// <summary>
/// Gets or sets the non-zero pattern.
/// Gets the non-zero pattern.
/// </summary>
public IMemoryOwner<uint> Nz { get; set; }
public IMemoryOwner<uint> Nz { get; }
/// <summary>
/// Gets 32+5 boundary samples needed by intra4x4.
@ -217,12 +217,12 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
public int I4 { get; set; }
/// <summary>
/// Gets or sets the top-non-zero context.
/// Gets the top-non-zero context.
/// </summary>
public int[] TopNz { get; }
/// <summary>
/// Gets or sets the left-non-zero. leftNz[8] is independent.
/// Gets the left-non-zero. leftNz[8] is independent.
/// </summary>
public int[] LeftNz { get; }
@ -288,7 +288,7 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
}
}
NzToBytes(); // import the non-zero context.
this.NzToBytes(); // import the non-zero context.
}
// Import uncompressed samples from source.
@ -864,9 +864,9 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
byte[] vals =
{
LossyUtils.Avg3(top[-1], top[0], top[1]),
LossyUtils.Avg3(top[ 0], top[1], top[2]),
LossyUtils.Avg3(top[ 1], top[2], top[3]),
LossyUtils.Avg3(top[ 2], top[3], top[4])
LossyUtils.Avg3(top[0], top[1], top[2]),
LossyUtils.Avg3(top[1], top[2], top[3]),
LossyUtils.Avg3(top[2], top[3], top[4])
};
for (int i = 0; i < 4; ++i)
@ -878,223 +878,223 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
private void He4(Span<byte> dst, Span<byte> top)
{
// horizontal
byte X = top[-1];
byte I = top[-2];
byte J = top[-3];
byte K = top[-4];
byte L = top[-5];
byte x = top[-1];
byte i = top[-2];
byte j = top[-3];
byte k = top[-4];
byte l = top[-5];
uint val = 0x01010101U * LossyUtils.Avg3(X, I, J);
uint val = 0x01010101U * LossyUtils.Avg3(x, i, j);
BinaryPrimitives.WriteUInt32BigEndian(dst, val);
val = 0x01010101U * LossyUtils.Avg3(I, J, K);
val = 0x01010101U * LossyUtils.Avg3(i, j, k);
BinaryPrimitives.WriteUInt32BigEndian(dst.Slice(1 * WebPConstants.Bps), val);
val = 0x01010101U * LossyUtils.Avg3(J, K, L);
val = 0x01010101U * LossyUtils.Avg3(j, k, l);
BinaryPrimitives.WriteUInt32BigEndian(dst.Slice(2 * WebPConstants.Bps), val);
val = 0x01010101U * LossyUtils.Avg3(K, L, L);
val = 0x01010101U * LossyUtils.Avg3(k, l, l);
BinaryPrimitives.WriteUInt32BigEndian(dst.Slice(1 * WebPConstants.Bps), val);
}
private void Rd4(Span<byte> dst, Span<byte> top)
{
byte X = top[-1];
byte I = top[-2];
byte J = top[-3];
byte K = top[-4];
byte L = top[-5];
byte A = top[0];
byte B = top[1];
byte C = top[2];
byte D = top[3];
LossyUtils.Dst(dst, 0, 3, LossyUtils.Avg3(J, K, L));
var ijk = LossyUtils.Avg3(I, J, K);
byte x = top[-1];
byte i = top[-2];
byte j = top[-3];
byte k = top[-4];
byte l = top[-5];
byte a = top[0];
byte b = top[1];
byte c = top[2];
byte d = top[3];
LossyUtils.Dst(dst, 0, 3, LossyUtils.Avg3(j, k, l));
var ijk = LossyUtils.Avg3(i, j, k);
LossyUtils.Dst(dst, 0, 2, ijk);
LossyUtils.Dst(dst, 1, 3, ijk);
var xij = LossyUtils.Avg3(X, I, J);
var xij = LossyUtils.Avg3(x, i, j);
LossyUtils.Dst(dst, 0, 1, xij);
LossyUtils.Dst(dst, 1, 2, xij);
LossyUtils.Dst(dst, 2, 3, xij);
var axi = LossyUtils.Avg3(A, X, I);
var axi = LossyUtils.Avg3(a, x, i);
LossyUtils.Dst(dst, 0, 0, axi);
LossyUtils.Dst(dst, 1, 1, axi);
LossyUtils.Dst(dst, 2, 2, axi);
LossyUtils.Dst(dst, 3, 3, axi);
var bax = LossyUtils.Avg3(B, A, X);
var bax = LossyUtils.Avg3(b, a, x);
LossyUtils.Dst(dst, 1, 0, bax);
LossyUtils.Dst(dst, 2, 1, bax);
LossyUtils.Dst(dst, 3, 2, bax);
var cba = LossyUtils.Avg3(C, B, A);
var cba = LossyUtils.Avg3(c, b, a);
LossyUtils.Dst(dst, 2, 0, cba);
LossyUtils.Dst(dst, 3, 1, cba);
LossyUtils.Dst(dst, 3, 0, LossyUtils.Avg3(D, C, B));
LossyUtils.Dst(dst, 3, 0, LossyUtils.Avg3(d, c, b));
}
private void Vr4(Span<byte> dst, Span<byte> top)
{
byte X = top[-1];
byte I = top[-2];
byte J = top[-3];
byte K = top[-4];
byte A = top[0];
byte B = top[1];
byte C = top[2];
byte D = top[3];
var xa = LossyUtils.Avg2(X, A);
byte x = top[-1];
byte i = top[-2];
byte j = top[-3];
byte k = top[-4];
byte a = top[0];
byte b = top[1];
byte c = top[2];
byte d = top[3];
var xa = LossyUtils.Avg2(x, a);
LossyUtils.Dst(dst, 0, 0, xa);
LossyUtils.Dst(dst, 1, 2, xa);
var ab = LossyUtils.Avg2(A, B);
var ab = LossyUtils.Avg2(a, b);
LossyUtils.Dst(dst, 1, 0, ab);
LossyUtils.Dst(dst, 2, 2, ab);
var bc = LossyUtils.Avg2(B, C);
var bc = LossyUtils.Avg2(b, c);
LossyUtils.Dst(dst, 2, 0, bc);
LossyUtils.Dst(dst, 3, 2, bc);
LossyUtils.Dst(dst, 3, 0, LossyUtils.Avg2(C, D));
LossyUtils.Dst(dst, 0, 3, LossyUtils.Avg3(K, J, I));
LossyUtils.Dst(dst, 0, 2, LossyUtils.Avg3(J, I, X));
var ixa = LossyUtils.Avg3(I, X, A);
LossyUtils.Dst(dst, 3, 0, LossyUtils.Avg2(c, d));
LossyUtils.Dst(dst, 0, 3, LossyUtils.Avg3(k, j, i));
LossyUtils.Dst(dst, 0, 2, LossyUtils.Avg3(j, i, x));
var ixa = LossyUtils.Avg3(i, x, a);
LossyUtils.Dst(dst, 0, 1, ixa);
LossyUtils.Dst(dst, 1, 3, ixa);
var xab = LossyUtils.Avg3(X, A, B);
var xab = LossyUtils.Avg3(x, a, b);
LossyUtils.Dst(dst, 1, 1, xab);
LossyUtils.Dst(dst, 2, 3, xab);
var abc = LossyUtils.Avg3(A, B, C);
var abc = LossyUtils.Avg3(a, b, c);
LossyUtils.Dst(dst, 2, 1, abc);
LossyUtils.Dst(dst, 3, 3, abc);
LossyUtils.Dst(dst, 3, 1, LossyUtils.Avg3(B, C, D));
LossyUtils.Dst(dst, 3, 1, LossyUtils.Avg3(b, c, d));
}
private void Ld4(Span<byte> dst, Span<byte> top)
{
byte A = top[0];
byte B = top[1];
byte C = top[2];
byte D = top[3];
byte E = top[4];
byte F = top[5];
byte G = top[6];
byte H = top[7];
LossyUtils.Dst(dst, 0, 0, LossyUtils.Avg3(A, B, C));
var bcd = LossyUtils.Avg3(B, C, D);
byte a = top[0];
byte b = top[1];
byte c = top[2];
byte d = top[3];
byte e = top[4];
byte f = top[5];
byte g = top[6];
byte h = top[7];
LossyUtils.Dst(dst, 0, 0, LossyUtils.Avg3(a, b, c));
var bcd = LossyUtils.Avg3(b, c, d);
LossyUtils.Dst(dst, 1, 0, bcd);
LossyUtils.Dst(dst, 0, 1, bcd);
var cde = LossyUtils.Avg3(C, D, E);
var cde = LossyUtils.Avg3(c, d, e);
LossyUtils.Dst(dst, 2, 0, cde);
LossyUtils.Dst(dst, 1, 1, cde);
LossyUtils.Dst(dst, 0, 2, cde);
var def = LossyUtils.Avg3(D, E, F);
var def = LossyUtils.Avg3(d, e, f);
LossyUtils.Dst(dst, 3, 0, def);
LossyUtils.Dst(dst, 2, 1, def);
LossyUtils.Dst(dst, 1, 2, def);
LossyUtils.Dst(dst, 0, 3, def);
var efg = LossyUtils.Avg3(E, F, G);
var efg = LossyUtils.Avg3(e, f, g);
LossyUtils.Dst(dst, 3, 1, efg);
LossyUtils.Dst(dst, 2, 2, efg);
LossyUtils.Dst(dst, 1, 3, efg);
var fgh = LossyUtils.Avg3(F, G, H);
var fgh = LossyUtils.Avg3(f, g, h);
LossyUtils.Dst(dst, 3, 2, fgh);
LossyUtils.Dst(dst, 2, 3, fgh);
LossyUtils.Dst(dst, 3, 3, LossyUtils.Avg3(G, H, H));
LossyUtils.Dst(dst, 3, 3, LossyUtils.Avg3(g, h, h));
}
private void Vl4(Span<byte> dst, Span<byte> top)
{
byte A = top[0];
byte B = top[1];
byte C = top[2];
byte D = top[3];
byte E = top[4];
byte F = top[5];
byte G = top[6];
byte H = top[7];
LossyUtils.Dst(dst, 0, 0, LossyUtils.Avg2(A, B));
var bc = LossyUtils.Avg2(B, C);
byte a = top[0];
byte b = top[1];
byte c = top[2];
byte d = top[3];
byte e = top[4];
byte f = top[5];
byte g = top[6];
byte h = top[7];
LossyUtils.Dst(dst, 0, 0, LossyUtils.Avg2(a, b));
var bc = LossyUtils.Avg2(b, c);
LossyUtils.Dst(dst, 1, 0, bc);
LossyUtils.Dst(dst, 0, 2, bc);
var cd = LossyUtils.Avg2(C, D);
var cd = LossyUtils.Avg2(c, d);
LossyUtils.Dst(dst, 2, 0, cd);
LossyUtils.Dst(dst, 1, 2, cd);
var de = LossyUtils.Avg2(D, E);
var de = LossyUtils.Avg2(d, e);
LossyUtils.Dst(dst, 3, 0, de);
LossyUtils.Dst(dst, 2, 2, de);
LossyUtils.Dst(dst, 0, 1, LossyUtils.Avg3(A, B, C));
var bcd = LossyUtils.Avg3(B,C,D);
LossyUtils.Dst(dst, 0, 1, LossyUtils.Avg3(a, b, c));
var bcd = LossyUtils.Avg3(b, c, d);
LossyUtils.Dst(dst, 1, 1, bcd);
LossyUtils.Dst(dst, 0, 3, bcd);
var cde = LossyUtils.Avg3(C, D, E);
var cde = LossyUtils.Avg3(c, d, e);
LossyUtils.Dst(dst, 2, 1, cde);
LossyUtils.Dst(dst, 1, 3, cde);
var def = LossyUtils.Avg3(D, E, F);
var def = LossyUtils.Avg3(d, e, f);
LossyUtils.Dst(dst, 3, 1, def);
LossyUtils.Dst(dst, 2, 3, def);
LossyUtils.Dst(dst, 3,2, LossyUtils.Avg3(E, F, G));
LossyUtils.Dst(dst, 3, 3, LossyUtils.Avg3(F, G, H));
LossyUtils.Dst(dst, 3, 2, LossyUtils.Avg3(e, f, g));
LossyUtils.Dst(dst, 3, 3, LossyUtils.Avg3(f, g, h));
}
private void Hd4(Span<byte> dst, Span<byte> top)
{
byte X = top[-1];
byte I = top[-2];
byte J = top[-3];
byte K = top[-4];
byte L = top[-5];
byte A = top[0];
byte B = top[1];
byte C = top[2];
var ix = LossyUtils.Avg2(I, X);
byte x = top[-1];
byte i = top[-2];
byte j = top[-3];
byte k = top[-4];
byte l = top[-5];
byte a = top[0];
byte b = top[1];
byte c = top[2];
var ix = LossyUtils.Avg2(i, x);
LossyUtils.Dst(dst, 0, 0, ix);
LossyUtils.Dst(dst, 2, 1, ix);
var ji = LossyUtils.Avg2(J,I);
var ji = LossyUtils.Avg2(j, i);
LossyUtils.Dst(dst, 0, 1, ji);
LossyUtils.Dst(dst, 2, 2, ji);
var kj = LossyUtils.Avg2(K, J);
var kj = LossyUtils.Avg2(k, j);
LossyUtils.Dst(dst, 0, 2, kj);
LossyUtils.Dst(dst, 2, 3, kj);
LossyUtils.Dst(dst, 0, 3, LossyUtils.Avg2(L, K));
LossyUtils.Dst(dst, 3, 0, LossyUtils.Avg3(A, B, C));
LossyUtils.Dst(dst, 2, 0, LossyUtils.Avg3(X, A, B));
var ixa = LossyUtils.Avg3(I, X, A);
LossyUtils.Dst(dst, 0, 3, LossyUtils.Avg2(l, k));
LossyUtils.Dst(dst, 3, 0, LossyUtils.Avg3(a, b, c));
LossyUtils.Dst(dst, 2, 0, LossyUtils.Avg3(x, a, b));
var ixa = LossyUtils.Avg3(i, x, a);
LossyUtils.Dst(dst, 1, 0, ixa);
LossyUtils.Dst(dst, 3, 1, ixa);
var jix = LossyUtils.Avg3(J, I, X);
var jix = LossyUtils.Avg3(j, i, x);
LossyUtils.Dst(dst, 1, 1, jix);
LossyUtils.Dst(dst, 3, 2, jix);
var kji = LossyUtils.Avg3(K, J, I);
var kji = LossyUtils.Avg3(k, j, i);
LossyUtils.Dst(dst, 1, 2, kji);
LossyUtils.Dst(dst, 3, 3, kji);
LossyUtils.Dst(dst, 1, 3, LossyUtils.Avg3(L, K, J));
LossyUtils.Dst(dst, 1, 3, LossyUtils.Avg3(l, k, j));
}
private void Hu4(Span<byte> dst, Span<byte> top)
{
byte I = top[-2];
byte J = top[-3];
byte K = top[-4];
byte L = top[-5];
byte i = top[-2];
byte j = top[-3];
byte k = top[-4];
byte l = top[-5];
LossyUtils.Dst(dst, 0, 0, LossyUtils.Avg2(I, J));
var jk = LossyUtils.Avg2(J, K);
LossyUtils.Dst(dst, 0, 0, LossyUtils.Avg2(i, j));
var jk = LossyUtils.Avg2(j, k);
LossyUtils.Dst(dst, 2, 0, jk);
LossyUtils.Dst(dst, 0, 1, jk);
var kl = LossyUtils.Avg2(K, L);
var kl = LossyUtils.Avg2(k, l);
LossyUtils.Dst(dst, 2, 1, kl);
LossyUtils.Dst(dst, 0, 2, kl);
LossyUtils.Dst(dst, 1, 0, LossyUtils.Avg3(I, J, K));
var jkl = LossyUtils.Avg3(J, K, L);
LossyUtils.Dst(dst, 1, 0, LossyUtils.Avg3(i, j, k));
var jkl = LossyUtils.Avg3(j, k, l);
LossyUtils.Dst(dst, 3, 0, jkl);
LossyUtils.Dst(dst, 1, 1, jkl);
var kll = LossyUtils.Avg3(K, L, L);
var kll = LossyUtils.Avg3(k, l, l);
LossyUtils.Dst(dst, 3, 1, kll);
LossyUtils.Dst(dst, 1, 2, kll);
LossyUtils.Dst(dst, 3, 2, L);
LossyUtils.Dst(dst, 2, 2, L);
LossyUtils.Dst(dst, 0, 3, L);
LossyUtils.Dst(dst, 1, 3, L);
LossyUtils.Dst(dst, 2, 3, L);
LossyUtils.Dst(dst, 3, 3, L);
LossyUtils.Dst(dst, 3, 2, l);
LossyUtils.Dst(dst, 2, 2, l);
LossyUtils.Dst(dst, 0, 3, l);
LossyUtils.Dst(dst, 1, 3, l);
LossyUtils.Dst(dst, 2, 3, l);
LossyUtils.Dst(dst, 3, 3, l);
}
private void Fill(Span<byte> dst, int value, int size)

27
src/ImageSharp/Formats/WebP/Lossy/Vp8Encoder.cs

@ -153,7 +153,7 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
it.Import(y, u, v, yStride, uvStride, width, height);
if (!this.Decimate(it, segmentInfos, info, method))
{
this.CodeResiduals(it);
this.CodeResiduals(it, info);
}
else
{
@ -180,8 +180,8 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
private void SetSegmentProbas(Vp8SegmentInfo[] dqm)
{
var p = new int[4];
int n;
// var p = new int[4];
// int n;
// TODO: SetSegmentProbas
}
@ -399,9 +399,8 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
rd.Score = bestScore;
}
private void CodeResiduals(Vp8EncIterator it)
private void CodeResiduals(Vp8EncIterator it, Vp8ModeScore rd)
{
}
private int ReconstructIntra16(Vp8EncIterator it, Vp8SegmentInfo dqm, Vp8ModeScore rd, Span<byte> yuvOut, int mode)
@ -560,9 +559,9 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
int b1 = a3 + a2;
int b2 = a3 - a2;
int b3 = a0 - a1;
output[ 0 + i] = (short)(b0 >> 1); // 15b
output[ 4 + i] = (short)(b1 >> 1);
output[ 8 + i] = (short)(b2 >> 1);
output[0 + i] = (short)(b0 >> 1); // 15b
output[4 + i] = (short)(b1 >> 1);
output[8 + i] = (short)(b2 >> 1);
output[12 + i] = (short)(b3 >> 1);
}
}
@ -581,15 +580,15 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
int n;
for (n = 0; n < 16; ++n)
{
int j = zigzag[n];
int j = this.zigzag[n];
bool sign = input[j] < 0;
uint coeff = (uint)((sign ? -input[j] : input[j]) + mtx.Sharpen[j]);
if (coeff > mtx.ZThresh[j])
{
uint Q = (uint)mtx.Q[j];
uint q = (uint)mtx.Q[j];
uint iQ = (uint)mtx.IQ[j];
uint B = mtx.Bias[j];
int level = this.QuantDiv(coeff, iQ, B);
uint b = mtx.Bias[j];
int level = this.QuantDiv(coeff, iQ, b);
if (level > MaxLevel)
{
level = MaxLevel;
@ -600,7 +599,7 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
level = -level;
}
input[j] = (short)(level * (int)Q);
input[j] = (short)(level * (int)q);
output[n] = (short)level;
if (level != 0)
{
@ -629,7 +628,9 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
private void ITransformOne(Span<byte> reference, Span<short> input, Span<byte> dst)
{
int i;
#pragma warning disable SA1312 // Variable names should begin with lower-case letter
var C = new int[4 * 4];
#pragma warning restore SA1312 // Variable names should begin with lower-case letter
Span<int> tmp = C.AsSpan();
for (i = 0; i < 4; ++i)
{

10
src/ImageSharp/Formats/WebP/Lossy/Vp8Matrix.cs

@ -18,27 +18,27 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
}
/// <summary>
/// quantizer steps.
/// Gets the quantizer steps.
/// </summary>
public short[] Q { get; }
/// <summary>
/// reciprocals, fixed point.
/// Gets the reciprocals, fixed point.
/// </summary>
public short[] IQ { get; }
/// <summary>
/// rounding bias.
/// Gets the rounding bias.
/// </summary>
public uint[] Bias { get; }
/// <summary>
/// value below which a coefficient is zeroed.
/// Gets the value below which a coefficient is zeroed.
/// </summary>
public uint[] ZThresh { get; }
/// <summary>
/// frequency boosters for slight sharpening.
/// Gets the frequency boosters for slight sharpening.
/// </summary>
public short[] Sharpen { get; }
}

24
src/ImageSharp/Formats/WebP/Lossy/Vp8ModeScore.cs

@ -32,62 +32,62 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
}
/// <summary>
/// Distortion.
/// Gets or sets the distortion.
/// </summary>
public long D { get; set; }
/// <summary>
/// Spectral distortion.
/// Gets or sets the spectral distortion.
/// </summary>
public long SD { get; set; }
/// <summary>
/// Header bits.
/// Gets or sets the header bits.
/// </summary>
public long H { get; set; }
/// <summary>
/// Rate.
/// Gets or sets the rate.
/// </summary>
public long R { get; set; }
/// <summary>
/// Score.
/// Gets or sets the score.
/// </summary>
public long Score { get; set; }
/// <summary>
/// Quantized levels for luma-DC.
/// Gets the quantized levels for luma-DC.
/// </summary>
public short[] YDcLevels { get; }
/// <summary>
/// Quantized levels for luma-AC.
/// Gets the quantized levels for luma-AC.
/// </summary>
public short[][] YAcLevels { get; }
/// <summary>
/// Quantized levels for chroma.
/// Gets the quantized levels for chroma.
/// </summary>
public short[][] UvLevels { get; }
/// <summary>
/// Mode number for intra16 prediction.
/// Gets or sets the mode number for intra16 prediction.
/// </summary>
public int ModeI16 { get; set; }
/// <summary>
/// Mode numbers for intra4 predictions.
/// Gets the mode numbers for intra4 predictions.
/// </summary>
public byte[] ModesI4 { get; }
/// <summary>
/// Mode number of chroma prediction.
/// Gets or sets the mode number of chroma prediction.
/// </summary>
public int ModeUv { get; set; }
/// <summary>
/// Non-zero blocks.
/// Gets or sets the Non-zero blocks.
/// </summary>
public uint Nz { get; set; }

18
src/ImageSharp/Formats/WebP/Lossy/Vp8SegmentInfo.cs

@ -6,47 +6,47 @@ namespace SixLabors.ImageSharp.Formats.WebP.Lossy
internal class Vp8SegmentInfo
{
/// <summary>
/// quantization matrix y1.
/// Gets or sets the quantization matrix y1.
/// </summary>
public Vp8Matrix Y1 { get; set; }
/// <summary>
/// quantization matrix y2.
/// Gets or sets the quantization matrix y2.
/// </summary>
public Vp8Matrix Y2 { get; set; }
/// <summary>
/// quantization matrix uv.
/// Gets or sets the quantization matrix uv.
/// </summary>
public Vp8Matrix Uv { get; set; }
/// <summary>
/// quant-susceptibility, range [-127,127]. Zero is neutral. Lower values indicate a lower risk of blurriness.
/// Gets or sets the quant-susceptibility, range [-127,127]. Zero is neutral. Lower values indicate a lower risk of blurriness.
/// </summary>
public int Alpha { get; set; }
/// <summary>
/// filter-susceptibility, range [0,255].
/// Gets or sets the filter-susceptibility, range [0,255].
/// </summary>
public int Beta { get; set; }
/// <summary>
/// final segment quantizer.
/// Gets or sets the final segment quantizer.
/// </summary>
public int Quant { get; set; }
/// <summary>
/// final in-loop filtering strength.
/// Gets or sets the final in-loop filtering strength.
/// </summary>
public int FStrength { get; set; }
/// <summary>
/// max edge delta (for filtering strength).
/// Gets or sets the max edge delta (for filtering strength).
/// </summary>
public int MaxEdge { get; set; }
/// <summary>
/// penalty for using Intra4.
/// Gets or sets the penalty for using Intra4.
/// </summary>
public long I4Penalty { get; set; }
}

12
src/ImageSharp/Formats/WebP/WebPLookupTables.cs

@ -39,16 +39,16 @@ namespace SixLabors.ImageSharp.Formats.WebP
public static readonly short[] Vp8Scan =
{
// Luma
0 + (0 * WebPConstants.Bps), 4 + (0 * WebPConstants.Bps), 8 + (0 * WebPConstants.Bps), 12 + (0 * WebPConstants.Bps),
0 + (4 * WebPConstants.Bps), 4 + (4 * WebPConstants.Bps), 8 + (4 * WebPConstants.Bps), 12 + (4 * WebPConstants.Bps),
0 + (8 * WebPConstants.Bps), 4 + (8 * WebPConstants.Bps), 8 + (8 * WebPConstants.Bps), 12 + (8 * WebPConstants.Bps),
0 + (12 * WebPConstants.Bps), 4 + (12 * WebPConstants.Bps), 8 + (12 * WebPConstants.Bps), 12 + (12 * WebPConstants.Bps),
0 + (0 * WebPConstants.Bps), 4 + (0 * WebPConstants.Bps), 8 + (0 * WebPConstants.Bps), 12 + (0 * WebPConstants.Bps),
0 + (4 * WebPConstants.Bps), 4 + (4 * WebPConstants.Bps), 8 + (4 * WebPConstants.Bps), 12 + (4 * WebPConstants.Bps),
0 + (8 * WebPConstants.Bps), 4 + (8 * WebPConstants.Bps), 8 + (8 * WebPConstants.Bps), 12 + (8 * WebPConstants.Bps),
0 + (12 * WebPConstants.Bps), 4 + (12 * WebPConstants.Bps), 8 + (12 * WebPConstants.Bps), 12 + (12 * WebPConstants.Bps),
};
public static readonly short[] Vp8ScanUv =
{
0 + (0 * WebPConstants.Bps), 4 + (0 * WebPConstants.Bps), 0 + (4 * WebPConstants.Bps), 4 + (4 * WebPConstants.Bps), // U
8 + (0 * WebPConstants.Bps), 12 + (0 * WebPConstants.Bps), 8 + (4 * WebPConstants.Bps), 12 + (4 * WebPConstants.Bps) // V
0 + (0 * WebPConstants.Bps), 4 + (0 * WebPConstants.Bps), 0 + (4 * WebPConstants.Bps), 4 + (4 * WebPConstants.Bps), // U
8 + (0 * WebPConstants.Bps), 12 + (0 * WebPConstants.Bps), 8 + (4 * WebPConstants.Bps), 12 + (4 * WebPConstants.Bps) // V
};
public static readonly short[,][] Vp8FixedCostsI4 = new short[10, 10][];

Loading…
Cancel
Save