Home | History | Annotate | Download | only in inc
      1 /*
      2  ** Copyright 2003-2010, VisualOn, Inc.
      3  **
      4  ** Licensed under the Apache License, Version 2.0 (the "License");
      5  ** you may not use this file except in compliance with the License.
      6  ** You may obtain a copy of the License at
      7  **
      8  **     http://www.apache.org/licenses/LICENSE-2.0
      9  **
     10  ** Unless required by applicable law or agreed to in writing, software
     11  ** distributed under the License is distributed on an "AS IS" BASIS,
     12  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  ** See the License for the specific language governing permissions and
     14  ** limitations under the License.
     15  */
     16 /*******************************************************************************
     17 	File:		psy_configuration.h
     18 
     19 	Content:	Psychoaccoustic configuration structure and functions
     20 
     21 *******************************************************************************/
     22 
     23 #ifndef _PSY_CONFIGURATION_H
     24 #define _PSY_CONFIGURATION_H
     25 
     26 #include "typedefs.h"
     27 #include "psy_const.h"
     28 #include "tns.h"
     29 
     30 typedef struct{
     31 
     32   Word16 sfbCnt;
     33   Word16 sfbActive;   /* number of sf bands containing energy after lowpass */
     34   const Word16 *sfbOffset;
     35 
     36   Word32 sfbThresholdQuiet[MAX_SFB_LONG];
     37 
     38   Word16 maxAllowedIncreaseFactor;   /* preecho control */
     39   Word16 minRemainingThresholdFactor;
     40 
     41   Word16 lowpassLine;
     42   Word16 sampRateIdx;
     43   Word32 clipEnergy;                 /* for level dependend tmn */
     44 
     45   Word16 ratio;
     46   Word16 sfbMaskLowFactor[MAX_SFB_LONG];
     47   Word16 sfbMaskHighFactor[MAX_SFB_LONG];
     48 
     49   Word16 sfbMaskLowFactorSprEn[MAX_SFB_LONG];
     50   Word16 sfbMaskHighFactorSprEn[MAX_SFB_LONG];
     51 
     52 
     53   Word16 sfbMinSnr[MAX_SFB_LONG];       /* minimum snr (formerly known as bmax) */
     54 
     55   TNS_CONFIG tnsConf;
     56 
     57 }PSY_CONFIGURATION_LONG; /*Word16 size: 8 + 52 + 102 + 51 + 51 + 51 + 51 + 47 = 515 */
     58 
     59 
     60 typedef struct{
     61 
     62   Word16 sfbCnt;
     63   Word16 sfbActive;   /* number of sf bands containing energy after lowpass */
     64   const Word16 *sfbOffset;
     65 
     66   Word32 sfbThresholdQuiet[MAX_SFB_SHORT];
     67 
     68   Word16 maxAllowedIncreaseFactor;   /* preecho control */
     69   Word16 minRemainingThresholdFactor;
     70 
     71   Word16 lowpassLine;
     72   Word16 sampRateIdx;
     73   Word32 clipEnergy;                 /* for level dependend tmn */
     74 
     75   Word16 ratio;
     76   Word16 sfbMaskLowFactor[MAX_SFB_SHORT];
     77   Word16 sfbMaskHighFactor[MAX_SFB_SHORT];
     78 
     79   Word16 sfbMaskLowFactorSprEn[MAX_SFB_SHORT];
     80   Word16 sfbMaskHighFactorSprEn[MAX_SFB_SHORT];
     81 
     82 
     83   Word16 sfbMinSnr[MAX_SFB_SHORT];       /* minimum snr (formerly known as bmax) */
     84 
     85   TNS_CONFIG tnsConf;
     86 
     87 }PSY_CONFIGURATION_SHORT; /*Word16 size: 8 + 16 + 16 + 16 + 16 + 16 + 16 + 16 + 47 = 167 */
     88 
     89 
     90 /* Returns the sample rate index */
     91 Word32 GetSRIndex(Word32 sampleRate);
     92 
     93 
     94 Word16 InitPsyConfigurationLong(Word32 bitrate,
     95                                 Word32 samplerate,
     96                                 Word16 bandwidth,
     97                                 PSY_CONFIGURATION_LONG *psyConf);
     98 
     99 Word16 InitPsyConfigurationShort(Word32 bitrate,
    100                                  Word32 samplerate,
    101                                  Word16 bandwidth,
    102                                  PSY_CONFIGURATION_SHORT *psyConf);
    103 
    104 #endif /* _PSY_CONFIGURATION_H */
    105 
    106 
    107 
    108