From 6e21f484a9be06e0607f890c1c9f083ec4686562 Mon Sep 17 00:00:00 2001 From: Christopher Herb Date: Fri, 3 Apr 2026 13:58:59 +0200 Subject: [PATCH] add license, clean up code --- companding/lut.h | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/companding/lut.h b/companding/lut.h index 4bfd7ca..c6f3d39 100644 --- a/companding/lut.h +++ b/companding/lut.h @@ -1,5 +1,25 @@ -// Auto-generated lookup tables for fixed-point log/exp -// Do not edit manually +/* + * lut.h + * Copyright (c) 2025 Christopher Herb + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ #pragma once @@ -9,7 +29,6 @@ namespace trnr { // Fixed-point log lookup table (Q12) -// Input: normalized float [0.0001, 1.0000] -> Output: log value constexpr int32_t LOG_TABLE_SIZE = 256; constexpr int32_t LOG_FRACTIONAL_BITS = 12; constexpr int32_t LOG_TABLE[LOG_TABLE_SIZE] = { @@ -42,13 +61,8 @@ constexpr int32_t LOG_TABLE[LOG_TABLE_SIZE] = { }; // Fixed-point exp lookup table (Q12) -// Input: normalized float [0.0000, 4.5000] -> Output: exp value constexpr int32_t EXP_TABLE_SIZE = 256; constexpr int32_t EXP_FRACTIONAL_BITS = 12; -constexpr float MIN_LOG_INPUT = 0.0001f; -constexpr float MAX_LOG_INPUT = 1.0f; -constexpr float MIN_EXP_INPUT = 0.0f; -constexpr float MAX_EXP_INPUT = 4.5f; constexpr int32_t EXP_TABLE[EXP_TABLE_SIZE] = { 4096, 4169, 4243, 4319, 4396, 4474, 4553, 4635, 4717, 4801,