Home | History | Annotate | Download | only in lib
      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 __MIXER_H__
     19 #define __MIXER_H__
     20 
     21 
     22 #ifdef __cplusplus
     23 extern "C" {
     24 #endif /* __cplusplus */
     25 
     26 
     27 #include "LVM_Types.h"
     28 
     29 /**********************************************************************************
     30    INSTANCE MEMORY TYPE DEFINITION
     31 ***********************************************************************************/
     32 
     33 #ifdef BUILD_FLOAT /* BUILD_FLOAT*/
     34 typedef struct
     35 {
     36     LVM_FLOAT   Alpha;                   /* Time constant. Set by calling application. \
     37                                             Can be changed at any time */
     38     LVM_FLOAT   Target;                  /* Target value.  Set by calling application. \
     39                                             Can be changed at any time */
     40     LVM_FLOAT   Current;                 /* Current value.  Set by the mixer function. */
     41     LVM_INT16   CallbackSet;             /* Boolean.  Should be set by calling application \
     42                                             each time the target value is updated */
     43     LVM_INT16   CallbackParam;           /* Parameter that will be used in the calback function */
     44     void        *pCallbackHandle;        /* Pointer to the instance of the callback function */
     45     void        *pGeneralPurpose;        /* Pointer for general purpose usage */
     46     LVM_Callback pCallBack;              /* Pointer to the callback function */
     47 } Mix_1St_Cll_FLOAT_t;
     48 typedef struct
     49 {
     50     LVM_FLOAT   Alpha1;
     51     LVM_FLOAT   Target1;
     52     LVM_FLOAT   Current1;
     53     LVM_INT16   CallbackSet1;
     54     LVM_INT16   CallbackParam1;
     55     void        *pCallbackHandle1;
     56     void        *pGeneralPurpose1;
     57     LVM_Callback pCallBack1;
     58 
     59     LVM_FLOAT   Alpha2;                   /* Warning the address of this location is passed as a \
     60                                              pointer to Mix_1St_Cll_t in some functions */
     61     LVM_FLOAT   Target2;
     62     LVM_FLOAT   Current2;
     63     LVM_INT16   CallbackSet2;
     64     LVM_INT16   CallbackParam2;
     65     void        *pCallbackHandle2;
     66     void        *pGeneralPurpose2;
     67     LVM_Callback pCallBack2;
     68 } Mix_2St_Cll_FLOAT_t;
     69 #else
     70 typedef struct
     71 {
     72     LVM_INT32   Alpha;                    /* Time constant. Set by calling application.  Can be changed at any time */
     73     LVM_INT32   Target;                   /* Target value.  Set by calling application.  Can be changed at any time */
     74     LVM_INT32   Current;                  /* Current value.  Set by the mixer function. */
     75     LVM_INT16   CallbackSet;              /* Boolean.  Should be set by calling application each time the target value is updated */
     76     LVM_INT16   CallbackParam;            /* Parameter that will be used in the calback function */
     77     void        *pCallbackHandle;         /* Pointer to the instance of the callback function */
     78     void        *pGeneralPurpose;         /* Pointer for general purpose usage */
     79     LVM_Callback pCallBack;               /* Pointer to the callback function */
     80 } Mix_1St_Cll_t;
     81 
     82 typedef struct
     83 {
     84     LVM_INT32   Alpha1;
     85     LVM_INT32   Target1;
     86     LVM_INT32   Current1;
     87     LVM_INT16   CallbackSet1;
     88     LVM_INT16   CallbackParam1;
     89     void        *pCallbackHandle1;
     90     void        *pGeneralPurpose1;
     91     LVM_Callback pCallBack1;
     92 
     93     LVM_INT32   Alpha2;                   /* Warning the address of this location is passed as a pointer to Mix_1St_Cll_t in some functions */
     94     LVM_INT32   Target2;
     95     LVM_INT32   Current2;
     96     LVM_INT16   CallbackSet2;
     97     LVM_INT16   CallbackParam2;
     98     void        *pCallbackHandle2;
     99     void        *pGeneralPurpose2;
    100     LVM_Callback pCallBack2;
    101 
    102 } Mix_2St_Cll_t;
    103 
    104 #endif
    105 
    106 /*** General functions ************************************************************/
    107 #ifdef BUILD_FLOAT
    108 
    109 LVM_FLOAT LVM_Mixer_TimeConstant(LVM_UINT32   tc,
    110 #ifdef HIGHER_FS
    111                                  LVM_UINT32   Fs,
    112 #else
    113                                  LVM_UINT16   Fs,
    114 #endif
    115                                  LVM_UINT16   NumChannels);
    116 
    117 void MixSoft_1St_D32C31_WRA(    Mix_1St_Cll_FLOAT_t       *pInstance,
    118                                 const LVM_FLOAT     *src,
    119                                 LVM_FLOAT     *dst,
    120                                 LVM_INT16     n);
    121 
    122 void MixSoft_2St_D32C31_SAT(    Mix_2St_Cll_FLOAT_t       *pInstance,
    123                                 const LVM_FLOAT     *src1,
    124                                 const LVM_FLOAT     *src2,
    125                                 LVM_FLOAT     *dst,
    126                                 LVM_INT16     n);
    127 
    128 void MixInSoft_D32C31_SAT(      Mix_1St_Cll_FLOAT_t       *pInstance,
    129                                 const LVM_FLOAT     *src,
    130                                 LVM_FLOAT     *dst,
    131                                 LVM_INT16     n);
    132 #else
    133 LVM_UINT32 LVM_Mixer_TimeConstant(LVM_UINT32   tc,
    134                                   LVM_UINT16   Fs,
    135                                   LVM_UINT16   NumChannels);
    136 
    137 
    138 void MixSoft_1St_D32C31_WRA(    Mix_1St_Cll_t       *pInstance,
    139                                 const LVM_INT32     *src,
    140                                       LVM_INT32     *dst,
    141                                       LVM_INT16     n);
    142 
    143 void MixSoft_2St_D32C31_SAT(    Mix_2St_Cll_t       *pInstance,
    144                                 const LVM_INT32     *src1,
    145                                 const LVM_INT32     *src2,
    146                                       LVM_INT32     *dst,
    147                                       LVM_INT16     n);
    148 
    149 void MixInSoft_D32C31_SAT(      Mix_1St_Cll_t       *pInstance,
    150                                 const LVM_INT32     *src,
    151                                       LVM_INT32     *dst,
    152                                       LVM_INT16     n);
    153 
    154 #endif
    155 
    156 /**********************************************************************************
    157    FUNCTION PROTOTYPES (LOW LEVEL SUBFUNCTIONS)
    158 ***********************************************************************************/
    159 #ifdef BUILD_FLOAT
    160 void Core_MixSoft_1St_D32C31_WRA(   Mix_1St_Cll_FLOAT_t       *pInstance,
    161                                     const LVM_FLOAT     *src,
    162                                     LVM_FLOAT     *dst,
    163                                     LVM_INT16     n);
    164 void Core_MixHard_2St_D32C31_SAT(   Mix_2St_Cll_FLOAT_t       *pInstance,
    165                                     const LVM_FLOAT     *src1,
    166                                     const LVM_FLOAT     *src2,
    167                                     LVM_FLOAT     *dst,
    168                                     LVM_INT16     n);
    169 void Core_MixInSoft_D32C31_SAT(     Mix_1St_Cll_FLOAT_t       *pInstance,
    170                                     const LVM_FLOAT     *src,
    171                                     LVM_FLOAT     *dst,
    172                                     LVM_INT16     n);
    173 #else
    174 void Core_MixSoft_1St_D32C31_WRA(   Mix_1St_Cll_t       *pInstance,
    175                                     const LVM_INT32     *src,
    176                                           LVM_INT32     *dst,
    177                                           LVM_INT16     n);
    178 
    179 void Core_MixHard_2St_D32C31_SAT(   Mix_2St_Cll_t       *pInstance,
    180                                     const LVM_INT32     *src1,
    181                                     const LVM_INT32     *src2,
    182                                           LVM_INT32     *dst,
    183                                           LVM_INT16     n);
    184 
    185 void Core_MixInSoft_D32C31_SAT(     Mix_1St_Cll_t       *pInstance,
    186                                     const LVM_INT32     *src,
    187                                           LVM_INT32     *dst,
    188                                           LVM_INT16     n);
    189 #endif
    190 #ifdef __cplusplus
    191 }
    192 #endif /* __cplusplus */
    193 
    194 
    195 /**********************************************************************************/
    196 
    197 #endif /* __MIXER_H__ */
    198