├── .cproject ├── .github ├── FUNDING.yml └── workflows │ ├── build.yml │ └── valgrind.supp ├── .gitignore ├── .project ├── CHANGELOG ├── COPYING ├── COPYING.LESSER ├── Makefile ├── README.md ├── dependencies.mk ├── include ├── lsp-plug.in │ └── dsp │ │ ├── common │ │ ├── 3dmath.h │ │ ├── 3dmath │ │ │ └── types.h │ │ ├── bitmap.h │ │ ├── bitmap │ │ │ ├── b1b8.h │ │ │ ├── b2b8.h │ │ │ ├── b4b8.h │ │ │ └── b8b8.h │ │ ├── coding.h │ │ ├── complex.h │ │ ├── context.h │ │ ├── convolution.h │ │ ├── copy.h │ │ ├── correlation.h │ │ ├── dynamics.h │ │ ├── dynamics │ │ │ ├── compressor.h │ │ │ ├── expander.h │ │ │ ├── gate.h │ │ │ └── types.h │ │ ├── fastconv.h │ │ ├── fft.h │ │ ├── filters.h │ │ ├── filters │ │ │ ├── dynamic.h │ │ │ ├── static.h │ │ │ ├── transfer.h │ │ │ ├── transform.h │ │ │ └── types.h │ │ ├── float.h │ │ ├── graphics.h │ │ ├── hmath.h │ │ ├── hmath │ │ │ ├── hdotp.h │ │ │ └── hsum.h │ │ ├── interpolation.h │ │ ├── interpolation │ │ │ └── linear.h │ │ ├── mix.h │ │ ├── msmatrix.h │ │ ├── pan.h │ │ ├── pcomplex.h │ │ ├── pmath.h │ │ ├── pmath │ │ │ ├── abs_vv.h │ │ │ ├── cos.h │ │ │ ├── exp.h │ │ │ ├── fmop_kx.h │ │ │ ├── fmop_vv.h │ │ │ ├── lanczos.h │ │ │ ├── log.h │ │ │ ├── lramp.h │ │ │ ├── minmax.h │ │ │ ├── normalize.h │ │ │ ├── op_kx.h │ │ │ ├── op_vv.h │ │ │ ├── pow.h │ │ │ ├── sin.h │ │ │ ├── sqr.h │ │ │ └── sqrt.h │ │ ├── resampling.h │ │ ├── search.h │ │ ├── search │ │ │ ├── iminmax.h │ │ │ └── minmax.h │ │ ├── smath.h │ │ └── types.h │ │ ├── dsp.h │ │ └── version.h └── private │ ├── dsp │ ├── arch │ │ ├── aarch64 │ │ │ ├── asimd │ │ │ │ ├── complex.h │ │ │ │ ├── convolution.h │ │ │ │ ├── copy.h │ │ │ │ ├── correlation.h │ │ │ │ ├── dynamics.h │ │ │ │ ├── dynamics │ │ │ │ │ ├── compressor.h │ │ │ │ │ ├── expander.h │ │ │ │ │ └── gate.h │ │ │ │ ├── fastconv.h │ │ │ │ ├── fastconv │ │ │ │ │ ├── apply.h │ │ │ │ │ ├── const.h │ │ │ │ │ ├── papply.h │ │ │ │ │ ├── parse.h │ │ │ │ │ └── restore.h │ │ │ │ ├── fft.h │ │ │ │ ├── fft │ │ │ │ │ ├── butterfly.h │ │ │ │ │ ├── const.h │ │ │ │ │ ├── normalize.h │ │ │ │ │ ├── pbutterfly.h │ │ │ │ │ ├── pscramble.h │ │ │ │ │ └── scramble.h │ │ │ │ ├── filters │ │ │ │ │ ├── dynamic.h │ │ │ │ │ ├── static.h │ │ │ │ │ ├── transfer.h │ │ │ │ │ └── transform.h │ │ │ │ ├── float.h │ │ │ │ ├── graphics │ │ │ │ │ ├── axis.h │ │ │ │ │ ├── colors.h │ │ │ │ │ ├── effects.h │ │ │ │ │ └── pixelfmt.h │ │ │ │ ├── hmath │ │ │ │ │ ├── hdotp.h │ │ │ │ │ └── hsum.h │ │ │ │ ├── interpolation │ │ │ │ │ └── linear.h │ │ │ │ ├── mix.h │ │ │ │ ├── msmatrix.h │ │ │ │ ├── pan.h │ │ │ │ ├── pcomplex.h │ │ │ │ ├── pfft.h │ │ │ │ ├── pmath.h │ │ │ │ ├── pmath │ │ │ │ │ ├── abs_vv.h │ │ │ │ │ ├── cos.h │ │ │ │ │ ├── exp.h │ │ │ │ │ ├── fmop_kx.h │ │ │ │ │ ├── fmop_vv.h │ │ │ │ │ ├── lanczos.h │ │ │ │ │ ├── log.h │ │ │ │ │ ├── lramp.h │ │ │ │ │ ├── minmax.h │ │ │ │ │ ├── op_kx.h │ │ │ │ │ ├── op_vv.h │ │ │ │ │ ├── pow.h │ │ │ │ │ ├── sin.h │ │ │ │ │ ├── sqr.h │ │ │ │ │ └── ssqrt.h │ │ │ │ ├── resampling.h │ │ │ │ └── search │ │ │ │ │ ├── iminmax.h │ │ │ │ │ └── minmax.h │ │ │ ├── features.h │ │ │ └── fpcr.h │ │ ├── arm │ │ │ ├── features.h │ │ │ ├── fpscr.h │ │ │ └── neon-d32 │ │ │ │ ├── complex.h │ │ │ │ ├── convolution.h │ │ │ │ ├── copy.h │ │ │ │ ├── correlation.h │ │ │ │ ├── dynamics.h │ │ │ │ ├── dynamics │ │ │ │ ├── compressor.h │ │ │ │ ├── expander.h │ │ │ │ └── gate.h │ │ │ │ ├── fastconv.h │ │ │ │ ├── fastconv │ │ │ │ ├── apply.h │ │ │ │ ├── papply.h │ │ │ │ ├── parse.h │ │ │ │ └── restore.h │ │ │ │ ├── fft.h │ │ │ │ ├── fft │ │ │ │ ├── butterfly.h │ │ │ │ ├── const.h │ │ │ │ ├── normalize.h │ │ │ │ ├── pbutterfly.h │ │ │ │ ├── pscramble.h │ │ │ │ └── scramble.h │ │ │ │ ├── filters │ │ │ │ ├── dynamic.h │ │ │ │ ├── static.h │ │ │ │ ├── transfer.h │ │ │ │ └── transform.h │ │ │ │ ├── float.h │ │ │ │ ├── graphics │ │ │ │ ├── axis.h │ │ │ │ ├── colors.h │ │ │ │ ├── effects.h │ │ │ │ └── pixelfmt.h │ │ │ │ ├── hmath │ │ │ │ ├── hdotp.h │ │ │ │ └── hsum.h │ │ │ │ ├── interpolation │ │ │ │ └── linear.h │ │ │ │ ├── mix.h │ │ │ │ ├── msmatrix.h │ │ │ │ ├── pan.h │ │ │ │ ├── pcomplex.h │ │ │ │ ├── pmath.h │ │ │ │ ├── pmath │ │ │ │ ├── abs_vv.h │ │ │ │ ├── cos.h │ │ │ │ ├── exp.h │ │ │ │ ├── fmop_kx.h │ │ │ │ ├── fmop_vv.h │ │ │ │ ├── lanczos.h │ │ │ │ ├── log.h │ │ │ │ ├── lramp.h │ │ │ │ ├── minmax.h │ │ │ │ ├── op_kx.h │ │ │ │ ├── op_vv.h │ │ │ │ ├── pow.h │ │ │ │ ├── sin.h │ │ │ │ ├── sqr.h │ │ │ │ └── ssqrt.h │ │ │ │ ├── resampling.h │ │ │ │ └── search │ │ │ │ ├── iminmax.h │ │ │ │ └── minmax.h │ │ ├── generic │ │ │ ├── 3dmath.h │ │ │ ├── bitmap.h │ │ │ ├── bitmap │ │ │ │ ├── b1b8.h │ │ │ │ ├── b2b8.h │ │ │ │ ├── b4b8.h │ │ │ │ ├── b8b8.h │ │ │ │ └── helpers.h │ │ │ ├── coding.h │ │ │ ├── complex.h │ │ │ ├── context.h │ │ │ ├── convolution.h │ │ │ ├── copy.h │ │ │ ├── correlation.h │ │ │ ├── dynamics.h │ │ │ ├── dynamics │ │ │ │ ├── compressor.h │ │ │ │ ├── expander.h │ │ │ │ └── gate.h │ │ │ ├── fastconv.h │ │ │ ├── features.h │ │ │ ├── fft.h │ │ │ ├── filters │ │ │ │ ├── dynamic.h │ │ │ │ ├── static.h │ │ │ │ ├── transfer.h │ │ │ │ └── transform.h │ │ │ ├── float.h │ │ │ ├── graphics.h │ │ │ ├── graphics │ │ │ │ ├── axis.h │ │ │ │ ├── effects.h │ │ │ │ ├── interpolation.h │ │ │ │ └── pixelfmt.h │ │ │ ├── hmath.h │ │ │ ├── hmath │ │ │ │ ├── hdotp.h │ │ │ │ └── hsum.h │ │ │ ├── interpolation │ │ │ │ └── linear.h │ │ │ ├── mix.h │ │ │ ├── msmatrix.h │ │ │ ├── pan.h │ │ │ ├── pcomplex.h │ │ │ ├── pmath.h │ │ │ ├── pmath │ │ │ │ ├── abs_vv.h │ │ │ │ ├── cos.h │ │ │ │ ├── exp.h │ │ │ │ ├── fmop_kx.h │ │ │ │ ├── fmop_vv.h │ │ │ │ ├── lanczos.h │ │ │ │ ├── log.h │ │ │ │ ├── lramp.h │ │ │ │ ├── minmax.h │ │ │ │ ├── normalize.h │ │ │ │ ├── op_kx.h │ │ │ │ ├── op_vv.h │ │ │ │ ├── pow.h │ │ │ │ ├── sin.h │ │ │ │ ├── sqr.h │ │ │ │ └── ssqrt.h │ │ │ ├── resampling.h │ │ │ ├── search.h │ │ │ └── smath.h │ │ └── x86 │ │ │ ├── avx │ │ │ ├── complex.h │ │ │ ├── convolution.h │ │ │ ├── copy.h │ │ │ ├── correlation.h │ │ │ ├── fastconv.h │ │ │ ├── fastconv │ │ │ │ ├── apply.h │ │ │ │ ├── butterfly.h │ │ │ │ └── prepare.h │ │ │ ├── fft.h │ │ │ ├── fft │ │ │ │ ├── butterfly.h │ │ │ │ ├── const.h │ │ │ │ ├── normalize.h │ │ │ │ ├── p_butterfly.h │ │ │ │ ├── p_repack.h │ │ │ │ ├── p_scramble.h │ │ │ │ └── scramble.h │ │ │ ├── filters │ │ │ │ ├── dynamic.h │ │ │ │ ├── static.h │ │ │ │ ├── transfer.h │ │ │ │ └── transform.h │ │ │ ├── float.h │ │ │ ├── graphics │ │ │ │ ├── axis.h │ │ │ │ └── pixelfmt.h │ │ │ ├── hmath │ │ │ │ ├── hdotp.h │ │ │ │ └── hsum.h │ │ │ ├── interpolation │ │ │ │ └── linear.h │ │ │ ├── mix.h │ │ │ ├── msmatrix.h │ │ │ ├── pan.h │ │ │ ├── pcomplex.h │ │ │ ├── pfft.h │ │ │ ├── pmath.h │ │ │ ├── pmath │ │ │ │ ├── abs_vv.h │ │ │ │ ├── fmop_kx.h │ │ │ │ ├── fmop_vv.h │ │ │ │ ├── lramp.h │ │ │ │ ├── minmax.h │ │ │ │ ├── normalize.h │ │ │ │ ├── op_kx.h │ │ │ │ ├── op_vv.h │ │ │ │ ├── sqr.h │ │ │ │ └── ssqrt.h │ │ │ ├── resampling.h │ │ │ ├── search │ │ │ │ └── minmax.h │ │ │ └── xcr.h │ │ │ ├── avx2 │ │ │ ├── dynamics.h │ │ │ ├── dynamics │ │ │ │ ├── compressor.h │ │ │ │ ├── expander.h │ │ │ │ └── gate.h │ │ │ ├── fft │ │ │ │ └── normalize.h │ │ │ ├── float.h │ │ │ ├── graphics │ │ │ │ ├── colors.h │ │ │ │ ├── effects.h │ │ │ │ ├── pixelfmt.h │ │ │ │ └── transpose.h │ │ │ ├── pmath.h │ │ │ ├── pmath │ │ │ │ ├── cos.h │ │ │ │ ├── exp.h │ │ │ │ ├── fmop_kx.h │ │ │ │ ├── lanczos.h │ │ │ │ ├── log.h │ │ │ │ ├── op_kx.h │ │ │ │ ├── pow.h │ │ │ │ └── sin.h │ │ │ └── search │ │ │ │ └── iminmax.h │ │ │ ├── avx512 │ │ │ ├── complex.h │ │ │ ├── convolution.h │ │ │ ├── copy.h │ │ │ ├── correlation.h │ │ │ ├── dynamics.h │ │ │ ├── dynamics │ │ │ │ ├── compressor.h │ │ │ │ ├── expander.h │ │ │ │ └── gate.h │ │ │ ├── fft.h │ │ │ ├── fft │ │ │ │ ├── butterfly.h │ │ │ │ ├── const.h │ │ │ │ ├── normalize.h │ │ │ │ └── scramble.h │ │ │ ├── float.h │ │ │ ├── graphics │ │ │ │ └── axis.h │ │ │ ├── hmath.h │ │ │ ├── hmath │ │ │ │ ├── hdotp.h │ │ │ │ └── hsum.h │ │ │ ├── mix.h │ │ │ ├── msmatrix.h │ │ │ ├── pan.h │ │ │ ├── pcomplex.h │ │ │ ├── pmath.h │ │ │ ├── pmath │ │ │ │ ├── abs_vv.h │ │ │ │ ├── cos.h │ │ │ │ ├── exp.h │ │ │ │ ├── fmop_kx.h │ │ │ │ ├── fmop_vv.h │ │ │ │ ├── lanczos.h │ │ │ │ ├── log.h │ │ │ │ ├── lramp.h │ │ │ │ ├── minmax.h │ │ │ │ ├── normalize.h │ │ │ │ ├── op_kx.h │ │ │ │ ├── op_vv.h │ │ │ │ ├── sin.h │ │ │ │ ├── sqr.h │ │ │ │ └── ssqrt.h │ │ │ ├── search.h │ │ │ └── search │ │ │ │ ├── iminmax.h │ │ │ │ └── minmax.h │ │ │ ├── copy.h │ │ │ ├── cpuid.h │ │ │ ├── defs.h │ │ │ ├── features.h │ │ │ ├── float.h │ │ │ ├── graphics.h │ │ │ ├── sse │ │ │ ├── 3dmath.h │ │ │ ├── complex.h │ │ │ ├── convolution.h │ │ │ ├── copy.h │ │ │ ├── correlation.h │ │ │ ├── fastconv.h │ │ │ ├── fastconv │ │ │ │ ├── apply.h │ │ │ │ ├── irestore.h │ │ │ │ ├── papply.h │ │ │ │ ├── parse.h │ │ │ │ └── restore.h │ │ │ ├── fft.h │ │ │ ├── fft │ │ │ │ ├── butterfly.h │ │ │ │ ├── const.h │ │ │ │ ├── normalize.h │ │ │ │ ├── p_butterfly.h │ │ │ │ ├── p_scramble.h │ │ │ │ ├── p_switch.h │ │ │ │ ├── scramble.h │ │ │ │ └── switch.h │ │ │ ├── filters │ │ │ │ ├── dynamic.h │ │ │ │ ├── static.h │ │ │ │ ├── transfer.h │ │ │ │ └── transform.h │ │ │ ├── float.h │ │ │ ├── graphics.h │ │ │ ├── graphics │ │ │ │ ├── axis.h │ │ │ │ └── fill.h │ │ │ ├── hmath │ │ │ │ ├── hdotp.h │ │ │ │ └── hsum.h │ │ │ ├── interpolation │ │ │ │ └── linear.h │ │ │ ├── mix.h │ │ │ ├── msmatrix.h │ │ │ ├── mxcsr.h │ │ │ ├── pan.h │ │ │ ├── pcomplex.h │ │ │ ├── pmath.h │ │ │ ├── pmath │ │ │ │ ├── abs_vv.h │ │ │ │ ├── fmop_kx.h │ │ │ │ ├── fmop_vv.h │ │ │ │ ├── lramp.h │ │ │ │ ├── minmax.h │ │ │ │ ├── normalize.h │ │ │ │ ├── op_kx.h │ │ │ │ ├── op_vv.h │ │ │ │ ├── sqr.h │ │ │ │ └── ssqrt.h │ │ │ ├── resampling.h │ │ │ ├── search │ │ │ │ └── minmax.h │ │ │ └── smath.h │ │ │ ├── sse2 │ │ │ ├── dynamics.h │ │ │ ├── dynamics │ │ │ │ ├── compressor.h │ │ │ │ ├── expander.h │ │ │ │ └── gate.h │ │ │ ├── float.h │ │ │ ├── graphics │ │ │ │ ├── axis.h │ │ │ │ ├── colors.h │ │ │ │ ├── effects.h │ │ │ │ └── pixelfmt.h │ │ │ ├── pmath.h │ │ │ ├── pmath │ │ │ │ ├── cos.h │ │ │ │ ├── exp.h │ │ │ │ ├── fmop_kx.h │ │ │ │ ├── fmop_vv.h │ │ │ │ ├── lanczos.h │ │ │ │ ├── log.h │ │ │ │ ├── op_kx.h │ │ │ │ ├── op_vv.h │ │ │ │ ├── pow.h │ │ │ │ └── sin.h │ │ │ └── search │ │ │ │ └── iminmax.h │ │ │ ├── sse3 │ │ │ ├── 3dmath.h │ │ │ ├── copy.h │ │ │ ├── correlation.h │ │ │ ├── filters │ │ │ │ ├── dynamic.h │ │ │ │ ├── static.h │ │ │ │ └── transform.h │ │ │ ├── graphics.h │ │ │ └── pcomplex.h │ │ │ └── sse4 │ │ │ └── 3dmath.h │ └── exports.h │ └── utest │ └── dsp │ ├── 3d │ └── helpers.h │ └── bitmap │ └── util.h ├── make ├── configure.mk ├── functions.mk ├── ld-windows.script ├── modules.mk ├── paths.mk ├── system.mk └── tools.mk ├── modules.mk ├── project.mk └── src ├── Makefile ├── main ├── aarch64 │ ├── aarch64.cpp │ └── asimd.cpp ├── arm │ ├── arm.cpp │ └── neon-d32.cpp ├── dsp.cpp ├── generic │ └── generic.cpp └── x86 │ ├── avx.cpp │ ├── avx2.cpp │ ├── avx512.cpp │ ├── sse.cpp │ ├── sse2.cpp │ ├── sse3.cpp │ ├── sse4.cpp │ └── x86.cpp └── test ├── init └── dsp.cpp ├── main.cpp ├── ptest ├── 3d │ ├── colocation_x2.cpp │ ├── colocation_x3.cpp │ └── raw_triangle.cpp ├── complex │ ├── div2.cpp │ ├── div3.cpp │ ├── mod.cpp │ ├── mul2.cpp │ ├── mul3.cpp │ └── rcp.cpp ├── convolve.cpp ├── copy │ ├── copy.cpp │ ├── fill.cpp │ ├── move.cpp │ └── reverse.cpp ├── corr_incr.cpp ├── corr_init.cpp ├── dynamics │ ├── compressor_x2_curve.cpp │ ├── compressor_x2_gain.cpp │ ├── dexpander_x1_curve.cpp │ ├── dexpander_x1_gain.cpp │ ├── gate_x1_curve.cpp │ ├── gate_x1_gain.cpp │ ├── uexpander_x1_curve.cpp │ └── uexpander_x1_gain.cpp ├── fft │ ├── fastconv.cpp │ ├── fft.cpp │ └── pfft.cpp ├── filters │ ├── bt.cpp │ ├── dynamic.cpp │ ├── mt.cpp │ ├── static.cpp │ └── transfer.cpp ├── float │ ├── limit.cpp │ ├── limit_saturate.cpp │ ├── sanitize.cpp │ └── saturation.cpp ├── graphics │ ├── abgr32_to_bgrff32.cpp │ ├── axis_lin1.cpp │ ├── axis_log1.cpp │ ├── axis_log2.cpp │ ├── effects.cpp │ ├── fill.cpp │ ├── hsla_to_rgba.cpp │ ├── pabc32_set_alpha.cpp │ ├── rgba.cpp │ ├── rgba_to_bgra32.cpp │ └── rgba_to_hsla.cpp ├── hmath │ ├── h_abs_dotp.cpp │ ├── h_abs_sum.cpp │ ├── h_dotp.cpp │ ├── h_sqr_dotp.cpp │ ├── h_sqr_sum.cpp │ └── h_sum.cpp ├── interpolation │ └── linear.cpp ├── mix2.cpp ├── mix3.cpp ├── mix4.cpp ├── msmatrix │ ├── conv2.cpp │ └── conv2x1.cpp ├── pan │ ├── depan_eqpow.cpp │ └── depan_lin.cpp ├── pcomplex │ ├── c2r.cpp │ ├── corr.cpp │ ├── div2.cpp │ ├── div3.cpp │ ├── mod.cpp │ ├── mul2.cpp │ ├── mul3.cpp │ ├── r2c.cpp │ ├── r2c_add.cpp │ ├── r2c_div.cpp │ ├── r2c_mul.cpp │ ├── r2c_rdiv.cpp │ ├── r2c_rsub.cpp │ ├── r2c_sub.cpp │ └── rcp.cpp ├── pmath │ ├── abs.cpp │ ├── abs_op2.cpp │ ├── abs_op3.cpp │ ├── cosf1.cpp │ ├── cosf2.cpp │ ├── cosf_kp1.cpp │ ├── exp1.cpp │ ├── exp2.cpp │ ├── fmop3.cpp │ ├── fmop4.cpp │ ├── fmop_k3.cpp │ ├── fmop_k4.cpp │ ├── lanczos1.cpp │ ├── logb1.cpp │ ├── logb2.cpp │ ├── logd1.cpp │ ├── logd2.cpp │ ├── loge1.cpp │ ├── loge2.cpp │ ├── lramp1.cpp │ ├── lramp2.cpp │ ├── lramp3.cpp │ ├── minmax2.cpp │ ├── minmax3.cpp │ ├── normalize1.cpp │ ├── normalize2.cpp │ ├── op2.cpp │ ├── op3.cpp │ ├── op_k2.cpp │ ├── op_k3.cpp │ ├── pow.cpp │ ├── sinf1.cpp │ ├── sinf2.cpp │ ├── sinf_kp1.cpp │ ├── sqr1.cpp │ ├── sqr2.cpp │ ├── ssqrt1.cpp │ └── ssqrt2.cpp ├── resampling │ ├── downsampling.cpp │ └── oversampling.cpp └── search │ ├── abs_max_index.cpp │ ├── abs_min_index.cpp │ ├── abs_minmax_index.cpp │ ├── max_index.cpp │ ├── min_index.cpp │ ├── minmax.cpp │ ├── minmax_index.cpp │ ├── sign_max.cpp │ ├── sign_min.cpp │ └── sign_minmax.cpp └── utest ├── 3d ├── angle.cpp ├── area.cpp ├── colocation_x2.cpp ├── colocation_x3.cpp ├── cull_triangle.cpp ├── edge.cpp ├── helpers.cpp ├── matrix.cpp ├── normal.cpp ├── plane.cpp ├── point.cpp ├── split_point.cpp ├── split_triangle.cpp ├── triangle.cpp ├── triplet.cpp └── vector.cpp ├── bitmap ├── b1b8.cpp ├── b2b8.cpp ├── b4b8.cpp ├── b8b8.cpp └── helpers.cpp ├── c_compat.cpp ├── coding └── base64.cpp ├── complex ├── div2.cpp ├── div3.cpp ├── mod.cpp ├── mul2.cpp ├── mul3.cpp └── rcp.cpp ├── convolve.cpp ├── copy ├── copy.cpp ├── fill.cpp ├── move.cpp └── reverse.cpp ├── corr_incr.cpp ├── corr_init.cpp ├── dsp └── bitmap │ └── util.cpp ├── dynamics ├── compressor_x2_curve.cpp ├── compressor_x2_gain.cpp ├── dexpander_x1_curve.cpp ├── dexpander_x1_gain.cpp ├── gate_x1_curve.cpp ├── gate_x1_gain.cpp ├── uexpander_x1_curve.cpp └── uexpander_x1_gain.cpp ├── fft ├── fastconv.cpp ├── fft.cpp ├── norm2.cpp ├── norm3.cpp └── pfft.cpp ├── filters ├── bt.cpp ├── dynamic.cpp ├── mt.cpp ├── static.cpp └── transfer.cpp ├── float ├── limit.cpp ├── limit_saturate.cpp ├── sanitize.cpp └── saturation.cpp ├── graphics ├── abgr32_to_bgrff32.cpp ├── axis_lin1.cpp ├── axis_log1.cpp ├── axis_log2.cpp ├── effects.cpp ├── fill.cpp ├── hsla_to_rgba.cpp ├── pabc32_set_alpha.cpp ├── rgba.cpp ├── rgba_to_bgra32.cpp └── rgba_to_hsla.cpp ├── hmath ├── h_abs_dotp.cpp ├── h_abs_sum.cpp ├── h_dotp.cpp ├── h_sqr_dotp.cpp ├── h_sqr_sum.cpp └── h_sum.cpp ├── interpolation └── linear.cpp ├── mix2.cpp ├── mix3.cpp ├── mix4.cpp ├── msmatrix ├── conv2.cpp └── conv2x1.cpp ├── pan ├── depan_eqpow.cpp └── depan_lin.cpp ├── pcomplex ├── c2r.cpp ├── corr.cpp ├── div2.cpp ├── div3.cpp ├── mod.cpp ├── mul.cpp ├── r2c.cpp ├── r2c_add.cpp ├── r2c_div.cpp ├── r2c_mul.cpp ├── r2c_rdiv.cpp ├── r2c_rsub.cpp ├── r2c_sub.cpp └── rcp.cpp ├── pmath ├── abs.cpp ├── abs_op2.cpp ├── abs_op3.cpp ├── cosf1.cpp ├── cosf2.cpp ├── cosf_kp1.cpp ├── exp1.cpp ├── exp2.cpp ├── fmop3.cpp ├── fmop4.cpp ├── fmop_k3.cpp ├── fmop_k4.cpp ├── lanczos1.cpp ├── logb1.cpp ├── logb2.cpp ├── logd1.cpp ├── logd2.cpp ├── loge1.cpp ├── loge2.cpp ├── lramp1.cpp ├── lramp2.cpp ├── lramp3.cpp ├── minmax2.cpp ├── minmax3.cpp ├── normalize1.cpp ├── normalize2.cpp ├── op2.cpp ├── op3.cpp ├── op_k2.cpp ├── op_k3.cpp ├── pow.cpp ├── sinf1.cpp ├── sinf2.cpp ├── sinf_kp1.cpp ├── sqr1.cpp ├── sqr2.cpp ├── ssqrt1.cpp └── ssqrt2.cpp ├── resampling ├── downsampling.cpp └── oversampling.cpp ├── search ├── abs_max_index.cpp ├── abs_min_index.cpp ├── abs_minmax_index.cpp ├── max_index.cpp ├── min_index.cpp ├── minmax.cpp ├── minmax_index.cpp ├── sign_max.cpp ├── sign_min.cpp └── sign_minmax.cpp └── smath └── ipowroot.cpp /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | liberapay: sadko4u 2 | patreon: sadko4u 3 | custom: 4 | - https://www.blockchain.com/btc/address/15X3AfDRF3EshSLBoK8UfHAsFr2TQsH8pk 5 | - https://etherscan.io/address/0x079b24da78d78302cd3cfbb80c728cd554606cc6 6 | - https://www.bountysource.com/teams/lsp-plugins 7 | - https://paypal.me/sadko4u 8 | -------------------------------------------------------------------------------- /.github/workflows/valgrind.supp: -------------------------------------------------------------------------------- 1 | { 2 | libdl is full of leaks 3 | Memcheck:Leak 4 | ... 5 | fun:_dl_open 6 | ... 7 | } 8 | { 9 | libdl is full of leaks 10 | Memcheck:Leak 11 | ... 12 | fun:_dl_close 13 | ... 14 | } 15 | { 16 | libdl is full of leaks 17 | Memcheck:Leak 18 | ... 19 | fun:_dl_init 20 | } 21 | { 22 | libdl is full of leaks 23 | Memcheck:Leak 24 | ... 25 | fun:_dl_allocate_tls 26 | ... 27 | } 28 | { 29 | libdl is full of leaks 30 | Memcheck:Leak 31 | ... 32 | fun:call_init.part.0 33 | } 34 | { 35 | ignore XInitThreads 36 | Memcheck:Leak 37 | ... 38 | fun:XInitThreads 39 | ... 40 | } 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.svn/* 2 | /.settings/* 3 | /.build/* 4 | /.test/* 5 | /Release 6 | *.log 7 | /gmon.out 8 | **/*.gmon 9 | *.core 10 | /.config.mk 11 | /modules/ 12 | /DebugLinux/ 13 | /DebugWin/ 14 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | lsp-dsp-lib 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.core.ccnature 24 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 25 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 26 | 27 | 28 | -------------------------------------------------------------------------------- /dependencies.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2025 Linux Studio Plugins Project 3 | # (C) 2025 Vladimir Sadovnikov 4 | # 5 | # This file is part of lsp-dsp-lib 6 | # 7 | # lsp-dsp-lib is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # any later version. 11 | # 12 | # lsp-dsp-lib is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with lsp-dsp-lib. If not, see . 19 | # 20 | 21 | # List of dependencies 22 | DEPENDENCIES = \ 23 | LIBPTHREAD \ 24 | LSP_COMMON_LIB 25 | 26 | TEST_DEPENDENCIES = \ 27 | LSP_TEST_FW 28 | 29 | #------------------------------------------------------------------------------ 30 | # Linux dependencies 31 | LINUX_DEPENDENCIES = 32 | 33 | LINUX_TEST_DEPENDENCIES = 34 | 35 | ifeq ($(PLATFORM),Linux) 36 | DEPENDENCIES += $(LINUX_DEPENDENCIES) 37 | TEST_DEPENDENCIES += $(LINUX_TEST_DEPENDENCIES) 38 | endif 39 | 40 | #------------------------------------------------------------------------------ 41 | # BSD dependencies 42 | BSD_DEPENDENCIES = 43 | 44 | BSD_TEST_DEPENDENCIES = 45 | 46 | ifeq ($(PLATFORM),BSD) 47 | DEPENDENCIES += $(BSD_DEPENDENCIES) 48 | TEST_DEPENDENCIES += $(BSD_TEST_DEPENDENCIES) 49 | endif 50 | 51 | #------------------------------------------------------------------------------ 52 | # Windows dependencies 53 | WINDOWS_DEPENDENCIES = 54 | 55 | WINDOWS_TEST_DEPENDENCIES = \ 56 | LIBSHLWAPI 57 | 58 | ifeq ($(PLATFORM),Windows) 59 | DEPENDENCIES += $(WINDOWS_DEPENDENCIES) 60 | TEST_DEPENDENCIES += $(WINDOWS_TEST_DEPENDENCIES) 61 | endif 62 | 63 | #------------------------------------------------------------------------------ 64 | # MacOS dependencies 65 | MACOS_DEPENDENCIES = 66 | 67 | MACOS_TEST_DEPENDENCIES = 68 | 69 | ifeq ($(PLATFORM),MacOS) 70 | DEPENDENCIES += $(MACOS_DEPENDENCIES) 71 | TEST_DEPENDENCIES += $(MACOS_TEST_DEPENDENCIES) 72 | endif 73 | 74 | #------------------------------------------------------------------------------ 75 | # Overall system dependencies 76 | ALL_DEPENDENCIES = \ 77 | $(DEPENDENCIES) \ 78 | $(LINUX_DEPENDENCIES) \ 79 | $(BSD_DEPENDENCIES) \ 80 | $(WINDOWS_DEPENDENCIES) \ 81 | $(MACOS_DEPENDENCIES) \ 82 | $(TEST_DEPENDENCIES) \ 83 | $(LINUX_TEST_DEPENDENCIES) \ 84 | $(BSD_TEST_DEPENDENCIES) \ 85 | $(WINDOWS_TEST_DEPENDENCIES) \ 86 | $(MACOS_TESTDEPENDENCIES) 87 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/bitmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 апр. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_BITMAP_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_BITMAP_H_ 24 | 25 | #include 26 | 27 | LSP_DSP_LIB_BEGIN_NAMESPACE 28 | 29 | typedef struct LSP_DSP_LIB_TYPE(bitmap_t) 30 | { 31 | int32_t width; 32 | int32_t height; 33 | int32_t stride; 34 | uint8_t *data; 35 | } LSP_DSP_LIB_TYPE(bitmap_t); 36 | 37 | 38 | typedef void (* LSP_DSP_LIB_TYPE(bitmap_render_func_t))( 39 | LSP_DSP_LIB_TYPE(bitmap_t) *dst, 40 | const LSP_DSP_LIB_TYPE(bitmap_t) *src, 41 | ssize_t x, 42 | ssize_t y); 43 | 44 | LSP_DSP_LIB_END_NAMESPACE 45 | 46 | #include 47 | #include 48 | #include 49 | #include 50 | 51 | #endif /* LSP_PLUG_IN_DSP_COMMON_BITMAP_H_ */ 52 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/bitmap/b1b8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 апр. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_BITMAP_B1B8_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_BITMAP_B1B8_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Put the source 1-bit bitmap to destination 8-bit bitmap, 29 | * the result pixel value will be computed as: result[i] = src[i] 30 | */ 31 | LSP_DSP_LIB_SYMBOL(void, bitmap_put_b1b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 32 | 33 | /** 34 | * Put the source 1-bit bitmap to destination 8-bit bitmap, 35 | * the result pixel value will be computed as: result[i] = saturate(dst[i] + src[i]) 36 | */ 37 | LSP_DSP_LIB_SYMBOL(void, bitmap_add_b1b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 38 | 39 | /** 40 | * Put the source 1-bit bitmap to destination 8-bit bitmap, 41 | * the result pixel value will be computed as: result[i] = saturate(dst[i] - src[i]) 42 | */ 43 | LSP_DSP_LIB_SYMBOL(void, bitmap_sub_b1b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 44 | 45 | /** 46 | * Put the source 1-bit bitmap to destination 8-bit bitmap, 47 | * the result pixel value will be computed as: result[i] = max(dst[i], src[i]) 48 | */ 49 | LSP_DSP_LIB_SYMBOL(void, bitmap_max_b1b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 50 | 51 | /** 52 | * Put the source 1-bit bitmap to destination 8-bit bitmap, 53 | * the result pixel value will be computed as: result[i] = min(dst[i], src[i]) 54 | */ 55 | LSP_DSP_LIB_SYMBOL(void, bitmap_min_b1b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 56 | 57 | #endif /* LSP_PLUG_IN_DSP_COMMON_BITMAP_B1B8_H_ */ 58 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/bitmap/b2b8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 апр. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_BITMAP_B2B8_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_BITMAP_B2B8_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Put the source 2-bit bitmap to destination 8-bit bitmap, 29 | * the result pixel value will be computed as: result[i] = src[i] 30 | */ 31 | LSP_DSP_LIB_SYMBOL(void, bitmap_put_b2b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 32 | 33 | /** 34 | * Put the source 2-bit bitmap to destination 8-bit bitmap, 35 | * the result pixel value will be computed as: result[i] = saturate(dst[i] + src[i]) 36 | */ 37 | LSP_DSP_LIB_SYMBOL(void, bitmap_add_b2b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 38 | 39 | /** 40 | * Put the source 2-bit bitmap to destination 8-bit bitmap, 41 | * the result pixel value will be computed as: result[i] = saturate(dst[i] - src[i]) 42 | */ 43 | LSP_DSP_LIB_SYMBOL(void, bitmap_sub_b2b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 44 | 45 | /** 46 | * Put the source 2-bit bitmap to destination 8-bit bitmap, 47 | * the result pixel value will be computed as: result[i] = max(dst[i], src[i]) 48 | */ 49 | LSP_DSP_LIB_SYMBOL(void, bitmap_max_b2b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 50 | 51 | /** 52 | * Put the source 2-bit bitmap to destination 8-bit bitmap, 53 | * the result pixel value will be computed as: result[i] = min(dst[i], src[i]) 54 | */ 55 | LSP_DSP_LIB_SYMBOL(void, bitmap_min_b2b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 56 | 57 | 58 | #endif /* LSP_PLUG_IN_DSP_COMMON_BITMAP_B2B8_H_ */ 59 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/bitmap/b4b8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 апр. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_BITMAP_B4B8_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_BITMAP_B4B8_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Put the source 4-bit bitmap to destination 8-bit bitmap, 29 | * the result pixel value will be computed as: result[i] = src[i] 30 | */ 31 | LSP_DSP_LIB_SYMBOL(void, bitmap_put_b4b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 32 | 33 | /** 34 | * Put the source 4-bit bitmap to destination 8-bit bitmap, 35 | * the result pixel value will be computed as: result[i] = saturate(dst[i] + src[i]) 36 | */ 37 | LSP_DSP_LIB_SYMBOL(void, bitmap_add_b4b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 38 | 39 | /** 40 | * Put the source 4-bit bitmap to destination 8-bit bitmap, 41 | * the result pixel value will be computed as: result[i] = saturate(dst[i] - src[i]) 42 | */ 43 | LSP_DSP_LIB_SYMBOL(void, bitmap_sub_b4b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 44 | 45 | /** 46 | * Put the source 4-bit bitmap to destination 8-bit bitmap, 47 | * the result pixel value will be computed as: result[i] = max(dst[i], src[i]) 48 | */ 49 | LSP_DSP_LIB_SYMBOL(void, bitmap_max_b4b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 50 | 51 | /** 52 | * Put the source 4-bit bitmap to destination 8-bit bitmap, 53 | * the result pixel value will be computed as: result[i] = min(dst[i], src[i]) 54 | */ 55 | LSP_DSP_LIB_SYMBOL(void, bitmap_min_b4b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 56 | 57 | 58 | 59 | #endif /* LSP_PLUG_IN_DSP_COMMON_BITMAP_B4B8_H_ */ 60 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/bitmap/b8b8.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 апр. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_BITMAP_B8B8_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_BITMAP_B8B8_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Put the source 8-bit bitmap to destination 8-bit bitmap, 29 | * the result pixel value will be computed as: result[i] = src[i] 30 | */ 31 | LSP_DSP_LIB_SYMBOL(void, bitmap_put_b8b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 32 | 33 | /** 34 | * Put the source 8-bit bitmap to destination 8-bit bitmap, 35 | * the result pixel value will be computed as: result[i] = saturate(dst[i] + src[i]) 36 | */ 37 | LSP_DSP_LIB_SYMBOL(void, bitmap_add_b8b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 38 | 39 | /** 40 | * Put the source 8-bit bitmap to destination 8-bit bitmap, 41 | * the result pixel value will be computed as: result[i] = saturate(dst[i] - src[i]) 42 | */ 43 | LSP_DSP_LIB_SYMBOL(void, bitmap_sub_b8b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 44 | 45 | /** 46 | * Put the source 8-bit bitmap to destination 8-bit bitmap, 47 | * the result pixel value will be computed as: result[i] = max(dst[i], src[i]) 48 | */ 49 | LSP_DSP_LIB_SYMBOL(void, bitmap_max_b8b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 50 | 51 | /** 52 | * Put the source 8-bit bitmap to destination 8-bit bitmap, 53 | * the result pixel value will be computed as: result[i] = min(dst[i], src[i]) 54 | */ 55 | LSP_DSP_LIB_SYMBOL(void, bitmap_min_b8b8, LSP_DSP_LIB_TYPE(bitmap_t) *dst, const LSP_DSP_LIB_TYPE(bitmap_t) *src, ssize_t x, ssize_t y); 56 | 57 | #endif /* LSP_PLUG_IN_DSP_COMMON_BITMAP_B8B8_H_ */ 58 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/coding.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_CODING_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_CODING_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Encode base-64 value, the function does not generate padding '=' characters, 29 | * since the estimated size of output data is known, caller should control size 30 | * of input buffer to prevent the algorithm from emitting end-of-sequence 31 | * @param dst destination buffer, should be at least 4 bytes large for encoding 32 | * @param dst_left number of bytes left in destination buffer 33 | * @param src source buffer 34 | * @param src_left number of bytes left in source buffer 35 | * @return number of bytes of source buffer processed 36 | */ 37 | LSP_DSP_LIB_SYMBOL(size_t, base64_enc, void *dst, size_t *dst_left, const void *src, size_t *src_left); 38 | 39 | /** 40 | * Decode base-64 value, the function treats '=' characters as error (for optimization purposes) 41 | * since the estimated size of output data is known, caller should control size 42 | * of input buffer to prevent the algorithm from emitting end-of-sequence 43 | * @param dst destination buffer, should be at leadt 3 bytes large for decoding 44 | * @param dst_left number of bytes left in destination buffer 45 | * @param src source buffer 46 | * @param src_left number of bytes left in source buffer 47 | * @return number of bytes decoded into destination buffer, negative value on illegal character in sequence 48 | */ 49 | LSP_DSP_LIB_SYMBOL(ssize_t, base64_dec, void *dst, size_t *dst_left, const void *src, size_t *src_left); 50 | 51 | #endif /* LSP_PLUG_IN_DSP_COMMON_CODING_H_ */ 52 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_CONTEXT_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_CONTEXT_H_ 24 | 25 | #include 26 | 27 | LSP_DSP_LIB_BEGIN_NAMESPACE 28 | 29 | #pragma pack(push, 1) 30 | /** 31 | * DSP context to store and restore machine state 32 | */ 33 | typedef struct LSP_DSP_LIB_TYPE(context_t) 34 | { 35 | uint32_t top; 36 | uint32_t data[15]; 37 | } LSP_DSP_LIB_TYPE(context_t); 38 | #pragma pack(pop) 39 | 40 | typedef struct LSP_DSP_LIB_TYPE(info_t) 41 | { 42 | const char *arch; /* Architecture information */ 43 | const char *cpu; /* CPU information */ 44 | const char *model; /* CPU model information */ 45 | const char *features; /* CPU features */ 46 | } LSP_DSP_LIB_TYPE(info_t); 47 | 48 | // Start and finish types 49 | typedef void (* LSP_DSP_LIB_TYPE(start_t))(LSP_DSP_LIB_TYPE(context_t) *ctx); 50 | typedef void (* LSP_DSP_LIB_TYPE(finish_t))(LSP_DSP_LIB_TYPE(context_t) *ctx); 51 | 52 | LSP_DSP_LIB_END_NAMESPACE 53 | 54 | #ifdef LSP_DSP_LIB_USE_CXX_IFACE 55 | namespace lsp 56 | { 57 | namespace dsp 58 | { 59 | /** Initialize DSP 60 | * 61 | */ 62 | LSP_DSP_LIB_PUBLIC 63 | void init(); 64 | } 65 | } 66 | #else 67 | /** Initialize DSP 68 | * 69 | */ 70 | LSP_DSP_LIB_PUBLIC 71 | void LSP_DSP_LIB_MANGLE(init()); 72 | #endif /* LSP_DSP_LIB_USE_CXX_IFACE */ 73 | 74 | 75 | /** Start DSP processing, save machine context 76 | * 77 | * @param ctx structure to save context 78 | */ 79 | LSP_DSP_LIB_SYMBOL(void, start, LSP_DSP_LIB_TYPE(context_t) *ctx); 80 | 81 | /** Finish DSP processing, restore machine context 82 | * 83 | * @param ctx structure to restore context 84 | */ 85 | LSP_DSP_LIB_SYMBOL(void, finish, LSP_DSP_LIB_TYPE(context_t) *ctx); 86 | 87 | /** 88 | * Get DSP information, returns pointer to dsp::info_t structure 89 | * that can be freed by free() 90 | * @return pointer to dsp::info_t structure 91 | */ 92 | LSP_DSP_LIB_SYMBOL(LSP_DSP_LIB_TYPE(info_t) *, info, ); 93 | 94 | #endif /* LSP_PLUG_IN_DSP_COMMON_CONTEXT_H_ */ 95 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/convolution.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_CONVOLUTION_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_CONVOLUTION_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Calculate convolution of source signal and convolution and add to destination buffer 29 | * @param dst destination buffer to add result of convolution 30 | * @param src source signal 31 | * @param conv convolution 32 | * @param length length of convolution 33 | * @param count the number of samples in source signal to process 34 | */ 35 | LSP_DSP_LIB_SYMBOL(void, convolve, float *dst, const float *src, const float *conv, size_t length, size_t count); 36 | 37 | #endif /* LSP_PLUG_IN_DSP_COMMON_CONVOLUTION_H_ */ 38 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/copy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_COPY_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_COPY_H_ 24 | 25 | #include 26 | 27 | /** Copy data: dst[i] = src[i] 28 | * 29 | * @param dst destination pointer 30 | * @param src source pointer 31 | * @param count number of elements 32 | */ 33 | LSP_DSP_LIB_SYMBOL(void, copy, float *dst, const float *src, size_t count); 34 | 35 | /** Move data: dst[i] = src[i] 36 | * 37 | * @param dst destination pointer 38 | * @param src source pointer 39 | * @param count number of elements 40 | */ 41 | LSP_DSP_LIB_SYMBOL(void, move, float *dst, const float *src, size_t count); 42 | 43 | /** Fill data: dst[i] = value 44 | * 45 | * @param dst destination pointer 46 | * @param value filling value 47 | * @param count number of elements 48 | */ 49 | LSP_DSP_LIB_SYMBOL(void, fill, float *dst, float value, size_t count); 50 | 51 | /** Fill data with zeros: dst[i] = 0.0f 52 | * 53 | * @param dst destination pointer 54 | * @param count number of elements 55 | */ 56 | LSP_DSP_LIB_SYMBOL(void, fill_zero, float *dst, size_t count); 57 | 58 | /** Fill data with ones: dst[i] = 1.0f 59 | * 60 | * @param dst destination pointer 61 | * @param count number of elements 62 | */ 63 | LSP_DSP_LIB_SYMBOL(void, fill_one, float *dst, size_t count); 64 | 65 | /** Fill data with negative ones: dst[i] = -1.0f 66 | * 67 | * @param dst destination pointer 68 | * @param count number of elements 69 | */ 70 | LSP_DSP_LIB_SYMBOL(void, fill_minus_one, float *dst, size_t count); 71 | 72 | /** Reverse the order of samples: dst[i] <=> dst[count - i - 1] 73 | * 74 | * @param dst the buffer to reverse 75 | * @param count number of samples in buffer 76 | */ 77 | LSP_DSP_LIB_SYMBOL(void, reverse1, float *dst, size_t count); 78 | 79 | /** Reverse the order of samples: dst[i] <=> src[count - i - 1] 80 | * 81 | * @param dst destination buffer to reverse 82 | * @param src source buffer to reverse 83 | * @param count number of samples in buffer 84 | */ 85 | LSP_DSP_LIB_SYMBOL(void, reverse2, float *dst, const float *src, size_t count); 86 | 87 | #endif /* LSP_PLUG_IN_DSP_COMMON_COPY_H_ */ 88 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 5 окт. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_DYNAMICS_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_H_ 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | 33 | #endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_H_ */ 34 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/dynamics/compressor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 5 окт. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_DYNAMICS_COMPRESSOR_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_COMPRESSOR_H_ 24 | 25 | #include 26 | #include 27 | 28 | 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); 29 | 30 | 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); 31 | 32 | #endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_COMPRESSOR_H_ */ 33 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/dynamics/expander.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 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 . 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 26 | #include 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_ */ 36 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/dynamics/gate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 19 окт. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_DYNAMICS_GATE_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_DYNAMICS_GATE_H_ 24 | 25 | #include 26 | #include 27 | 28 | LSP_DSP_LIB_SYMBOL(void, gate_x1_gain, float *dst, const float *src, const LSP_DSP_LIB_TYPE(gate_knee_t) *c, size_t count); 29 | 30 | LSP_DSP_LIB_SYMBOL(void, gate_x1_curve, float *dst, const float *src, const LSP_DSP_LIB_TYPE(gate_knee_t) *c, size_t count); 31 | 32 | 33 | #endif /* LSP_PLUG_IN_DSP_COMMON_DYNAMICS_GATE_H_ */ 34 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/fastconv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_FASTCONV_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_FASTCONV_H_ 24 | 25 | #include 26 | 27 | /** Parse input real data to fast convolution data 28 | * 29 | * @param dst destination buffer of 2^(rank+1) floats 30 | * @param src source real data of 2^(rank-1) floats 31 | * @param rank the convolution rank 32 | */ 33 | LSP_DSP_LIB_SYMBOL(void, fastconv_parse, float *dst, const float *src, size_t rank); 34 | 35 | /** Parse input real data to fast convolution data, 36 | * convolve with another convolution data, 37 | * restore data to real data and add to output buffer 38 | * 39 | * @param dst target real data of 2^rank floats to store convolved data 40 | * @param tmp temporary buffer of 2^(rank+1) floats to store intermediate data 41 | * @param c fast convolution data of 2^(rank+1) floats to apply to the buffer 42 | * @param src source real data of 2^(rank-1) floats 43 | * @param rank the convolution rank 44 | */ 45 | LSP_DSP_LIB_SYMBOL(void, fastconv_parse_apply, float *dst, float *tmp, const float *c, const float *src, size_t rank); 46 | 47 | /** Restore convolution to real data, 48 | * modifies the source fast convolution data 49 | * 50 | * @param dst destination real data of 2^rank floats 51 | * @param src source fast convolution data of 2^(rank+1) floats 52 | * @param rank the convolution rank 53 | */ 54 | LSP_DSP_LIB_SYMBOL(void, fastconv_restore, float *dst, float *src, size_t rank); 55 | 56 | /** Convolve two convolutions and restore data to real data 57 | * and add to output buffer 58 | * 59 | * @param dst target real data of 2^rank floats to apply convolved data 60 | * @param tmp temporary buffer of 2^(rank+1) floats to store intermediate data 61 | * @param c1 fast convolution data of 2^(rank+1) floats 62 | * @param c2 fast convolution data of 2^(rank+1) floats 63 | * @param rank the convolution rank 64 | */ 65 | LSP_DSP_LIB_SYMBOL(void, fastconv_apply, float *dst, float *tmp, const float *c1, const float *c2, size_t rank); 66 | 67 | #endif /* LSP_PLUG_IN_DSP_COMMON_FASTCONV_H_ */ 68 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/filters.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_FILTERS_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_FILTERS_H_ 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #endif /* LSP_PLUG_IN_DSP_COMMON_FILTERS_H_ */ 34 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/filters/static.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_FILTERS_STATIC_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_FILTERS_STATIC_H_ 24 | 25 | #include 26 | #include 27 | 28 | /** Process single bi-quadratic filter for multiple samples 29 | * 30 | * @param dst destination samples 31 | * @param src source samples 32 | * @param count number of samples to process 33 | * @param f bi-quadratic filter structure 34 | */ 35 | LSP_DSP_LIB_SYMBOL(void, biquad_process_x1, float *dst, const float *src, size_t count, LSP_DSP_LIB_TYPE(biquad_t) *f); 36 | 37 | /** Process two bi-quadratic filters for multiple samples simultaneously 38 | * 39 | * @param dst destination samples 40 | * @param src source samples 41 | * @param count number of samples to process 42 | * @param f bi-quadratic filter structure 43 | */ 44 | LSP_DSP_LIB_SYMBOL(void, biquad_process_x2, float *dst, const float *src, size_t count, LSP_DSP_LIB_TYPE(biquad_t) *f); 45 | 46 | /** Process four bi-quadratic filters for multiple samples simultaneously 47 | * 48 | * @param dst destination samples 49 | * @param src source samples 50 | * @param count number of samples to process 51 | * @param f bi-quadratic filter structure 52 | */ 53 | LSP_DSP_LIB_SYMBOL(void, biquad_process_x4, float *dst, const float *src, size_t count, LSP_DSP_LIB_TYPE(biquad_t) *f); 54 | 55 | /** Process eight bi-quadratic filters for multiple samples simultaneously 56 | * 57 | * @param dst destination samples 58 | * @param src source samples 59 | * @param count number of samples to process 60 | * @param f bi-quadratic filter structure 61 | */ 62 | LSP_DSP_LIB_SYMBOL(void, biquad_process_x8, float *dst, const float *src, size_t count, LSP_DSP_LIB_TYPE(biquad_t) *f); 63 | 64 | #endif /* LSP_PLUG_IN_DSP_COMMON_FILTERS_STATIC_H_ */ 65 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/filters/transfer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_FILTERS_TRANSFER_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_FILTERS_TRANSFER_H_ 24 | 25 | #include 26 | #include 27 | 28 | /** 29 | * Compute filter transfer function, computes complex dst = H(f) 30 | * @param re destination to store transfer function (real value) 31 | * @param im destination to store transfer function (imaginary value) 32 | * @param c filter cascade 33 | * @param freq normalized frequency array 34 | * @param count size of frequency array 35 | */ 36 | LSP_DSP_LIB_SYMBOL(void, filter_transfer_calc_ri, float *re, float *im, const LSP_DSP_LIB_TYPE(f_cascade_t) *c, const float *freq, size_t count); 37 | 38 | /** 39 | * Apply filter transfer function, computes complex dst = dst * H(f) 40 | * @param re destination to apply transfer function (real value) 41 | * @param im destination to apply transfer function (imaginary value) 42 | * @param c filter cascade 43 | * @param freq normalized frequency array 44 | * @param count size of frequency array 45 | */ 46 | LSP_DSP_LIB_SYMBOL(void, filter_transfer_apply_ri, float *re, float *im, const LSP_DSP_LIB_TYPE(f_cascade_t) *c, const float *freq, size_t count); 47 | 48 | /** 49 | * Compute filter transfer function, computes complex dst = H(f) 50 | * @param dst destination to store transfer function (packed complex value) 51 | * @param c filter cascade 52 | * @param freq normalized frequency array 53 | * @param count size of frequency array 54 | */ 55 | LSP_DSP_LIB_SYMBOL(void, filter_transfer_calc_pc, float *dst, const LSP_DSP_LIB_TYPE(f_cascade_t) *c, const float *freq, size_t count); 56 | 57 | /** 58 | * Apply filter transfer function, computes complex dst = dst * H(f) 59 | * @param dst destination to apply transfer function (packed complex value) 60 | * @param c filter cascade 61 | * @param freq normalized frequency array 62 | * @param count size of frequency array 63 | */ 64 | LSP_DSP_LIB_SYMBOL(void, filter_transfer_apply_pc, float *dst, const LSP_DSP_LIB_TYPE(f_cascade_t) *c, const float *freq, size_t count); 65 | 66 | 67 | #endif /* LSP_PLUG_IN_DSP_COMMON_FILTERS_TRANSFER_H_ */ 68 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/hmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_HMATH_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_HMATH_H_ 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #endif /* LSP_PLUG_IN_DSP_COMMON_HMATH_H_ */ 31 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/hmath/hdotp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_HMATH_HDOTP_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_HMATH_HDOTP_H_ 24 | 25 | #include 26 | 27 | /** Calculate dot product: sum {from 0 to count-1} (a[i] * b[i]) 28 | * 29 | * @param a first vector 30 | * @param b second vector 31 | * @param count number of elements 32 | * @return scalar multiplication 33 | */ 34 | LSP_DSP_LIB_SYMBOL(float, h_dotp, const float *a, const float *b, size_t count); 35 | 36 | /** Calculate dot product of squares: sum {from 0 to count-1} (sqr(a[i]) * sqr(b[i])) 37 | * 38 | * @param a first vector 39 | * @param b second vector 40 | * @param count number of elements 41 | * @return scalar multiplication 42 | */ 43 | LSP_DSP_LIB_SYMBOL(float, h_sqr_dotp, const float *a, const float *b, size_t count); 44 | 45 | /** Calculate dot product of absolute values: sum {from 0 to count-1} (abs(a[i]) * abs(b[i])) 46 | * 47 | * @param a first vector 48 | * @param b second vector 49 | * @param count number of elements 50 | * @return scalar multiplication 51 | */ 52 | LSP_DSP_LIB_SYMBOL(float, h_abs_dotp, const float *a, const float *b, size_t count); 53 | 54 | #endif /* LSP_PLUG_IN_DSP_COMMON_HMATH_HDOTP_H_ */ 55 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/hmath/hsum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_HMATH_HSUM_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_HMATH_HSUM_H_ 24 | 25 | #include 26 | 27 | /** Calculate horizontal sum: result = sum (i) from 0 to count-1 src[i] 28 | * 29 | * @param src vector to summarize 30 | * @param count number of elements 31 | * @return status of operation 32 | */ 33 | LSP_DSP_LIB_SYMBOL(float, h_sum, const float *src, size_t count); 34 | 35 | /** Calculate horizontal sum: result = sum (i) from 0 to count-1 sqr(src[i]) 36 | * 37 | * @param src vector to summarize 38 | * @param count number of elements 39 | * @return status of operation 40 | */ 41 | LSP_DSP_LIB_SYMBOL(float, h_sqr_sum, const float *src, size_t count); 42 | 43 | /** Calculate horizontal sum of absolute values: result = sum (i) from 0 to count-1 abs(src[i]) 44 | * 45 | * @param src vector to summarize 46 | * @param count number of elements 47 | * @return status of operation 48 | */ 49 | LSP_DSP_LIB_SYMBOL(float, h_abs_sum, const float *src, size_t count); 50 | 51 | #endif /* LSP_PLUG_IN_DSP_COMMON_HMATH_HSUM_H_ */ 52 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/interpolation.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 13 дек. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_INTERPOLATION_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_INTERPOLATION_H_ 24 | 25 | #include 26 | 27 | #endif /* INCLUDE_LSP_PLUG_IN_DSP_COMMON_INTERPOLATION_H_ */ 28 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/mix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_MIX_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_MIX_H_ 24 | 25 | #include 26 | 27 | /** Calculate dst[i] = dst[i] * k1 + src[i] * k2 28 | * 29 | */ 30 | LSP_DSP_LIB_SYMBOL(void, mix2, float *dst, const float *src, float k1, float k2, size_t count); 31 | 32 | /** Calculate dst[i] = src1[i] * k1 + src2[i] * k2 33 | * 34 | */ 35 | LSP_DSP_LIB_SYMBOL(void, mix_copy2, float *dst, const float *src1, const float *src2, float k1, float k2, size_t count); 36 | 37 | /** Calculate dst[i] = dst[i] + src1[i] * k1 + src2[i] * k2 38 | * 39 | */ 40 | LSP_DSP_LIB_SYMBOL(void, mix_add2, float *dst, const float *src1, const float *src2, float k1, float k2, size_t count); 41 | 42 | /** Calculate dst[i] = dst[i] * k1 + src1[i] * k2 + src2[i] * k3 43 | * 44 | */ 45 | LSP_DSP_LIB_SYMBOL(void, mix3, float *dst, const float *src1, const float *src2, float k1, float k2, float k3, size_t count); 46 | 47 | /** Calculate dst[i] = src1[i] * k1 + src2[i] * k2 + src3 * k3 48 | * 49 | */ 50 | LSP_DSP_LIB_SYMBOL(void, mix_copy3, float *dst, const float *src1, const float *src2, const float *src3, float k1, float k2, float k3, size_t count); 51 | 52 | /** Calculate dst[i] = dst[i] + src1[i] * k1 + src2[i] * k2 + src3 * k3 53 | * 54 | */ 55 | LSP_DSP_LIB_SYMBOL(void, mix_add3, float *dst, const float *src1, const float *src2, const float *src3, float k1, float k2, float k3, size_t count); 56 | 57 | /** Calculate dst[i] = dst[i] * k1 + src1[i] * k2 + src2[i] * k3 + src3[i] * k4 58 | * 59 | */ 60 | LSP_DSP_LIB_SYMBOL(void, mix4, float *dst, const float *src1, const float *src2, const float *src3, float k1, float k2, float k3, float k4, size_t count); 61 | 62 | /** Calculate dst[i] = src1[i] * k1 + src2[i] * k2 + src3 * k3 + src4 * k4 63 | * 64 | */ 65 | LSP_DSP_LIB_SYMBOL(void, mix_copy4, float *dst, const float *src1, const float *src2, const float *src3, const float *src4, float k1, float k2, float k3, float k4, size_t count); 66 | 67 | /** Calculate dst[i] = dst[i] + src1[i] * k1 + src2[i] * k2 + src3 * k3 + src4 * k4 68 | * 69 | */ 70 | LSP_DSP_LIB_SYMBOL(void, mix_add4, float *dst, const float *src1, const float *src2, const float *src3, const float *src4, float k1, float k2, float k3, float k4, size_t count); 71 | 72 | #endif /* LSP_PLUG_IN_DSP_COMMON_MIX_H_ */ 73 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/msmatrix.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_MSMATRIX_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_MSMATRIX_H_ 24 | 25 | #include 26 | 27 | /** Convert stereo signal to mid-side signal 28 | * 29 | * @param m mid signal 30 | * @param s side signal 31 | * @param l left signal 32 | * @param r right signal 33 | * @param count number of samples to process 34 | */ 35 | LSP_DSP_LIB_SYMBOL(void, lr_to_ms, float *m, float *s, const float *l, const float *r, size_t count); 36 | 37 | /** Convert stereo signal to middle signal 38 | * 39 | * @param m mid signal 40 | * @param l left channel 41 | * @param r right channel 42 | * @param count number of samples to process 43 | */ 44 | LSP_DSP_LIB_SYMBOL(void, lr_to_mid, float *m, const float *l, const float *r, size_t count); 45 | 46 | /** Convert stereo signal to side signal 47 | * 48 | * @param s side signal 49 | * @param l left channel 50 | * @param r right channel 51 | * @param count number of samples to process 52 | */ 53 | LSP_DSP_LIB_SYMBOL(void, lr_to_side, float *s, const float *l, const float *r, size_t count); 54 | 55 | /** Convert mid-side signal to left-right signal 56 | * 57 | * @param l left signal 58 | * @param r right signal 59 | * @param m mid signal 60 | * @param s side signal 61 | * @param count number of samples to process 62 | */ 63 | LSP_DSP_LIB_SYMBOL(void, ms_to_lr, float *l, float *r, const float *m, const float *s, size_t count); 64 | 65 | /** Convert mid-side signal to left signal 66 | * 67 | * @param l left signal 68 | * @param m mid signal 69 | * @param s side signal 70 | * @param count number of samples to process 71 | */ 72 | LSP_DSP_LIB_SYMBOL(void, ms_to_left, float *l, const float *m, const float *s, size_t count); 73 | 74 | /** Convert mid-side signal to right signal 75 | * 76 | * @param r right signal 77 | * @param m mid signal 78 | * @param s side signal 79 | * @param count number of samples to process 80 | */ 81 | LSP_DSP_LIB_SYMBOL(void, ms_to_right, float *r, const float *m, const float *s, size_t count); 82 | 83 | #endif /* LSP_PLUG_IN_DSP_COMMON_MSMATRIX_H_ */ 84 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Linux Studio Plugins Project 3 | * (C) 2024 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 10 нояб. 2024 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PAN_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PAN_H_ 24 | 25 | #include 26 | 27 | LSP_DSP_LIB_BEGIN_NAMESPACE 28 | 29 | #pragma pack(push, 1) 30 | 31 | /** 32 | * Definition for the panorama calulation function (parallel form) 33 | * 34 | * @param dst destination buffer to store value 35 | * @param l left channel data 36 | * @param r right channel data 37 | * @param dfl default value if it is not possible to compute panorama 38 | * @param count number of samples to process 39 | */ 40 | typedef void (* LSP_DSP_LIB_TYPE(depan_t))(float *dst, const float *l, const float *r, float dfl, size_t count); 41 | 42 | #pragma pack(pop) 43 | 44 | LSP_DSP_LIB_END_NAMESPACE 45 | 46 | /** 47 | * Calculate the linear pan law panorama position between left and right channels (parallel form): 48 | * pan = abs(R) / (abs(L) + abs(R)) 49 | * 50 | * @param dst destination buffer to store value 51 | * @param l left channel data 52 | * @param r right channel data 53 | * @param dfl default value if it is not possible to compute panorama 54 | * @param count number of samples to process 55 | */ 56 | LSP_DSP_LIB_SYMBOL(void, depan_lin, float *dst, const float *l, const float *r, float dfl, size_t count); 57 | 58 | /** 59 | * Calculate the equal power pan law (quadratic) panorama position between left and right channels (parallel form): 60 | * pan = R^2 / (L^2 + R^2) 61 | * 62 | * @param dst destination buffer to store value 63 | * @param l left channel data 64 | * @param r right channel data 65 | * @param dfl default value if it is not possible to compute panorama 66 | * @param count number of samples to process 67 | */ 68 | LSP_DSP_LIB_SYMBOL(void, depan_eqpow, float *dst, const float *l, const float *r, float dfl, size_t count); 69 | 70 | #endif /* LSP_PLUG_IN_DSP_COMMON_PAN_H_ */ 71 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_H_ 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | 44 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_H_ */ 45 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/cos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 10 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_COS_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_COS_H_ 24 | 25 | /** 26 | * Calculate cosine function: dst[i] = cos(dst[i]) 27 | * 28 | * @param dst destination vector 29 | * @param count number of elements 30 | */ 31 | LSP_DSP_LIB_SYMBOL(void, cosf1, float *dst, size_t count); 32 | 33 | /** 34 | * Calculate cosine function: dst[i] = cos(src[i]) 35 | * 36 | * @param dst destination vector 37 | * @param src source vector 38 | * @param count number of elements 39 | */ 40 | LSP_DSP_LIB_SYMBOL(void, cosf2, float *dst, const float *src, size_t count); 41 | 42 | /** 43 | * Calculate cosine function with generated argument: dst[i] = cos(k*i + p) 44 | * 45 | * @param dst destination vector 46 | * @param k phase step 47 | * @param p initial phase 48 | * @param count number of elements 49 | */ 50 | LSP_DSP_LIB_SYMBOL(void, cosf_kp1, float *dst, float k, float p, size_t count); 51 | 52 | 53 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_COS_H_ */ 54 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/exp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_EXP_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_EXP_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Compute dst[i] = exp(dst[i]) 29 | * @param dst destination 30 | * @param count number of elements in destination 31 | */ 32 | LSP_DSP_LIB_SYMBOL(void, exp1, float *dst, size_t count); 33 | 34 | /** 35 | * Compute dst[i] = exp(src[i]) 36 | * @param dst destination 37 | * @param src source 38 | * @param count number of elements in source 39 | */ 40 | LSP_DSP_LIB_SYMBOL(void, exp2, float *dst, const float *src, size_t count); 41 | 42 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_EXP_H_ */ 43 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/lanczos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 10 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_LANCZOS_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_LANCZOS_H_ 24 | 25 | /** 26 | * Calculate lanczos filter response function with generated argument: 27 | * 28 | * for each x = PI * (k*i - p) 29 | * 30 | * { 1.0 if fabsf(x) <= 1e-6 31 | * dst[i] = { sinc(x) * sinc(x*a)/(a * x^2) if fabsf(x) < t and fabsf(x) >= 1e-6 32 | * { 0.0 otherwise 33 | * 34 | * @param dst destination vector 35 | * @param src source vector 36 | * @param k number of samples per lobe multiplied by PI 37 | * @param p shift in lobes multiplied by PI 38 | * @param t the number of lobes multiplied by PI 39 | * @param a reverse number of lobes 40 | * @param count number of elements 41 | */ 42 | LSP_DSP_LIB_SYMBOL(void, lanczos1, float *dst, float k, float p, float t, float a, size_t count); 43 | 44 | 45 | 46 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_SINCSINC_H_ */ 47 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_LOG_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_LOG_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Compute binary logarithm: dst[i] = log(2, dst[i]) 29 | * @param dst destination 30 | * @param count number of elements in destination 31 | */ 32 | LSP_DSP_LIB_SYMBOL(void, logb1, float *dst, size_t count); 33 | 34 | /** 35 | * Compute binary logarithm: dst[i] = log(2, src[i]) 36 | * @param dst destination 37 | * @param src source 38 | * @param count number of elements in source 39 | */ 40 | LSP_DSP_LIB_SYMBOL(void, logb2, float *dst, const float *src, size_t count); 41 | 42 | /** 43 | * Compute natural logarithm: dst[i] = log(E, dst[i]) 44 | * @param dst destination 45 | * @param count number of elements in destination 46 | */ 47 | LSP_DSP_LIB_SYMBOL(void, loge1, float *dst, size_t count); 48 | 49 | /** 50 | * Compute natural logarithm: dst[i] = log(E, src[i]) 51 | * @param dst destination 52 | * @param src source 53 | * @param count number of elements in source 54 | */ 55 | LSP_DSP_LIB_SYMBOL(void, loge2, float *dst, const float *src, size_t count); 56 | 57 | /** 58 | * Compute decimal logarithm: dst[i] = log(10, dst[i]) 59 | * @param dst destination 60 | * @param count number of elements in destination 61 | */ 62 | LSP_DSP_LIB_SYMBOL(void, logd1, float *dst, size_t count); 63 | 64 | /** 65 | * Compute decimal logarithm: dst[i] = log(10, src[i]) 66 | * @param dst destination 67 | * @param src source 68 | * @param count number of elements in source 69 | */ 70 | LSP_DSP_LIB_SYMBOL(void, logd2, float *dst, const float *src, size_t count); 71 | 72 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_LOG_H_ */ 73 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/normalize.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_NORMALIZE_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_NORMALIZE_H_ 24 | 25 | #include 26 | 27 | /** Calculate absolute normalized values: dst[i] = abs(src[i]) / max { abs(src) } 28 | * 29 | * @param dst destination vector 30 | * @param src source vector 31 | * @param count number of elements 32 | */ 33 | LSP_DSP_LIB_SYMBOL(void, abs_normalized, float *dst, const float *src, size_t count); 34 | 35 | /** Calculate normalized values: dst[i] = src[i] / (max { abs(src) }) 36 | * 37 | * @param dst destination vector 38 | * @param src source vector 39 | * @param count number of elements 40 | */ 41 | LSP_DSP_LIB_SYMBOL(void, normalize, float *dst, const float *src, size_t count); 42 | 43 | /** Calculate normalized values: dst[i] = dst[i] / (max { abs{ dst }}) 44 | * 45 | * @param dst destination vector 46 | * @param src source vector 47 | * @param count number of elements 48 | */ 49 | LSP_DSP_LIB_SYMBOL(void, normalize1, float *dst, size_t count); 50 | 51 | /** Calculate normalized values: dst[i] = src[i] / (max { abs{ src }}) 52 | * 53 | * @param dst destination vector 54 | * @param src source vector 55 | * @param count number of elements 56 | */ 57 | LSP_DSP_LIB_SYMBOL(void, normalize2, float *dst, const float *src, size_t count); 58 | 59 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_NORMALIZE_H_ */ 60 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/pow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_POW_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_POW_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Compute v[i] = c ^ v[i], the value to be raised should be non-negative 29 | * @param v power array 30 | * @param c value to be raised 31 | * @param count number of elements in array 32 | */ 33 | LSP_DSP_LIB_SYMBOL(void, powcv1, float *v, float c, size_t count); 34 | 35 | /** 36 | * Compute dst[i] = c ^ v[i], the value to be raised should be non-negative 37 | * @param dst output array 38 | * @param v power array 39 | * @param c value to be raised 40 | * @param count number of elements in array 41 | */ 42 | LSP_DSP_LIB_SYMBOL(void, powcv2, float *dst, const float *v, float c, size_t count); 43 | 44 | /** 45 | * Compute v[i] = v[i] ^ c, the value to be raised should be non-negative 46 | * @param v values to be raised 47 | * @param c power value 48 | * @param count number of elements in array 49 | */ 50 | LSP_DSP_LIB_SYMBOL(void, powvc1, float *c, float v, size_t count); 51 | 52 | /** 53 | * Compute dst[i] = v[i] ^ c, the value to be raised should be non-negative 54 | * @param dst output array 55 | * @param v values to be raised 56 | * @param c power value 57 | * @param count number of elements in array 58 | */ 59 | LSP_DSP_LIB_SYMBOL(void, powvc2, float *dst, const float *c, float v, size_t count); 60 | 61 | /** 62 | * Compute v[i] = v[i] ^ x[i], the value to be raised should be non-negative 63 | * @param v values to be raised 64 | * @param x power values 65 | * @param count number of elements in array 66 | */ 67 | LSP_DSP_LIB_SYMBOL(void, powvx1, float *v, const float *x, size_t count); 68 | 69 | /** 70 | * Compute dst[i] = v[i] ^ x[i], the value to be raised should be non-negative 71 | * @param dst output array 72 | * @param v values to be raised 73 | * @param x power values 74 | * @param count number of elements in array 75 | */ 76 | LSP_DSP_LIB_SYMBOL(void, powvx2, float *dst, const float *v, const float *x, size_t count); 77 | 78 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_POW_H_ */ 79 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/sin.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 9 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_SIN_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_SIN_H_ 24 | 25 | /** 26 | * Calculate sine function: dst[i] = sin(dst[i]) 27 | * 28 | * @param dst destination vector 29 | * @param count number of elements 30 | */ 31 | LSP_DSP_LIB_SYMBOL(void, sinf1, float *dst, size_t count); 32 | 33 | /** 34 | * Calculate sine function: dst[i] = sin(src[i]) 35 | * 36 | * @param dst destination vector 37 | * @param src source vector 38 | * @param count number of elements 39 | */ 40 | LSP_DSP_LIB_SYMBOL(void, sinf2, float *dst, const float *src, size_t count); 41 | 42 | /** 43 | * Calculate sine function with generated argument: dst[i] = sin(k*i + p) 44 | * 45 | * @param dst destination vector 46 | * @param k phase step 47 | * @param p initial phase 48 | * @param count number of elements 49 | */ 50 | LSP_DSP_LIB_SYMBOL(void, sinf_kp1, float *dst, float k, float p, size_t count); 51 | 52 | 53 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_SIN_H_ */ 54 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/sqr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 20 сент. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_SQR_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_SQR_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Compute squares: dst[i] = dst[i]*dst[i] 29 | * @param dst destination 30 | * @param count number of elements to process 31 | */ 32 | LSP_DSP_LIB_SYMBOL(void, sqr1, float *dst, size_t count); 33 | 34 | /** 35 | * Compute squares: dst[i] = src[i]*src[i] 36 | * @param dst destination 37 | * @param src source 38 | * @param count number of elements in source 39 | */ 40 | LSP_DSP_LIB_SYMBOL(void, sqr2, float *dst, const float *src, size_t count); 41 | 42 | 43 | 44 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_SQR_H_ */ 45 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/pmath/sqrt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 20 сент. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_PMATH_SQRT_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_PMATH_SQRT_H_ 24 | 25 | #include 26 | 27 | /** 28 | * Compute saturated square roots: dst[i] = sqrt(max(dst[i], 0)) 29 | * @param dst destination 30 | * @param count number of elements to process 31 | */ 32 | LSP_DSP_LIB_SYMBOL(void, ssqrt1, float *dst, size_t count); 33 | 34 | /** 35 | * Compute saturated square roots: dst[i] = sqrt(max(src[i], 0)) 36 | * @param dst destination 37 | * @param src source 38 | * @param count number of elements in source 39 | */ 40 | LSP_DSP_LIB_SYMBOL(void, ssqrt2, float *dst, const float *src, size_t count); 41 | 42 | 43 | 44 | #endif /* LSP_PLUG_IN_DSP_COMMON_PMATH_SQRT_H_ */ 45 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/search.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_SEARCH_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_SEARCH_H_ 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | 31 | #endif /* LSP_PLUG_IN_DSP_COMMON_SEARCH_H_ */ 32 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/search/iminmax.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_SEARCH_IMINMAX_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_SEARCH_IMINMAX_H_ 24 | 25 | #include 26 | 27 | /** Calculate @ min { src } 28 | * 29 | * @param src source vector 30 | * @param count number of elements 31 | * @return minimum value index 32 | */ 33 | LSP_DSP_LIB_SYMBOL(size_t, min_index, const float *src, size_t count); 34 | 35 | /** Calculate @ max { src } 36 | * 37 | * @param src source vector 38 | * @param count number of elements 39 | * @return maximum value 40 | */ 41 | LSP_DSP_LIB_SYMBOL(size_t, max_index, const float *src, size_t count); 42 | 43 | /** Calculate @ minmax { src } 44 | * 45 | * @param src source vector 46 | * @param count number of elements 47 | * @param min pointer to store minimum value index 48 | * @param max pointer to store maximum value index 49 | */ 50 | LSP_DSP_LIB_SYMBOL(void, minmax_index, const float *src, size_t count, size_t *min, size_t *max); 51 | 52 | /** Calculate @ max { abs(src) } 53 | * 54 | * @param src source 55 | * @param count number of samples 56 | * @return index of maximum element 57 | */ 58 | LSP_DSP_LIB_SYMBOL(size_t, abs_max_index, const float *src, size_t count); 59 | 60 | /** Calculate @ min { abs(src) } 61 | * 62 | * @param src source 63 | * @param count number of samples 64 | * @return index of maximum element 65 | */ 66 | LSP_DSP_LIB_SYMBOL(size_t, abs_min_index, const float *src, size_t count); 67 | 68 | /** Calculate @ minmax { abs(src) } 69 | * 70 | * @param src source vector 71 | * @param count number of elements 72 | * @param min pointer to store absolute minimum value index 73 | * @param max pointer to store absolute maximum value index 74 | */ 75 | LSP_DSP_LIB_SYMBOL(void, abs_minmax_index, const float *src, size_t count, size_t *min, size_t *max); 76 | 77 | #endif /* LSP_PLUG_IN_DSP_COMMON_SEARCH_IMINMAX_H_ */ 78 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/common/smath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_COMMON_SMATH_H_ 23 | #define LSP_PLUG_IN_DSP_COMMON_SMATH_H_ 24 | 25 | #include 26 | 27 | /** Power of floating-point value by integer constant 28 | * 29 | * @param x value to power 30 | * @param deg the power degree 31 | * @return result of x^deg calculation 32 | */ 33 | LSP_DSP_LIB_SYMBOL(float, ipowf, float x, int deg); 34 | 35 | /** Calculate the integer root of value 36 | * 37 | * @param x the value to calculate 38 | * @param deg the root degree, should be positive 39 | * @return the deg'th root of x 40 | */ 41 | LSP_DSP_LIB_SYMBOL(float, irootf, float x, int deg); 42 | 43 | #endif /* LSP_PLUG_IN_DSP_COMMON_SMATH_H_ */ 44 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/dsp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Linux Studio Plugins Project 3 | * (C) 2024 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_DSP_H_ 23 | #define LSP_PLUG_IN_DSP_DSP_H_ 24 | 25 | #include 26 | 27 | #ifndef LSP_DSP_LIB_SYMBOL 28 | #ifdef LSP_DSP_LIB_USE_CXX_IFACE 29 | #define LSP_DSP_LIB_SYMBOL(ret, name, ...) \ 30 | namespace lsp { \ 31 | namespace dsp { \ 32 | LSP_DSP_LIB_PUBLIC \ 33 | extern ret (* name)(__VA_ARGS__); \ 34 | } \ 35 | } 36 | #else 37 | #define LSP_DSP_LIB_SYMBOL(ret, name, ...) \ 38 | LSP_DSP_LIB_PUBLIC \ 39 | extern ret (* LSP_DSP_LIB_MANGLE(name))(__VA_ARGS__); 40 | #endif /* LSP_DSP_LIB_USE_CXX_IFACE */ 41 | #endif /* LSP_DSP_LIB_SYMBOL */ 42 | 43 | // Include all partial definitions 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | 70 | #endif /* LSP_PLUG_IN_DSP_DSP_H_ */ 71 | -------------------------------------------------------------------------------- /include/lsp-plug.in/dsp/version.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 14 мая 2020 г. 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 | * ${project_name} 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 . 20 | */ 21 | 22 | #ifndef LSP_PLUG_IN_DSP_VERSION_H_ 23 | #define LSP_PLUG_IN_DSP_VERSION_H_ 24 | 25 | // Define version of headers 26 | #define LSP_DSP_LIB_MAJOR 1 27 | #define LSP_DSP_LIB_MINOR 0 28 | #define LSP_DSP_LIB_MICRO 30 29 | 30 | #if defined(__WINDOWS__) || defined(__WIN32__) || defined(__WIN64__) || defined(_WIN64) || defined(_WIN32) || defined(__WINNT) || defined(__WINNT__) 31 | #define LSP_DSP_LIB_EXPORT_MODIFIER __declspec(dllexport) 32 | #define LSP_DSP_LIB_IMPORT_MODIFIER __declspec(dllimport) 33 | #else 34 | #define LSP_DSP_LIB_EXPORT_MODIFIER __attribute__((visibility("default"))) 35 | #define LSP_DSP_LIB_IMPORT_MODIFIER 36 | #endif /* __WINDOWS__ */ 37 | 38 | #if defined(LSP_DSP_LIB_PUBLISHER) 39 | #define LSP_DSP_LIB_PUBLIC LSP_DSP_LIB_EXPORT_MODIFIER 40 | #elif defined(LSP_DSP_LIB_BUILTIN) || defined(LSP_IDE_DEBUG) 41 | #define LSP_DSP_LIB_PUBLIC 42 | #else 43 | #define LSP_DSP_LIB_PUBLIC LSP_DSP_LIB_IMPORT_MODIFIER 44 | #endif 45 | 46 | #define LSP_DSP_LIB_MANGLE(name) lsp_dsp_ ## name 47 | 48 | // Determine what interface to use (C or C++) 49 | #if defined(LSP_DSP_LIB_USE_C_IFACE) 50 | #ifdef LSP_DSP_LIB_USE_CXX_IFACE 51 | #undef LSP_DSP_LIB_USE_CXX_IFACE 52 | #endif /* LSP_DSP_LIB_USE_CXX_IFACE */ 53 | #elif defined(__cplusplus) && !defined(LSP_DSP_LIB_USE_CXX_IFACE) 54 | #define LSP_DSP_LIB_USE_CXX_IFACE 55 | #endif /* LSP_DSP_LIB_USE_C_IFACE */ 56 | 57 | #ifdef LSP_DSP_LIB_USE_CXX_IFACE 58 | #define LSP_DSP_LIB_TYPE(name) name 59 | #define LSP_DSP_LIB_BEGIN_NAMESPACE namespace lsp { namespace dsp { 60 | #define LSP_DSP_LIB_END_NAMESPACE } } 61 | #else 62 | #define LSP_DSP_LIB_TYPE(name) LSP_DSP_LIB_MANGLE(name) 63 | #define LSP_DSP_LIB_BEGIN_NAMESPACE 64 | #define LSP_DSP_LIB_END_NAMESPACE 65 | #endif 66 | 67 | #endif /* LSP_PLUG_IN_DSP_VERSION_H_ */ 68 | -------------------------------------------------------------------------------- /include/private/dsp/arch/aarch64/asimd/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 окт. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_H_ 23 | #define PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_H_ 24 | 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 | 29 | #include 30 | #include 31 | #include 32 | 33 | #endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_DYNAMICS_H_ */ 34 | -------------------------------------------------------------------------------- /include/private/dsp/arch/aarch64/asimd/fastconv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_FASTCONV_H_ 23 | #define PRIVATE_DSP_ARCH_AARCH64_ASIMD_FASTCONV_H_ 24 | 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 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_FASTCONV_H_ */ 37 | -------------------------------------------------------------------------------- /include/private/dsp/arch/aarch64/asimd/fastconv/const.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_FASTCONV_CONST_H_ 23 | #define PRIVATE_DSP_ARCH_AARCH64_ASIMD_FASTCONV_CONST_H_ 24 | 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 | 29 | namespace lsp 30 | { 31 | namespace asimd 32 | { 33 | IF_ARCH_AARCH64( 34 | static const uint32_t fastconv_swp_mask[8] = 35 | { 36 | 0, 0xffffffff, 0, 0xffffffff, 37 | 0, 0xffffffff, 0, 0xffffffff 38 | }; 39 | ) 40 | } 41 | } 42 | 43 | #endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_FASTCONV_CONST_H_ */ 44 | -------------------------------------------------------------------------------- /include/private/dsp/arch/aarch64/asimd/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 13 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_AARCH64_ASIMD_PMATH_H_ 23 | #define PRIVATE_DSP_ARCH_AARCH64_ASIMD_PMATH_H_ 24 | 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 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* PRIVATE_DSP_ARCH_AARCH64_ASIMD_PMATH_H_ */ 46 | -------------------------------------------------------------------------------- /include/private/dsp/arch/aarch64/fpcr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_AARCH64_FPCR_H_ 23 | #define PRIVATE_DSP_ARCH_AARCH64_FPCR_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_AARCH64_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_AARCH64_IMPL */ 28 | 29 | #define FPCR_IOE (1 << 8) /* Invalid operation exception enable */ 30 | #define FPCR_DZE (1 << 9) /* Division by zero exception enable */ 31 | #define FPCR_OFE (1 << 10) /* Overflow exception enable */ 32 | #define FPCR_UFE (1 << 11) /* Underflow exception enable */ 33 | #define FPCR_IXE (1 << 12) /* Inexact exception enable */ 34 | #define FPCR_IDE (1 << 15) /* Input Denormal exception enable */ 35 | #define FPCR_FZ16 (1 << 19) /* Flush-to-zero mode control bit on half-precision data-processing instructions */ 36 | #define FPCR_RMODE_MASK (3 << 22) /* Rounding mode mask */ 37 | #define FPCR_RMODE_RN (0 << 22) /* Rounding to nearest */ 38 | #define FPCR_RMODE_RP (1 << 22) /* Rounding towards plus infinity */ 39 | #define FPCR_RMODE_RM (2 << 22) /* Rounding towards minus infinity */ 40 | #define FPCR_RMODE_RZ (3 << 22) /* Rounding towards zero */ 41 | #define FPCR_FZ (1 << 24) /* Flush-to-zero mode */ 42 | #define FPCR_DN (1 << 25) /* Default NaN mode control */ 43 | #define FPCR_AHP (1 << 26) /* Alternative half-precision control */ 44 | 45 | namespace lsp 46 | { 47 | namespace aarch64 48 | { 49 | inline uint64_t read_fpcr() 50 | { 51 | uint64_t fpcr = 0; 52 | 53 | ARCH_AARCH64_ASM 54 | ( 55 | __ASM_EMIT("mrs %[fpcr], FPCR") 56 | : [fpcr] "=&r" (fpcr) 57 | : : 58 | ); 59 | 60 | return fpcr; 61 | } 62 | 63 | inline void write_fpcr(uint64_t fpcr) 64 | { 65 | ARCH_AARCH64_ASM 66 | ( 67 | __ASM_EMIT("msr FPCR, %[fpcr]") 68 | : 69 | : [fpcr] "r" (fpcr) 70 | : 71 | ); 72 | } 73 | } 74 | } 75 | 76 | #endif /* PRIVATE_DSP_ARCH_AARCH64_FPCR_H_ */ 77 | -------------------------------------------------------------------------------- /include/private/dsp/arch/arm/neon-d32/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 7 окт. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_DYNAMICS_H_ 23 | #define PRIVATE_DSP_ARCH_ARM_NEON_D32_DYNAMICS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | #endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_DYNAMICS_H_ */ 35 | -------------------------------------------------------------------------------- /include/private/dsp/arch/arm/neon-d32/fastconv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_FASTCONV_H_ 23 | #define PRIVATE_DSP_ARCH_ARM_NEON_D32_FASTCONV_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_FASTCONV_H_ */ 36 | -------------------------------------------------------------------------------- /include/private/dsp/arch/arm/neon-d32/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 13 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_PMATH_H_ 23 | #define PRIVATE_DSP_ARCH_ARM_NEON_D32_PMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | #endif /* PRIVATE_DSP_ARCH_ARM_NEON_D32_PMATH_H_ */ 46 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/bitmap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 апр. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_BITMAP_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_BITMAP_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #endif /* PRIVATE_DSP_ARCH_GENERIC_BITMAP_H_ */ 36 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/bitmap/helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 8 апр. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_BITMAP_HELPERS_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_BITMAP_HELPERS_H_ 24 | 25 | #include 26 | 27 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 28 | #error "This header should not be included directly" 29 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 30 | 31 | namespace lsp 32 | { 33 | namespace generic 34 | { 35 | typedef struct bitmap_part_t 36 | { 37 | ssize_t src_x; 38 | ssize_t src_y; 39 | ssize_t dst_x; 40 | ssize_t dst_y; 41 | ssize_t count_x; 42 | ssize_t count_y; 43 | } bitmap_part_t; 44 | 45 | static inline bitmap_part_t bitmap_clip_rect(const bitmap_t *dst, const bitmap_t *src, ssize_t x, ssize_t y) 46 | { 47 | bitmap_part_t rect; 48 | 49 | rect.dst_x = lsp_max(ssize_t(0), x); 50 | rect.dst_y = lsp_max(ssize_t(0), y); 51 | rect.src_x = rect.dst_x - x; 52 | rect.src_y = rect.dst_y - y; 53 | rect.count_y = lsp_min(dst->height - rect.dst_y, src->height - rect.src_y); 54 | rect.count_x = lsp_min(dst->width - rect.dst_x, src->width - rect.src_x); 55 | 56 | return rect; 57 | } 58 | 59 | static inline uint8_t b8_saturate(int value) 60 | { 61 | return (value < 0) ? 0x00 : (value > 0xff) ? 0xff : value; 62 | } 63 | 64 | } /* namespace generic */ 65 | } /* namespaec lsp */ 66 | 67 | 68 | 69 | 70 | #endif /* PRIVATE_DSP_ARCH_GENERIC_BITMAP_HELPERS_H_ */ 71 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_CONTEXT_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_CONTEXT_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void start(dsp::context_t *ctx) 34 | { 35 | ctx->top = 0; 36 | } 37 | 38 | void finish(dsp::context_t *ctx) 39 | { 40 | // TODO 41 | // if (ctx->top != 0) 42 | // lsp_warn("DSP context is not empty"); 43 | } 44 | 45 | dsp::info_t *info() 46 | { 47 | size_t szof_dsp_info = sizeof(dsp::info_t); 48 | size_t size = 49 | szof_dsp_info + 50 | strlen(ARCH_STRING) + 1 + 51 | strlen("native cpu") + 1 + 52 | strlen("unknown") + 1; 53 | 54 | uint8_t *ptr = static_cast(malloc(size)); 55 | if (ptr == NULL) 56 | return NULL; 57 | 58 | dsp::info_t *res = reinterpret_cast(ptr); 59 | ptr += szof_dsp_info; 60 | 61 | char *text = reinterpret_cast(ptr); 62 | res->arch = text; 63 | text = stpcpy(text, ARCH_STRING) + 1; 64 | res->cpu = text; 65 | text = stpcpy(text, "native cpu") + 1; 66 | res->model = text; 67 | text = stpcpy(text, "unknown"); 68 | res->features = text; // Empty string 69 | 70 | return res; 71 | } 72 | } /* namespace generic */ 73 | } /* namespace lsp */ 74 | 75 | #endif /* PRIVATE_DSP_ARCH_GENERIC_CONTEXT_H_ */ 76 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 5 окт. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_DYNAMICS_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_DYNAMICS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #endif /* PRIVATE_DSP_ARCH_GENERIC_DYNAMICS_H_ */ 34 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/dynamics/gate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 19 окт. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_DYNAMICS_GATE_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_DYNAMICS_GATE_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void gate_x1_gain(float *dst, const float *src, const dsp::gate_knee_t *c, size_t count) 34 | { 35 | for (size_t i=0; istart) 39 | x = c->gain_start; 40 | else if (x >= c->end) 41 | x = c->gain_end; 42 | else 43 | { 44 | float lx = logf(x); 45 | x = expf(((c->herm[0]*lx + c->herm[1])*lx + c->herm[2])*lx + c->herm[3]); 46 | } 47 | dst[i] = x; 48 | } 49 | } 50 | 51 | void gate_x1_curve(float *dst, const float *src, const dsp::gate_knee_t *c, size_t count) 52 | { 53 | for (size_t i=0; istart) 57 | x *= c->gain_start; 58 | else if (x >= c->end) 59 | x *= c->gain_end; 60 | else 61 | { 62 | float lx = logf(x); 63 | x *= expf(((c->herm[0]*lx + c->herm[1])*lx + c->herm[2])*lx + c->herm[3]); 64 | } 65 | dst[i] = x; 66 | } 67 | } 68 | } /* namespace generic */ 69 | } /* namespace lsp */ 70 | 71 | 72 | 73 | #endif /* PRIVATE_DSP_ARCH_GENERIC_DYNAMICS_GATE_H_ */ 74 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/features.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Linux Studio Plugins Project 3 | * (C) 2022 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-plugins-sampler 6 | * Created on: 4 нояб. 2022 г. 7 | * 8 | * lsp-plugins-sampler 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-plugins-sampler 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-plugins-sampler. If not, see . 20 | */ 21 | 22 | #ifndef LSP_DSP_LIB_INCLUDE_PRIVATE_DSP_ARCH_GENERIC_FEATURES_H_ 23 | #define LSP_DSP_LIB_INCLUDE_PRIVATE_DSP_ARCH_GENERIC_FEATURES_H_ 24 | 25 | #include 26 | 27 | namespace lsp 28 | { 29 | namespace generic 30 | { 31 | void dsp_init(); 32 | } /* namespace generic */ 33 | } /* namespace lsp */ 34 | 35 | #endif /* LSP_DSP_LIB_INCLUDE_PRIVATE_DSP_ARCH_GENERIC_FEATURES_H_ */ 36 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/graphics/axis.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 24 сент. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_GRAPHICS_AXIS_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_GRAPHICS_AXIS_H_ 24 | 25 | namespace lsp 26 | { 27 | namespace generic 28 | { 29 | void axis_apply_lin1(float *x, const float *v, float zero, float norm, size_t count) 30 | { 31 | for (size_t i=0; i 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_GRAPHICS_INTERPOLATION_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_GRAPHICS_INTERPOLATION_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void smooth_cubic_linear(float *dst, float start, float stop, size_t count) 34 | { 35 | float dy = 2.0f * (stop - start); 36 | float nx = 1.0f / (count + 1); // Normalizing x 37 | 38 | for (size_t i=0; i 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_HMATH_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_HMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | float scalar_mul(const float *a, const float *b, size_t count) 34 | { 35 | float result = 0; 36 | while (count--) 37 | result += *(a++) * *(b++); 38 | return result; 39 | } 40 | 41 | float h_sum(const float *src, size_t count) 42 | { 43 | float result = 0.0f; 44 | while (count--) 45 | result += *(src++); 46 | return result; 47 | } 48 | 49 | float h_sqr_sum(const float *src, size_t count) 50 | { 51 | float result = 0.0f; 52 | while (count--) 53 | { 54 | float tmp = *(src++); 55 | result += tmp * tmp; 56 | } 57 | return result; 58 | } 59 | 60 | float h_abs_sum(const float *src, size_t count) 61 | { 62 | float result = 0.0f; 63 | while (count--) 64 | { 65 | float tmp = *(src++); 66 | if (tmp < 0.0f) 67 | result -= tmp; 68 | else 69 | result += tmp; 70 | } 71 | return result; 72 | } 73 | } 74 | } 75 | 76 | #endif /* PRIVATE_DSP_ARCH_GENERIC_HMATH_H_ */ 77 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/hmath/hdotp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_HMATH_HDOTP_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_HMATH_HDOTP_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | float h_dotp(const float *a, const float *b, size_t count) 34 | { 35 | float result = 0; 36 | while (count--) 37 | result += *(a++) * *(b++); 38 | return result; 39 | } 40 | 41 | float h_abs_dotp(const float *a, const float *b, size_t count) 42 | { 43 | float result = 0; 44 | while (count--) 45 | result += ::fabs(*(a++)) * ::fabs(*(b++)); 46 | return result; 47 | } 48 | 49 | float h_sqr_dotp(const float *a, const float *b, size_t count) 50 | { 51 | float result = 0; 52 | while (count--) 53 | { 54 | float xa = *a++, xb = *b++; 55 | result += xa*xa * xb*xb; 56 | } 57 | return result; 58 | } 59 | } 60 | } 61 | 62 | #endif /* PRIVATE_DSP_ARCH_GENERIC_HMATH_HDOTP_H_ */ 63 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/hmath/hsum.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_HMATH_HSUM_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_HMATH_HSUM_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | float h_sum(const float *src, size_t count) 34 | { 35 | float result = 0.0f; 36 | for (size_t i=0; i 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_MSMATRIX_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_MSMATRIX_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void lr_to_ms(float *m, float *s, const float *l, const float *r, size_t count) 34 | { 35 | while (count--) 36 | { 37 | float lv = *(l++); 38 | float rv = *(r++); 39 | *(m++) = (lv + rv) * 0.5f; 40 | *(s++) = (lv - rv) * 0.5f; 41 | } 42 | } 43 | 44 | void lr_to_mid(float *m, const float *l, const float *r, size_t count) 45 | { 46 | while (count--) 47 | { 48 | float lv = *(l++); 49 | float rv = *(r++); 50 | *(m++) = (lv + rv) * 0.5f; 51 | } 52 | } 53 | 54 | void lr_to_side(float *s, const float *l, const float *r, size_t count) 55 | { 56 | while (count--) 57 | { 58 | float lv = *(l++); 59 | float rv = *(r++); 60 | *(s++) = (lv - rv) * 0.5f; 61 | } 62 | } 63 | 64 | void ms_to_lr(float *l, float *r, const float *m, const float *s, size_t count) 65 | { 66 | while (count--) 67 | { 68 | float mv = *(m++); 69 | float sv = *(s++); 70 | *(l++) = mv + sv; 71 | *(r++) = mv - sv; 72 | } 73 | } 74 | 75 | void ms_to_left(float *l, const float *m, const float *s, size_t count) 76 | { 77 | while (count--) 78 | *(l++) = *(m++) + *(s++); 79 | } 80 | 81 | void ms_to_right(float *r, const float *m, const float *s, size_t count) 82 | { 83 | while (count--) 84 | *(r++) = *(m++) - *(s++); 85 | } 86 | } 87 | } 88 | 89 | #endif /* PRIVATE_DSP_ARCH_GENERIC_MSMATRIX_H_ */ 90 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/pan.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Linux Studio Plugins Project 3 | * (C) 2024 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 10 нояб. 2024 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PAN_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PAN_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | #include 30 | #include 31 | 32 | namespace lsp 33 | { 34 | namespace generic 35 | { 36 | void depan_lin(float *dst, const float *l, const float *r, float dfl, size_t count) 37 | { 38 | for (size_t i=0; i= 1e-18f) ? sr / den : dfl; 44 | } 45 | } 46 | 47 | void depan_eqpow(float *dst, const float *l, const float *r, float dfl, size_t count) 48 | { 49 | for (size_t i=0; i= 1e-36f) ? sr / den : dfl; 55 | } 56 | } 57 | 58 | } /* namespace generic */ 59 | } /* namespace lsp */ 60 | 61 | #endif /* PRIVATE_DSP_ARCH_GENERIC_PAN_H_ */ 62 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | 46 | #endif /* PRIVATE_DSP_ARCH_GENERIC_PMATH_H_ */ 47 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/pmath/cos.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 10 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_COS_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_COS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void cosf1(float *dst, size_t count) 34 | { 35 | for (size_t i=0; i 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_EXP_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_EXP_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void exp1(float *dst, size_t count) 34 | { 35 | for (size_t i=0; i 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 10 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_LANCZOS_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_LANCZOS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void lanczos1(float *dst, float k, float p, float t, float a, size_t count) 34 | { 35 | for (size_t j=0; j= 1e-6f) ? (sinf(x1) * sinf(x2)) / (x1 * x2) : 1.0f; 44 | } 45 | else 46 | dst[j] = 0.0f; 47 | } 48 | } 49 | 50 | } /* namespace generic */ 51 | } /* namespace lsp */ 52 | 53 | 54 | #endif /* PRIVATE_DSP_ARCH_GENERIC_PMATH_LANCZOS_H_ */ 55 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/pmath/log.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_LOG_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_LOG_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void logb1(float *dst, size_t count) 34 | { 35 | for (size_t i=0; i 3 | * (C) 2022 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 6 нояб. 2022 г. 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 . 20 | */ 21 | 22 | #ifndef INCLUDE_PRIVATE_DSP_ARCH_GENERIC_PMATH_NORMALIZE_H_ 23 | #define INCLUDE_PRIVATE_DSP_ARCH_GENERIC_PMATH_NORMALIZE_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void abs_normalized(float *dst, const float *src, size_t count) 34 | { 35 | // Calculate absolute values 36 | dsp::abs2(dst, src, count); 37 | 38 | // Find the maximum value 39 | float max = dsp::max(dst, count); 40 | 41 | // Divide if it is possible 42 | if (max != 0.0f) 43 | dsp::mul_k2(dst, 1.0f / max, count); 44 | } 45 | 46 | void normalize1(float *dst, size_t count) 47 | { 48 | // Find minimum and maximum 49 | float max = dsp::abs_max(dst, count); 50 | // Normalize OR do nothing 51 | if (max > 0.0f) 52 | dsp::mul_k2(dst, 1.0f / max, count); 53 | } 54 | 55 | void normalize2(float *dst, const float *src, size_t count) 56 | { 57 | // Find the absolute maximum 58 | float max = dsp::abs_max(src, count); 59 | // Normalize OR copy 60 | if (max > 0.0f) 61 | dsp::mul_k3(dst, src, 1.0f / max, count); 62 | else 63 | dsp::copy(dst, src, count); 64 | } 65 | } /* namespace generic */ 66 | } /* namespace lsp */ 67 | 68 | 69 | #endif /* INCLUDE_PRIVATE_DSP_ARCH_GENERIC_PMATH_NORMALIZE_H_ */ 70 | -------------------------------------------------------------------------------- /include/private/dsp/arch/generic/pmath/pow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_POW_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_POW_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void powcv1(float *v, float c, size_t count) 34 | { 35 | float C = ::logf(c); 36 | for (size_t i=0; i 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 10 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_SIN_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_SIN_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void sinf1(float *dst, size_t count) 34 | { 35 | for (size_t i=0; i 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 20 сент. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_SQR_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_SQR_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_GENERIC_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_GENERIC_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace generic 32 | { 33 | void sqr1(float *dst, size_t count) 34 | { 35 | for (size_t i=0; i 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 20 сент. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_GENERIC_PMATH_SQRT_H_ 23 | #define PRIVATE_DSP_ARCH_GENERIC_PMATH_SQRT_H_ 24 | 25 | namespace lsp 26 | { 27 | namespace generic 28 | { 29 | void ssqrt1(float *dst, size_t count) 30 | { 31 | for (size_t i=0; i 0.0f) ? sqrt(s) : 0.0f; 35 | } 36 | } 37 | 38 | void ssqrt2(float *dst, const float *src, size_t count) 39 | { 40 | for (size_t i=0; i 0.0f) ? sqrt(s) : 0.0f; 44 | } 45 | } 46 | 47 | } /* namespace generic */ 48 | } /* namespace lsp */ 49 | 50 | 51 | 52 | 53 | #endif /* PRIVATE_DSP_ARCH_GENERIC_PMATH_SQRT_H_ */ 54 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Linux Studio Plugins Project 3 | * (C) 2022 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 6 нояб. 2022 г. 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 . 20 | */ 21 | 22 | #ifndef INCLUDE_PRIVATE_DSP_ARCH_X86_AVX_PMATH_H_ 23 | #define INCLUDE_PRIVATE_DSP_ARCH_X86_AVX_PMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_AVX_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_AVX_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #endif /* INCLUDE_PRIVATE_DSP_ARCH_X86_AVX_PMATH_H_ */ 41 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx/xcr.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_AVX_XCR_H_ 23 | #define PRIVATE_DSP_ARCH_X86_AVX_XCR_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_AVX_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_AVX_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace x86 32 | { 33 | #ifdef ARCH_X86_AVX 34 | uint64_t read_xcr(umword_t xcr_id) 35 | { 36 | uint64_t xcr; 37 | 38 | ARCH_X86_ASM 39 | ( 40 | __ASM_EMIT64("xor %%rax, %%rax") 41 | __ASM_EMIT("xgetbv") 42 | __ASM_EMIT64("shl $32, %%rdx") 43 | __ASM_EMIT64("or %%rdx, %%rax") 44 | : __IF_32("=A" (xcr)) __IF_64("=a" (xcr)) 45 | : "c" (xcr_id) 46 | : __IF_64("%rdx") 47 | ); 48 | return xcr; 49 | } 50 | #else 51 | uint64_t read_xcr(umword_t xcr_id) 52 | { 53 | return 0; 54 | } 55 | #endif /* ARCH_X86_AVX */ 56 | } 57 | } 58 | 59 | #endif /* PRIVATE_DSP_ARCH_X86_AVX_XCR_H_ */ 60 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx2/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 6 окт. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_AVX2_DYNAMICS_H_ 23 | #define PRIVATE_DSP_ARCH_X86_AVX2_DYNAMICS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_AVX2_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_AVX2_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | #endif /* PRIVATE_DSP_ARCH_X86_AVX2_DYNAMICS_H_ */ 35 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx2/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 12 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_AVX2_PMATH_H_ 23 | #define PRIVATE_DSP_ARCH_X86_AVX2_PMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_AVX2_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_AVX2_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #endif /* PRIVATE_DSP_ARCH_X86_AVX2_PMATH_H_ */ 39 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx512/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 30 окт. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_AVX512_DYNAMICS_H_ 23 | #define PRIVATE_DSP_ARCH_X86_AVX512_DYNAMICS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_AVX512_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_AVX512_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | 34 | #endif /* PRIVATE_DSP_ARCH_X86_AVX512_DYNAMICS_H_ */ 35 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx512/hmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Linux Studio Plugins Project 3 | * (C) 2024 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 11 дек. 2024 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_AVX512_HMATH_H_ 23 | #define PRIVATE_DSP_ARCH_X86_AVX512_HMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_AVX512_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_AVX512_IMPL */ 28 | 29 | 30 | #include 31 | #include 32 | 33 | 34 | #endif /* PRIVATE_DSP_ARCH_X86_AVX512_HMATH_H_ */ 35 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx512/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 20 сент. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_AVX512_PMATH_H_ 23 | #define PRIVATE_DSP_ARCH_X86_AVX512_PMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_AVX512_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_AVX512_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | 45 | 46 | #endif /* PRIVATE_DSP_ARCH_X86_AVX512_PMATH_H_ */ 47 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/avx512/search.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2024 Linux Studio Plugins Project 3 | * (C) 2024 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 29 июл. 2024 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_AVX512_SEARCH_H_ 23 | #define PRIVATE_DSP_ARCH_X86_AVX512_SEARCH_H_ 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | #endif /* PRIVATE_DSP_ARCH_X86_AVX512_SEARCH_H_ */ 31 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/copy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef INCLUDE_PRIVATE_DSP_ARCH_X86_COPY_H_ 23 | #define INCLUDE_PRIVATE_DSP_ARCH_X86_COPY_H_ 24 | 25 | namespace lsp 26 | { 27 | namespace x86 28 | { 29 | void copy(float *dst, const float *src, size_t count) 30 | { 31 | IF_ARCH_X86_64(size_t tmp); 32 | 33 | ARCH_X86_64_ASM 34 | ( 35 | __ASM_EMIT("mov %[count], %[tmp]") 36 | __ASM_EMIT("shr $1, %[count]") 37 | __ASM_EMIT("jz 1f") 38 | __ASM_EMIT("rep movsq") 39 | __ASM_EMIT("1:") 40 | __ASM_EMIT("test $1, %[tmp]") 41 | __ASM_EMIT("jz 2f") 42 | __ASM_EMIT("movsl ") 43 | __ASM_EMIT("2:") 44 | : [dst] "+D" (dst), [src] "+S" (src), 45 | [tmp] "=&r" (tmp), [count] "+c" (count) 46 | : 47 | : "cc", "memory" 48 | ); 49 | 50 | ARCH_I386_ASM 51 | ( 52 | __ASM_EMIT("rep movsl") 53 | : [dst] "+D" (dst), [src] "+S" (src), 54 | [count] "+c" (count) 55 | : 56 | : "cc", "memory" 57 | ); 58 | } 59 | } 60 | } 61 | 62 | 63 | 64 | #endif /* INCLUDE_PRIVATE_DSP_ARCH_X86_COPY_H_ */ 65 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Linux Studio Plugins Project 3 | * (C) 2022 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 27 авг. 2022 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_DEFS_H_ 23 | #define PRIVATE_DSP_ARCH_X86_DEFS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_IMPL */ 28 | 29 | 30 | #include 31 | 32 | #ifdef ARCH_32BIT 33 | #ifdef COMPILER_CLANG 34 | #define X86_GREG "m" 35 | #define X86_PGREG "+m" 36 | #else 37 | #define X86_GREG "g" 38 | #define X86_PGREG "+g" 39 | #endif /* COMPILER_CLANG */ 40 | #else 41 | #define X86_GREG "r" 42 | #define X86_PGREG "+r" 43 | #endif /* ARCH_32BIT */ 44 | 45 | 46 | #endif /* PRIVATE_DSP_ARCH_X86_DEFS_H_ */ 47 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/float.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_FLOAT_H_ 23 | #define PRIVATE_DSP_ARCH_X86_FLOAT_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_IMPL */ 28 | 29 | namespace lsp 30 | { 31 | namespace x86 32 | { 33 | static uint32_t fpu_read_cr() 34 | { 35 | uint16_t cr = 0; 36 | 37 | ARCH_X86_ASM 38 | ( 39 | __ASM_EMIT("fstcw %[cr]") 40 | 41 | : [cr] "+m" (cr) 42 | : 43 | : "memory" 44 | ); 45 | 46 | return cr; 47 | } 48 | 49 | static void fpu_write_cr(uint32_t value) 50 | { 51 | uint16_t cr = value; 52 | 53 | ARCH_X86_ASM 54 | ( 55 | __ASM_EMIT("fldcw %[cr]") 56 | 57 | : 58 | : [cr] "m" (cr) 59 | : 60 | ); 61 | } 62 | } 63 | } 64 | 65 | #endif /* PRIVATE_DSP_ARCH_X86_FLOAT_H_ */ 66 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/sse/fastconv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_SSE_FASTCONV_H_ 23 | #define PRIVATE_DSP_ARCH_X86_SSE_FASTCONV_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_SSE_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_SSE_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | namespace lsp 36 | { 37 | namespace sse 38 | { 39 | void fastconv_parse_apply(float *dst, float *tmp, const float *c, const float *src, size_t rank) 40 | { 41 | // Do direct FFT 42 | fastconv_parse_internal(tmp, src, rank); 43 | 44 | // Apply complex convolution 45 | fastconv_parse_apply_internal(tmp, c, rank); 46 | 47 | // Do reverse FFT 48 | fastconv_restore_internal(dst, tmp, rank); 49 | } 50 | 51 | void fastconv_apply(float *dst, float *tmp, const float *c1, const float *c2, size_t rank) 52 | { 53 | // Apply complex convolution 54 | fastconv_apply_internal(tmp, c1, c2, rank); 55 | 56 | // Do reverse FFT 57 | fastconv_restore_internal(dst, tmp, rank); 58 | } 59 | } 60 | } 61 | 62 | #endif /* PRIVATE_DSP_ARCH_X86_SSE_FASTCONV_H_ */ 63 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/sse/graphics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_SSE_GRAPHICS_H_ 23 | #define PRIVATE_DSP_ARCH_X86_SSE_GRAPHICS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_SSE_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_SSE_IMPL */ 28 | 29 | #include 30 | #include 31 | 32 | #endif /* PRIVATE_DSP_ARCH_X86_SSE_GRAPHICS_H_ */ 33 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/sse/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2022 Linux Studio Plugins Project 3 | * (C) 2022 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 6 нояб. 2022 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_SSE_PMATH_H_ 23 | #define PRIVATE_DSP_ARCH_X86_SSE_PMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_SSE_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_SSE_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #endif /* PRIVATE_DSP_ARCH_X86_SSE_PMATH_H_ */ 41 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/sse2/dynamics.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 5 окт. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_SSE2_DYNAMICS_H_ 23 | #define PRIVATE_DSP_ARCH_X86_SSE2_DYNAMICS_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_SSE2_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_SSE2_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #endif /* PRIVATE_DSP_ARCH_X86_SSE2_DYNAMICS_H_ */ 34 | -------------------------------------------------------------------------------- /include/private/dsp/arch/x86/sse2/pmath.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2025 Linux Studio Plugins Project 3 | * (C) 2025 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 14 апр. 2025 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_ARCH_X86_SSE2_PMATH_H_ 23 | #define PRIVATE_DSP_ARCH_X86_SSE2_PMATH_H_ 24 | 25 | #ifndef PRIVATE_DSP_ARCH_X86_SSE2_IMPL 26 | #error "This header should not be included directly" 27 | #endif /* PRIVATE_DSP_ARCH_X86_SSE2_IMPL */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #endif /* PRIVATE_DSP_ARCH_X86_SSE2_PMATH_H_ */ 41 | -------------------------------------------------------------------------------- /include/private/dsp/exports.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_DSP_EXPORTS_H_ 23 | #define PRIVATE_DSP_EXPORTS_H_ 24 | 25 | #include 26 | 27 | #define LSP_DSP_LIB_SYMBOL(ret, name, ...) \ 28 | namespace lsp { \ 29 | namespace dsp { \ 30 | LSP_DSP_LIB_PUBLIC \ 31 | extern ret (* name)(__VA_ARGS__); \ 32 | \ 33 | extern "C" { \ 34 | LSP_DSP_LIB_PUBLIC \ 35 | extern ret (* LSP_DSP_LIB_MANGLE(name))(__VA_ARGS__); \ 36 | } \ 37 | } \ 38 | } 39 | 40 | #endif /* PRIVATE_DSP_EXPORTS_H_ */ 41 | -------------------------------------------------------------------------------- /include/private/utest/dsp/3d/helpers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * helpers.h 3 | * 4 | * Created on: 30 авг. 2018 г. 5 | * Author: sadko 6 | */ 7 | 8 | #ifndef PRIVATE_UTEST_DSP_3D_HELPERS_H_ 9 | #define PRIVATE_UTEST_DSP_3D_HELPERS_H_ 10 | 11 | #include 12 | #include 13 | 14 | namespace lsp 15 | { 16 | namespace test 17 | { 18 | bool point3d_ck(const dsp::point3d_t *p1, const dsp::point3d_t *p2); 19 | bool point3d_sck(const dsp::point3d_t *p1, const dsp::point3d_t *p2); 20 | bool point3d_ack(const dsp::point3d_t *p1, const dsp::point3d_t *p2, float tolerance = DSP_3D_TOLERANCE); 21 | bool vector3d_sck(const dsp::vector3d_t *v1, const dsp::vector3d_t *v2); 22 | bool vector3d_ack(const dsp::vector3d_t *v1, const dsp::vector3d_t *v2, float tolerance = DSP_3D_TOLERANCE); 23 | bool matrix3d_ck(const dsp::matrix3d_t *m1, const dsp::matrix3d_t *m2); 24 | 25 | void dump_point(const char *text, const dsp::point3d_t *p); 26 | void dump_vector(const char *text, const dsp::vector3d_t *v); 27 | } 28 | } 29 | 30 | #endif /* PRIVATE_UTEST_DSP_3D_HELPERS_H_ */ 31 | -------------------------------------------------------------------------------- /include/private/utest/dsp/bitmap/util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 21 апр. 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 . 20 | */ 21 | 22 | #ifndef PRIVATE_UTEST_DSP_BITMAP_UTIL_H_ 23 | #define PRIVATE_UTEST_DSP_BITMAP_UTIL_H_ 24 | 25 | #include 26 | 27 | namespace lsp 28 | { 29 | namespace test 30 | { 31 | typedef struct bitmap_pattern_t 32 | { 33 | ssize_t x; 34 | ssize_t y; 35 | uint8_t fill; 36 | const char *data; 37 | } bitmap_pattern_t; 38 | 39 | /** 40 | * Rasterize bitmap 41 | * @param bitmap bitmap to rasterize 42 | * @return rasterized bitmap image, should be free()'d after use 43 | */ 44 | char *rasterize(const dsp::bitmap_t *bitmap); 45 | 46 | } /* namespace test */ 47 | } /* namespace lsp */ 48 | 49 | 50 | #endif /* PRIVATE_UTEST_DSP_BITMAP_UTIL_H_ */ 51 | -------------------------------------------------------------------------------- /modules.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Linux Studio Plugins Project 3 | # (C) 2020 Vladimir Sadovnikov 4 | # 5 | # This file is part of lsp-dsp-lib 6 | # 7 | # lsp-dsp-lib is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # any later version. 11 | # 12 | # lsp-dsp-lib is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with lsp-dsp-lib. If not, see . 19 | # 20 | 21 | # Variables that describe dependencies 22 | LSP_COMMON_LIB_VERSION := 1.0.42 23 | LSP_COMMON_LIB_NAME := lsp-common-lib 24 | LSP_COMMON_LIB_TYPE := src 25 | LSP_COMMON_LIB_URL_RO := https://github.com/lsp-plugins/$(LSP_COMMON_LIB_NAME).git 26 | LSP_COMMON_LIB_URL_RW := git@github.com:lsp-plugins/$(LSP_COMMON_LIB_NAME).git 27 | 28 | LSP_TEST_FW_VERSION := 1.0.31 29 | LSP_TEST_FW_NAME := lsp-test-fw 30 | LSP_TEST_FW_TYPE := src 31 | LSP_TEST_FW_URL_RO := https://github.com/lsp-plugins/$(LSP_TEST_FW_NAME).git 32 | LSP_TEST_FW_URL_RW := git@github.com:lsp-plugins/$(LSP_TEST_FW_NAME).git 33 | 34 | LIBPTHREAD_VERSION := system 35 | LIBPTHREAD_NAME := libpthread 36 | LIBPTHREAD_TYPE := opt 37 | LIBPTHREAD_LDFLAGS := -lpthread 38 | 39 | LIBSHLWAPI_VERSION := system 40 | LIBSHLWAPI_NAME := libshlwapi 41 | LIBSHLWAPI_TYPE := opt 42 | LIBSHLWAPI_LDFLAGS := -lshlwapi 43 | -------------------------------------------------------------------------------- /project.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2020 Linux Studio Plugins Project 3 | # (C) 2020 Vladimir Sadovnikov 4 | # 5 | # This file is part of lsp-dsp-lib 6 | # 7 | # lsp-dsp-lib is free software: you can redistribute it and/or modify 8 | # it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or 10 | # any later version. 11 | # 12 | # lsp-dsp-lib is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | # GNU Lesser General Public License for more details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with lsp-dsp-lib. If not, see . 19 | # 20 | 21 | # Package version 22 | ARTIFACT_ID = LSP_DSP_LIB 23 | ARTIFACT_NAME = lsp-dsp-lib 24 | ARTIFACT_DESC = DSP library for digital signal processing 25 | ARTIFACT_HEADERS = lsp-plug.in 26 | ARTIFACT_VERSION = 1.0.30 27 | -------------------------------------------------------------------------------- /src/main/dsp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | 33 | #define LSP_DSP_LIB_SYMBOL(ret, name, ...) \ 34 | namespace lsp { \ 35 | namespace dsp { \ 36 | LSP_DSP_LIB_PUBLIC \ 37 | ret (* name)(__VA_ARGS__) = NULL; \ 38 | \ 39 | extern "C" { \ 40 | LSP_DSP_LIB_PUBLIC \ 41 | ret (* LSP_DSP_LIB_MANGLE(name))(__VA_ARGS__) = NULL; \ 42 | } \ 43 | } \ 44 | } 45 | 46 | #include 47 | 48 | #ifndef LSP_DSP_CPU_NAMESPACE 49 | #define IF_ARCH_SPECIFIC_INIT(...) 50 | #else 51 | #define IF_ARCH_SPECIFIC_INIT(...) __VA_ARGS__ 52 | #endif /* LSP_DSP_CPU_NAMESPACE */ 53 | 54 | 55 | namespace lsp 56 | { 57 | namespace dsp 58 | { 59 | static lsp::singletone_t library; 60 | 61 | LSP_DSP_LIB_PUBLIC 62 | void init() 63 | { 64 | // Check that library has already been initialized 65 | if (library.initialized()) 66 | return; 67 | 68 | // Dectect CPU options 69 | IF_ARCH_SPECIFIC_INIT( 70 | LSP_DSP_CPU_NAMESPACE::cpu_features_t f; 71 | LSP_DSP_CPU_NAMESPACE::detect_cpu_features(&f); 72 | ); 73 | 74 | // Write architecture-optimized pointers to functions 75 | lsp_singletone_init(library) { 76 | // Initialize native functions 77 | generic::dsp_init(); 78 | 79 | // Initialize architecture-dependent functions that utilize architecture-specific features 80 | IF_ARCH_SPECIFIC_INIT(LSP_DSP_CPU_NAMESPACE::dsp_init(&f)); 81 | }; 82 | } 83 | 84 | extern "C" 85 | { 86 | LSP_DSP_LIB_PUBLIC 87 | void LSP_DSP_LIB_MANGLE(init)() 88 | { 89 | dsp::init(); 90 | } 91 | } 92 | } 93 | } 94 | 95 | 96 | -------------------------------------------------------------------------------- /src/main/x86/sse4.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #include 23 | 24 | #ifdef ARCH_X86 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | // Test framework 31 | #ifdef LSP_TESTING 32 | #include 33 | #else 34 | #define TEST_EXPORT(...) 35 | #endif /* LSP_TESTING */ 36 | 37 | // Feature detection 38 | #define PRIVATE_DSP_ARCH_X86_IMPL 39 | #include 40 | #include 41 | #undef PRIVATE_DSP_ARCH_X86_IMPL 42 | 43 | #define PRIVATE_DSP_ARCH_X86_SSE4_IMPL 44 | #include 45 | #undef PRIVATE_DSP_ARCH_X86_SSE4_IMPL 46 | 47 | namespace lsp 48 | { 49 | namespace sse4 50 | { 51 | using namespace x86; 52 | 53 | #define EXPORT1(function) \ 54 | { \ 55 | dsp::function = sse4::function; \ 56 | dsp::LSP_DSP_LIB_MANGLE(function) = sse4::function; \ 57 | TEST_EXPORT(sse4::function); \ 58 | } 59 | 60 | void dsp_init(const cpu_features_t *f) 61 | { 62 | if (!(f->features & CPU_OPTION_SSE4_1)) 63 | return; 64 | 65 | // 3D Math 66 | EXPORT1(normalize_point); 67 | EXPORT1(scale_point1); 68 | EXPORT1(scale_point2); 69 | 70 | EXPORT1(normalize_vector); 71 | EXPORT1(scale_vector1); 72 | EXPORT1(scale_vector2); 73 | 74 | EXPORT1(check_point3d_on_triangle_p3p); 75 | EXPORT1(check_point3d_on_triangle_pvp); 76 | EXPORT1(check_point3d_on_triangle_tp); 77 | } 78 | 79 | #undef EXPORT1 80 | } /* namespace sse4 */ 81 | } /* namespace lsp */ 82 | 83 | #endif /* ARCH_X86 */ 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/test/init/dsp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace lsp 27 | { 28 | static __thread dsp::context_t *pTestContext = NULL; 29 | } 30 | 31 | INIT_BEGIN(dsp_initializer) 32 | 33 | INIT_FUNC 34 | { 35 | // Initialize DSP 36 | dsp::init(); 37 | 38 | // Output information if necessary 39 | dsp::info_t *info = dsp::info(); 40 | if (info != NULL) 41 | { 42 | printf("Architecture: %s\n", info->arch); 43 | printf("Processor: %s\n", info->cpu); 44 | printf("Model: %s\n", info->model); 45 | printf("Features: %s\n", info->features); 46 | 47 | ::free(info); 48 | } 49 | } 50 | 51 | BEFORE_FUNC 52 | { 53 | // Check test match 54 | if (::strstr(test, "dsp.") != test) 55 | return; 56 | 57 | // Update context 58 | pTestContext = reinterpret_cast(::malloc(sizeof(dsp::context_t))); 59 | if (pTestContext != NULL) 60 | dsp::start(pTestContext); 61 | } 62 | 63 | AFTER_FUNC 64 | { 65 | // Restore context 66 | if (pTestContext != NULL) 67 | { 68 | dsp::finish(pTestContext); 69 | ::free(pTestContext); 70 | pTestContext = NULL; 71 | } 72 | } 73 | 74 | INIT_END 75 | 76 | 77 | -------------------------------------------------------------------------------- /src/test/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #include 23 | 24 | #ifndef LSP_BUILTIN_MODULE 25 | int main(int argc, const char **argv) 26 | { 27 | lsp::test::main(argc, argv); 28 | } 29 | #endif 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/test/utest/3d/edge.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | namespace lsp 27 | { 28 | namespace generic 29 | { 30 | size_t longest_edge3d_p3(const dsp::point3d_t *p1, const dsp::point3d_t *p2, const dsp::point3d_t *p3); 31 | size_t longest_edge3d_pv(const dsp::point3d_t *p); 32 | } 33 | 34 | IF_ARCH_X86( 35 | namespace sse 36 | { 37 | size_t longest_edge3d_p3(const dsp::point3d_t *p1, const dsp::point3d_t *p2, const dsp::point3d_t *p3); 38 | size_t longest_edge3d_pv(const dsp::point3d_t *p); 39 | } 40 | ) 41 | 42 | typedef size_t (* longest_edge3d_p3_t)(const dsp::point3d_t *p1, const dsp::point3d_t *p2, const dsp::point3d_t *p3); 43 | typedef size_t (* longest_edge3d_pv_t)(const dsp::point3d_t *p); 44 | } 45 | 46 | UTEST_BEGIN("dsp.3d", edge) 47 | 48 | void call(const char *label, 49 | longest_edge3d_p3_t longest_edge3d_p3, 50 | longest_edge3d_pv_t longest_edge3d_pv 51 | ) 52 | { 53 | printf("Testing %s...\n", label); 54 | 55 | dsp::point3d_t lp[3]; 56 | dsp::init_point_xyz(&lp[0], 1.0f, 1.0f, 1.0f); 57 | dsp::init_point_xyz(&lp[1], 2.0f, 2.0f, 2.0f); 58 | dsp::init_point_xyz(&lp[2], 0.1f, 0.1f, 0.1f); 59 | 60 | UTEST_ASSERT_MSG(longest_edge3d_pv(lp) == 1, "longest_edge3d_pv failed"); 61 | 62 | UTEST_ASSERT_MSG(longest_edge3d_p3(&lp[0], &lp[1], &lp[2]) == 1, "longest_edge3d_p3 failed"); 63 | UTEST_ASSERT_MSG(longest_edge3d_p3(&lp[1], &lp[2], &lp[0]) == 0, "longest_edge3d_p3 failed"); 64 | UTEST_ASSERT_MSG(longest_edge3d_p3(&lp[2], &lp[0], &lp[1]) == 2, "longest_edge3d_p3 failed"); 65 | } 66 | 67 | UTEST_MAIN 68 | { 69 | call("generic::longest_edge", 70 | generic::longest_edge3d_p3, 71 | generic::longest_edge3d_pv 72 | ); 73 | IF_ARCH_X86( 74 | call("sse::longest_edge", 75 | sse::longest_edge3d_p3, 76 | sse::longest_edge3d_pv 77 | ) 78 | ); 79 | } 80 | 81 | UTEST_END 82 | 83 | 84 | 85 | 86 | 87 | -------------------------------------------------------------------------------- /src/test/utest/3d/point.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace lsp 28 | { 29 | namespace generic 30 | { 31 | void init_point_xyz(dsp::point3d_t *p, float x, float y, float z); 32 | void init_point(dsp::point3d_t *p, const dsp::point3d_t *s); 33 | void normalize_point(dsp::point3d_t *p); 34 | } 35 | 36 | IF_ARCH_X86( 37 | namespace sse 38 | { 39 | void init_point_xyz(dsp::point3d_t *p, float x, float y, float z); 40 | void init_point(dsp::point3d_t *p, const dsp::point3d_t *s); 41 | void normalize_point(dsp::point3d_t *p); 42 | } 43 | ) 44 | 45 | typedef void (* init_point_xyz_t)(dsp::point3d_t *p, float x, float y, float z); 46 | typedef void (* init_point_t)(dsp::point3d_t *p, const dsp::point3d_t *s); 47 | typedef void (* normalize_point_t)(dsp::point3d_t *p); 48 | } 49 | 50 | UTEST_BEGIN("dsp.3d", point) 51 | 52 | void call( 53 | const char *label, 54 | init_point_xyz_t init_xyz, 55 | init_point_t init, 56 | normalize_point_t norm 57 | ) 58 | { 59 | if ((!UTEST_SUPPORTED(init_xyz)) || (!UTEST_SUPPORTED(init)) || (!UTEST_SUPPORTED(norm))) 60 | return; 61 | 62 | printf("Testing %s\n", label); 63 | 64 | dsp::point3d_t p1, p2, p3; 65 | 66 | generic::init_point_xyz(&p1, 1.0f, 2.0f, 3.0f); 67 | init_xyz(&p2, 1.0f, 2.0f, 3.0f); 68 | UTEST_ASSERT_MSG(point3d_sck(&p1, &p2), "Failed init_point_xyz"); 69 | 70 | generic::init_point(&p2, &p1); 71 | init(&p3, &p1); 72 | UTEST_ASSERT_MSG(point3d_sck(&p1, &p2), "Failed generic init_point"); 73 | UTEST_ASSERT_MSG(point3d_sck(&p1, &p3), "Failed optimized init_point"); 74 | 75 | generic::normalize_point(&p2); 76 | norm(&p3); 77 | 78 | UTEST_ASSERT_MSG(point3d_sck(&p2, &p3), "Failed normalize point"); 79 | } 80 | 81 | UTEST_MAIN 82 | { 83 | IF_ARCH_X86(call("sse_point", sse::init_point_xyz, sse::init_point, sse::normalize_point)); 84 | } 85 | UTEST_END; 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/test/utest/3d/vector.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2020 Linux Studio Plugins Project 3 | * (C) 2020 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 31 мар. 2020 г. 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 . 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace lsp 28 | { 29 | namespace generic 30 | { 31 | void init_vector_dxyz(dsp::vector3d_t *v, float dx, float dy, float dz); 32 | void init_vector(dsp::vector3d_t *p, const dsp::vector3d_t *s); 33 | void normalize_vector(dsp::vector3d_t *v); 34 | } 35 | 36 | IF_ARCH_X86( 37 | namespace sse 38 | { 39 | void init_vector_dxyz(dsp::vector3d_t *v, float dx, float dy, float dz); 40 | void init_vector(dsp::vector3d_t *p, const dsp::vector3d_t *s); 41 | void normalize_vector(dsp::vector3d_t *v); 42 | } 43 | ) 44 | 45 | typedef void (* init_vector_dxyz_t)(dsp::vector3d_t *v, float dx, float dy, float dz); 46 | typedef void (* init_vector_t)(dsp::vector3d_t *p, const dsp::vector3d_t *s); 47 | typedef void (* normalize_vector_t)(dsp::vector3d_t *v); 48 | } 49 | 50 | UTEST_BEGIN("dsp.3d", vector) 51 | 52 | void call( 53 | const char *label, 54 | init_vector_dxyz_t init_dxyz, 55 | init_vector_t init, 56 | normalize_vector_t norm 57 | ) 58 | { 59 | if ((!UTEST_SUPPORTED(init_dxyz)) || (!UTEST_SUPPORTED(init)) || (!UTEST_SUPPORTED(norm))) 60 | return; 61 | 62 | printf("Testing %s\n", label); 63 | 64 | dsp::vector3d_t v1, v2, v3; 65 | 66 | generic::init_vector_dxyz(&v1, 1.0f, 2.0f, 3.0f); 67 | init_dxyz(&v2, 1.0f, 2.0f, 3.0f); 68 | UTEST_ASSERT_MSG(vector3d_sck(&v1, &v2), "Failed init_vector_dxyz"); 69 | 70 | generic::init_vector(&v2, &v1); 71 | init(&v3, &v1); 72 | UTEST_ASSERT_MSG(vector3d_sck(&v1, &v2), "Failed generic init_vector"); 73 | UTEST_ASSERT_MSG(vector3d_sck(&v1, &v3), "Failed optimized init_vector"); 74 | 75 | generic::normalize_vector(&v2); 76 | norm(&v3); 77 | 78 | UTEST_ASSERT_MSG(vector3d_sck(&v2, &v3), "Failed normalize vector"); 79 | } 80 | 81 | UTEST_MAIN 82 | { 83 | IF_ARCH_X86(call("sse_vector", sse::init_vector_dxyz, sse::init_vector, sse::normalize_vector)); 84 | } 85 | UTEST_END; 86 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /src/test/utest/c_compat.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 26 авг. 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 . 20 | */ 21 | 22 | #define LSP_DSP_LIB_USE_C_IFACE 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | static constexpr size_t ARRAY_SIZE = 0x1000; 29 | 30 | UTEST_BEGIN("dsp", c_compat) 31 | UTEST_MAIN 32 | { 33 | // Optionally: output information about the system 34 | lsp_dsp_info_t *info = lsp_dsp_info(); 35 | if (info != NULL) 36 | { 37 | printf("Architecture: %s\n", info->arch); 38 | printf("Processor: %s\n", info->cpu); 39 | printf("Model: %s\n", info->model); 40 | printf("Features: %s\n", info->features); 41 | 42 | free(info); 43 | } 44 | 45 | // For faster computing we can tune CPU by updating thread context. 46 | // This will enable Flush-to-Zero and Denormals-are-Zero flags on 47 | // CPUs that support them. This is thread-local change and should 48 | // be called in each individual processing thread 49 | lsp_dsp_context_t ctx; 50 | lsp_dsp_start(&ctx); 51 | 52 | // Here we call some dsp functions, for example lsp_dsp_fill_zero 53 | float *v = static_cast(malloc(ARRAY_SIZE * sizeof(float))); 54 | lsp_finally { free(v); }; 55 | lsp_dsp_fill_zero(v, ARRAY_SIZE); 56 | 57 | // At the end, we need to restore the context and reset CPU settings to defaults 58 | lsp_dsp_finish(&ctx); 59 | } 60 | 61 | UTEST_END; 62 | 63 | 64 | -------------------------------------------------------------------------------- /src/test/utest/dsp/bitmap/util.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2023 Linux Studio Plugins Project 3 | * (C) 2023 Vladimir Sadovnikov 4 | * 5 | * This file is part of lsp-dsp-lib 6 | * Created on: 21 апр. 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 . 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | namespace lsp 26 | { 27 | namespace test 28 | { 29 | static const char hex_chars[] = "0123456789abcdef"; 30 | 31 | /** 32 | * Rasterize bitmap 33 | * @param bitmap bitmap to rasterize 34 | * @return rasterized bitmap image, should be free()'d after use 35 | */ 36 | char *rasterize(const dsp::bitmap_t *bitmap) 37 | { 38 | size_t to_alloc = (bitmap->width * 2 + 1) * bitmap->height + 1; 39 | 40 | char *buf = reinterpret_cast(malloc(to_alloc)); 41 | if (buf == NULL) 42 | return buf; 43 | 44 | char *p = buf; 45 | for (ssize_t y=0; yheight; ++y) 46 | { 47 | const uint8_t *s = &bitmap->data[y * bitmap->stride]; 48 | for (ssize_t x=0; xwidth; ++x) 49 | { 50 | uint8_t b = s[x]; 51 | *(p++) = hex_chars[b >> 4]; 52 | *(p++) = hex_chars[b & 0x0f]; 53 | } 54 | *(p++) = '\n'; 55 | } 56 | *(p++) = '\0'; 57 | 58 | return buf; 59 | } 60 | 61 | } /* namespace test */ 62 | } /* namespace lsp */ 63 | 64 | 65 | --------------------------------------------------------------------------------