From 61400794c09d120a35ce79e3b62f524d3fde3650 Mon Sep 17 00:00:00 2001 From: Ynse Hoornenborg Date: Tue, 5 Nov 2024 22:11:12 +0100 Subject: [PATCH] Memory optimization for Frame Info Map --- .../Formats/Heif/Av1/Tiling/Av1FrameModeInfoMap.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1FrameModeInfoMap.cs b/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1FrameModeInfoMap.cs index 6867b3966d..d13b1592a4 100644 --- a/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1FrameModeInfoMap.cs +++ b/src/ImageSharp/Formats/Heif/Av1/Tiling/Av1FrameModeInfoMap.cs @@ -13,7 +13,7 @@ internal partial class Av1FrameInfo /// public class Av1FrameModeInfoMap { - private readonly int[] offsets; + private readonly ushort[] offsets; private Size alignedModeInfoCount; public Av1FrameModeInfoMap(Size modeInfoCount, int superblockSizeLog2) @@ -22,7 +22,7 @@ internal partial class Av1FrameInfo modeInfoCount.Width * (1 << (superblockSizeLog2 - Av1Constants.ModeInfoSizeLog2)), modeInfoCount.Height * (1 << (superblockSizeLog2 - Av1Constants.ModeInfoSizeLog2))); this.NextIndex = 0; - this.offsets = new int[this.alignedModeInfoCount.Width * this.alignedModeInfoCount.Height]; + this.offsets = new ushort[this.alignedModeInfoCount.Width * this.alignedModeInfoCount.Height]; } /// @@ -54,7 +54,7 @@ internal partial class Av1FrameInfo /* Update 4x4 nbr offset map */ for (int i = modeInfoLocation.Y; i < modeInfoLocation.Y + bh4; i++) { - Array.Fill(this.offsets, this.NextIndex, (i * this.alignedModeInfoCount.Width) + modeInfoLocation.X, bw4); + Array.Fill(this.offsets, (ushort)this.NextIndex, (i * this.alignedModeInfoCount.Width) + modeInfoLocation.X, bw4); } this.NextIndex++;