Skip to content

Commit

Permalink
Release 1.0.20
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
sadko4u committed Dec 20, 2023
2 parents 50a40b6 + c54c203 commit 3dd0b83
Show file tree
Hide file tree
Showing 54 changed files with 7,856 additions and 309 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@
* RECENT CHANGES
*******************************************************************************

=== 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.

=== 1.0.19 ===
* AVX2 optimization of search functions for maximum and minimum.
* Implemented SIMD-optimized gate functions.
Expand Down
1 change: 1 addition & 0 deletions include/lsp-plug.in/dsp/common/dynamics.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <lsp-plug.in/dsp/common/dynamics/types.h>
#include <lsp-plug.in/dsp/common/dynamics/compressor.h>
#include <lsp-plug.in/dsp/common/dynamics/expander.h>
#include <lsp-plug.in/dsp/common/dynamics/gate.h>


Expand Down
35 changes: 35 additions & 0 deletions include/lsp-plug.in/dsp/common/dynamics/expander.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <[email protected]>
*
* This file is part of lsp-dsp-lib
* Created on: 1 нояб. 2023 г.
*
* 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 <https://www.gnu.org/licenses/>.
*/

#ifndef LSP_PLUG_IN_DSP_COMMON_DYNAMICS_EXPANDER_H_
#define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_EXPANDER_H_

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

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);
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);

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);
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);


#endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_EXPANDER_H_ */
35 changes: 35 additions & 0 deletions include/lsp-plug.in/dsp/common/dynamics/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,41 @@ typedef struct LSP_DSP_LIB_TYPE(gate_knee_t)
float herm[4]; // Hermite interpolation of the knee with the 3rd-order polynom
} LSP_DSP_LIB_TYPE(gate_knee_t);

/**
* Gate knee is a curve that consists of three parts:
* 1. Part with constant gain amplification
* 2. Soft compression knee
* 3. Gain reduction part
*
* The order of these parts can be direct for upward expander and reverse for downward expander.
*
* The typical algorithm of computing the expander's curve:
* a. for upward expander:
* 1. Take absolute value of the sample: x = fabfs(in)
* 2. If x >= threshold then assume x = threshold
* 3. If x <= start then return x
* 4. Compute the natural logarithm of the x: lx = logf(x).
* 5. If x < end then compute the gain using the 2nd-order polynom: gain = (herm[0]*lx + herm[1])*lx + herm[2]
* 6. Otherwise compute the gain using the 1st-order polynom: gain = tilt[0]*lx + tilt[1]
* 7. return expf(gain)
* b. for downward expander:
* 1. Take absolute value of the sample: x = fabfs(in)
* 2. If x < threshold then return 0.
* 3. If x >= end then return x
* 4. Compute the natural logarithm of the x: lx = logf(x).
* 5. If x > start then compute the gain using the 2nd-order polynom: gain = (herm[0]*lx + herm[1])*lx + herm[2]
* 6. Otherwise compute the gain using the 1st-order polynom: gain = tilt[0]*lx + tilt[1]
* 7. return expf(gain)
*/
typedef struct LSP_DSP_LIB_TYPE(expander_knee_t)
{
float start; // The start of the knee, in gain units
float end; // The end of the knee, in gain units
float threshold; // The threshold to limit the expander effect and prevent from +Inf/-Inf values
float herm[3]; // Hermite interpolation of the knee with the 2nd-order polynom
float tilt[2]; // Tilt interpolation
} LSP_DSP_LIB_TYPE(expander_knee_t);

#pragma pack(pop)

LSP_DSP_LIB_END_NAMESPACE
Expand Down
2 changes: 1 addition & 1 deletion include/lsp-plug.in/dsp/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// Define version of headers
#define LSP_DSP_LIB_MAJOR 1
#define LSP_DSP_LIB_MINOR 0
#define LSP_DSP_LIB_MICRO 19
#define LSP_DSP_LIB_MICRO 20

#if defined(__WINDOWS__) || defined(__WIN32__) || defined(__WIN64__) || defined(_WIN64) || defined(_WIN32) || defined(__WINNT) || defined(__WINNT__)
#define LSP_DSP_LIB_EXPORT_MODIFIER __declspec(dllexport)
Expand Down
1 change: 1 addition & 0 deletions include/private/dsp/arch/aarch64/asimd/dynamics.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL */

#include <private/dsp/arch/aarch64/asimd/dynamics/compressor.h>
#include <private/dsp/arch/aarch64/asimd/dynamics/expander.h>
#include <private/dsp/arch/aarch64/asimd/dynamics/gate.h>

#endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_H_ */
5 changes: 5 additions & 0 deletions include/private/dsp/arch/aarch64/asimd/dynamics/compressor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
#ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_COMPRESSOR_H_
#define PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_COMPRESSOR_H_

#ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL
#error "This header should not be included directly"
#endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_IMPL */

#include <private/dsp/arch/aarch64/asimd/pmath/exp.h>
#include <private/dsp/arch/aarch64/asimd/pmath/log.h>

Expand Down Expand Up @@ -126,6 +130,7 @@ namespace lsp

#define PROCESS_COMP_FULL_X4 \
/* in: q0 = x0, q1 = x1 */ \
__ASM_EMIT("fabs v0.4s, v0.4s") /* v0 = fabsf(x0) */ \
__ASM_EMIT("str q0, [%[mem], #0x00]") /* mem[0x00] = fabfs(x0) */ \
LOGE_CORE_X4 /* v0= lx0 = logf(fabsf(x0)) */ \
__ASM_EMIT("str q0, [%[mem], #0x20]") /* mem[0x20] = lx0 */ \
Expand Down
Loading

0 comments on commit 3dd0b83

Please sign in to comment.