MPD: pcm/dsd2pcm/noiseshape.h Source File

MPD 0.20.15

noiseshape.h
Go to the documentation of this file.
1 /*
2
3 Copyright 2009, 2011 Sebastian Gesemann. All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification, are
6 permitted provided that the following conditions are met:
7
8 1. Redistributions of source code must retain the above copyright notice, this list of
9 conditions and the following disclaimer.
10
11 2. Redistributions in binary form must reproduce the above copyright notice, this list
12 of conditions and the following disclaimer in the documentation and/or other materials
13 provided with the distribution.
14
15 THIS SOFTWARE IS PROVIDED BY SEBASTIAN GESEMANN ''AS IS'' AND ANY EXPRESS OR IMPLIED
16 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SEBASTIAN GESEMANN OR
18 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
22 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25 The views and conclusions contained in the software and documentation are those of the
26 authors and should not be interpreted as representing official policies, either expressed
27 or implied, of Sebastian Gesemann.
28
29 */
30
31 #ifndef NOISE_SHAPE_H_INCLUDED
32 #define NOISE_SHAPE_H_INCLUDED
33
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37
38 typedef struct noise_shape_ctx_s {
39 int sos_count; /* number of second order sections */
40 const float *bbaa; /* filter coefficients, owned by user */
41 float *t1, *t2; /* filter state, owned by ns library */
42 } noise_shape_ctx;
43
48 extern int noise_shape_init(
49 noise_shape_ctx *ctx,
50 int sos_count,
51 const float *coeffs);
52
56 extern void noise_shape_destroy(
57 noise_shape_ctx *ctx);
58
64 extern int noise_shape_clone(
65 const noise_shape_ctx *from, noise_shape_ctx *to);
66
72 extern float noise_shape_get(
73 noise_shape_ctx *ctx);
74
79 extern void noise_shape_update(
80 noise_shape_ctx *ctx, float qerror);
81
82 #ifdef __cplusplus
83 } /* extern "C" */
84 #endif
85
86 #endif /* NOISE_SHAPE_H_INCLUDED */
87
noise_shape_clone
int noise_shape_clone(const noise_shape_ctx *from, noise_shape_ctx *to)
initializes a noise_shaper context so that its state is a copy of a given context returns an error co...
noise_shape_init
int noise_shape_init(noise_shape_ctx *ctx, int sos_count, const float *coeffs)
initializes a noise_shaper context returns an error code or 0
noise_shape_ctx_s::bbaa
const float * bbaa
Definition: noiseshape.h:40
noise_shape_get
float noise_shape_get(noise_shape_ctx *ctx)
computes the next "noise shaping sample".
noise_shape_destroy
void noise_shape_destroy(noise_shape_ctx *ctx)
destroys a noise_shaper context
noise_shape_ctx_s::sos_count
int sos_count
Definition: noiseshape.h:39
noise_shape_ctx
struct noise_shape_ctx_s noise_shape_ctx
noise_shape_update
void noise_shape_update(noise_shape_ctx *ctx, float qerror)
updates the noise shaper&#39;s state with the last quantization error
noise_shape_ctx_s::t1
float * t1
Definition: noiseshape.h:41
noise_shape_ctx_s::t2
float * t2
Definition: noiseshape.h:41
noise_shape_ctx_s
Definition: noiseshape.h:38