function [judge]= thresh(window, thres);

sizewindow = size(window,1);

leftsize = (sizewindow -1)/2;

meanleft = mean(window([1:leftsize],:));
meanright = mean(window([(leftsize + 2):sizewindow],:));

stdleft = std(window([1:leftsize],:));
stdright = std(window([(leftsize + 2):sizewindow],:));

left = meanleft + (thres * sqrt(stdleft));
right = meanright + (thres * sqrt(stdright));

val = max(left, right);

if window(leftsize+1,1) > val
    judge = 1;
elseif window(leftsize+1,1) == max(window)
    judge = 1;
else
    judge = 0;
end
return