Skip to content

Commit

Permalink
Release 1.0.17
Browse files Browse the repository at this point in the history
* Implemented SIMD-optimized 2-knee compressor curve and gain calculation functions.
* Implemented several AVX-512 optimized packed complex functions.
* Removed pcomplex_add_r function. Use pcomplex_r2c_add2 function instead.
* Fixed improper formula for complex_div and pcomplex_div functions.
* Implemented sqr1, sqr2, ssqr1 and ssqr2 functions.
* Implemented axis_apply_lin1 function.
* Updated module versions in dependencies.
  • Loading branch information
sadko4u committed Oct 10, 2023
2 parents fa23c53 + dc6d890 commit 65807ff
Show file tree
Hide file tree
Showing 135 changed files with 14,471 additions and 3,705 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.17 ===
* Implemented SIMD-optimized 2-knee compressor curve and gain calculation functions.
* Implemented several AVX-512 optimized packed complex functions.
* Removed pcomplex_add_r function. Use pcomplex_r2c_add2 function instead.
* Fixed improper formula for complex_div and pcomplex_div functions.
* Implemented sqr1, sqr2, ssqr1 and ssqr2 functions.
* Implemented axis_apply_lin1 function.
* Updated module versions in dependencies.

=== 1.0.16 ===
* Fixed improper AVX-512 detection which causes crash for several functions.

Expand Down
31 changes: 31 additions & 0 deletions include/lsp-plug.in/dsp/common/dynamics.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <sadko4u@gmail.com>
*
* This file is part of lsp-dsp-lib
* Created on: 5 окт. 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_H_
#define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_H_

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

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


#endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_H_ */
32 changes: 32 additions & 0 deletions include/lsp-plug.in/dsp/common/dynamics/compressor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <sadko4u@gmail.com>
*
* This file is part of lsp-dsp-lib
* Created on: 5 окт. 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_COMPRESSOR_H_
#define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_COMPRESSOR_H_

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

LSP_DSP_LIB_SYMBOL(void, compressor_x2_gain, float *dst, const float *src, const LSP_DSP_LIB_TYPE(compressor_x2_t) *c, size_t count);

LSP_DSP_LIB_SYMBOL(void, compressor_x2_curve, float *dst, const float *src, const LSP_DSP_LIB_TYPE(compressor_x2_t) *c, size_t count);

#endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_COMPRESSOR_H_ */
68 changes: 68 additions & 0 deletions include/lsp-plug.in/dsp/common/dynamics/types.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <sadko4u@gmail.com>
*
* This file is part of lsp-dsp-lib
* Created on: 5 окт. 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_TYPES_H_
#define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_TYPES_H_

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

LSP_DSP_LIB_BEGIN_NAMESPACE

#pragma pack(push, 1)

/**
* Compressor knee is a curve that constists of three parts:
* 1. Part with constant gain amplification in the range [-inf .. start] dB
* 2. Soft compression knee in the range (start .. end) dB present by the quadratic function (2nd-order polynom)
* 3. Gain reduction part in the range [end .. +inf] dB present by the linear function (1st-order polynom)
*
* The typical algorithm of computing the compressor's curve:
* 1. Take absolute value of the sample: x = fabfs(in)
* 2. If x <= start then return gain*x
* 3. Compute the natural logarithm of the x: lx = logf(x).
* 4. If x < end then compute the gain using the 2nd-order polynom: gain = (herm[0]*lx + herm[1])*lx + herm[2]
* 5. Otherwise compute the gain using the 1st-order polynom: gain = tilt[0]*lx + tilt[1]
* 6. return expf(gain)
*/
typedef struct LSP_DSP_LIB_TYPE(compressor_knee_t)
{
float start; // The start of the knee, in gain units
float end; // The end of the knee, in gain units
float gain; // Pre-amplification gain
float herm[3]; // Hermite interpolation of the knee with the 2nd-order polynom
float tilt[2]; // Tilt line parameters after the knee
} LSP_DSP_LIB_TYPE(compressor_knee_t);


/**
* Two-knee compressor.
* The result gain/curve is a result of multiplication of gain/curve between both knees.
*/
typedef struct LSP_DSP_LIB_TYPE(compressor_x2_t)
{
LSP_DSP_LIB_TYPE(compressor_knee_t) k[2];
} LSP_DSP_LIB_TYPE(compressor_x2_t);

#pragma pack(pop)

LSP_DSP_LIB_END_NAMESPACE

#endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_TYPES_H_ */
10 changes: 10 additions & 0 deletions include/lsp-plug.in/dsp/common/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,16 @@ typedef struct LSP_DSP_LIB_TYPE(hsla_light_eff_t)

LSP_DSP_LIB_END_NAMESPACE

/** Do linear vector apply for 1D-schema:
* x[i] = x[i] + norm_x * (v[i] + zero)
*
* @param x destination vector for X coordinate
* @param v delta vector to apply
* @param zero graphics zero point shift
* @param norm X norming factor
*/
LSP_DSP_LIB_SYMBOL(void, axis_apply_lin1, float *x, const float *v, float zero, float norm, size_t count);

/** Do logarithmic vector apply for 1D-schema:
* x[i] = x[i] + norm_x * logf(absf(v[i]*zero))
*
Expand Down
8 changes: 0 additions & 8 deletions include/lsp-plug.in/dsp/common/pcomplex.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,6 @@ LSP_DSP_LIB_SYMBOL(void, pcomplex_r2c, float *dst, const float *src, size_t coun
*/
LSP_DSP_LIB_SYMBOL(void, pcomplex_c2r, float *dst, const float *src, size_t count);

/** Convert packed complex to real and add to destination buffer
*
* @param dst destination real data
* @param src source packed complex data
* @param count number of items to convert
*/
LSP_DSP_LIB_SYMBOL(void, pcomplex_add_r, float *dst, const float *src, size_t count);

/** Get module for complex numbers: mod = sqrt(re*re + im*im)
*
* @param dst_mod array to sore module
Expand Down
2 changes: 2 additions & 0 deletions include/lsp-plug.in/dsp/common/pmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,7 @@
#include <lsp-plug.in/dsp/common/pmath/op_kx.h>
#include <lsp-plug.in/dsp/common/pmath/op_vv.h>
#include <lsp-plug.in/dsp/common/pmath/pow.h>
#include <lsp-plug.in/dsp/common/pmath/sqr.h>
#include <lsp-plug.in/dsp/common/pmath/sqrt.h>

#endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_H_ */
44 changes: 44 additions & 0 deletions include/lsp-plug.in/dsp/common/pmath/sqr.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <sadko4u@gmail.com>
*
* This file is part of lsp-dsp-lib
* Created on: 20 сент. 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_PMATH_SQR_H_
#define LSP_PLUG_IN_DSP_COMMON_PMATH_SQR_H_

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

/**
* Compute squares: dst[i] = dst[i]*dst[i]
* @param dst destination
* @param count number of elements to process
*/
LSP_DSP_LIB_SYMBOL(void, sqr1, float *dst, size_t count);

/**
* Compute squares: dst[i] = src[i]*src[i]
* @param dst destination
* @param src source
* @param count number of elements in source
*/
LSP_DSP_LIB_SYMBOL(void, sqr2, float *dst, const float *src, size_t count);



#endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_SQR_H_ */
44 changes: 44 additions & 0 deletions include/lsp-plug.in/dsp/common/pmath/sqrt.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright (C) 2023 Linux Studio Plugins Project <https://lsp-plug.in/>
* (C) 2023 Vladimir Sadovnikov <sadko4u@gmail.com>
*
* This file is part of lsp-dsp-lib
* Created on: 20 сент. 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_PMATH_SQRT_H_
#define LSP_PLUG_IN_DSP_COMMON_PMATH_SQRT_H_

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

/**
* Compute saturated square roots: dst[i] = sqrt(max(dst[i], 0))
* @param dst destination
* @param count number of elements to process
*/
LSP_DSP_LIB_SYMBOL(void, ssqrt1, float *dst, size_t count);

/**
* Compute saturated square roots: dst[i] = sqrt(max(src[i], 0))
* @param dst destination
* @param src source
* @param count number of elements in source
*/
LSP_DSP_LIB_SYMBOL(void, ssqrt2, float *dst, const float *src, size_t count);



#endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_SQRT_H_ */
15 changes: 10 additions & 5 deletions include/lsp-plug.in/dsp/common/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@
#include <limits.h>

// Macro definitions
#define LSP_DSP_VEC2(v) v, v
#define LSP_DSP_VEC4(v) v, v, v, v
#define LSP_DSP_VEC8(v) v, v, v, v, v, v, v, v
#define LSP_DSP_VEC16(v) v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v
#define LSP_DSP_VEC32(v) v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v, v
#define LSP_DSP_VEC2(v) v, v
#define LSP_DSP_VEC4(v) LSP_DSP_VEC2(v), LSP_DSP_VEC2(v)
#define LSP_DSP_VEC8(v) LSP_DSP_VEC4(v), LSP_DSP_VEC4(v)
#define LSP_DSP_VEC16(v) LSP_DSP_VEC8(v), LSP_DSP_VEC8(v)
#define LSP_DSP_VEC32(v) LSP_DSP_VEC16(v), LSP_DSP_VEC16(v)

#define LSP_DSP_VEC2x2(a, b) a, b, a, b
#define LSP_DSP_VEC4x2(a, b) LSP_DSP_VEC2x2(a, b), LSP_DSP_VEC2x2(a, b)
#define LSP_DSP_VEC8x2(a, b) LSP_DSP_VEC4x2(a, b), LSP_DSP_VEC4x2(a, b)
#define LSP_DSP_VEC16x2(a, b) LSP_DSP_VEC8x2(a, b), LSP_DSP_VEC8x2(a, b)

// Different constants
#define LSP_DSP_AMPLIFICATION_THRESH 1e-8
Expand Down
1 change: 1 addition & 0 deletions include/lsp-plug.in/dsp/dsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <lsp-plug.in/dsp/common/context.h>
#include <lsp-plug.in/dsp/common/convolution.h>
#include <lsp-plug.in/dsp/common/copy.h>
#include <lsp-plug.in/dsp/common/dynamics.h>
#include <lsp-plug.in/dsp/common/fastconv.h>
#include <lsp-plug.in/dsp/common/fft.h>
#include <lsp-plug.in/dsp/common/filters.h>
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 16
#define LSP_DSP_LIB_MICRO 17

#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
Loading

0 comments on commit 65807ff

Please sign in to comment.