sl@0
|
1 |
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
#ifndef __SBCCONST_H__
|
sl@0
|
17 |
#define __SBCCONST_H__
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
SBC Syncword, used in the begin of each sbc frame to identify sbc frame,
|
sl@0
|
21 |
it's value is always 0x9c
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
const TUint8 KSBCFrameSyncWord = 0x9c;
|
sl@0
|
24 |
|
sl@0
|
25 |
/**
|
sl@0
|
26 |
This table is used to calculate bit allocation for 4 subbands sbc frame
|
sl@0
|
27 |
with Loudness allocation method
|
sl@0
|
28 |
*/
|
sl@0
|
29 |
const TInt8 KSBCOffset4[4][4] =
|
sl@0
|
30 |
{
|
sl@0
|
31 |
{-1, 0, 0, 0}, // fs = 16000
|
sl@0
|
32 |
{-2, 0, 0, 1}, // fs = 32000
|
sl@0
|
33 |
{-2, 0, 0, 1}, // fs = 44100
|
sl@0
|
34 |
{-2, 0, 0, 1} // fs = 48000
|
sl@0
|
35 |
};
|
sl@0
|
36 |
|
sl@0
|
37 |
/**
|
sl@0
|
38 |
This table is used to calculate bit allocation for 8 subbands sbc frame
|
sl@0
|
39 |
with Loudness allocation method
|
sl@0
|
40 |
*/
|
sl@0
|
41 |
const TInt8 KSBCOffset8[4][8] =
|
sl@0
|
42 |
{
|
sl@0
|
43 |
{-2, 0, 0, 0, 0, 0, 0, 1}, // fs = 16000
|
sl@0
|
44 |
{-3, 0, 0, 0, 0, 0, 1, 2}, // fs = 32000
|
sl@0
|
45 |
{-4, 0, 0, 0, 0, 0, 1, 2}, // fs = 44100
|
sl@0
|
46 |
{-4, 0, 0, 0, 0, 0, 1, 2} // fs = 48000
|
sl@0
|
47 |
};
|
sl@0
|
48 |
|
sl@0
|
49 |
/**
|
sl@0
|
50 |
2^32, scale value of Table KSBCProto4 and KSBCProto8.
|
sl@0
|
51 |
*/
|
sl@0
|
52 |
const TUint8 KSBCProtoBitsShift = 32;
|
sl@0
|
53 |
|
sl@0
|
54 |
/**
|
sl@0
|
55 |
Table KSBCProto4 is derived form Table Proto_4_40 (see A2DP spec for detail)
|
sl@0
|
56 |
by scaling up by 2^32, it is for the Analysis process for 4 subbands sbc frames,
|
sl@0
|
57 |
we are using integer numbers for high speed, after the calculation the results
|
sl@0
|
58 |
will be scaled down by the same value.
|
sl@0
|
59 |
*/
|
sl@0
|
60 |
const TInt32 KSBCProto4[40] =
|
sl@0
|
61 |
{
|
sl@0
|
62 |
0, 2304460, 6407591, 11741191,
|
sl@0
|
63 |
16480657, 16716234, 8013623, -13143128,
|
sl@0
|
64 |
46874251, 87782726, 124020356, 138271872,
|
sl@0
|
65 |
111139929, 26338680, -123788377, -333488531,
|
sl@0
|
66 |
582368677, 837466400, 1059296397, 1210442915,
|
sl@0
|
67 |
1264074726, 1210442915, 1059296397, 837466400,
|
sl@0
|
68 |
-582368677, -333488531, -123788377, 26338680,
|
sl@0
|
69 |
111139929, 138271872, 124020356, 87782726,
|
sl@0
|
70 |
-46874251, -13143128, 8013623, 16716234,
|
sl@0
|
71 |
16480657, 11741191, 6407591, 2304460
|
sl@0
|
72 |
};
|
sl@0
|
73 |
|
sl@0
|
74 |
/**
|
sl@0
|
75 |
Table KSBCProto8 is derived form Table Proto_8_80 (see A2DP spec for detail)
|
sl@0
|
76 |
by scaling up by 2^32, it is for the Analysis process for 8 subbands sbc frames,
|
sl@0
|
77 |
we are using integer numbers for high speed, after the calculation the results
|
sl@0
|
78 |
will be scaled down by the same value.
|
sl@0
|
79 |
*/
|
sl@0
|
80 |
const TInt32 KSBCProto8[80] =
|
sl@0
|
81 |
{
|
sl@0
|
82 |
0, 672486, 1474275, 2382076,
|
sl@0
|
83 |
3538707, 4895941, 6341097, 7661007,
|
sl@0
|
84 |
8640724, 9035408, 8566508, 6943084,
|
sl@0
|
85 |
3874724, -767963, -7085541, -15020250,
|
sl@0
|
86 |
24307345, 34486060, 44918676, 54748951,
|
sl@0
|
87 |
62932121, 68309566, 69668008, 65792073,
|
sl@0
|
88 |
55564768, 38042997, 12558847, -21113115,
|
sl@0
|
89 |
-62880072, -112141060, -167826440, -228437728,
|
sl@0
|
90 |
292053237, 356416821, 419083117, 477586143,
|
sl@0
|
91 |
529417202, 572366304, 604531701, 624444638,
|
sl@0
|
92 |
631167211, 624444638, 604531701, 572366304,
|
sl@0
|
93 |
529417202, 477586143, 419083117, 356416821,
|
sl@0
|
94 |
-292053237, -228437728, -167826440, -112141060,
|
sl@0
|
95 |
-62880072, -21113115, 12558847, 38042997,
|
sl@0
|
96 |
55564768, 65792073, 69668008, 68309566,
|
sl@0
|
97 |
62932121, 54748951, 44918676, 34486060,
|
sl@0
|
98 |
-24307345, -15020250, -7085541, -767963,
|
sl@0
|
99 |
3874724, 6943084, 8566508, 9035408,
|
sl@0
|
100 |
8640724, 7661007, 6341097, 4895941,
|
sl@0
|
101 |
3538707, 2382076, 1474275, 672486
|
sl@0
|
102 |
};
|
sl@0
|
103 |
|
sl@0
|
104 |
|
sl@0
|
105 |
/**
|
sl@0
|
106 |
2^30, scale value of Table KSBCAnalysisMatrix4 and KSBCAnalysisMatrix8.
|
sl@0
|
107 |
*/
|
sl@0
|
108 |
const TUint8 KSBCAnalysisMatrixBitsShift = 30;
|
sl@0
|
109 |
|
sl@0
|
110 |
/**
|
sl@0
|
111 |
Table of cos((i + 0.5) * (k - 2) * PI / 4) * 2^30
|
sl@0
|
112 |
This table is used in Analysis process for 4 subbands, here we are using
|
sl@0
|
113 |
integer values instead of real values for high speed, the values are scaled
|
sl@0
|
114 |
up by 2^30, after calculation the results will be scaled down by the same value.
|
sl@0
|
115 |
*/
|
sl@0
|
116 |
const TInt32 KSBCAnalysisMatrix4[4][8] =
|
sl@0
|
117 |
{
|
sl@0
|
118 |
{ 759250125, 992008094, 1073741824, 992008094,
|
sl@0
|
119 |
759250125, 410903207, 0, -410903207 },
|
sl@0
|
120 |
|
sl@0
|
121 |
{ -759250125, 410903207, 1073741824, 410903207,
|
sl@0
|
122 |
-759250125, -992008094, 0, 992008094 },
|
sl@0
|
123 |
|
sl@0
|
124 |
{ -759250125, -410903207, 1073741824, -410903207,
|
sl@0
|
125 |
-759250125, 992008094, 0, -992008094 },
|
sl@0
|
126 |
|
sl@0
|
127 |
{ 759250125, -992008094, 1073741824, -992008094,
|
sl@0
|
128 |
759250125, -410903207, 0, 410903207 }
|
sl@0
|
129 |
};
|
sl@0
|
130 |
|
sl@0
|
131 |
/**
|
sl@0
|
132 |
Table of cos((i + 0.5) * (k - 4) * PI / 8) * 2^30
|
sl@0
|
133 |
This table is used in Analysis process for 8 subbands, here we are using
|
sl@0
|
134 |
integer values instead of real values for high speed, the values are scaled
|
sl@0
|
135 |
up by 2^30, after calculation the results will be scaled down by the same value.
|
sl@0
|
136 |
*/
|
sl@0
|
137 |
const TInt32 KSBCAnalysisMatrix8[8][16] =
|
sl@0
|
138 |
{
|
sl@0
|
139 |
{ 759250125, 892783698, 992008094, 1053110176,
|
sl@0
|
140 |
1073741824, 1053110176, 992008094, 892783698,
|
sl@0
|
141 |
759250125, 596538995, 410903207, 209476638,
|
sl@0
|
142 |
0, -209476638, -410903207, -596538995 },
|
sl@0
|
143 |
|
sl@0
|
144 |
{ -759250125, -209476638, 410903207, 892783698,
|
sl@0
|
145 |
1073741824, 892783698, 410903207, -209476638,
|
sl@0
|
146 |
-759250125, -1053110176, -992008094, -596538995,
|
sl@0
|
147 |
0, 596538995, 992008094, 1053110176 },
|
sl@0
|
148 |
|
sl@0
|
149 |
{ -759250125, -1053110176, -410903207, 596538995,
|
sl@0
|
150 |
1073741824, 596538995, -410903207, -1053110176,
|
sl@0
|
151 |
-759250125, 209476638, 992008094, 892783698,
|
sl@0
|
152 |
0, -892783698, -992008094, -209476638 },
|
sl@0
|
153 |
|
sl@0
|
154 |
{ 759250125, -596538995, -992008094, 209476638,
|
sl@0
|
155 |
1073741824, 209476638, -992008094, -596538995,
|
sl@0
|
156 |
759250125, 892783698, -410903207, -1053110176,
|
sl@0
|
157 |
0, 1053110176, 410903207, -892783698 },
|
sl@0
|
158 |
|
sl@0
|
159 |
{ 759250125, 596538995, -992008094, -209476638,
|
sl@0
|
160 |
1073741824, -209476638, -992008094, 596538995,
|
sl@0
|
161 |
759250125, -892783698, -410903207, 1053110176,
|
sl@0
|
162 |
0, -1053110176, 410903207, 892783698 },
|
sl@0
|
163 |
|
sl@0
|
164 |
{ -759250125, 1053110176, -410903207, -596538995,
|
sl@0
|
165 |
1073741824, -596538995, -410903207, 1053110176,
|
sl@0
|
166 |
-759250125, -209476638, 992008094, -892783698,
|
sl@0
|
167 |
0, 892783698, -992008094, 209476638 },
|
sl@0
|
168 |
|
sl@0
|
169 |
{ -759250125, 209476638, 410903207, -892783698,
|
sl@0
|
170 |
1073741824, -892783698, 410903207, 209476638,
|
sl@0
|
171 |
-759250125, 1053110176, -992008094, 596538995,
|
sl@0
|
172 |
0, -596538995, 992008094, -1053110176 },
|
sl@0
|
173 |
|
sl@0
|
174 |
{ 759250125, -892783698, 992008094, -1053110176,
|
sl@0
|
175 |
1073741824, -1053110176, 992008094, -892783698,
|
sl@0
|
176 |
759250125, -596538995, 410903207, -209476638,
|
sl@0
|
177 |
0, 209476638, -410903207, 596538995 }
|
sl@0
|
178 |
};
|
sl@0
|
179 |
|
sl@0
|
180 |
#endif // __SBCCONST_H__
|