• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.h
18 
19 	Content:	TNS structures
20 
21 *******************************************************************************/
22 
23 #ifndef _TNS_H
24 #define _TNS_H
25 
26 #include "typedef.h"
27 #include "psy_const.h"
28 
29 
30 
31 #define TNS_MAX_ORDER 12
32 #define TNS_MAX_ORDER_SHORT 5
33 
34 #define FILTER_DIRECTION    0
35 
36 typedef struct{ /*stuff that is tabulated dependent on bitrate etc. */
37   Word16     threshOn;                /* min. prediction gain for using tns TABUL * 100*/
38   Word32     lpcStartFreq;            /* lowest freq for lpc TABUL*/
39   Word32     lpcStopFreq;             /* TABUL */
40   Word32     tnsTimeResolution;
41 }TNS_CONFIG_TABULATED;
42 
43 
44 typedef struct {   /*assigned at InitTime*/
45   Word16 tnsActive;
46   Word16 tnsMaxSfb;
47 
48   Word16 maxOrder;                /* max. order of tns filter */
49   Word16 tnsStartFreq;            /* lowest freq. for tns filtering */
50   Word16 coefRes;
51 
52   TNS_CONFIG_TABULATED confTab;
53 
54   Word32 acfWindow[TNS_MAX_ORDER+1];
55 
56   Word16 tnsStartBand;
57   Word16 tnsStartLine;
58 
59   Word16 tnsStopBand;
60   Word16 tnsStopLine;
61 
62   Word16 lpcStartBand;
63   Word16 lpcStartLine;
64 
65   Word16 lpcStopBand;
66   Word16 lpcStopLine;
67 
68   Word16 tnsRatioPatchLowestCb;
69   Word16 tnsModifyBeginCb;
70 
71   Word16 threshold; /* min. prediction gain for using tns TABUL * 100 */
72 
73 }TNS_CONFIG;
74 
75 
76 typedef struct {
77   Word16 tnsActive;
78   Word32 parcor[TNS_MAX_ORDER];
79   Word16 predictionGain;
80 } TNS_SUBBLOCK_INFO; /* Word16 size: 26 */
81 
82 typedef struct{
83   TNS_SUBBLOCK_INFO subBlockInfo[TRANS_FAC];
84 } TNS_DATA_SHORT;
85 
86 typedef struct{
87   TNS_SUBBLOCK_INFO subBlockInfo;
88 } TNS_DATA_LONG;
89 
90 typedef struct{
91   TNS_DATA_LONG tnsLong;
92   TNS_DATA_SHORT tnsShort;
93 }TNS_DATA_RAW;
94 
95 typedef struct{
96   Word16 numOfSubblocks;
97   TNS_DATA_RAW dataRaw;
98 }TNS_DATA; /* Word16 size: 1 + 8*26 + 26 = 235 */
99 
100 typedef struct{
101   Word16 tnsActive[TRANS_FAC];
102   Word16 coefRes[TRANS_FAC];
103   Word16 length[TRANS_FAC];
104   Word16 order[TRANS_FAC];
105   Word16 coef[TRANS_FAC*TNS_MAX_ORDER_SHORT];
106 }TNS_INFO; /* Word16 size: 72 */
107 
108 #endif /* _TNS_H */
109