1 /*
2  * Copyright (C) 2004-2010 NXP Software
3  * Copyright (C) 2010 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef _COMP_LIM_H
19 #define _COMP_LIM_H
20 
21 /************************************************************************************/
22 /*                                                                                  */
23 /*  Includes                                                                        */
24 /*                                                                                  */
25 /************************************************************************************/
26 
27 #include "LVM_Types.h"
28 
29 /************************************************************************************/
30 /*                                                                                  */
31 /*  Structures                                                                      */
32 /*                                                                                  */
33 /************************************************************************************/
34 
35 typedef struct /* Compressor state */
36 {
37     /* Normaliser */
38     LVM_INT16 Norm_Attack; /* Attack time constant of the Normaliser integrator */
39     LVM_INT16 Norm_Decay;  /* Decay time constant of the Normaliser integrator */
40     LVM_INT32 NormInt;     /* Normaliser integrator current value */
41     LVM_INT16 Shift;       /* Shift gain */
42     LVM_INT16 Threshold;   /* Target threshold */
43 
44     /* Compressor */
45     LVM_INT16 Comp_Atten;    /* Attenuation applied before soft knee compressor */
46     LVM_INT16 Comp_Attack_S; /* Attack time constant of the slow integrator */
47     LVM_INT16 Comp_Decay_S;  /* Decay time constant of slow the integrator */
48     LVM_INT16 Comp_Attack_F; /* Attack time constant of fast the integrator */
49     LVM_INT16 Comp_Decay_F;  /* Decay time constant of fast the integrator */
50     LVM_INT16 SoftClipGain;  /* Soft clip gain control */
51     LVM_INT32 CompIntSlow;   /* Compressor slow integrator current value */
52     LVM_INT32 CompIntFast;   /* Compressor fast integrator current value */
53 
54 } CompLim_Instance_t;
55 
56 /************************************************************************************/
57 /*                                                                                  */
58 /*  Function Prototypes                                                             */
59 /*                                                                                  */
60 /************************************************************************************/
61 void NonLinComp_Float(LVM_FLOAT Gain, LVM_FLOAT* pDataIn, LVM_FLOAT* pDataOut,
62                       LVM_INT32 BlockLength);
63 
64 #endif /* #ifndef _COMP_LIM_H */
65