Skip to content

Commit 15ff69a

Browse files
singalsulgirdwood
authored andcommitted
Audio: SRC: Tune: Add to export static and __cold_rodata
With these additions the new generated and exported SRC coefficients sets match the existing hand-edited header files for coefficients. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 66a1234 commit 15ff69a

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/audio/src/tune/src_export_coef.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
src.blk_in, src.blk_out, src.halfband, ...
8484
src.gain, vfn);
8585
case { 'int16' 'int24' 'int32' }
86-
fprintf(fh, 'const struct src_stage %s = {\n', sfn);
86+
fprintf(fh, 'static const struct src_stage %s = {\n', sfn);
8787
fprintf(fh, '\t%d, %d, %d, %d, %d, %d, %d, %d, %d,\n\t%s};\n', ...
8888
src.idm, src.odm, src.num_of_subfilters, ...
8989
src.subfilter_length, src.filter_length, ...
@@ -100,7 +100,7 @@
100100
end
101101

102102
function print_int_coef(src, fh, vtype, vfn, nbits)
103-
fprintf(fh, 'const %s %s[%d] = {\n', ...
103+
fprintf(fh, '__cold_rodata static const %s %s[%d] = {\n', ...
104104
vtype, vfn, src.filter_length);
105105

106106
cint = coef_quant(src, nbits);

src/audio/src/tune/src_export_table_2s.m

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -97,29 +97,29 @@
9797
fprintf(fh, '/* SRC table */\n');
9898
switch ctype
9999
case 'float'
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');
100+
fprintf(fh, 'static const %s fir_one = 1.0;\n', vtype);
101+
fprintf(fh, 'static 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, 'static const struct src_stage src_double_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0.0, &fir_one };\n');
103103
case 'int16'
104104
scale16 = 2^15;
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');
105+
fprintf(fh, 'static const %s fir_one = %d;\n', vtype, round(scale16*0.5));
106+
fprintf(fh, 'static 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, 'static const struct src_stage src_int16_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n');
108108
case 'int24'
109109
scale24 = 2^23;
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');
110+
fprintf(fh, 'static const %s fir_one = %d;\n', vtype, round(scale24*0.5));
111+
fprintf(fh, 'static 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, 'static const struct src_stage src_int24_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n');
113113
case 'int32'
114114
scale32 = 2^31;
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');
115+
fprintf(fh, 'static const %s fir_one = %d;\n', vtype, round(scale32*0.5));
116+
fprintf(fh, 'static 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, 'static const struct src_stage src_int32_0_0_0_0 = { 0, 0, 0, 0, 0, 0, 0, 0, 0, &fir_one };\n');
118118
otherwise
119119
error('Unknown coefficient type!');
120120
end
121121

122-
fprintf(fh, 'const int src_in_fs[%d] = {', n_in);
122+
fprintf(fh, 'static const int src_in_fs[%d] = {', n_in);
123123
j = 1;
124124
for i=1:n_in
125125
fprintf(fh, ' %d', fs_in(i));
@@ -134,7 +134,7 @@
134134
end
135135
fprintf(fh, '};\n');
136136

137-
fprintf(fh, 'const int src_out_fs[%d] = {', n_out);
137+
fprintf(fh, 'static const int src_out_fs[%d] = {', n_out);
138138
j = 1;
139139
for i=1:n_out
140140
fprintf(fh, ' %d', fs_out(i));
@@ -150,7 +150,7 @@
150150
fprintf(fh, '};\n');
151151

152152
for n = 1:2
153-
fprintf(fh, 'const struct src_stage * const src_table%d[%d][%d] = {\n', ...
153+
fprintf(fh, 'static const struct src_stage * const src_table%d[%d][%d] = {\n', ...
154154
n, n_out, n_in);
155155
i = 1;
156156
for b = 1:n_out

0 commit comments

Comments
 (0)