diff --git a/main.go b/main.go index b00c12d..9792dba 100644 --- a/main.go +++ b/main.go @@ -81,6 +81,7 @@ func main() { repeatedByte1Estimator, repeatedByte2Estimator, repeatedOrZeroEstimator, + fastLZWithUpperBoundEstimator, fastLZEstimator, zlibBestEstimator, zlibBestBatchEstimator, // final estimator value is always used as the "ground truth" against which others are measured @@ -470,6 +471,14 @@ func fastLZEstimator(tx []byte) float64 { return float64(flzCompressLen(tx)) } +func fastLZWithUpperBoundEstimator(tx []byte) float64 { + fastLZSize := fastLZEstimator(tx) + if fastLZSize > float64(len(tx)) { + return float64(len(tx)) + } + return fastLZSize +} + // uncompressedSizeEstimator just returns the length of the input func uncompressedSizeEstimator(tx []byte) float64 { return float64(len(tx))