Stable factorization for phase factors of quantum signal processing