ГОСТ Р 56047— 2014
М = min (N. L);
for (i = 0:M-1)
s = s + abs (x(i+1));
end
if (s > Thr)
ib = 0;
return
end
-
for (i = 1:N-L)
s = s + (abs (x(i+L-1+1)) - abs (x(i-1+1)));
if (s > Thr)
ib = i;
return
end
end
%
-----
function ie = PO_DataEnd (x. N, L. Thr)
ie = -1:
s = 0;
M = min (N. L);
for (i = N-M:N-1)
s = s + abs (x(i+1));
end
if (s > Thr)
ie = N-1;
return
end
for (i = N-2:-1:L-1)
s = s + (abs (x(i-L+1+1)) - abs (x(i+1+1)));if (s > Thr)
ie = i;
return
end
end
function x = PQgetData (WAV. i, N)
persistent Buff
iB = WAV.iB + 1;
if (N == 0)
Buff(iB).N = 20 * 1024;% Fixed size
Buff(iB).x = PQ_ReadWAV (WAV. i. Buff(iB).N):
Buff(iB).i = i;
end
if (N > Buff(iB).N)
error (’» > PQgetData: Request exceeds buffer size’);
end
is = i - Buff(iB).i;
if (is < 0 | is + N - 1> Buff(iB).N - 1)
Buff(iB).x = PQ_ReadWAV (WAV. i. Buff(iB).N):
Buff(iB).i = i;
end
Nchan = WAV.Nchan;
is = i - Buff(iB).i;
x = Buff(iB).x(1:Nchan.is+1 :is+N-1+1);
%------
function x = PQ_ReadWAV (WAV. i. N)
Amax = 32768;
Nchan = WAV.Nchan;
35