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:		tns_func.h
18
19	Content:	TNS functions
20
21*******************************************************************************/
22
23/*
24   Temporal noise shaping
25 */
26#ifndef _TNS_FUNC_H
27#define _TNS_FUNC_H
28#include "typedef.h"
29#include "psy_configuration.h"
30
31Word16 InitTnsConfigurationLong(Word32 bitrate,
32                                Word32 samplerate,
33                                Word16 channels,
34                                TNS_CONFIG *tnsConfig,
35                                PSY_CONFIGURATION_LONG *psyConfig,
36                                Word16 active);
37
38Word16 InitTnsConfigurationShort(Word32 bitrate,
39                                 Word32 samplerate,
40                                 Word16 channels,
41                                 TNS_CONFIG *tnsConfig,
42                                 PSY_CONFIGURATION_SHORT *psyConfig,
43                                 Word16 active);
44
45Word32 TnsDetect(TNS_DATA* tnsData,
46                 TNS_CONFIG tC,
47                 Word32* pScratchTns,
48                 const Word16 sfbOffset[],
49                 Word32* spectrum,
50                 Word16 subBlockNumber,
51                 Word16 blockType,
52                 Word32 * sfbEnergy);
53
54void TnsSync(TNS_DATA *tnsDataDest,
55             const TNS_DATA *tnsDataSrc,
56             const TNS_CONFIG tC,
57             const Word16 subBlockNumber,
58             const Word16 blockType);
59
60Word16 TnsEncode(TNS_INFO* tnsInfo,
61                 TNS_DATA* tnsData,
62                 Word16 numOfSfb,
63                 TNS_CONFIG tC,
64                 Word16 lowPassLine,
65                 Word32* spectrum,
66                 Word16 subBlockNumber,
67                 Word16 blockType);
68
69void ApplyTnsMultTableToRatios(Word16 startCb,
70                               Word16 stopCb,
71                               TNS_SUBBLOCK_INFO subInfo,
72                               Word32 *thresholds);
73
74
75#endif /* _TNS_FUNC_H */
76