From daa814728d722d3c85709315700b351de9b532c5 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 22 Sep 2023 21:13:31 -0400 Subject: [PATCH] Simplify the Quantum models for now --- Compression/Quantum/Constants.cs | 77 ++++++++++++++++-------------- Compression/Quantum/Model.cs | 9 ---- Compression/Quantum/ModelSymbol.cs | 1 - 3 files changed, 41 insertions(+), 46 deletions(-) diff --git a/Compression/Quantum/Constants.cs b/Compression/Quantum/Constants.cs index 500ddb1..9ea1cfd 100644 --- a/Compression/Quantum/Constants.cs +++ b/Compression/Quantum/Constants.cs @@ -1,45 +1,50 @@ namespace SabreTools.Models.Compression.Quantum { + /// public static class Constants { - /// - /// Mask for Quantum Compression Level - /// - public const ushort MASK_QUANTUM_LEVEL = 0x00F0; + public static readonly int[] PositionSlot = new int[] + { + 0x00000, 0x00001, 0x00002, 0x00003, 0x00004, 0x00006, 0x00008, 0x0000c, + 0x00010, 0x00018, 0x00020, 0x00030, 0x00040, 0x00060, 0x00080, 0x000c0, + 0x00100, 0x00180, 0x00200, 0x00300, 0x00400, 0x00600, 0x00800, 0x00c00, + 0x01000, 0x01800, 0x02000, 0x03000, 0x04000, 0x06000, 0x08000, 0x0c000, + 0x10000, 0x18000, 0x20000, 0x30000, 0x40000, 0x60000, 0x80000, 0xc0000, + 0x100000, 0x180000 + }; + + public static readonly int[] PositionExtraBits = new int[] + { + 0, 0, 0, 0, 1, 1, 2, 2, + 3, 3, 4, 4, 5, 5, 6, 6, + 7, 7, 8, 8, 9, 9, 10, 10, + 11, 11, 12, 12, 13, 13, 14, 14, + 15, 15, 16, 16, 17, 17, 18, 18, + 19, 19 + }; + + public static readonly int[] LengthSlot = new int[] + { + 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08, + 0x0a, 0x0c, 0x0e, 0x12, 0x16, 0x1a, 0x1e, 0x26, + 0x2e, 0x36, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x9e, + 0xbe, 0xde, 0xfe + }; + + public static readonly int[] LengthExtraBits = new int[] + { + 0, 0, 0, 0, 0, 0, 1, 1, + 1, 1, 2, 2, 2, 2, 3, 3, + 3, 3, 4, 4, 4, 4, 5, 5, + 5, 5, 0 + }; /// - /// Lowest Quantum Level (1) + /// Number of position slots for (tsize - 10) /// - public const ushort QUANTUM_LEVEL_LO = 0x0010; - - /// - /// Highest Quantum Level (7) - /// - public const ushort QUANTUM_LEVEL_HI = 0x0070; - - /// - /// Amount to shift over to get int - /// - public const ushort SHIFT_QUANTUM_LEVEL = 4; - - /// - /// Mask for Quantum Compression Memory - /// - public const ushort MASK_QUANTUM_MEM = 0x1F00; - - /// - /// Lowest Quantum Memory (10) - /// - public const ushort QUANTUM_MEM_LO = 0x0A00; - - /// - /// Highest Quantum Memory (21) - /// - public const ushort QUANTUM_MEM_HI = 0x1500; - - /// - /// Amount to shift over to get int - /// - public const ushort SHIFT_QUANTUM_MEM = 8; + public static readonly int[] NumPositionSlots = new int[] + { + 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42 + }; } } \ No newline at end of file diff --git a/Compression/Quantum/Model.cs b/Compression/Quantum/Model.cs index e88b150..a5b228a 100644 --- a/Compression/Quantum/Model.cs +++ b/Compression/Quantum/Model.cs @@ -1,11 +1,8 @@ namespace SabreTools.Models.Compression.Quantum { - /// /// public sealed class Model { - public int TimeToReorder { get; set; } - public int Entries { get; set; } #if NET48 @@ -13,11 +10,5 @@ namespace SabreTools.Models.Compression.Quantum #else public ModelSymbol?[]? Symbols { get; set; } #endif - -#if NET48 - public ushort[] LookupTable { get; set; } = new ushort[256]; -#else - public ushort[]? LookupTable { get; set; } = new ushort[256]; -#endif } } \ No newline at end of file diff --git a/Compression/Quantum/ModelSymbol.cs b/Compression/Quantum/ModelSymbol.cs index ebd8eca..43ac9e6 100644 --- a/Compression/Quantum/ModelSymbol.cs +++ b/Compression/Quantum/ModelSymbol.cs @@ -1,6 +1,5 @@ namespace SabreTools.Models.Compression.Quantum { - /// /// public sealed class ModelSymbol {