diff --git a/src/ImageSharp/Formats/WebP/Vp8FilterInfo.cs b/src/ImageSharp/Formats/WebP/Vp8FilterInfo.cs new file mode 100644 index 0000000000..0cfaf1e041 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/Vp8FilterInfo.cs @@ -0,0 +1,31 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Filter information. + /// + internal class Vp8FilterInfo + { + /// + /// Gets or sets the filter limit in [3..189], or 0 if no filtering. + /// + public sbyte Limit { get; set; } + + /// + /// Gets or sets the inner limit in [1..63]. + /// + public sbyte InnerLevel { get; set; } + + /// + /// Gets or sets a value indicating whether to do inner filtering. + /// + public bool InnerFiltering { get; set; } + + /// + /// Gets or sets the high edge variance threshold in [0..2]. + /// + public sbyte HighEdgeVarianceThreshold { get; set; } + } +} diff --git a/src/ImageSharp/Formats/WebP/Vp8FrameHeader.cs b/src/ImageSharp/Formats/WebP/Vp8FrameHeader.cs new file mode 100644 index 0000000000..c7bfa67f65 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/Vp8FrameHeader.cs @@ -0,0 +1,26 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Vp8 frame header information. + /// + internal class Vp8FrameHeader + { + /// + /// Gets or sets a value indicating whether this is a key frame. + /// + public bool KeyFrame { get; set; } + + /// + /// Gets or sets Vp8 profile [0..3]. + /// + public sbyte Profile { get; set; } + + /// + /// Gets or sets the partition length. + /// + public uint PartitionLength { get; set; } + } +} diff --git a/src/ImageSharp/Formats/WebP/Vp8LDecoder.cs b/src/ImageSharp/Formats/WebP/Vp8LDecoder.cs index ed827fd3c2..fa4a570ec6 100644 --- a/src/ImageSharp/Formats/WebP/Vp8LDecoder.cs +++ b/src/ImageSharp/Formats/WebP/Vp8LDecoder.cs @@ -5,6 +5,9 @@ using System.Collections.Generic; namespace SixLabors.ImageSharp.Formats.WebP { + /// + /// Holds information for decoding a lossless image. + /// internal class Vp8LDecoder { public Vp8LDecoder(int width, int height) @@ -14,12 +17,24 @@ namespace SixLabors.ImageSharp.Formats.WebP this.Metadata = new Vp8LMetadata(); } + /// + /// Gets or sets the width of the image to decode. + /// public int Width { get; set; } + /// + /// Gets or sets the height of the image to decode. + /// public int Height { get; set; } + /// + /// Gets or sets the necessary VP8L metadata (like huffman tables) to decode the image. + /// public Vp8LMetadata Metadata { get; set; } + /// + /// Gets or sets the transformations which needs to be reversed. + /// public List Transforms { get; set; } } } diff --git a/src/ImageSharp/Formats/WebP/Vp8MacroBlock.cs b/src/ImageSharp/Formats/WebP/Vp8MacroBlock.cs new file mode 100644 index 0000000000..b867893f51 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/Vp8MacroBlock.cs @@ -0,0 +1,21 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Info about a macro block. + /// + internal class Vp8MacroBlock + { + /// + /// Gets or sets non-zero AC/DC coeffs (4bit for luma + 4bit for chroma). + /// + public uint NoneZeroAcDcCoeffs { get; set; } + + /// + /// Gets or sets non-zero DC coeff (1bit). + /// + public uint NoneZeroDcCoeffs { get; set; } + } +} diff --git a/src/ImageSharp/Formats/WebP/Vp8MacroBlockData.cs b/src/ImageSharp/Formats/WebP/Vp8MacroBlockData.cs new file mode 100644 index 0000000000..35d8803af9 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/Vp8MacroBlockData.cs @@ -0,0 +1,44 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Data needed to reconstruct a macroblock. + /// + internal class Vp8MacroBlockData + { + /// + /// Gets or sets the coefficient. 384 coeffs = (16+4+4) * 4*4. + /// + public short Coeffs { get; set; } + + /// + /// Gets or sets a value indicating whether its intra4x4. + /// + public bool IsI4x4 { get; set; } + + /// + /// Gets or sets the modes. One 16x16 mode (#0) or sixteen 4x4 modes. + /// + public byte Modes { get; set; } + + /// + /// Gets or sets the chroma prediction mode. + /// + public byte UvMode { get; set; } + + public uint NonZeroY { get; set; } + + public uint NonZeroUv { get; set; } + + /// + /// Gets or sets the local dithering strength (deduced from NonZero_*). + /// + public byte Dither { get; set; } + + public byte Skip { get; set; } + + public byte Segment { get; set; } + } +} diff --git a/src/ImageSharp/Formats/WebP/Vp8PictureHeader.cs b/src/ImageSharp/Formats/WebP/Vp8PictureHeader.cs new file mode 100644 index 0000000000..f9f0fd37d2 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/Vp8PictureHeader.cs @@ -0,0 +1,38 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + internal class Vp8PictureHeader + { + /// + /// Gets or sets the width of the image. + /// + public uint Width { get; set; } + + /// + /// Gets or sets the Height of the image. + /// + public uint Height { get; set; } + + /// + /// Gets or sets the horizontal scale. + /// + public sbyte XScale { get; set; } + + /// + /// Gets or sets the vertical scale. + /// + public sbyte YScale { get; set; } + + /// + /// Gets or sets the colorspace. 0 = YCbCr. + /// + public sbyte ColorSpace { get; set; } + + /// + /// Gets or sets the clamp type. + /// + public sbyte ClampType { get; set; } + } +} diff --git a/src/ImageSharp/Formats/WebP/Vp8QuantMatrix.cs b/src/ImageSharp/Formats/WebP/Vp8QuantMatrix.cs new file mode 100644 index 0000000000..aaca802851 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/Vp8QuantMatrix.cs @@ -0,0 +1,24 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + internal class Vp8QuantMatrix + { + public int[] Y1Mat { get; set; } + + public int[] Y2Mat { get; set; } + + public int[] UVMat { get; set; } + + /// + /// Gets or sets the U/V quantizer value. + /// + public int UvQuant { get; set; } + + /// + /// Gets or sets the dithering amplitude (0 = off, max=255). + /// + public int Dither { get; set; } + } +} diff --git a/src/ImageSharp/Formats/WebP/Vp8SegmentHeader.cs b/src/ImageSharp/Formats/WebP/Vp8SegmentHeader.cs new file mode 100644 index 0000000000..993b744845 --- /dev/null +++ b/src/ImageSharp/Formats/WebP/Vp8SegmentHeader.cs @@ -0,0 +1,33 @@ +// Copyright (c) Six Labors and contributors. +// Licensed under the Apache License, Version 2.0. + +namespace SixLabors.ImageSharp.Formats.WebP +{ + /// + /// Segment features. + /// + internal class Vp8SegmentHeader + { + public bool UseSegment { get; set; } + + /// + /// Gets or sets a value indicating whether to update the segment map or not. + /// + public bool UpdateMap { get; set; } + + /// + /// Gets or sets the absolute or delta values for quantizer and filter. + /// + public int AbsoluteOrDelta { get; set; } + + /// + /// Gets or sets quantization changes. + /// + public byte[] Quantizer { get; set; } + + /// + /// Gets or sets the filter strength for segments. + /// + public byte[] FilterStrength { get; set; } + } +}