1 /******************************************************************************
2 * *
3 * Copyright (C) 2018 The Android Open Source Project
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *****************************************************************************
18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 #include "ixheaacd_cnst.h"
21
22 #include "ixheaac_constants.h"
23 #include "ixheaac_type_def.h"
24 #include "ixheaac_basic_ops32.h"
25 #include "ixheaac_basic_ops40.h"
26
27 #include "ixheaacd_windows.h"
28
ixheaacd_calc_window(WORD32 ** win,WORD32 win_sz,WORD32 win_sel,WORD32 ec_flag)29 WORD32 ixheaacd_calc_window(WORD32 **win, WORD32 win_sz, WORD32 win_sel, WORD32 ec_flag) {
30 switch (win_sel) {
31 case WIN_SEL_0:
32 switch (win_sz) {
33 case WIN_LEN_128:
34 *win = (WORD32 *)ixheaacd_sine_win_128;
35 break;
36 case WIN_LEN_1024:
37 *win = (WORD32 *)ixheaacd_sine_win_1024;
38 break;
39 case WIN_LEN_64:
40 *win = (WORD32 *)ixheaacd_sine_win_64;
41 break;
42 case WIN_LEN_768:
43 *win = (WORD32 *)ixheaacd_sine_win_768;
44 break;
45 case WIN_LEN_192:
46 *win = (WORD32 *)ixheaacd_sine_win_192;
47 break;
48 case WIN_LEN_96:
49 *win = (WORD32 *)ixheaacd_sine_win_96;
50 break;
51 case WIN_LEN_256:
52 *win = (WORD32 *)ixheaacd_sine_win_256;
53 break;
54 default:
55 if (ec_flag)
56 *win = (WORD32 *)ixheaacd_sine_win_1024;
57 else
58 return -1;
59 break;
60 }
61 break;
62
63 case WIN_SEL_1:
64 switch (win_sz) {
65 case WIN_LEN_120:
66 *win = (WORD32 *)ixheaacd_kbd_win120;
67 break;
68 case WIN_LEN_128:
69 *win = (WORD32 *)ixheaacd_kbd_win128;
70 break;
71 case WIN_LEN_960:
72 *win = (WORD32 *)ixheaacd_kbd_win960;
73 break;
74 case WIN_LEN_1024:
75 *win = (WORD32 *)ixheaacd_kbd_win1024;
76 break;
77 case WIN_LEN_4:
78 *win = (WORD32 *)ixheaacd_kbd_win4;
79 break;
80 case WIN_LEN_16:
81 *win = (WORD32 *)ixheaacd_kbd_win16;
82 break;
83 case WIN_LEN_64:
84 *win = (WORD32 *)ixheaacd_kbd_win_64;
85 break;
86 case WIN_LEN_768:
87 *win = (WORD32 *)ixheaacd_kbd_win768;
88 break;
89 case WIN_LEN_192:
90 *win = (WORD32 *)ixheaacd_kbd_win192;
91 break;
92 case WIN_LEN_96:
93 *win = (WORD32 *)ixheaacd_kbd_win96;
94 break;
95 case WIN_LEN_48:
96 *win = (WORD32 *)ixheaacd_kbd_win48;
97 break;
98 default:
99 if (ec_flag)
100 *win = (WORD32 *)ixheaacd_kbd_win1024;
101 else
102 return -1;
103 break;
104 }
105 break;
106
107 default:
108 return -1;
109 break;
110 }
111 return 0;
112 }
113