From e838c22a9c39d875ca3822e13ef0ec4dbf76e1ce Mon Sep 17 00:00:00 2001 From: James Jackson-South Date: Mon, 24 Aug 2026 23:34:20 +1000 Subject: [PATCH] Complete HEIF transform documentation --- .../Formats/Heif/Av1/Av1YuvConverter.cs | 3 + .../Heif/Av1/Tiling/Av1SuperblockInfo.cs | 1 + .../Heif/Av1/Transform/Av1CoefficientShape.cs | 15 ++++ .../Heif/Av1/Transform/Av1TransformClass.cs | 11 +++ .../Av1/Transform/Av1TransformFunctionType.cs | 59 +++++++++++++ .../Heif/Av1/Transform/Av1TransformMode.cs | 11 +++ .../Heif/Av1/Transform/Av1TransformSetType.cs | 4 + .../Heif/Av1/Transform/Av1TransformSize.cs | 87 +++++++++++++++++++ .../Heif/Av1/Transform/Av1TransformType.cs | 48 ++++++++++ .../Heif/Av1/Transform/Av1TransformType1d.cs | 15 ++++ 10 files changed, 254 insertions(+) diff --git a/src/ImageSharp/Formats/Heif/Av1/Av1YuvConverter.cs b/src/ImageSharp/Formats/Heif/Av1/Av1YuvConverter.cs index c3c6d214e..1a10640eb 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Av1YuvConverter.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Av1YuvConverter.cs @@ -317,6 +317,7 @@ internal static class Av1YuvConverter /// /// Converts one YUV row to packed RGB using the resolved H.273 conversion state. /// + /// The encoded sample type. /// The luma samples. /// The upper blue-difference chroma row. /// The lower blue-difference chroma row. @@ -412,6 +413,7 @@ internal static class Av1YuvConverter /// /// Bilinearly reconstructs a chroma sample at a luma coordinate. /// + /// The encoded sample type. /// The upper chroma row. /// The lower chroma row. /// The luma column coordinate. @@ -485,6 +487,7 @@ internal static class Av1YuvConverter /// /// Converts one packed RGB row to YUV 4:4:4 using the resolved H.273 conversion state. /// + /// The encoded sample type. /// The source RGB pixels. /// The destination luma samples. /// The destination blue-difference chroma samples. diff --git a/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1SuperblockInfo.cs b/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1SuperblockInfo.cs index c381c2236..610b0698c 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1SuperblockInfo.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1SuperblockInfo.cs @@ -106,6 +106,7 @@ internal class Av1SuperblockInfo /// /// Gets the mode information records parsed for this superblock in bitstream order. /// + /// The mode information records for the superblock. public Span GetModeInfos() => this.frameInfo.GetModeInfos(this.Position, this.BlockCount); /// diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1CoefficientShape.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1CoefficientShape.cs index b1e62deb1..1cb149288 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1CoefficientShape.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1CoefficientShape.cs @@ -8,8 +8,23 @@ namespace SixLabors.ImageSharp.Formats.Heif.Av1.Transform; /// internal enum Av1CoefficientShape { + /// + /// Evaluates the complete coefficient plane. + /// Default, + + /// + /// Evaluates the half-coefficient shape. + /// N2, + + /// + /// Evaluates the quarter-coefficient shape. + /// N4, + + /// + /// Evaluates only the DC coefficient. + /// OnlyDc } diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformClass.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformClass.cs index 1d96f3ea0..759384373 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformClass.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformClass.cs @@ -8,7 +8,18 @@ namespace SixLabors.ImageSharp.Formats.Heif.Av1.Transform; /// internal enum Av1TransformClass { + /// + /// A two-dimensional transform with non-identity processing on both axes. + /// Class2D = 0, + + /// + /// A horizontal transform with identity processing on the vertical axis. + /// ClassHorizontal = 1, + + /// + /// A vertical transform with identity processing on the horizontal axis. + /// ClassVertical = 2, } diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformFunctionType.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformFunctionType.cs index cd06fd235..025006789 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformFunctionType.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformFunctionType.cs @@ -8,19 +8,78 @@ namespace SixLabors.ImageSharp.Formats.Heif.Av1.Transform; /// internal enum Av1TransformFunctionType { + /// + /// A four-sample discrete cosine transform. + /// Dct4, + + /// + /// An eight-sample discrete cosine transform. + /// Dct8, + + /// + /// A sixteen-sample discrete cosine transform. + /// Dct16, + + /// + /// A thirty-two-sample discrete cosine transform. + /// Dct32, + + /// + /// A sixty-four-sample discrete cosine transform. + /// Dct64, + + /// + /// A four-sample asymmetric discrete sine transform. + /// Adst4, + + /// + /// An eight-sample asymmetric discrete sine transform. + /// Adst8, + + /// + /// A sixteen-sample asymmetric discrete sine transform. + /// Adst16, + + /// + /// A thirty-two-sample asymmetric discrete sine transform. + /// Adst32, + + /// + /// A four-sample identity transform. + /// Identity4, + + /// + /// An eight-sample identity transform. + /// Identity8, + + /// + /// A sixteen-sample identity transform. + /// Identity16, + + /// + /// A thirty-two-sample identity transform. + /// Identity32, + + /// + /// A sixty-four-sample identity transform. + /// Identity64, + + /// + /// No valid transform function. + /// Invalid, } diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformMode.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformMode.cs index e56fccca6..b60092117 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformMode.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformMode.cs @@ -8,7 +8,18 @@ namespace SixLabors.ImageSharp.Formats.Heif.Av1.Transform; /// internal enum Av1TransformMode : byte { + /// + /// Every transform block is four by four samples. + /// Only4x4 = 0, + + /// + /// Each block uses the largest permitted transform size. + /// Largest = 1, + + /// + /// Transform-block sizes are selected by block-level syntax. + /// Select = 2, } diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSetType.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSetType.cs index 244228f00..512ca6880 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSetType.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSetType.cs @@ -39,5 +39,9 @@ internal enum Av1TransformSetType /// Allowed transforms: Discrete Trig transforms w/ flip (9) + Identity (1) + 1D Hor/Ver (6) /// InterSet1, + + /// + /// The number of defined transform sets. + /// AllSets } diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSize.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSize.cs index 6ea115a73..7d1aa856c 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSize.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformSize.cs @@ -8,26 +8,113 @@ namespace SixLabors.ImageSharp.Formats.Heif.Av1.Transform; /// internal enum Av1TransformSize : byte { + /// + /// A 4-by-4 transform block. + /// Size4x4 = 0, + + /// + /// An 8-by-8 transform block. + /// Size8x8 = 1, + + /// + /// A 16-by-16 transform block. + /// Size16x16 = 2, + + /// + /// A 32-by-32 transform block. + /// Size32x32 = 3, + + /// + /// A 64-by-64 transform block. + /// Size64x64 = 4, + + /// + /// A 4-by-8 transform block. + /// Size4x8 = 5, + + /// + /// An 8-by-4 transform block. + /// Size8x4 = 6, + + /// + /// An 8-by-16 transform block. + /// Size8x16 = 7, + + /// + /// A 16-by-8 transform block. + /// Size16x8 = 8, + + /// + /// A 16-by-32 transform block. + /// Size16x32 = 9, + + /// + /// A 32-by-16 transform block. + /// Size32x16 = 10, + + /// + /// A 32-by-64 transform block. + /// Size32x64 = 11, + + /// + /// A 64-by-32 transform block. + /// Size64x32 = 12, + + /// + /// A 4-by-16 transform block. + /// Size4x16 = 13, + + /// + /// A 16-by-4 transform block. + /// Size16x4 = 14, + + /// + /// An 8-by-32 transform block. + /// Size8x32 = 15, + + /// + /// A 32-by-8 transform block. + /// Size32x8 = 16, + + /// + /// A 16-by-64 transform block. + /// Size16x64 = 17, + + /// + /// A 64-by-16 transform block. + /// Size64x16 = 18, + + /// + /// The number of defined transform-block sizes. + /// AllSizes = 19, + + /// + /// The number of square transform-block sizes. + /// SquareSizes = Size4x8, + + /// + /// No valid transform-block size. + /// Invalid = 255, } diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType.cs index 368c234c0..4d52b464b 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType.cs @@ -27,17 +27,65 @@ internal enum Av1TransformType : byte /// ADST in both directions. /// AdstAdst, + + /// + /// Flipped ADST vertically and DCT horizontally. + /// FlipAdstDct, + + /// + /// DCT vertically and flipped ADST horizontally. + /// DctFlipAdst, + + /// + /// Flipped ADST in both directions. + /// FlipAdstFlipAdst, + + /// + /// ADST vertically and flipped ADST horizontally. + /// AdstFlipAdst, + + /// + /// Flipped ADST vertically and ADST horizontally. + /// FlipAdstAdst, + + /// + /// Identity transforms in both directions. + /// Identity, + + /// + /// DCT vertically and identity horizontally. + /// VerticalDct, + + /// + /// Identity vertically and DCT horizontally. + /// HorizontalDct, + + /// + /// ADST vertically and identity horizontally. + /// VerticalAdst, + + /// + /// Identity vertically and ADST horizontally. + /// HorizontalAdst, + + /// + /// Flipped ADST vertically and identity horizontally. + /// VerticalFlipAdst, + + /// + /// Identity vertically and flipped ADST horizontally. + /// HorizontalFlipAdst, /// diff --git a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType1d.cs b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType1d.cs index a47836789..16f80d943 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType1d.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Transform/Av1TransformType1d.cs @@ -8,8 +8,23 @@ namespace SixLabors.ImageSharp.Formats.Heif.Av1.Transform; /// internal enum Av1TransformType1d { + /// + /// A discrete cosine transform. + /// Dct, + + /// + /// An asymmetric discrete sine transform. + /// Adst, + + /// + /// A flipped asymmetric discrete sine transform. + /// FlipAdst, + + /// + /// An identity transform. + /// Identity }