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/****************************************************************************************/
19/*                                                                                      */
20/*    Header file for the private layer interface of Dynamic Bass Enhancement module    */
21/*                                                                                      */
22/*  This files includes all definitions, types, structures and function                 */
23/*  prototypes required by the execution layer.                                         */
24/*                                                                                      */
25/****************************************************************************************/
26
27#ifndef __LVDBE_PRIVATE_H__
28#define __LVDBE_PRIVATE_H__
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34
35/****************************************************************************************/
36/*                                                                                      */
37/*    Includes                                                                          */
38/*                                                                                      */
39/****************************************************************************************/
40
41#include "LVDBE.h"                                /* Calling or Application layer definitions */
42#include "BIQUAD.h"
43#include "LVC_Mixer.h"
44#include "AGC.h"
45
46
47/****************************************************************************************/
48/*                                                                                      */
49/*    Defines                                                                           */
50/*                                                                                      */
51/****************************************************************************************/
52
53/* General */
54#define    LVDBE_INVALID            0xFFFF        /* Invalid init parameter */
55
56/* Memory */
57#define LVDBE_MEMREGION_INSTANCE         0       /* Offset to the instance memory region */
58#define LVDBE_MEMREGION_PERSISTENT_DATA  1       /* Offset to persistent data memory region */
59#define LVDBE_MEMREGION_PERSISTENT_COEF  2       /* Offset to persistent coefficient region */
60#define LVDBE_MEMREGION_SCRATCH          3       /* Offset to data scratch memory region */
61
62#define LVDBE_INSTANCE_ALIGN             4       /* 32-bit alignment for structures */
63#define LVDBE_PERSISTENT_DATA_ALIGN      4       /* 32-bit alignment for data */
64#define LVDBE_PERSISTENT_COEF_ALIGN      4       /* 32-bit alignment for coef */
65#define LVDBE_SCRATCH_ALIGN              4       /* 32-bit alignment for long data */
66
67#define LVDBE_SCRATCHBUFFERS_INPLACE     6       /* Number of buffers required for inplace processing */
68
69#define LVDBE_MIXER_TC                   5       /* Mixer time  */
70#define LVDBE_BYPASS_MIXER_TC            100     /* Bypass mixer time */
71
72
73/****************************************************************************************/
74/*                                                                                      */
75/*    Structures                                                                        */
76/*                                                                                      */
77/****************************************************************************************/
78
79/* Data structure */
80typedef struct
81{
82    /* AGC parameters */
83    AGC_MIX_VOL_2St1Mon_D32_t   AGCInstance;        /* AGC instance parameters */
84
85    /* Process variables */
86    Biquad_2I_Order2_Taps_t     HPFTaps;            /* High pass filter taps */
87    Biquad_1I_Order2_Taps_t     BPFTaps;            /* Band pass filter taps */
88    LVMixer3_1St_st             BypassVolume;       /* Bypass volume scaler */
89    LVMixer3_2St_st             BypassMixer;        /* Bypass Mixer for Click Removal */
90
91} LVDBE_Data_t;
92
93/* Coefs structure */
94typedef struct
95{
96    /* Process variables */
97    Biquad_Instance_t           HPFInstance;        /* High pass filter instance */
98    Biquad_Instance_t           BPFInstance;        /* Band pass filter instance */
99
100} LVDBE_Coef_t;
101
102/* Instance structure */
103typedef struct
104{
105    /* Public parameters */
106    LVDBE_MemTab_t                MemoryTable;        /* Instance memory allocation table */
107    LVDBE_Params_t                Params;             /* Instance parameters */
108    LVDBE_Capabilities_t        Capabilities;         /* Instance capabilities */
109
110    /* Data and coefficient pointers */
111    LVDBE_Data_t                *pData;                /* Instance data */
112    LVDBE_Coef_t                *pCoef;                /* Instance coefficients */
113} LVDBE_Instance_t;
114
115
116/****************************************************************************************/
117/*                                                                                      */
118/* Function prototypes                                                                  */
119/*                                                                                      */
120/****************************************************************************************/
121
122void    LVDBE_SetAGC(LVDBE_Instance_t       *pInstance,
123                     LVDBE_Params_t         *pParams);
124
125
126void    LVDBE_SetVolume(LVDBE_Instance_t    *pInstance,
127                        LVDBE_Params_t      *pParams);
128
129
130void    LVDBE_SetFilters(LVDBE_Instance_t   *pInstance,
131                         LVDBE_Params_t     *pParams);
132
133
134#ifdef __cplusplus
135}
136#endif /* __cplusplus */
137
138#endif      /* __LVDBE_PRIVATE_H__ */
139
140
141