]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
turn off RTF optimization
authorinikep <inikep@gmail.com>
Thu, 25 Feb 2016 15:47:57 +0000 (16:47 +0100)
committerinikep <inikep@gmail.com>
Thu, 25 Feb 2016 15:47:57 +0000 (16:47 +0100)
lib/zstd_opt.h

index 55acef67fe5ae6fc96d74a5c16b8d0da9db51f65..922a569cf0bebb83825cbcc5a239f36671a5e3e5 100644 (file)
@@ -46,6 +46,7 @@ FORCE_INLINE U32 ZSTD_GETPRICE(seqStore_t* seqStorePtr, U32 litLength, const BYT
     if (matchLength >= MaxML) matchLength = MaxML;
     price += ZSTD_getLiteralPrice(seqStorePtr, litLength, literals) + ZSTD_highbit(seqStorePtr->matchLengthSum+1) - ZSTD_highbit(seqStorePtr->matchLengthFreq[matchLength]+1);
 
+#if ZSTD_OPT_DEBUG >= 3
     switch (seqStorePtr->priceFunc)
     {
         default:
@@ -58,6 +59,9 @@ FORCE_INLINE U32 ZSTD_GETPRICE(seqStore_t* seqStorePtr, U32 litLength, const BYT
         case 3:
             return 1 + price;
     }
+#else
+    return 1 + price + ((seqStorePtr->litSum>>5) / seqStorePtr->litLengthSum) + ((seqStorePtr->litSum<<1) / (seqStorePtr->litSum + seqStorePtr->matchSum));
+#endif
 }
 
 
@@ -266,7 +270,7 @@ void ZSTD_COMPRESSBLOCK_OPT_GENERIC(ZSTD_CCtx* ctx,
     ZSTD_rescaleFreqs(seqStorePtr);
     if ((ip-base) < REPCODE_STARTVALUE) ip = base + REPCODE_STARTVALUE;
 
-
+#if ZSTD_OPT_DEBUG >= 3
     size_t mostFrequent;
     unsigned count[256], maxSymbolValue, usedSymbols = 0;
     maxSymbolValue = 255;
@@ -276,6 +280,7 @@ void ZSTD_COMPRESSBLOCK_OPT_GENERIC(ZSTD_CCtx* ctx,
 
     seqStorePtr->factor = ((usedSymbols <= 18) && (mostFrequent < (1<<14))) ? mostFrequent>>10 : 0; // helps RTF files
     seqStorePtr->factor2 = (usedSymbols==256) && (mostFrequent > (1<<14));
+#endif
 
 #if 0
     if (seqStorePtr->factor2)