/* * Copyright (C) 2023 Linux Studio Plugins Project * (C) 2023 Vladimir Sadovnikov * * This file is part of lsp-dsp-lib * Created on: 31 мар. 2020 г. * * lsp-dsp-lib is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * lsp-dsp-lib is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with lsp-dsp-lib. If not, see . */ #ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_PMATH_POW_H_ #define PRIVATE_DSP_ARCH_AARCH64_ASIMD_PMATH_POW_H_ #ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL #error "This header should not be included directly" #endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL */ namespace lsp { namespace asimd { #define POW_LOAD_VALUES \ __ASM_EMIT("ldp q16, q17, [%[P2C], #0x000]") /* v16 = LC0, v17 = LC1 */ \ __ASM_EMIT("ldp q18, q19, [%[P2C], #0x020]") /* v18 = LC2, v19 = LC3 */ \ __ASM_EMIT("ldp q20, q21, [%[P2C], #0x040]") /* v20 = LC4, v21 = EC5 */ \ __ASM_EMIT("ldp q24, q25, [%[P2C], #0x060]") /* v24 = EC4, v25 = EC3 */ \ __ASM_EMIT("ldp q26, q27, [%[P2C], #0x080]") /* v26 = EC2, v27 = EC1 */ \ __ASM_EMIT("ldp q28, q29, [%[P2C], #0x0a0]") /* v28 = EC0, v29 = EC6 */ \ __ASM_EMIT("ldp q30, q31, [%[P2C], #0x0c0]") /* v30 = MM , v31 = ME */ \ __ASM_EMIT("ldp q12, q13, [%[P2C], #0x0e0]") /* v12 = C7 , v13 = L2 */ \ __ASM_EMIT("ldr q14, [%[P2C], #0x100]") /* v14 = LE */ #define POW_LOG_X4 \ LOGN_CORE_X4("v30", "v31", "v16", "v17", "v18", "v19", "v20", "v12") #define POW_LOG_X8 \ LOGN_CORE_X8("v30", "v31", "v16", "v17", "v18", "v19", "v20", "v12") #define POW_POW2_X8 \ POW2_CORE_X8("v31", "v13", "v21", "v24", "v25", "v26", "v27", "v28", "v29", "v12") #define POW_POW2_X4 \ POW2_CORE_X4("v31", "v13", "v21", "v24", "v25", "v26", "v27", "v28", "v29", "v12") IF_ARCH_AARCH64( static const uint32_t POW_CONST[] __lsp_aligned16 = { LSP_DSP_VEC4(0x3dba2e8c), // LC0 = 1/11 = 0.0909090936183929 LSP_DSP_VEC4(0x3de38e39), // LC1 = 1/9 = 0.1111111119389534 LSP_DSP_VEC4(0x3e124925), // LC2 = 1/7 = 0.1428571492433548 LSP_DSP_VEC4(0x3e4ccccd), // LC3 = 1/5 = 0.2000000029802322 LSP_DSP_VEC4(0x3eaaaaab), // LC4 = 1/3 = 0.3333333432674408 LSP_DSP_VEC4(0x40e00000), // EC5 = 7!/6! = 7.0000000000000000 LSP_DSP_VEC4(0x42280000), // EC4 = 7!/5! = 42.0000000000000000 LSP_DSP_VEC4(0x43520000), // EC3 = 7!/4! = 210.0000000000000000 LSP_DSP_VEC4(0x44520000), // EC2 = 7!/3! = 840.0000000000000000 LSP_DSP_VEC4(0x451d8000), // EC1 = 7!/2! = 2520.0000000000000000 LSP_DSP_VEC4(0x459d8000), // EC0 = 7!/1! = 5040.0000000000000000 LSP_DSP_VEC4(0x39500d01), // EC6 = 1/7! = 0.0001984127011383 LSP_DSP_VEC4(0x007fffff), // MM = frac LSP_DSP_VEC4(0x0000007f), // ME = 127 LSP_DSP_VEC4(0x3f800000), // C7 = 1.0f LSP_DSP_VEC4(0x3f317218), // L2 = ln(2) LSP_DSP_VEC4(0x4038aa3b) // LE = 2*log2(e) }; ) void powcv2(float *dst, const float *v, float c, size_t count) { // float C = logf(c); // for (size_t i=0; i