1 /* |
|
2 * Copyright (c) 2010 Ixonos Plc. |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - Initial contribution |
|
11 * |
|
12 * Contributors: |
|
13 * Ixonos Plc |
|
14 * |
|
15 * Description: |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 #include "chandefs.h" |
|
23 |
|
24 CInfo* CInfo::NewL() |
|
25 { |
|
26 |
|
27 CInfo* self = new (ELeave) CInfo(); |
|
28 CleanupStack::PushL(self); |
|
29 self->ConstructL(); |
|
30 CleanupStack::Pop(self); |
|
31 return self; |
|
32 |
|
33 } |
|
34 |
|
35 void CInfo::ConstructL() |
|
36 { |
|
37 |
|
38 bins_per_sbk = new (ELeave) int16[MAX_SBK]; |
|
39 sfb_per_sbk = new (ELeave) int16[MAX_SBK]; |
|
40 bk_sfb_top = new (ELeave) int16[200]; |
|
41 group_len = new (ELeave) int16[NSHORT]; |
|
42 group_offs = new (ELeave) int16[NSHORT]; |
|
43 |
|
44 } |
|
45 |
|
46 CInfo::CInfo() |
|
47 { |
|
48 |
|
49 } |
|
50 |
|
51 CInfo::~CInfo() |
|
52 { |
|
53 |
|
54 if (bins_per_sbk != 0) delete[] bins_per_sbk; |
|
55 if (sfb_per_sbk != 0) delete[] sfb_per_sbk; |
|
56 if (bk_sfb_top != 0) delete[] bk_sfb_top; |
|
57 if (group_len != 0) delete[] group_len; |
|
58 if (group_offs != 0) delete[] group_offs; |
|
59 |
|
60 } |
|
61 |
|
62 |
|
63 CSfb_Info* CSfb_Info::NewL(uint8 isEncoder) |
|
64 { |
|
65 |
|
66 CSfb_Info* self = new (ELeave) CSfb_Info(); |
|
67 CleanupStack::PushL(self); |
|
68 self->ConstructL(isEncoder); |
|
69 CleanupStack::Pop(self); |
|
70 return self; |
|
71 |
|
72 } |
|
73 |
|
74 void CSfb_Info::ConstructL(uint8 isEncoder) |
|
75 { |
|
76 |
|
77 only_long_info = CInfo::NewL(); |
|
78 eight_short_info = CInfo::NewL(); |
|
79 |
|
80 if(isEncoder) |
|
81 { |
|
82 int16 i; |
|
83 |
|
84 /*-- Allocate SFB data. --*/ |
|
85 sect_sfb_offsetL = (int16 *) new (ELeave) int16[MAXLONGSFBBANDS]; |
|
86 |
|
87 sect_sfb_offsetS = (int16 *) new (ELeave) int16[MAXSHORTSFBBANDS]; |
|
88 |
|
89 for(i = 0; i < NSHORT; i++) |
|
90 { |
|
91 sect_sfb_offsetS2[i] = (int16 *) new (ELeave) int16[MAXSHORTSFBBANDS]; |
|
92 } |
|
93 |
|
94 } |
|
95 |
|
96 } |
|
97 |
|
98 CSfb_Info::CSfb_Info() |
|
99 { |
|
100 int16 i; |
|
101 |
|
102 only_long_info = 0; |
|
103 eight_short_info = 0; |
|
104 |
|
105 /*-- Scalefactor offsets. --*/ |
|
106 sect_sfb_offsetL = 0; |
|
107 sect_sfb_offsetS = 0; |
|
108 sfbOffsetTablePtr[0] = sfbOffsetTablePtr[1] = 0; |
|
109 |
|
110 for(i = 0; i < NSHORT; i++) |
|
111 { |
|
112 sect_sfb_offsetS2[i] = 0; |
|
113 } |
|
114 |
|
115 |
|
116 } |
|
117 |
|
118 CSfb_Info::~CSfb_Info() |
|
119 |
|
120 { |
|
121 int16 i; |
|
122 |
|
123 if (only_long_info != 0) |
|
124 { |
|
125 delete only_long_info; |
|
126 only_long_info = 0; |
|
127 |
|
128 } |
|
129 |
|
130 if (eight_short_info != 0) |
|
131 { |
|
132 delete eight_short_info; |
|
133 eight_short_info = 0; |
|
134 |
|
135 } |
|
136 |
|
137 if(sect_sfb_offsetL != 0) |
|
138 { |
|
139 delete[] sect_sfb_offsetL; |
|
140 sect_sfb_offsetL = 0; |
|
141 |
|
142 } |
|
143 |
|
144 if(sect_sfb_offsetS != 0) |
|
145 { |
|
146 delete[] sect_sfb_offsetS; |
|
147 sect_sfb_offsetS = 0; |
|
148 |
|
149 } |
|
150 |
|
151 for(i = 0; i < NSHORT; i++) |
|
152 { |
|
153 if(sect_sfb_offsetS2[i] != 0) |
|
154 { |
|
155 delete[] sect_sfb_offsetS2[i]; |
|
156 sect_sfb_offsetS2[i] = 0; |
|
157 |
|
158 } |
|
159 } |
|
160 |
|
161 } |
|