Skip to content
This repository was archived by the owner on Jan 17, 2019. It is now read-only.

Commit 0913d7c

Browse files
committed
EQ: Fix an integer type bug in IIR coefficients blob packer
This patch adds explicit conversion to signed int32 type for response to channels indices in assign_response and filter coefficients. The bug was visible if trying to activate in IIR blob the per channel filter bypass by having a negative value (-1) in any of channel assigns. Octave assumed the type to be unsigned and produced wrong configuration bytes. The filter coefficients are already integer type from previous quantization code in the conversion process. However it does not hurt to have extra safety to avoid similar issue as assign. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent c0a881a commit 0913d7c

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tune/eq/eq_iir_blob_pack.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@
4141
endian = 'little';
4242
end
4343

44+
%% Channels count and assign vector lengths must be the same
45+
if bs.platform_max_channels ~= length( bs.assign_response)
46+
bs
47+
error("Channels # and response assign length must match");
48+
end
49+
4450
%% Shift values for little/big endian
4551
switch lower(endian)
4652
case 'little'
@@ -63,12 +69,14 @@
6369
blob8(j:j+3) = w2b(bs.number_of_responses_defined, sh); j=j+4;
6470

6571
for i=1:bs.platform_max_channels
66-
blob8(j:j+3) = w2b(bs.assign_response(i), sh); j=j+4;
72+
blob8(j:j+3) = w2b(int32(bs.assign_response(i)), sh);
73+
j=j+4;
6774
end
6875

6976
%% Pack coefficients
7077
for i=1:length(bs.all_coefficients)
71-
blob8(j:j+3) = w2b(bs.all_coefficients(i), sh); j=j+4;
78+
blob8(j:j+3) = w2b(int32(bs.all_coefficients(i)), sh);
79+
j=j+4;
7280
end
7381
fprintf('Blob size is %d bytes.\n', nbytes);
7482

0 commit comments

Comments
 (0)