Bridging lossy and lossless compression by motif pattern discovery