Skip to content

Commit 86e2a84

Browse files
committed
fixed negative offset handling in echo diagnostic
git-svn-id: http://svn.xiph.org/trunk/speex@12804 0101bb08-14d6-0310-b084-bc0e0c8e3800
1 parent c30fb59 commit 86e2a84

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libspeex/echo_diagnostic.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
corr2 = real(ifft(fft(rec(N2+1:end)).*conj(fft(play(N2+1:end)))));
4242

4343
[a,b1] = max(corr1);
44-
if b1 > N/2
45-
b1 = b1-N;
44+
if b1 > N2/2
45+
b1 = b1-N2;
4646
end
4747
[a,b2] = max(corr2);
48-
if b2 > N/2
49-
b2 = b2-N;
48+
if b2 > N2/2
49+
b2 = b2-N2;
5050
end
5151
drift = (b1-b2)/N2;
5252
printf ('Drift estimate is %f%% (%d samples)\n', 100*drift, b1-b2);

0 commit comments

Comments
 (0)