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 #ifdef __cplusplus
22 extern "C" {
23 #endif /* __cplusplus */
24 
25 
26 /************************************************************************************/
27 /*                                                                                  */
28 /*  Includes                                                                        */
29 /*                                                                                  */
30 /************************************************************************************/
31 
32 #include "LVM_Types.h"
33 
34 
35 /************************************************************************************/
36 /*                                                                                  */
37 /*  Structures                                                                      */
38 /*                                                                                  */
39 /************************************************************************************/
40 
41 typedef struct /* Compressor state */
42 {
43     /* Normaliser */
44     LVM_INT16   Norm_Attack;        /* Attack time constant of the Normaliser integrator */
45     LVM_INT16   Norm_Decay;         /* Decay time constant of the Normaliser integrator */
46     LVM_INT32   NormInt;            /* Normaliser integrator current value */
47     LVM_INT16   Shift;              /* Shift gain */
48     LVM_INT16   Threshold;          /* Target threshold */
49 
50     /* Compressor */
51     LVM_INT16   Comp_Atten;         /* Attenuation applied before soft knee compressor */
52     LVM_INT16   Comp_Attack_S;      /* Attack time constant of the slow integrator */
53     LVM_INT16   Comp_Decay_S;       /* Decay time constant of slow the integrator */
54     LVM_INT16   Comp_Attack_F;      /* Attack time constant of fast the integrator */
55     LVM_INT16   Comp_Decay_F;       /* Decay time constant of fast the integrator */
56     LVM_INT16   SoftClipGain;       /* Soft clip gain control */
57     LVM_INT32   CompIntSlow;        /* Compressor slow integrator current value */
58     LVM_INT32   CompIntFast;        /* Compressor fast integrator current value */
59 
60 
61 } CompLim_Instance_t;
62 
63 
64 /************************************************************************************/
65 /*                                                                                  */
66 /*  Function Prototypes                                                             */
67 /*                                                                                  */
68 /************************************************************************************/
69 
70 void NonLinComp_D16(LVM_INT16        Gain,
71                     LVM_INT16        *pSterBfIn,
72                     LVM_INT16        *pSterBfOut,
73                     LVM_INT32        BlockLength);
74 
75 
76 #ifdef __cplusplus
77 }
78 #endif /* __cplusplus */
79 
80 #endif /* #ifndef _COMP_LIM_H */
81 
82 
83 
84