|
82 | 82 | um_tmp = unique_modes(i,:); |
83 | 83 | if isequal(um_tmp(1:2),[1 1]) || isequal(um_tmp(1:2),[0 0]) |
84 | 84 | else |
85 | | - fprintf(fh, '#include <%ssrc_%s_%d_%d_%d_%d.h>\n', ... |
86 | | - ppath, prof_ctype, um_tmp(1:4)); |
| 85 | + fprintf(fh, '#include \"src_%s_%d_%d_%d_%d.h\"\n', ... |
| 86 | + prof_ctype, um_tmp(1:4)); |
87 | 87 |
|
88 | 88 | n = all_modes(ia(i), 5); |
89 | 89 | a = all_modes(ia(i), 6); |
90 | 90 | b = all_modes(ia(i), 7); |
91 | 91 | sfl = sfl +taps_2s(n, a, b); % Count sum of filter lengths |
92 | 92 | end |
93 | 93 | end |
94 | | -fprintf(fh, '#include <sof/audio/src/src.h>\n'); |
95 | 94 | fprintf(fh, '#include <stdint.h>\n'); |
96 | 95 | fprintf(fh,'\n'); |
97 | 96 |
|
98 | 97 | fprintf(fh, '/* SRC table */\n'); |
99 | 98 | switch ctype |
100 | 99 | case 'float' |
101 | | - fprintf(fh, '%s fir_one = 1.0;\n', vtype); |
102 | | - fprintf(fh, 'struct src_stage src_double_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, 1.0, &fir_one };\n'); |
103 | | - fprintf(fh, 'struct src_stage src_double_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0.0, &fir_one };\n'); |
| 100 | + fprintf(fh, 'const %s fir_one = 1.0;\n', vtype); |
| 101 | + fprintf(fh, 'const struct src_stage src_double_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, 1.0, &fir_one };\n'); |
| 102 | + fprintf(fh, 'const struct src_stage src_double_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0.0, &fir_one };\n'); |
104 | 103 | case 'int16' |
105 | 104 | scale16 = 2^15; |
106 | | - fprintf(fh, '%s fir_one = %d;\n', vtype, round(scale16*0.5)); |
107 | | - fprintf(fh, 'struct src_stage src_int16_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one };\n'); |
108 | | - fprintf(fh, 'struct src_stage src_int16_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n'); |
| 105 | + fprintf(fh, 'const %s fir_one = %d;\n', vtype, round(scale16*0.5)); |
| 106 | + fprintf(fh, 'const struct src_stage src_int16_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one };\n'); |
| 107 | + fprintf(fh, 'const struct src_stage src_int16_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n'); |
109 | 108 | case 'int24' |
110 | 109 | scale24 = 2^23; |
111 | | - fprintf(fh, '%s fir_one = %d;\n', vtype, round(scale24*0.5)); |
112 | | - fprintf(fh, 'struct src_stage src_int24_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one };\n'); |
113 | | - fprintf(fh, 'struct src_stage src_int24_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n'); |
| 110 | + fprintf(fh, 'const %s fir_one = %d;\n', vtype, round(scale24*0.5)); |
| 111 | + fprintf(fh, 'const struct src_stage src_int24_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one };\n'); |
| 112 | + fprintf(fh, 'const struct src_stage src_int24_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n'); |
114 | 113 | case 'int32' |
115 | 114 | scale32 = 2^31; |
116 | | - fprintf(fh, '%s fir_one = %d;\n', vtype, round(scale32*0.5)); |
117 | | - fprintf(fh, 'struct src_stage src_int32_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one };\n'); |
118 | | - fprintf(fh, 'struct src_stage src_int32_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n'); |
| 115 | + fprintf(fh, 'const %s fir_one = %d;\n', vtype, round(scale32*0.5)); |
| 116 | + fprintf(fh, 'const struct src_stage src_int32_1_1_0_0 = { 0, 0, 1, 1, 1, 1, 1, 0, -1, &fir_one };\n'); |
| 117 | + fprintf(fh, 'const struct src_stage src_int32_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n'); |
119 | 118 | otherwise |
120 | 119 | error('Unknown coefficient type!'); |
121 | 120 | end |
122 | 121 |
|
123 | | -fprintf(fh, 'int src_in_fs[%d] = {', n_in); |
| 122 | +fprintf(fh, 'const int src_in_fs[%d] = {', n_in); |
124 | 123 | j = 1; |
125 | 124 | for i=1:n_in |
126 | 125 | fprintf(fh, ' %d', fs_in(i)); |
|
135 | 134 | end |
136 | 135 | fprintf(fh, '};\n'); |
137 | 136 |
|
138 | | -fprintf(fh, 'int src_out_fs[%d] = {', n_out); |
| 137 | +fprintf(fh, 'const int src_out_fs[%d] = {', n_out); |
139 | 138 | j = 1; |
140 | 139 | for i=1:n_out |
141 | 140 | fprintf(fh, ' %d', fs_out(i)); |
|
151 | 150 | fprintf(fh, '};\n'); |
152 | 151 |
|
153 | 152 | for n = 1:2 |
154 | | - fprintf(fh, 'struct src_stage *src_table%d[%d][%d] = {\n', ... |
| 153 | + fprintf(fh, 'const struct src_stage *src_table%d[%d][%d] = {\n', ... |
155 | 154 | n, n_out, n_in); |
156 | 155 | i = 1; |
157 | 156 | for b = 1:n_out |
|
0 commit comments