A fast quality-on-demand algorithm for wavelet-based electrocardiogram signal compression