diff --git a/src/ImageSharp/Formats/Heif/Av1/Av1BlockSize.cs b/src/ImageSharp/Formats/Heif/Av1/Av1BlockSize.cs index f043208e98..6eca5bc638 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Av1BlockSize.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Av1BlockSize.cs @@ -32,13 +32,3 @@ internal enum Av1BlockSize BlockInvalid = 255, BlockLargest = BlockSizeS - 1, } - -internal static class Av1BlockSizeExtensions -{ - private static readonly int[] SizeWide = { 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 1, 4, 2, 8, 4, 16 }; - private static readonly int[] SizeHigh = { 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 4, 1, 8, 2, 16, 4 }; - - public static int Get4x4WideCount(this Av1BlockSize blockSize) => SizeWide[(int)blockSize]; - - public static int Get4x4HighCount(this Av1BlockSize blockSize) => SizeHigh[(int)blockSize]; -} diff --git a/src/ImageSharp/Formats/Heif/Av1/Av1BlockSizeExtensions.cs b/src/ImageSharp/Formats/Heif/Av1/Av1BlockSizeExtensions.cs new file mode 100644 index 0000000000..16190dd6b2 --- /dev/null +++ b/src/ImageSharp/Formats/Heif/Av1/Av1BlockSizeExtensions.cs @@ -0,0 +1,14 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +namespace SixLabors.ImageSharp.Formats.Heif.Av1; + +internal static class Av1BlockSizeExtensions +{ + private static readonly int[] SizeWide = { 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 1, 4, 2, 8, 4, 16 }; + private static readonly int[] SizeHigh = { 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16, 32, 16, 32, 4, 1, 8, 2, 16, 4 }; + + public static int Get4x4WideCount(this Av1BlockSize blockSize) => SizeWide[(int)blockSize]; + + public static int Get4x4HighCount(this Av1BlockSize blockSize) => SizeHigh[(int)blockSize]; +} diff --git a/src/ImageSharp/Formats/Heif/Av1/Av1Decoder.cs b/src/ImageSharp/Formats/Heif/Av1/Av1Decoder.cs index c8bec52428..8841697388 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Av1Decoder.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Av1Decoder.cs @@ -5,7 +5,7 @@ using SixLabors.ImageSharp.Formats.Heif.Av1.OpenBitstreamUnit; namespace SixLabors.ImageSharp.Formats.Heif.Av1; -internal class Av1Decoder +internal class Av1Decoder : IAv1TileDecoder { public Av1Decoder() { @@ -32,20 +32,19 @@ internal class Av1Decoder ObuReader.Read(ref reader, buffer.Length, this, false); } - internal void DecodeTile(ref Av1BitStreamReader reader, int tileNum) + public void DecodeTile(ref Av1BitStreamReader reader, int tileNum) { // TODO: Implement } - internal void DecodeBlock(Av1BlockModeInfo blockMode, int rowIndex, int columnIndex) + public void FinishDecodeTiles(ref Av1BitStreamReader reader, bool doCdef, bool doLoopRestoration) { - int block4x4Width = blockMode.BlockSize.Get4x4WideCount(); - int block4x4Height = blockMode.BlockSize.Get4x4HighCount(); - + // TODO: Implement } - internal void FinishDecodeTiles(ref Av1BitStreamReader reader, bool doCdef, bool doLoopRestoration) + private static void DecodeBlock(Av1BlockModeInfo blockMode, int rowIndex, int columnIndex) { - // TODO: Implement + int block4x4Width = blockMode.BlockSize.Get4x4WideCount(); + int block4x4Height = blockMode.BlockSize.Get4x4HighCount(); } }