Ternary wavelets and their applications to signal compression