Skip to content

Commit 3dd0b83

Browse files
committed
Release 1.0.20
* Optimization of compressor and gate functions using AVX-512 instruction set. * Introduced SIMD-optimized expander curve and gain functions. * Improved performance of logarithm values calculations. * Fixed Mid/Side conversion functions for AArch64 architecture (contributed by marcan at GitHub). * Updated build scripts. * Updated module versions in dependencies.
2 parents 50a40b6 + c54c203 commit 3dd0b83

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+7856
-309
lines changed

CHANGELOG

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
* RECENT CHANGES
33
*******************************************************************************
44

5+
=== 1.0.20 ===
6+
* Optimization of compressor and gate functions using AVX-512 instruction set.
7+
* Introduced SIMD-optimized expander curve and gain functions.
8+
* Improved performance of logarithm values calculations.
9+
* Fixed Mid/Side conversion functions for AArch64 architecture (contributed by
10+
marcan at GitHub).
11+
* Updated build scripts.
12+
* Updated module versions in dependencies.
13+
514
=== 1.0.19 ===
615
* AVX2 optimization of search functions for maximum and minimum.
716
* Implemented SIMD-optimized gate functions.

include/lsp-plug.in/dsp/common/dynamics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
#include <lsp-plug.in/dsp/common/dynamics/types.h>
2828
#include <lsp-plug.in/dsp/common/dynamics/compressor.h>
29+
#include <lsp-plug.in/dsp/common/dynamics/expander.h>
2930
#include <lsp-plug.in/dsp/common/dynamics/gate.h>
3031

3132

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
3+
* (C) 2023 Vladimir Sadovnikov <sadko4u@gmail.com>
4+
*
5+
* This file is part of lsp-dsp-lib
6+
* Created on: 1 нояб. 2023 г.
7+
*
8+
* lsp-dsp-lib is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU Lesser General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* any later version.
12+
*
13+
* lsp-dsp-lib is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Lesser General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU Lesser General Public License
19+
* along with lsp-dsp-lib. If not, see <https://www.gnu.org/licenses/>.
20+
*/
21+
22+
#ifndef LSP_PLUG_IN_DSP_COMMON_DYNAMICS_EXPANDER_H_
23+
#define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_EXPANDER_H_
24+
25+
#include <lsp-plug.in/dsp/common/types.h>
26+
#include <lsp-plug.in/dsp/common/dynamics/types.h>
27+
28+
LSP_DSP_LIB_SYMBOL(void, uexpander_x1_gain, float *dst, const float *src, const LSP_DSP_LIB_TYPE(expander_knee_t) *c, size_t count);
29+
LSP_DSP_LIB_SYMBOL(void, dexpander_x1_gain, float *dst, const float *src, const LSP_DSP_LIB_TYPE(expander_knee_t) *c, size_t count);
30+
31+
LSP_DSP_LIB_SYMBOL(void, uexpander_x1_curve, float *dst, const float *src, const LSP_DSP_LIB_TYPE(expander_knee_t) *c, size_t count);
32+
LSP_DSP_LIB_SYMBOL(void, dexpander_x1_curve, float *dst, const float *src, const LSP_DSP_LIB_TYPE(expander_knee_t) *c, size_t count);
33+
34+
35+
#endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_EXPANDER_H_ */

include/lsp-plug.in/dsp/common/dynamics/types.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,41 @@ typedef struct LSP_DSP_LIB_TYPE(gate_knee_t)
8585
float herm[4]; // Hermite interpolation of the knee with the 3rd-order polynom
8686
} LSP_DSP_LIB_TYPE(gate_knee_t);
8787

88+
/**
89+
* Gate knee is a curve that consists of three parts:
90+
* 1. Part with constant gain amplification
91+
* 2. Soft compression knee
92+
* 3. Gain reduction part
93+
*
94+
* The order of these parts can be direct for upward expander and reverse for downward expander.
95+
*
96+
* The typical algorithm of computing the expander's curve:
97+
* a. for upward expander:
98+
* 1. Take absolute value of the sample: x = fabfs(in)
99+
* 2. If x >= threshold then assume x = threshold
100+
* 3. If x <= start then return x
101+
* 4. Compute the natural logarithm of the x: lx = logf(x).
102+
* 5. If x < end then compute the gain using the 2nd-order polynom: gain = (herm[0]*lx + herm[1])*lx + herm[2]
103+
* 6. Otherwise compute the gain using the 1st-order polynom: gain = tilt[0]*lx + tilt[1]
104+
* 7. return expf(gain)
105+
* b. for downward expander:
106+
* 1. Take absolute value of the sample: x = fabfs(in)
107+
* 2. If x < threshold then return 0.
108+
* 3. If x >= end then return x
109+
* 4. Compute the natural logarithm of the x: lx = logf(x).
110+
* 5. If x > start then compute the gain using the 2nd-order polynom: gain = (herm[0]*lx + herm[1])*lx + herm[2]
111+
* 6. Otherwise compute the gain using the 1st-order polynom: gain = tilt[0]*lx + tilt[1]
112+
* 7. return expf(gain)
113+
*/
114+
typedef struct LSP_DSP_LIB_TYPE(expander_knee_t)
115+
{
116+
float start; // The start of the knee, in gain units
117+
float end; // The end of the knee, in gain units
118+
float threshold; // The threshold to limit the expander effect and prevent from +Inf/-Inf values
119+
float herm[3]; // Hermite interpolation of the knee with the 2nd-order polynom
120+
float tilt[2]; // Tilt interpolation
121+
} LSP_DSP_LIB_TYPE(expander_knee_t);
122+
88123
#pragma pack(pop)
89124

90125
LSP_DSP_LIB_END_NAMESPACE

include/lsp-plug.in/dsp/version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// Define version of headers
2626
#define LSP_DSP_LIB_MAJOR 1
2727
#define LSP_DSP_LIB_MINOR 0
28-
#define LSP_DSP_LIB_MICRO 19
28+
#define LSP_DSP_LIB_MICRO 20
2929

3030
#if defined(__WINDOWS__) || defined(__WIN32__) || defined(__WIN64__) || defined(_WIN64) || defined(_WIN32) || defined(__WINNT) || defined(__WINNT__)
3131
#define LSP_DSP_LIB_EXPORT_MODIFIER __declspec(dllexport)

include/private/dsp/arch/aarch64/asimd/dynamics.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL */
2828

2929
#include <private/dsp/arch/aarch64/asimd/dynamics/compressor.h>
30+
#include <private/dsp/arch/aarch64/asimd/dynamics/expander.h>
3031
#include <private/dsp/arch/aarch64/asimd/dynamics/gate.h>
3132

3233
#endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_H_ */

include/private/dsp/arch/aarch64/asimd/dynamics/compressor.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
#ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_COMPRESSOR_H_
2323
#define PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_COMPRESSOR_H_
2424

25+
#ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL
26+
#error "This header should not be included directly"
27+
#endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL */
28+
2529
#include <private/dsp/arch/aarch64/asimd/pmath/exp.h>
2630
#include <private/dsp/arch/aarch64/asimd/pmath/log.h>
2731

@@ -126,6 +130,7 @@ namespace lsp
126130

127131
#define PROCESS_COMP_FULL_X4 \
128132
/* in: q0 = x0, q1 = x1 */ \
133+
__ASM_EMIT("fabs v0.4s, v0.4s") /* v0 = fabsf(x0) */ \
129134
__ASM_EMIT("str q0, [%[mem], #0x00]") /* mem[0x00] = fabfs(x0) */ \
130135
LOGE_CORE_X4 /* v0= lx0 = logf(fabsf(x0)) */ \
131136
__ASM_EMIT("str q0, [%[mem], #0x20]") /* mem[0x20] = lx0 */ \

0 commit comments

Comments
 (0)