File: interpolation.h

package info (click to toggle)
lsp-plugins 1.2.5-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 91,856 kB
  • sloc: cpp: 427,831; xml: 57,779; makefile: 9,961; php: 1,005; sh: 18
file content (85 lines) | stat: -rw-r--r-- 3,874 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
 * Copyright (C) 2020 Linux Studio Plugins Project <https://lsp-plug.in/>
 *           (C) 2020 Vladimir Sadovnikov <sadko4u@gmail.com>
 *
 * This file is part of lsp-plugins
 * Created on: 23 сент. 2016 г.
 *
 * lsp-plugins is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * any later version.
 *
 * lsp-plugins is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with lsp-plugins. If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef LSP_PLUG_IN_DSP_UNITS_MISC_INTERPOLATION_H_
#define LSP_PLUG_IN_DSP_UNITS_MISC_INTERPOLATION_H_

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

namespace lsp
{
    namespace dspu
    {
        namespace interpolation
        {
            /** Perform quadratic Hermite interpolation
             *
             * @param p destination (3 floats) to store the final hermite polynom
             * @param x0 x-coordinate of first point used for interpolation
             * @param y0 y-coordinate of first point used for interpolation
             * @param k0 the tangent angle of the line at first point
             * @param x1 x-coordinate of second point used for interpolation
             * @param k1 the tangent angle of the line at second point
             */
            LSP_DSP_UNITS_PUBLIC
            void hermite_quadratic(float *p, float x0, float y0, float k0, float x1, float k1);

            /** Perform cubic Hermite interpolation
             *
             * @param p destination (4 floats) to store the final hermite polynom
             * @param x0 x-coordinate of first point used for interpolation
             * @param y0 y-coordinate of first point used for interpolation
             * @param k0 the tangent angle of the line at first point
             * @param x1 x-coordinate of second point used for interpolation
             * @param y1 y-coordinate of second point used for interpolation
             * @param k1 the tangent angle of the line at second point
             */
            LSP_DSP_UNITS_PUBLIC
            void hermite_cubic(float *p, float x0, float y0, float k0, float x1, float y1, float k1);

            /** Perform exponent interpolation
             *
             * @param p destination (3 floats) to store the formula: y(x) = p[0] + p[1] * exp(p[2] * x)
             * @param x0 x-coordinate of first point used for interpolation
             * @param y0 y-coordinate of first point used for interpolation
             * @param x1 x-coordinate of second point used for interpolation
             * @param y1 y-coordinate of second point used for interpolation
             * @param k growing/lowering coefficient
             */
            LSP_DSP_UNITS_PUBLIC
            void exponent(float *p, float x0, float y0, float x1, float y1, float k);

            /** Perform linear interpolation
             *
             * @param p destination (2 floats) to store the formula: y(x) = p[0]*x + p[1]
             * @param x0 x-coordinate of first point used for interpolation
             * @param y0 y-coordinate of first point used for interpolation
             * @param x1 x-coordinate of second point used for interpolation
             * @param y1 y-coordinate of second point used for interpolation
             */
            LSP_DSP_UNITS_PUBLIC
            void linear(float *p, float x0, float y0, float x1, float y1);
        }
    }
}

#endif /* LSP_PLUG_IN_DSP_UNITS_MISC_INTERPOLATION_H_ */