function [nflag] = Wm_test(half_sum,org_h)
new_DEh = 4 * org_h;
new_1DEh = new_DEh + 1;
new_2DEh = new_DEh + 2;
new_3DEh = new_DEh + 3;
nflag = 0;
if (half_sum <= 255) & (half_sum >= 128)  
    tmp_value = 2*(255-half_sum);
elseif (half_sum <= 127) & (half_sum >= 0)  
    tmp_value = (2*half_sum+1);
end
if abs(new_DEh) == tmp_value
    if new_DEh >= 0
        new_h = tmp_value/4;  
    else 
        new_h = - tmp_value/4;
    end
    if new_h == org_h
        nflag = nflag + 1;
    end
elseif abs(new_1DEh) == tmp_value
    if new_1DEh >= 0
        new_h = (tmp_value - 1)/4;  
    else 
        new_h = -(tmp_value + 1)/4;
    end
    if new_h == org_h
        nflag = nflag + 1;
    end
elseif abs(new_2DEh) == tmp_value
    if new_2DEh >= 0
        new_h = (tmp_value - 2)/4;  
    else 
        new_h = -(tmp_value + 2)/4;
    end
    if new_h == org_h
        nflag = nflag + 1;
    end
elseif abs(new_3DEh) == tmp_value
    if new_3DEh >= 0
        new_h = (tmp_value - 3)/4;  
    else 
        new_h = -(tmp_value + 3)/4;
    end
    if new_h == org_h
        nflag = nflag + 1;
    end
end
            