| 1 | /* LzmaEnc.c -- LZMA Encoder |
| 2 | 2009-02-02 : Igor Pavlov : Public domain */ |
| 3 | |
| 4 | #include <string.h> |
| 5 | |
| 6 | /* #define SHOW_STAT */ |
| 7 | /* #define SHOW_STAT2 */ |
| 8 | |
| 9 | #if defined(SHOW_STAT) || defined(SHOW_STAT2) |
| 10 | #include <stdio.h> |
| 11 | #endif |
| 12 | |
| 13 | #include "LzmaEnc.h"cxx . . $ `<file>/compression/lzma/LzmaEnc.h`/ |
| 14 | |
| 15 | #include "LzFind.h"cxx . . $ `<file>/compression/lzma/LzFind.h`/ |
| 16 | #ifdef COMPRESS_MF_MT |
| 17 | #include "LzFindMt.h" |
| 18 | #endif |
| 19 | |
| 20 | #ifdef SHOW_STAT |
| 21 | static int ttt = 0; |
| 22 | #endif |
| 23 | |
| 24 | #define kBlockSizeMaxcxx . . $ `compression/lzma/LzmaEnc.c:24:9`! ((1 << LZMA_NUM_BLOCK_SIZE_BITS) - 1) |
| 25 | |
| 26 | #define kBlockSizecxx . . $ `compression/lzma/LzmaEnc.c:26:9`! (9 << 10) |
| 27 | #define kUnpackBlockSizecxx . . $ `compression/lzma/LzmaEnc.c:27:9`! (1 << 18) |
| 28 | #define kMatchArraySizecxx . . $ `compression/lzma/LzmaEnc.c:28:9`! (1 << 21) |
| 29 | #define kMatchRecordMaxSizecxx . . $ `compression/lzma/LzmaEnc.c:29:9`! ((LZMA_MATCH_LEN_MAX * 2 + 3) * LZMA_MATCH_LEN_MAX) |
| 30 | |
| 31 | #define kNumMaxDirectBitscxx . . $ `compression/lzma/LzmaEnc.c:31:9`! (31) |
| 32 | |
| 33 | #define kNumTopBitscxx . . $ `compression/lzma/LzmaEnc.c:33:9`! 24 |
| 34 | #define kTopValuecxx . . $ `compression/lzma/LzmaEnc.c:34:9`! ((UInt32)1 << kNumTopBitscxx . . $ `compression/lzma/LzmaEnc.c:33:9`!) |
| 35 | |
| 36 | #define kNumBitModelTotalBitscxx . . $ `compression/lzma/LzmaEnc.c:36:9`! 11 |
| 37 | #define kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! (1 << kNumBitModelTotalBitscxx . . $ `compression/lzma/LzmaEnc.c:36:9`!) |
| 38 | #define kNumMoveBitscxx . . $ `compression/lzma/LzmaEnc.c:38:9`! 5 |
| 39 | #define kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`! (kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! >> 1) |
| 40 | |
| 41 | #define kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`! 4 |
| 42 | #define kNumBitPriceShiftBitscxx . . $ `compression/lzma/LzmaEnc.c:42:9`! 4 |
| 43 | #define kBitPricecxx . . $ `compression/lzma/LzmaEnc.c:43:9`! (1 << kNumBitPriceShiftBits) |
| 44 | |
| 45 | void LzmaEncProps_Initcxx . . $ LzmaEncProps_Init(8b45acebcbbd4466).(CLzmaEncPropscxx . . $ CLzmaEncProps# *p) |
| 46 | { |
| 47 | p->levelcxx . . $ _CLzmaEncProps#level. = 5; |
| 48 | p->dictSizecxx . . $ _CLzmaEncProps#dictSize. = p->mccxx . . $ _CLzmaEncProps#mc. = 0; |
| 49 | p->lccxx . . $ _CLzmaEncProps#lc. = p->lpcxx . . $ _CLzmaEncProps#lp. = p->pbcxx . . $ _CLzmaEncProps#pb. = p->algocxx . . $ _CLzmaEncProps#algo. = p->fbcxx . . $ _CLzmaEncProps#fb. = p->btModecxx . . $ _CLzmaEncProps#btMode. = p->numHashBytescxx . . $ _CLzmaEncProps#numHashBytes. = p->numThreadscxx . . $ _CLzmaEncProps#numThreads. = -1; |
| 50 | p->writeEndMarkcxx . . $ _CLzmaEncProps#writeEndMark. = 0; |
| 51 | } |
| 52 | |
| 53 | void LzmaEncProps_Normalizecxx . . $ LzmaEncProps_Normalize(8b45acebcbbd4466).(CLzmaEncPropscxx . . $ CLzmaEncProps# *p) |
| 54 | { |
| 55 | int level = p->levelcxx . . $ _CLzmaEncProps#level.; |
| 56 | if (level < 0) level = 5; |
| 57 | p->levelcxx . . $ _CLzmaEncProps#level. = level; |
| 58 | if (p->dictSizecxx . . $ _CLzmaEncProps#dictSize. == 0) p->dictSizecxx . . $ _CLzmaEncProps#dictSize. = (UInt32cxx . . $ UInt32#) ((level <= 5 ? (1 << (level * 2 + 14)) : (level == 6 ? (1 << 25) : (1 << 26)))); /*MAB casts UInt32 */ |
| 59 | if (p->lccxx . . $ _CLzmaEncProps#lc. < 0) p->lccxx . . $ _CLzmaEncProps#lc. = 3; |
| 60 | if (p->lpcxx . . $ _CLzmaEncProps#lp. < 0) p->lpcxx . . $ _CLzmaEncProps#lp. = 0; |
| 61 | if (p->pbcxx . . $ _CLzmaEncProps#pb. < 0) p->pbcxx . . $ _CLzmaEncProps#pb. = 2; |
| 62 | if (p->algocxx . . $ _CLzmaEncProps#algo. < 0) p->algocxx . . $ _CLzmaEncProps#algo. = (level < 5 ? 0 : 1); |
| 63 | if (p->fbcxx . . $ _CLzmaEncProps#fb. < 0) p->fbcxx . . $ _CLzmaEncProps#fb. = (level < 7 ? 32 : 64); |
| 64 | if (p->btModecxx . . $ _CLzmaEncProps#btMode. < 0) p->btModecxx . . $ _CLzmaEncProps#btMode. = (p->algocxx . . $ _CLzmaEncProps#algo. == 0 ? 0 : 1); |
| 65 | if (p->numHashBytescxx . . $ _CLzmaEncProps#numHashBytes. < 0) p->numHashBytescxx . . $ _CLzmaEncProps#numHashBytes. = 4; |
| 66 | if (p->mccxx . . $ _CLzmaEncProps#mc. == 0) p->mccxx . . $ _CLzmaEncProps#mc. = (UInt32cxx . . $ UInt32#) ((16 + (p->fbcxx . . $ _CLzmaEncProps#fb. >> 1)) >> (p->btModecxx . . $ _CLzmaEncProps#btMode. ? 0 : 1)); /*MAB casts UInt32 */ |
| 67 | if (p->numThreadscxx . . $ _CLzmaEncProps#numThreads. < 0) |
| 68 | p->numThreadscxx . . $ _CLzmaEncProps#numThreads. = |
| 69 | #ifdef COMPRESS_MF_MT |
| 70 | ((p->btMode && p->algo) ? 2 : 1); |
| 71 | #else |
| 72 | 1; |
| 73 | #endif |
| 74 | } |
| 75 | |
| 76 | UInt32cxx . . $ UInt32# LzmaEncProps_GetDictSizecxx . . $ LzmaEncProps_GetDictSize(3a5902fc24077008).(const CLzmaEncPropscxx . . $ CLzmaEncProps# *props2) |
| 77 | { |
| 78 | CLzmaEncPropscxx . . $ CLzmaEncProps# props = *props2; |
| 79 | LzmaEncProps_Normalizecxx . . $ LzmaEncProps_Normalize(8b45acebcbbd4466).(&props); |
| 80 | return props.dictSizecxx . . $ _CLzmaEncProps#dictSize.; |
| 81 | } |
| 82 | |
| 83 | /* #define LZMA_LOG_BSR */ |
| 84 | /* Define it for Intel's CPU */ |
| 85 | |
| 86 | |
| 87 | #ifdef LZMA_LOG_BSR |
| 88 | |
| 89 | #define kDicLogSizeMaxCompress 30 |
| 90 | |
| 91 | /*MAB: i changed to i__ to avoid possible hiding of a variable */ |
| 92 | #define BSR2_RET(pos, res) { unsigned long i__; _BitScanReverse(&i__, (pos)); res = (i__ + i__) + ((pos >> (i__ - 1)) & 1); } |
| 93 | |
| 94 | UInt32 GetPosSlot1(UInt32 pos) |
| 95 | { |
| 96 | UInt32 res; |
| 97 | BSR2_RET(pos, res); |
| 98 | return res; |
| 99 | } |
| 100 | #define GetPosSlot2(pos, res) { BSR2_RET(pos, res); } |
| 101 | #define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); } |
| 102 | |
| 103 | #else |
| 104 | |
| 105 | #define kNumLogBitscxx . . $ `compression/lzma/LzmaEnc.c:105:9`! (9 + (int)sizeof(size_t) / 2) |
| 106 | #define kDicLogSizeMaxCompresscxx . . $ `compression/lzma/LzmaEnc.c:106:9`! ((kNumLogBitscxx . . $ `compression/lzma/LzmaEnc.c:105:9`! - 1) * 2 + 7) |
| 107 | |
| 108 | /*MAB: static added */ |
| 109 | static |
| 110 | void LzmaEnc_FastPosInitcxx . . $ LzmaEnc_FastPosInit(f25546b61a629de7).(Bytecxx . . $ Byte# *g_FastPos) |
| 111 | { |
| 112 | int c = 2, slotFast; |
| 113 | g_FastPos[0] = 0; |
| 114 | g_FastPos[1] = 1; |
| 115 | |
| 116 | for (slotFast = 2; slotFast < kNumLogBitscxx . . $ `compression/lzma/LzmaEnc.c:105:9`! * 2; slotFast++) |
| 117 | { |
| 118 | UInt32cxx . . $ UInt32# k = (UInt32cxx . . $ UInt32#) ((1 << ((slotFast >> 1) - 1))); /*MAB casts */ |
| 119 | UInt32cxx . . $ UInt32# j; |
| 120 | for (j = 0; j < k; j++, c++) |
| 121 | g_FastPos[c] = (Bytecxx . . $ Byte#)slotFast; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | /*MAB: i changed to i__ to avoid hiding a variable */ |
| 126 | #define BSR2_RETcxx . . $ `compression/lzma/LzmaEnc.c:126:9`!(pos, res) { UInt32 i__ = 6 + ((kNumLogBitscxx . . $ `compression/lzma/LzmaEnc.c:105:9`! - 1) & \ |
| 127 | (0 - (((((UInt32)1 << (kNumLogBitscxx . . $ `compression/lzma/LzmaEnc.c:105:9`! + 6)) - 1) - pos) >> 31))); \ |
| 128 | res = p->g_FastPos[pos >> i__] + (i__ * 2); } |
| 129 | |
| 130 | /* |
| 131 | #define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ |
| 132 | p->g_FastPos[pos >> 6] + 12 : \ |
| 133 | p->g_FastPos[pos >> (6 + kNumLogBits - 1)] + (6 + (kNumLogBits - 1)) * 2; } |
| 134 | */ |
| 135 | |
| 136 | #define GetPosSlot1cxx . . $ `compression/lzma/LzmaEnc.c:136:9`!(pos) p->g_FastPos[pos] |
| 137 | #define GetPosSlot2cxx . . $ `compression/lzma/LzmaEnc.c:137:9`!(pos, res) { BSR2_RETcxx . . $ `compression/lzma/LzmaEnc.c:126:9`!(pos, res); } |
| 138 | #define GetPosSlotcxx . . $ `compression/lzma/LzmaEnc.c:138:9`!(pos, res) { if (pos < kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!) res = p->g_FastPos[pos]; else BSR2_RETcxx . . $ `compression/lzma/LzmaEnc.c:126:9`!(pos, res); } |
| 139 | |
| 140 | #endif |
| 141 | |
| 142 | |
| 143 | #define LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`! 4 |
| 144 | |
| 145 | typedef unsigned CStatecxx . . $ CState#; |
| 146 | |
| 147 | typedef struct _COptimalcxx . . $ _COptimal# |
| 148 | { |
| 149 | UInt32cxx . . $ UInt32# pricecxx . . $ _COptimal#price.; |
| 150 | |
| 151 | CStatecxx . . $ CState# statecxx . . $ _COptimal#state.; |
| 152 | int prev1IsCharcxx . . $ _COptimal#prev1IsChar.; |
| 153 | int prev2cxx . . $ _COptimal#prev2.; |
| 154 | |
| 155 | UInt32cxx . . $ UInt32# posPrev2cxx . . $ _COptimal#posPrev2.; |
| 156 | UInt32cxx . . $ UInt32# backPrev2cxx . . $ _COptimal#backPrev2.; |
| 157 | |
| 158 | UInt32cxx . . $ UInt32# posPrevcxx . . $ _COptimal#posPrev.; |
| 159 | UInt32cxx . . $ UInt32# backPrevcxx . . $ _COptimal#backPrev.; |
| 160 | UInt32cxx . . $ UInt32# backscxx . . $ _COptimal#backs.[LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!]; |
| 161 | } COptimalcxx . . $ COptimal#; |
| 162 | |
| 163 | #define kNumOptscxx . . $ `compression/lzma/LzmaEnc.c:163:9`! (1 << 12) |
| 164 | |
| 165 | #define kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`! 4 |
| 166 | #define kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`! 6 |
| 167 | #define kDicLogSizeMincxx . . $ `compression/lzma/LzmaEnc.c:167:9`! 0 |
| 168 | #define kDicLogSizeMaxcxx . . $ `compression/lzma/LzmaEnc.c:168:9`! 32 |
| 169 | #define kDistTableSizeMaxcxx . . $ `compression/lzma/LzmaEnc.c:169:9`! (kDicLogSizeMaxcxx . . $ `compression/lzma/LzmaEnc.c:168:9`! * 2) |
| 170 | |
| 171 | |
| 172 | #define kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`! 4 |
| 173 | #define kAlignTableSizecxx . . $ `compression/lzma/LzmaEnc.c:173:9`! (1 << kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!) |
| 174 | #define kAlignMaskcxx . . $ `compression/lzma/LzmaEnc.c:174:9`! (kAlignTableSizecxx . . $ `compression/lzma/LzmaEnc.c:173:9`! - 1) |
| 175 | |
| 176 | #define kStartPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:176:9`! 4 |
| 177 | #define kEndPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:177:9`! 14 |
| 178 | #define kNumPosModelscxx . . $ `compression/lzma/LzmaEnc.c:178:9`! (kEndPosModelIndex - kStartPosModelIndex) |
| 179 | |
| 180 | #define kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`! (1 << (kEndPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:177:9`! / 2)) |
| 181 | |
| 182 | #ifdef _LZMA_PROB32 |
| 183 | #define CLzmaProb UInt32 |
| 184 | #else |
| 185 | #define CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! UInt16 |
| 186 | #endif |
| 187 | |
| 188 | #define LZMA_PB_MAXcxx . . $ `compression/lzma/LzmaEnc.c:188:9`! 4 |
| 189 | #define LZMA_LC_MAXcxx . . $ `compression/lzma/LzmaEnc.c:189:9`! 8 |
| 190 | #define LZMA_LP_MAXcxx . . $ `compression/lzma/LzmaEnc.c:190:9`! 4 |
| 191 | |
| 192 | #define LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`! (1 << LZMA_PB_MAXcxx . . $ `compression/lzma/LzmaEnc.c:188:9`!) |
| 193 | |
| 194 | |
| 195 | #define kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`! 3 |
| 196 | #define kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`! (1 << kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`!) |
| 197 | #define kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`! 3 |
| 198 | #define kLenNumMidSymbolscxx . . $ `compression/lzma/LzmaEnc.c:198:9`! (1 << kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`!) |
| 199 | #define kLenNumHighBitscxx . . $ `compression/lzma/LzmaEnc.c:199:9`! 8 |
| 200 | #define kLenNumHighSymbolscxx . . $ `compression/lzma/LzmaEnc.c:200:9`! (1 << kLenNumHighBitscxx . . $ `compression/lzma/LzmaEnc.c:199:9`!) |
| 201 | |
| 202 | #define kLenNumSymbolsTotalcxx . . $ `compression/lzma/LzmaEnc.c:202:9`! (kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`! + kLenNumMidSymbolscxx . . $ `compression/lzma/LzmaEnc.c:198:9`! + kLenNumHighSymbolscxx . . $ `compression/lzma/LzmaEnc.c:200:9`!) |
| 203 | |
| 204 | #define LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`! 2 |
| 205 | #define LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`! (LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`! + kLenNumSymbolsTotalcxx . . $ `compression/lzma/LzmaEnc.c:202:9`! - 1) |
| 206 | |
| 207 | #define kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`! 12 |
| 208 | |
| 209 | typedef struct CLenEnccxx . . $ CLenEnc# |
| 210 | { |
| 211 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! choicecxx . . $ CLenEnc#choice.; |
| 212 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! choice2cxx . . $ CLenEnc#choice2.; |
| 213 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! lowcxx . . $ CLenEnc#low.[LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`! << kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`!]; |
| 214 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! midcxx . . $ CLenEnc#mid.[LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`! << kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`!]; |
| 215 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! highcxx . . $ CLenEnc#high.[kLenNumHighSymbolscxx . . $ `compression/lzma/LzmaEnc.c:200:9`!]; |
| 216 | } CLenEnccxx . . $ CLenEnc#; |
| 217 | |
| 218 | typedef struct CLenPriceEnccxx . . $ CLenPriceEnc# |
| 219 | { |
| 220 | CLenEnccxx . . $ CLenEnc# pcxx . . $ CLenPriceEnc#p.; |
| 221 | UInt32cxx . . $ UInt32# pricescxx . . $ CLenPriceEnc#prices.[LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`!][kLenNumSymbolsTotalcxx . . $ `compression/lzma/LzmaEnc.c:202:9`!]; |
| 222 | UInt32cxx . . $ UInt32# tableSizecxx . . $ CLenPriceEnc#tableSize.; |
| 223 | UInt32cxx . . $ UInt32# counterscxx . . $ CLenPriceEnc#counters.[LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`!]; |
| 224 | } CLenPriceEnccxx . . $ CLenPriceEnc#; |
| 225 | |
| 226 | typedef struct _CRangeEnccxx . . $ _CRangeEnc# |
| 227 | { |
| 228 | UInt32cxx . . $ UInt32# rangecxx . . $ _CRangeEnc#range.; |
| 229 | Bytecxx . . $ Byte# cachecxx . . $ _CRangeEnc#cache.; |
| 230 | UInt64cxx . . $ UInt64# lowcxx . . $ _CRangeEnc#low.; |
| 231 | UInt64cxx . . $ UInt64# cacheSizecxx . . $ _CRangeEnc#cacheSize.; |
| 232 | Bytecxx . . $ Byte# *bufcxx . . $ _CRangeEnc#buf.; |
| 233 | Bytecxx . . $ Byte# *bufLimcxx . . $ _CRangeEnc#bufLim.; |
| 234 | Bytecxx . . $ Byte# *bufBasecxx . . $ _CRangeEnc#bufBase.; |
| 235 | ISeqOutStreamcxx . . $ ISeqOutStream# *outStreamcxx . . $ _CRangeEnc#outStream.; |
| 236 | UInt64cxx . . $ UInt64# processedcxx . . $ _CRangeEnc#processed.; |
| 237 | SRescxx . . $ SRes# rescxx . . $ _CRangeEnc#res.; |
| 238 | } CRangeEnccxx . . $ CRangeEnc#; |
| 239 | |
| 240 | typedef struct _CSeqInStreamBufcxx . . $ _CSeqInStreamBuf# |
| 241 | { |
| 242 | ISeqInStreamcxx . . $ ISeqInStream# funcTablecxx . . $ _CSeqInStreamBuf#funcTable.; |
| 243 | const Bytecxx . . $ Byte# *datacxx . . $ _CSeqInStreamBuf#data.; |
| 244 | SizeTcxx . . $ SizeT# remcxx . . $ _CSeqInStreamBuf#rem.; |
| 245 | } CSeqInStreamBufcxx . . $ CSeqInStreamBuf#; |
| 246 | |
| 247 | static SRescxx . . $ SRes# MyReadcxx . . $ MyRead(a015fd6b590df30c).(void *pp, void *data, size_t *size) |
| 248 | { |
| 249 | size_t curSize = *size; |
| 250 | CSeqInStreamBufcxx . . $ CSeqInStreamBuf# *p = (CSeqInStreamBufcxx . . $ CSeqInStreamBuf# *)pp; |
| 251 | if (p->remcxx . . $ _CSeqInStreamBuf#rem. < curSize) |
| 252 | curSize = p->remcxx . . $ _CSeqInStreamBuf#rem.; |
| 253 | memcpycxx . . $ memcpy(cc817cb175f282d).(data, p->datacxx . . $ _CSeqInStreamBuf#data., curSize); |
| 254 | p->remcxx . . $ _CSeqInStreamBuf#rem. -= curSize; |
| 255 | p->datacxx . . $ _CSeqInStreamBuf#data. += curSize; |
| 256 | *size = curSize; |
| 257 | return SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 258 | } |
| 259 | |
| 260 | typedef struct CSaveStatecxx . . $ CSaveState# |
| 261 | { |
| 262 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *litProbscxx . . $ CSaveState#litProbs.; |
| 263 | |
| 264 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isMatchcxx . . $ CSaveState#isMatch.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!][LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`!]; |
| 265 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepcxx . . $ CSaveState#isRep.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 266 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepG0cxx . . $ CSaveState#isRepG0.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 267 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepG1cxx . . $ CSaveState#isRepG1.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 268 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepG2cxx . . $ CSaveState#isRepG2.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 269 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRep0Longcxx . . $ CSaveState#isRep0Long.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!][LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`!]; |
| 270 | |
| 271 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! posSlotEncodercxx . . $ CSaveState#posSlotEncoder.[kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`!][1 << kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`!]; |
| 272 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! posEncoderscxx . . $ CSaveState#posEncoders.[kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`! - kEndPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:177:9`!]; |
| 273 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! posAlignEncodercxx . . $ CSaveState#posAlignEncoder.[1 << kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!]; |
| 274 | |
| 275 | CLenPriceEnccxx . . $ CLenPriceEnc# lenEnccxx . . $ CSaveState#lenEnc.; |
| 276 | CLenPriceEnccxx . . $ CLenPriceEnc# repLenEnccxx . . $ CSaveState#repLenEnc.; |
| 277 | |
| 278 | UInt32cxx . . $ UInt32# repscxx . . $ CSaveState#reps.[LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!]; |
| 279 | UInt32cxx . . $ UInt32# statecxx . . $ CSaveState#state.; |
| 280 | } CSaveStatecxx . . $ CSaveState#; |
| 281 | |
| 282 | typedef struct _CLzmaEnccxx . . $ _CLzmaEnc# |
| 283 | { |
| 284 | IMatchFindercxx . . $ IMatchFinder# matchFindercxx . . $ _CLzmaEnc#matchFinder.; |
| 285 | void *matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.; |
| 286 | |
| 287 | #ifdef COMPRESS_MF_MT |
| 288 | Bool mtMode; |
| 289 | CMatchFinderMt matchFinderMt; |
| 290 | #endif |
| 291 | |
| 292 | CMatchFindercxx . . $ CMatchFinder# matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase.; |
| 293 | |
| 294 | #ifdef COMPRESS_MF_MT |
| 295 | Byte pad[128]; |
| 296 | #endif |
| 297 | |
| 298 | UInt32cxx . . $ UInt32# optimumEndIndexcxx . . $ _CLzmaEnc#optimumEndIndex.; |
| 299 | UInt32cxx . . $ UInt32# optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex.; |
| 300 | |
| 301 | UInt32cxx . . $ UInt32# longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength.; |
| 302 | UInt32cxx . . $ UInt32# numPairscxx . . $ _CLzmaEnc#numPairs.; |
| 303 | UInt32cxx . . $ UInt32# numAvailcxx . . $ _CLzmaEnc#numAvail.; |
| 304 | COptimalcxx . . $ COptimal# optcxx . . $ _CLzmaEnc#opt.[kNumOptscxx . . $ `compression/lzma/LzmaEnc.c:163:9`!]; |
| 305 | |
| 306 | #ifndef LZMA_LOG_BSR |
| 307 | Bytecxx . . $ Byte# g_FastPoscxx . . $ _CLzmaEnc#g_FastPos.[1 << kNumLogBitscxx . . $ `compression/lzma/LzmaEnc.c:105:9`!]; |
| 308 | #endif |
| 309 | |
| 310 | UInt32cxx . . $ UInt32# ProbPricescxx . . $ _CLzmaEnc#ProbPrices.[kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!]; |
| 311 | UInt32cxx . . $ UInt32# matchescxx . . $ _CLzmaEnc#matches.[LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`! * 2 + 2 + 1]; |
| 312 | UInt32cxx . . $ UInt32# numFastBytescxx . . $ _CLzmaEnc#numFastBytes.; |
| 313 | UInt32cxx . . $ UInt32# additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset.; |
| 314 | UInt32cxx . . $ UInt32# repscxx . . $ _CLzmaEnc#reps.[LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!]; |
| 315 | UInt32cxx . . $ UInt32# statecxx . . $ _CLzmaEnc#state.; |
| 316 | |
| 317 | UInt32cxx . . $ UInt32# posSlotPricescxx . . $ _CLzmaEnc#posSlotPrices.[kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`!][kDistTableSizeMaxcxx . . $ `compression/lzma/LzmaEnc.c:169:9`!]; |
| 318 | UInt32cxx . . $ UInt32# distancesPricescxx . . $ _CLzmaEnc#distancesPrices.[kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`!][kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!]; |
| 319 | UInt32cxx . . $ UInt32# alignPricescxx . . $ _CLzmaEnc#alignPrices.[kAlignTableSizecxx . . $ `compression/lzma/LzmaEnc.c:173:9`!]; |
| 320 | UInt32cxx . . $ UInt32# alignPriceCountcxx . . $ _CLzmaEnc#alignPriceCount.; |
| 321 | |
| 322 | UInt32cxx . . $ UInt32# distTableSizecxx . . $ _CLzmaEnc#distTableSize.; |
| 323 | |
| 324 | unsigned lccxx . . $ _CLzmaEnc#lc., lpcxx . . $ _CLzmaEnc#lp., pbcxx . . $ _CLzmaEnc#pb.; |
| 325 | unsigned lpMaskcxx . . $ _CLzmaEnc#lpMask., pbMaskcxx . . $ _CLzmaEnc#pbMask.; |
| 326 | |
| 327 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *litProbscxx . . $ _CLzmaEnc#litProbs.; |
| 328 | |
| 329 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isMatchcxx . . $ _CLzmaEnc#isMatch.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!][LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`!]; |
| 330 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepcxx . . $ _CLzmaEnc#isRep.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 331 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepG0cxx . . $ _CLzmaEnc#isRepG0.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 332 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepG1cxx . . $ _CLzmaEnc#isRepG1.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 333 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRepG2cxx . . $ _CLzmaEnc#isRepG2.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]; |
| 334 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! isRep0Longcxx . . $ _CLzmaEnc#isRep0Long.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!][LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`!]; |
| 335 | |
| 336 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! posSlotEncodercxx . . $ _CLzmaEnc#posSlotEncoder.[kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`!][1 << kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`!]; |
| 337 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! posEncoderscxx . . $ _CLzmaEnc#posEncoders.[kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`! - kEndPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:177:9`!]; |
| 338 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! posAlignEncodercxx . . $ _CLzmaEnc#posAlignEncoder.[1 << kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!]; |
| 339 | |
| 340 | CLenPriceEnccxx . . $ CLenPriceEnc# lenEnccxx . . $ _CLzmaEnc#lenEnc.; |
| 341 | CLenPriceEnccxx . . $ CLenPriceEnc# repLenEnccxx . . $ _CLzmaEnc#repLenEnc.; |
| 342 | |
| 343 | unsigned lclpcxx . . $ _CLzmaEnc#lclp.; |
| 344 | |
| 345 | Boolcxx . . $ Bool# fastModecxx . . $ _CLzmaEnc#fastMode.; |
| 346 | |
| 347 | CRangeEnccxx . . $ CRangeEnc# rccxx . . $ _CLzmaEnc#rc.; |
| 348 | |
| 349 | Boolcxx . . $ Bool# writeEndMarkcxx . . $ _CLzmaEnc#writeEndMark.; |
| 350 | UInt64cxx . . $ UInt64# nowPos64cxx . . $ _CLzmaEnc#nowPos64.; |
| 351 | UInt32cxx . . $ UInt32# matchPriceCountcxx . . $ _CLzmaEnc#matchPriceCount.; |
| 352 | Boolcxx . . $ Bool# finishedcxx . . $ _CLzmaEnc#finished.; |
| 353 | Boolcxx . . $ Bool# multiThreadcxx . . $ _CLzmaEnc#multiThread.; |
| 354 | |
| 355 | SRescxx . . $ SRes# resultcxx . . $ _CLzmaEnc#result.; |
| 356 | UInt32cxx . . $ UInt32# dictSizecxx . . $ _CLzmaEnc#dictSize.; |
| 357 | UInt32cxx . . $ UInt32# matchFinderCyclescxx . . $ _CLzmaEnc#matchFinderCycles.; |
| 358 | |
| 359 | ISeqInStreamcxx . . $ ISeqInStream# *inStreamcxx . . $ _CLzmaEnc#inStream.; |
| 360 | CSeqInStreamBufcxx . . $ CSeqInStreamBuf# seqBufInStreamcxx . . $ _CLzmaEnc#seqBufInStream.; |
| 361 | |
| 362 | CSaveStatecxx . . $ CSaveState# saveStatecxx . . $ _CLzmaEnc#saveState.; |
| 363 | } CLzmaEnccxx . . $ CLzmaEnc#; |
| 364 | |
| 365 | |
| 366 | #if defined(USE_UNUSED_CODE) |
| 367 | /*MAB: static added */ |
| 368 | static |
| 369 | void LzmaEnc_SaveState(CLzmaEncHandle pp) |
| 370 | { |
| 371 | CLzmaEnc *p = (CLzmaEnc *)pp; |
| 372 | CSaveState *dest = &p->saveState; |
| 373 | int i; |
| 374 | dest->lenEnc = p->lenEnc; |
| 375 | dest->repLenEnc = p->repLenEnc; |
| 376 | dest->state = p->state; |
| 377 | |
| 378 | for (i = 0; i < kNumStates; i++) |
| 379 | { |
| 380 | memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); |
| 381 | memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); |
| 382 | } |
| 383 | for (i = 0; i < kNumLenToPosStates; i++) |
| 384 | memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); |
| 385 | memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); |
| 386 | memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); |
| 387 | memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); |
| 388 | memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); |
| 389 | memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); |
| 390 | memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); |
| 391 | memcpy(dest->reps, p->reps, sizeof(p->reps)); |
| 392 | memcpy(dest->litProbs, p->litProbs, (0x300 << p->lclp) * sizeof(CLzmaProb)); |
| 393 | } |
| 394 | |
| 395 | /*MAB: static added */ |
| 396 | static void LzmaEnc_RestoreState(CLzmaEncHandle pp) |
| 397 | { |
| 398 | CLzmaEnc *dest = (CLzmaEnc *)pp; |
| 399 | const CSaveState *p = &dest->saveState; |
| 400 | int i; |
| 401 | dest->lenEnc = p->lenEnc; |
| 402 | dest->repLenEnc = p->repLenEnc; |
| 403 | dest->state = p->state; |
| 404 | |
| 405 | for (i = 0; i < kNumStates; i++) |
| 406 | { |
| 407 | memcpy(dest->isMatch[i], p->isMatch[i], sizeof(p->isMatch[i])); |
| 408 | memcpy(dest->isRep0Long[i], p->isRep0Long[i], sizeof(p->isRep0Long[i])); |
| 409 | } |
| 410 | for (i = 0; i < kNumLenToPosStates; i++) |
| 411 | memcpy(dest->posSlotEncoder[i], p->posSlotEncoder[i], sizeof(p->posSlotEncoder[i])); |
| 412 | memcpy(dest->isRep, p->isRep, sizeof(p->isRep)); |
| 413 | memcpy(dest->isRepG0, p->isRepG0, sizeof(p->isRepG0)); |
| 414 | memcpy(dest->isRepG1, p->isRepG1, sizeof(p->isRepG1)); |
| 415 | memcpy(dest->isRepG2, p->isRepG2, sizeof(p->isRepG2)); |
| 416 | memcpy(dest->posEncoders, p->posEncoders, sizeof(p->posEncoders)); |
| 417 | memcpy(dest->posAlignEncoder, p->posAlignEncoder, sizeof(p->posAlignEncoder)); |
| 418 | memcpy(dest->reps, p->reps, sizeof(p->reps)); |
| 419 | memcpy(dest->litProbs, p->litProbs, (0x300 << dest->lclp) * sizeof(CLzmaProb)); |
| 420 | } |
| 421 | #endif |
| 422 | |
| 423 | SRescxx . . $ SRes# LzmaEnc_SetPropscxx . . $ LzmaEnc_SetProps(56f3369ab02c17f).(CLzmaEncHandlecxx . . $ CLzmaEncHandle# pp, const CLzmaEncPropscxx . . $ CLzmaEncProps# *props2) |
| 424 | { |
| 425 | CLzmaEnccxx . . $ CLzmaEnc# *p = (CLzmaEnccxx . . $ CLzmaEnc# *)pp; |
| 426 | CLzmaEncPropscxx . . $ CLzmaEncProps# props = *props2; |
| 427 | LzmaEncProps_Normalizecxx . . $ LzmaEncProps_Normalize(8b45acebcbbd4466).(&props); |
| 428 | |
| 429 | if (props.lccxx . . $ _CLzmaEncProps#lc. > LZMA_LC_MAXcxx . . $ `compression/lzma/LzmaEnc.c:189:9`! || props.lpcxx . . $ _CLzmaEncProps#lp. > LZMA_LP_MAXcxx . . $ `compression/lzma/LzmaEnc.c:190:9`! || props.pbcxx . . $ _CLzmaEncProps#pb. > LZMA_PB_MAXcxx . . $ `compression/lzma/LzmaEnc.c:188:9`! || |
| 430 | props.dictSizecxx . . $ _CLzmaEncProps#dictSize. > (1u << kDicLogSizeMaxCompresscxx . . $ `compression/lzma/LzmaEnc.c:106:9`!) || props.dictSizecxx . . $ _CLzmaEncProps#dictSize. > (1u << 30)) /*MAB: 1u to silence warnings */ |
| 431 | return SZ_ERROR_PARAMcxx . . $ `compression/lzma/Types.h:19:9`!; |
| 432 | p->dictSizecxx . . $ _CLzmaEnc#dictSize. = props.dictSizecxx . . $ _CLzmaEncProps#dictSize.; |
| 433 | p->matchFinderCyclescxx . . $ _CLzmaEnc#matchFinderCycles. = props.mccxx . . $ _CLzmaEncProps#mc.; |
| 434 | { |
| 435 | unsigned fb = (unsigned) props.fbcxx . . $ _CLzmaEncProps#fb.; /*MAB casts */ |
| 436 | if (fb < 5) |
| 437 | fb = 5; |
| 438 | if (fb > LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!) |
| 439 | fb = LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!; |
| 440 | p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes. = fb; |
| 441 | } |
| 442 | p->lccxx . . $ _CLzmaEnc#lc. = (unsigned) props.lccxx . . $ _CLzmaEncProps#lc.; |
| 443 | p->lpcxx . . $ _CLzmaEnc#lp. = (unsigned) props.lpcxx . . $ _CLzmaEncProps#lp.; |
| 444 | p->pbcxx . . $ _CLzmaEnc#pb. = (unsigned) props.pbcxx . . $ _CLzmaEncProps#pb.; |
| 445 | p->fastModecxx . . $ _CLzmaEnc#fastMode. = (props.algocxx . . $ _CLzmaEncProps#algo. == 0); |
| 446 | p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase..btModecxx . . $ _CMatchFinder#btMode. = props.btModecxx . . $ _CLzmaEncProps#btMode.; |
| 447 | { |
| 448 | UInt32cxx . . $ UInt32# numHashBytes = 4; |
| 449 | if (props.btModecxx . . $ _CLzmaEncProps#btMode.) |
| 450 | { |
| 451 | if (props.numHashBytescxx . . $ _CLzmaEncProps#numHashBytes. < 2) |
| 452 | numHashBytes = 2; |
| 453 | else if (props.numHashBytescxx . . $ _CLzmaEncProps#numHashBytes. < 4) |
| 454 | numHashBytes = (UInt32cxx . . $ UInt32#) props.numHashBytescxx . . $ _CLzmaEncProps#numHashBytes.; /*MAB casts */ |
| 455 | } |
| 456 | p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase..numHashBytescxx . . $ _CMatchFinder#numHashBytes. = numHashBytes; |
| 457 | } |
| 458 | |
| 459 | p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase..cutValuecxx . . $ _CMatchFinder#cutValue. = props.mccxx . . $ _CLzmaEncProps#mc.; |
| 460 | |
| 461 | p->writeEndMarkcxx . . $ _CLzmaEnc#writeEndMark. = (Boolcxx . . $ Bool#) props.writeEndMarkcxx . . $ _CLzmaEncProps#writeEndMark.; /*MAB casts */ |
| 462 | |
| 463 | #ifdef COMPRESS_MF_MT |
| 464 | /* |
| 465 | if (newMultiThread != _multiThread) |
| 466 | { |
| 467 | ReleaseMatchFinder(); |
| 468 | _multiThread = newMultiThread; |
| 469 | } |
| 470 | */ |
| 471 | p->multiThread = (props.numThreads > 1); |
| 472 | #endif |
| 473 | |
| 474 | return SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 475 | } |
| 476 | |
| 477 | static const int kLiteralNextStatescxx . . $ kLiteralNextStates.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!] = {0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 4, 5}; |
| 478 | static const int kMatchNextStatescxx . . $ kMatchNextStates.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!] = {7, 7, 7, 7, 7, 7, 7, 10, 10, 10, 10, 10}; |
| 479 | static const int kRepNextStatescxx . . $ kRepNextStates.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!] = {8, 8, 8, 8, 8, 8, 8, 11, 11, 11, 11, 11}; |
| 480 | static const int kShortRepNextStatescxx . . $ kShortRepNextStates.[kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!]= {9, 9, 9, 9, 9, 9, 9, 11, 11, 11, 11, 11}; |
| 481 | |
| 482 | #define IsCharStatecxx . . $ `compression/lzma/LzmaEnc.c:482:9`!(s) ((s) < 7) |
| 483 | |
| 484 | #define GetLenToPosStatecxx . . $ `compression/lzma/LzmaEnc.c:484:9`!(len) (((len) < kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`! + 1) ? (len) - 2 : kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`! - 1) |
| 485 | |
| 486 | #define kInfinityPricecxx . . $ `compression/lzma/LzmaEnc.c:486:9`! (1 << 30) |
| 487 | |
| 488 | static void RangeEnc_Constructcxx . . $ RangeEnc_Construct(d97b4104f7cae7a0).(CRangeEnccxx . . $ CRangeEnc# *p) |
| 489 | { |
| 490 | p->outStreamcxx . . $ _CRangeEnc#outStream. = 0; |
| 491 | p->bufBasecxx . . $ _CRangeEnc#bufBase. = 0; |
| 492 | } |
| 493 | |
| 494 | #define RangeEnc_GetProcessedcxx . . $ `compression/lzma/LzmaEnc.c:494:9`!(p) ((p)->processed + (UInt64) ((p)->buf - (p)->bufBase) + (p)->cacheSize) /*MAB casts */ |
| 495 | |
| 496 | #define RC_BUF_SIZEcxx . . $ `compression/lzma/LzmaEnc.c:496:9`! (1 << 16) |
| 497 | static int RangeEnc_Alloccxx . . $ RangeEnc_Alloc(a619cf74c1da9906).(CRangeEnccxx . . $ CRangeEnc# *p, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 498 | { |
| 499 | if (p->bufBasecxx . . $ _CRangeEnc#bufBase. == 0) |
| 500 | { |
| 501 | p->bufBasecxx . . $ _CRangeEnc#bufBase. = (Bytecxx . . $ Byte# *)alloc->Alloccxx . . $ ISzAlloc#Alloc.(alloc, RC_BUF_SIZEcxx . . $ `compression/lzma/LzmaEnc.c:496:9`!); |
| 502 | if (p->bufBasecxx . . $ _CRangeEnc#bufBase. == 0) |
| 503 | return 0; |
| 504 | p->bufLimcxx . . $ _CRangeEnc#bufLim. = p->bufBasecxx . . $ _CRangeEnc#bufBase. + RC_BUF_SIZEcxx . . $ `compression/lzma/LzmaEnc.c:496:9`!; |
| 505 | } |
| 506 | return 1; |
| 507 | } |
| 508 | |
| 509 | static void RangeEnc_Freecxx . . $ RangeEnc_Free(b02bb5f954b00114).(CRangeEnccxx . . $ CRangeEnc# *p, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 510 | { |
| 511 | alloc->Freecxx . . $ ISzAlloc#Free.(alloc, p->bufBasecxx . . $ _CRangeEnc#bufBase.); |
| 512 | p->bufBasecxx . . $ _CRangeEnc#bufBase. = 0; |
| 513 | } |
| 514 | |
| 515 | static void RangeEnc_Initcxx . . $ RangeEnc_Init(d97b4104f7cae7a0).(CRangeEnccxx . . $ CRangeEnc# *p) |
| 516 | { |
| 517 | /* Stream.Init(); */ |
| 518 | p->lowcxx . . $ _CRangeEnc#low. = 0; |
| 519 | p->rangecxx . . $ _CRangeEnc#range. = 0xFFFFFFFF; |
| 520 | p->cacheSizecxx . . $ _CRangeEnc#cacheSize. = 1; |
| 521 | p->cachecxx . . $ _CRangeEnc#cache. = 0; |
| 522 | |
| 523 | p->bufcxx . . $ _CRangeEnc#buf. = p->bufBasecxx . . $ _CRangeEnc#bufBase.; |
| 524 | |
| 525 | p->processedcxx . . $ _CRangeEnc#processed. = 0; |
| 526 | p->rescxx . . $ _CRangeEnc#res. = SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 527 | } |
| 528 | |
| 529 | static void RangeEnc_FlushStreamcxx . . $ RangeEnc_FlushStream(d97b4104f7cae7a0).(CRangeEnccxx . . $ CRangeEnc# *p) |
| 530 | { |
| 531 | size_t num; |
| 532 | if (p->rescxx . . $ _CRangeEnc#res. != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 533 | return; |
| 534 | num = (size_t)(p->bufcxx . . $ _CRangeEnc#buf. - p->bufBasecxx . . $ _CRangeEnc#bufBase.); /*MAB casts */ |
| 535 | if (num != p->outStreamcxx . . $ _CRangeEnc#outStream.->Writecxx . . $ ISeqOutStream#Write.(p->outStreamcxx . . $ _CRangeEnc#outStream., p->bufBasecxx . . $ _CRangeEnc#bufBase., num)) |
| 536 | p->rescxx . . $ _CRangeEnc#res. = SZ_ERROR_WRITEcxx . . $ `compression/lzma/Types.h:23:9`!; |
| 537 | p->processedcxx . . $ _CRangeEnc#processed. += num; |
| 538 | p->bufcxx . . $ _CRangeEnc#buf. = p->bufBasecxx . . $ _CRangeEnc#bufBase.; |
| 539 | } |
| 540 | |
| 541 | static void MY_FAST_CALLcxx . . $ `compression/lzma/Types.h:102:9`! RangeEnc_ShiftLowcxx . . $ RangeEnc_ShiftLow(d97b4104f7cae7a0).(CRangeEnccxx . . $ CRangeEnc# *p) |
| 542 | { |
| 543 | if ((UInt32cxx . . $ UInt32#)p->lowcxx . . $ _CRangeEnc#low. < (UInt32cxx . . $ UInt32#)0xFF000000 || (int)(p->lowcxx . . $ _CRangeEnc#low. >> 32) != 0) |
| 544 | { |
| 545 | Bytecxx . . $ Byte# temp = p->cachecxx . . $ _CRangeEnc#cache.; |
| 546 | do |
| 547 | { |
| 548 | Bytecxx . . $ Byte# *buf = p->bufcxx . . $ _CRangeEnc#buf.; |
| 549 | *buf++ = (Bytecxx . . $ Byte#)(temp + (Bytecxx . . $ Byte#)(p->lowcxx . . $ _CRangeEnc#low. >> 32)); |
| 550 | p->bufcxx . . $ _CRangeEnc#buf. = buf; |
| 551 | if (buf == p->bufLimcxx . . $ _CRangeEnc#bufLim.) |
| 552 | RangeEnc_FlushStreamcxx . . $ RangeEnc_FlushStream(d97b4104f7cae7a0).(p); |
| 553 | temp = 0xFF; |
| 554 | } |
| 555 | while (--p->cacheSizecxx . . $ _CRangeEnc#cacheSize. != 0); |
| 556 | p->cachecxx . . $ _CRangeEnc#cache. = (Bytecxx . . $ Byte#)((UInt32cxx . . $ UInt32#)p->lowcxx . . $ _CRangeEnc#low. >> 24); |
| 557 | } |
| 558 | p->cacheSizecxx . . $ _CRangeEnc#cacheSize.++; |
| 559 | p->lowcxx . . $ _CRangeEnc#low. = (UInt32cxx . . $ UInt32#)p->lowcxx . . $ _CRangeEnc#low. << 8; |
| 560 | } |
| 561 | |
| 562 | static void RangeEnc_FlushDatacxx . . $ RangeEnc_FlushData(d97b4104f7cae7a0).(CRangeEnccxx . . $ CRangeEnc# *p) |
| 563 | { |
| 564 | int i; |
| 565 | for (i = 0; i < 5; i++) |
| 566 | RangeEnc_ShiftLowcxx . . $ RangeEnc_ShiftLow(d97b4104f7cae7a0).(p); |
| 567 | } |
| 568 | |
| 569 | static void RangeEnc_EncodeDirectBitscxx . . $ RangeEnc_EncodeDirectBits(676cf8ae91c30878).(CRangeEnccxx . . $ CRangeEnc# *p, UInt32cxx . . $ UInt32# value, int numBits) |
| 570 | { |
| 571 | do |
| 572 | { |
| 573 | p->rangecxx . . $ _CRangeEnc#range. >>= 1; |
| 574 | p->lowcxx . . $ _CRangeEnc#low. += p->rangecxx . . $ _CRangeEnc#range. & (0 - ((value >> --numBits) & 1)); |
| 575 | if (p->rangecxx . . $ _CRangeEnc#range. < kTopValuecxx . . $ `compression/lzma/LzmaEnc.c:34:9`!) |
| 576 | { |
| 577 | p->rangecxx . . $ _CRangeEnc#range. <<= 8; |
| 578 | RangeEnc_ShiftLowcxx . . $ RangeEnc_ShiftLow(d97b4104f7cae7a0).(p); |
| 579 | } |
| 580 | } |
| 581 | while (numBits != 0); |
| 582 | } |
| 583 | |
| 584 | static void RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(CRangeEnccxx . . $ CRangeEnc# *p, CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *prob, UInt32cxx . . $ UInt32# symbol) |
| 585 | { |
| 586 | UInt32cxx . . $ UInt32# ttt = *prob; |
| 587 | UInt32cxx . . $ UInt32# newBound = (p->rangecxx . . $ _CRangeEnc#range. >> kNumBitModelTotalBitscxx . . $ `compression/lzma/LzmaEnc.c:36:9`!) * ttt; |
| 588 | if (symbol == 0) |
| 589 | { |
| 590 | p->rangecxx . . $ _CRangeEnc#range. = newBound; |
| 591 | ttt += (kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! - ttt) >> kNumMoveBitscxx . . $ `compression/lzma/LzmaEnc.c:38:9`!; |
| 592 | } |
| 593 | else |
| 594 | { |
| 595 | p->lowcxx . . $ _CRangeEnc#low. += newBound; |
| 596 | p->rangecxx . . $ _CRangeEnc#range. -= newBound; |
| 597 | ttt -= ttt >> kNumMoveBitscxx . . $ `compression/lzma/LzmaEnc.c:38:9`!; |
| 598 | } |
| 599 | *prob = (CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`!)ttt; |
| 600 | if (p->rangecxx . . $ _CRangeEnc#range. < kTopValuecxx . . $ `compression/lzma/LzmaEnc.c:34:9`!) |
| 601 | { |
| 602 | p->rangecxx . . $ _CRangeEnc#range. <<= 8; |
| 603 | RangeEnc_ShiftLowcxx . . $ RangeEnc_ShiftLow(d97b4104f7cae7a0).(p); |
| 604 | } |
| 605 | } |
| 606 | |
| 607 | static void LitEnc_Encodecxx . . $ LitEnc_Encode(3aa722912e2e9d51).(CRangeEnccxx . . $ CRangeEnc# *p, CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, UInt32cxx . . $ UInt32# symbol) |
| 608 | { |
| 609 | symbol |= 0x100; |
| 610 | do |
| 611 | { |
| 612 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(p, probs + (symbol >> 8), (symbol >> 7) & 1); |
| 613 | symbol <<= 1; |
| 614 | } |
| 615 | while (symbol < 0x10000); |
| 616 | } |
| 617 | |
| 618 | static void LitEnc_EncodeMatchedcxx . . $ LitEnc_EncodeMatched(d9d99b7691bbb741).(CRangeEnccxx . . $ CRangeEnc# *p, CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, UInt32cxx . . $ UInt32# symbol, UInt32cxx . . $ UInt32# matchByte) |
| 619 | { |
| 620 | UInt32cxx . . $ UInt32# offs = 0x100; |
| 621 | symbol |= 0x100; |
| 622 | do |
| 623 | { |
| 624 | matchByte <<= 1; |
| 625 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(p, probs + (offs + (matchByte & offs) + (symbol >> 8)), (symbol >> 7) & 1); |
| 626 | symbol <<= 1; |
| 627 | offs &= ~(matchByte ^ symbol); |
| 628 | } |
| 629 | while (symbol < 0x10000); |
| 630 | } |
| 631 | |
| 632 | /*MAB: static added */ |
| 633 | static void LzmaEnc_InitPriceTablescxx . . $ LzmaEnc_InitPriceTables(218b13e5e7cbf689).(UInt32cxx . . $ UInt32# *ProbPrices) |
| 634 | { |
| 635 | UInt32cxx . . $ UInt32# i; |
| 636 | for (i = (1 << kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!) / 2; i < kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`!; i += (1 << kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!)) |
| 637 | { |
| 638 | const int kCyclesBits = kNumBitPriceShiftBitscxx . . $ `compression/lzma/LzmaEnc.c:42:9`!; |
| 639 | UInt32cxx . . $ UInt32# w = i; |
| 640 | UInt32cxx . . $ UInt32# bitCount = 0; |
| 641 | int j; |
| 642 | for (j = 0; j < kCyclesBits; j++) |
| 643 | { |
| 644 | w = w * w; |
| 645 | bitCount <<= 1; |
| 646 | while (w >= ((UInt32cxx . . $ UInt32#)1 << 16)) |
| 647 | { |
| 648 | w >>= 1; |
| 649 | bitCount++; |
| 650 | } |
| 651 | } |
| 652 | ProbPrices[i >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!] = (/*MAB: cast to silence*/(UInt32cxx . . $ UInt32#)(kNumBitModelTotalBitscxx . . $ `compression/lzma/LzmaEnc.c:36:9`! << kCyclesBits) - /*MAB: cast to silence*/(UInt32cxx . . $ UInt32#)15 - bitCount); |
| 653 | } |
| 654 | } |
| 655 | |
| 656 | |
| 657 | #define GET_PRICEcxx . . $ `compression/lzma/LzmaEnc.c:657:9`!(prob, symbol) \ |
| 658 | p->ProbPrices[((prob) ^ (((-(int)(symbol))) & (kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! - 1))) >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!]; |
| 659 | |
| 660 | #define GET_PRICEacxx . . $ `compression/lzma/LzmaEnc.c:660:9`!(prob, symbol) \ |
| 661 | ProbPrices[((prob) ^ ((-((int)(symbol))) & (kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! - 1))) >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!]; |
| 662 | |
| 663 | #define GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(prob) p->ProbPrices[(prob) >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!] |
| 664 | #define GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(prob) p->ProbPrices[((prob) ^ (kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! - 1)) >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!] |
| 665 | |
| 666 | #define GET_PRICE_0acxx . . $ `compression/lzma/LzmaEnc.c:666:9`!(prob) ProbPrices[(prob) >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!] |
| 667 | #define GET_PRICE_1acxx . . $ `compression/lzma/LzmaEnc.c:667:9`!(prob) ProbPrices[((prob) ^ (kBitModelTotalcxx . . $ `compression/lzma/LzmaEnc.c:37:9`! - 1)) >> kNumMoveReducingBitscxx . . $ `compression/lzma/LzmaEnc.c:41:9`!] |
| 668 | |
| 669 | static UInt32cxx . . $ UInt32# LitEnc_GetPricecxx . . $ LitEnc_GetPrice(87c8c2a7b36bc868).(const CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, UInt32cxx . . $ UInt32# symbol, UInt32cxx . . $ UInt32# *ProbPrices) |
| 670 | { |
| 671 | UInt32cxx . . $ UInt32# price = 0; |
| 672 | symbol |= 0x100; |
| 673 | do |
| 674 | { |
| 675 | price += GET_PRICEacxx . . $ `compression/lzma/LzmaEnc.c:660:9`!(probs[symbol >> 8], (symbol >> 7) & 1); |
| 676 | symbol <<= 1; |
| 677 | } |
| 678 | while (symbol < 0x10000); |
| 679 | return price; |
| 680 | } |
| 681 | |
| 682 | static UInt32cxx . . $ UInt32# LitEnc_GetPriceMatchedcxx . . $ LitEnc_GetPriceMatched(e455c4847037b245).(const CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, UInt32cxx . . $ UInt32# symbol, UInt32cxx . . $ UInt32# matchByte, UInt32cxx . . $ UInt32# *ProbPrices) |
| 683 | { |
| 684 | UInt32cxx . . $ UInt32# price = 0; |
| 685 | UInt32cxx . . $ UInt32# offs = 0x100; |
| 686 | symbol |= 0x100; |
| 687 | do |
| 688 | { |
| 689 | matchByte <<= 1; |
| 690 | price += GET_PRICEacxx . . $ `compression/lzma/LzmaEnc.c:660:9`!(probs[offs + (matchByte & offs) + (symbol >> 8)], (symbol >> 7) & 1); |
| 691 | symbol <<= 1; |
| 692 | offs &= ~(matchByte ^ symbol); |
| 693 | } |
| 694 | while (symbol < 0x10000); |
| 695 | return price; |
| 696 | } |
| 697 | |
| 698 | |
| 699 | static void RcTree_Encodecxx . . $ RcTree_Encode(5f22b0202e1ec115).(CRangeEnccxx . . $ CRangeEnc# *rc, CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, int numBitLevels, UInt32cxx . . $ UInt32# symbol) |
| 700 | { |
| 701 | UInt32cxx . . $ UInt32# m = 1; |
| 702 | int i; |
| 703 | for (i = numBitLevels; i != 0;) |
| 704 | { |
| 705 | UInt32cxx . . $ UInt32# bit; |
| 706 | i--; |
| 707 | bit = (symbol >> i) & 1; |
| 708 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(rc, probs + m, bit); |
| 709 | m = (m << 1) | bit; |
| 710 | } |
| 711 | } |
| 712 | |
| 713 | static void RcTree_ReverseEncodecxx . . $ RcTree_ReverseEncode(5f22b0202e1ec115).(CRangeEnccxx . . $ CRangeEnc# *rc, CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, int numBitLevels, UInt32cxx . . $ UInt32# symbol) |
| 714 | { |
| 715 | UInt32cxx . . $ UInt32# m = 1; |
| 716 | int i; |
| 717 | for (i = 0; i < numBitLevels; i++) |
| 718 | { |
| 719 | UInt32cxx . . $ UInt32# bit = symbol & 1; |
| 720 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(rc, probs + m, bit); |
| 721 | m = (m << 1) | bit; |
| 722 | symbol >>= 1; |
| 723 | } |
| 724 | } |
| 725 | |
| 726 | static UInt32cxx . . $ UInt32# RcTree_GetPricecxx . . $ RcTree_GetPrice(b6dfaeb572b0790a).(const CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, int numBitLevels, UInt32cxx . . $ UInt32# symbol, UInt32cxx . . $ UInt32# *ProbPrices) |
| 727 | { |
| 728 | UInt32cxx . . $ UInt32# price = 0; |
| 729 | symbol |= (1u << numBitLevels); /*MAB 1u */ |
| 730 | while (symbol != 1) |
| 731 | { |
| 732 | price += GET_PRICEacxx . . $ `compression/lzma/LzmaEnc.c:660:9`!(probs[symbol >> 1], symbol & 1); |
| 733 | symbol >>= 1; |
| 734 | } |
| 735 | return price; |
| 736 | } |
| 737 | |
| 738 | static UInt32cxx . . $ UInt32# RcTree_ReverseGetPricecxx . . $ RcTree_ReverseGetPrice(b6dfaeb572b0790a).(const CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs, int numBitLevels, UInt32cxx . . $ UInt32# symbol, UInt32cxx . . $ UInt32# *ProbPrices) |
| 739 | { |
| 740 | UInt32cxx . . $ UInt32# price = 0; |
| 741 | UInt32cxx . . $ UInt32# m = 1; |
| 742 | int i; |
| 743 | for (i = numBitLevels; i != 0; i--) |
| 744 | { |
| 745 | UInt32cxx . . $ UInt32# bit = symbol & 1; |
| 746 | symbol >>= 1; |
| 747 | price += GET_PRICEacxx . . $ `compression/lzma/LzmaEnc.c:660:9`!(probs[m], bit); |
| 748 | m = (m << 1) | bit; |
| 749 | } |
| 750 | return price; |
| 751 | } |
| 752 | |
| 753 | |
| 754 | static void LenEnc_Initcxx . . $ LenEnc_Init(d20878b51efee4f5).(CLenEnccxx . . $ CLenEnc# *p) |
| 755 | { |
| 756 | unsigned i; |
| 757 | p->choicecxx . . $ CLenEnc#choice. = p->choice2cxx . . $ CLenEnc#choice2. = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 758 | for (i = 0; i < (LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`! << kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`!); i++) |
| 759 | p->lowcxx . . $ CLenEnc#low.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 760 | for (i = 0; i < (LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`! << kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`!); i++) |
| 761 | p->midcxx . . $ CLenEnc#mid.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 762 | for (i = 0; i < kLenNumHighSymbolscxx . . $ `compression/lzma/LzmaEnc.c:200:9`!; i++) |
| 763 | p->highcxx . . $ CLenEnc#high.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 764 | } |
| 765 | |
| 766 | static void LenEnc_Encodecxx . . $ LenEnc_Encode(3833e61da4ff8d90).(CLenEnccxx . . $ CLenEnc# *p, CRangeEnccxx . . $ CRangeEnc# *rc, UInt32cxx . . $ UInt32# symbol, UInt32cxx . . $ UInt32# posState) |
| 767 | { |
| 768 | if (symbol < kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`!) |
| 769 | { |
| 770 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(rc, &p->choicecxx . . $ CLenEnc#choice., 0); |
| 771 | RcTree_Encodecxx . . $ RcTree_Encode(5f22b0202e1ec115).(rc, p->lowcxx . . $ CLenEnc#low. + (posState << kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`!), kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`!, symbol); |
| 772 | } |
| 773 | else |
| 774 | { |
| 775 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(rc, &p->choicecxx . . $ CLenEnc#choice., 1); |
| 776 | if (symbol < kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`! + kLenNumMidSymbolscxx . . $ `compression/lzma/LzmaEnc.c:198:9`!) |
| 777 | { |
| 778 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(rc, &p->choice2cxx . . $ CLenEnc#choice2., 0); |
| 779 | RcTree_Encodecxx . . $ RcTree_Encode(5f22b0202e1ec115).(rc, p->midcxx . . $ CLenEnc#mid. + (posState << kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`!), kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`!, symbol - kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`!); |
| 780 | } |
| 781 | else |
| 782 | { |
| 783 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(rc, &p->choice2cxx . . $ CLenEnc#choice2., 1); |
| 784 | RcTree_Encodecxx . . $ RcTree_Encode(5f22b0202e1ec115).(rc, p->highcxx . . $ CLenEnc#high., kLenNumHighBitscxx . . $ `compression/lzma/LzmaEnc.c:199:9`!, symbol - kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`! - kLenNumMidSymbolscxx . . $ `compression/lzma/LzmaEnc.c:198:9`!); |
| 785 | } |
| 786 | } |
| 787 | } |
| 788 | |
| 789 | static void LenEnc_SetPricescxx . . $ LenEnc_SetPrices(a23b3a46ef60ed96).(CLenEnccxx . . $ CLenEnc# *p, UInt32cxx . . $ UInt32# posState, UInt32cxx . . $ UInt32# numSymbols, UInt32cxx . . $ UInt32# *prices, UInt32cxx . . $ UInt32# *ProbPrices) |
| 790 | { |
| 791 | UInt32cxx . . $ UInt32# a0 = GET_PRICE_0acxx . . $ `compression/lzma/LzmaEnc.c:666:9`!(p->choice); |
| 792 | UInt32cxx . . $ UInt32# a1 = GET_PRICE_1acxx . . $ `compression/lzma/LzmaEnc.c:667:9`!(p->choice); |
| 793 | UInt32cxx . . $ UInt32# b0 = a1 + GET_PRICE_0acxx . . $ `compression/lzma/LzmaEnc.c:666:9`!(p->choice2); |
| 794 | UInt32cxx . . $ UInt32# b1 = a1 + GET_PRICE_1acxx . . $ `compression/lzma/LzmaEnc.c:667:9`!(p->choice2); |
| 795 | UInt32cxx . . $ UInt32# i = 0; |
| 796 | for (i = 0; i < kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`!; i++) |
| 797 | { |
| 798 | if (i >= numSymbols) |
| 799 | return; |
| 800 | prices[i] = a0 + RcTree_GetPricecxx . . $ RcTree_GetPrice(b6dfaeb572b0790a).(p->lowcxx . . $ CLenEnc#low. + (posState << kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`!), kLenNumLowBitscxx . . $ `compression/lzma/LzmaEnc.c:195:9`!, i, ProbPrices); |
| 801 | } |
| 802 | for (; i < kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`! + kLenNumMidSymbolscxx . . $ `compression/lzma/LzmaEnc.c:198:9`!; i++) |
| 803 | { |
| 804 | if (i >= numSymbols) |
| 805 | return; |
| 806 | prices[i] = b0 + RcTree_GetPricecxx . . $ RcTree_GetPrice(b6dfaeb572b0790a).(p->midcxx . . $ CLenEnc#mid. + (posState << kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`!), kLenNumMidBitscxx . . $ `compression/lzma/LzmaEnc.c:197:9`!, i - kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`!, ProbPrices); |
| 807 | } |
| 808 | for (; i < numSymbols; i++) |
| 809 | prices[i] = b1 + RcTree_GetPricecxx . . $ RcTree_GetPrice(b6dfaeb572b0790a).(p->highcxx . . $ CLenEnc#high., kLenNumHighBitscxx . . $ `compression/lzma/LzmaEnc.c:199:9`!, i - kLenNumLowSymbolscxx . . $ `compression/lzma/LzmaEnc.c:196:9`! - kLenNumMidSymbolscxx . . $ `compression/lzma/LzmaEnc.c:198:9`!, ProbPrices); |
| 810 | } |
| 811 | |
| 812 | static void MY_FAST_CALLcxx . . $ `compression/lzma/Types.h:102:9`! LenPriceEnc_UpdateTablecxx . . $ LenPriceEnc_UpdateTable(80a8df4121d30fc3).(CLenPriceEnccxx . . $ CLenPriceEnc# *p, UInt32cxx . . $ UInt32# posState, UInt32cxx . . $ UInt32# *ProbPrices) |
| 813 | { |
| 814 | LenEnc_SetPricescxx . . $ LenEnc_SetPrices(a23b3a46ef60ed96).(&p->pcxx . . $ CLenPriceEnc#p., posState, p->tableSizecxx . . $ CLenPriceEnc#tableSize., p->pricescxx . . $ CLenPriceEnc#prices.[posState], ProbPrices); |
| 815 | p->counterscxx . . $ CLenPriceEnc#counters.[posState] = p->tableSizecxx . . $ CLenPriceEnc#tableSize.; |
| 816 | } |
| 817 | |
| 818 | static void LenPriceEnc_UpdateTablescxx . . $ LenPriceEnc_UpdateTables(80a8df4121d30fc3).(CLenPriceEnccxx . . $ CLenPriceEnc# *p, UInt32cxx . . $ UInt32# numPosStates, UInt32cxx . . $ UInt32# *ProbPrices) |
| 819 | { |
| 820 | UInt32cxx . . $ UInt32# posState; |
| 821 | for (posState = 0; posState < numPosStates; posState++) |
| 822 | LenPriceEnc_UpdateTablecxx . . $ LenPriceEnc_UpdateTable(80a8df4121d30fc3).(p, posState, ProbPrices); |
| 823 | } |
| 824 | |
| 825 | static void LenEnc_Encode2cxx . . $ LenEnc_Encode2(b90f9a3d4ca2a8ad).(CLenPriceEnccxx . . $ CLenPriceEnc# *p, CRangeEnccxx . . $ CRangeEnc# *rc, UInt32cxx . . $ UInt32# symbol, UInt32cxx . . $ UInt32# posState, Boolcxx . . $ Bool# updatePrice, UInt32cxx . . $ UInt32# *ProbPrices) |
| 826 | { |
| 827 | LenEnc_Encodecxx . . $ LenEnc_Encode(3833e61da4ff8d90).(&p->pcxx . . $ CLenPriceEnc#p., rc, symbol, posState); |
| 828 | if (updatePrice) |
| 829 | if (--p->counterscxx . . $ CLenPriceEnc#counters.[posState] == 0) |
| 830 | LenPriceEnc_UpdateTablecxx . . $ LenPriceEnc_UpdateTable(80a8df4121d30fc3).(p, posState, ProbPrices); |
| 831 | } |
| 832 | |
| 833 | |
| 834 | |
| 835 | |
| 836 | static void MovePoscxx . . $ MovePos(f2b1754a7ad3e15d).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# num) |
| 837 | { |
| 838 | #ifdef SHOW_STAT |
| 839 | ttt += num; |
| 840 | printf("\n MovePos %d", num); |
| 841 | #endif |
| 842 | if (num != 0) |
| 843 | { |
| 844 | p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset. += num; |
| 845 | p->matchFindercxx . . $ _CLzmaEnc#matchFinder..Skipcxx . . $ _IMatchFinder#Skip.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj., num); |
| 846 | } |
| 847 | } |
| 848 | |
| 849 | static UInt32cxx . . $ UInt32# ReadMatchDistancescxx . . $ ReadMatchDistances(a4099a4a91d7b59b).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# *numDistancePairsRes) |
| 850 | { |
| 851 | UInt32cxx . . $ UInt32# lenRes = 0, numPairs; |
| 852 | p->numAvailcxx . . $ _CLzmaEnc#numAvail. = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetNumAvailableBytescxx . . $ _IMatchFinder#GetNumAvailableBytes.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.); |
| 853 | numPairs = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetMatchescxx . . $ _IMatchFinder#GetMatches.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj., p->matchescxx . . $ _CLzmaEnc#matches.); |
| 854 | #ifdef SHOW_STAT |
| 855 | printf("\n i = %d numPairs = %d ", ttt, numPairs / 2); |
| 856 | ttt++; |
| 857 | { |
| 858 | UInt32 i; |
| 859 | for (i = 0; i < numPairs; i += 2) |
| 860 | printf("%2d %6d | ", p->matches[i], p->matches[i + 1]); |
| 861 | } |
| 862 | #endif |
| 863 | if (numPairs > 0) |
| 864 | { |
| 865 | lenRes = p->matchescxx . . $ _CLzmaEnc#matches.[numPairs - 2]; |
| 866 | if (lenRes == p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.) |
| 867 | { |
| 868 | const Bytecxx . . $ Byte# *pby = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetPointerToCurrentPoscxx . . $ _IMatchFinder#GetPointerToCurrentPos.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) - 1; |
| 869 | UInt32cxx . . $ UInt32# distance = p->matchescxx . . $ _CLzmaEnc#matches.[numPairs - 1] + 1; |
| 870 | UInt32cxx . . $ UInt32# numAvail = p->numAvailcxx . . $ _CLzmaEnc#numAvail.; |
| 871 | if (numAvail > LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!) |
| 872 | numAvail = LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!; |
| 873 | { |
| 874 | const Bytecxx . . $ Byte# *pby2 = pby - distance; |
| 875 | for (; lenRes < numAvail && pby[lenRes] == pby2[lenRes]; lenRes++); |
| 876 | } |
| 877 | } |
| 878 | } |
| 879 | p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset.++; |
| 880 | *numDistancePairsRes = numPairs; |
| 881 | return lenRes; |
| 882 | } |
| 883 | |
| 884 | |
| 885 | #define MakeAsCharcxx . . $ `compression/lzma/LzmaEnc.c:885:9`!(p) (p)->backPrev = (UInt32)(-1); (p)->prev1IsChar = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 886 | #define MakeAsShortRepcxx . . $ `compression/lzma/LzmaEnc.c:886:9`!(p) (p)->backPrev = 0; (p)->prev1IsChar = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 887 | #define IsShortRepcxx . . $ `compression/lzma/LzmaEnc.c:887:9`!(p) ((p)->backPrev == 0) |
| 888 | |
| 889 | static UInt32cxx . . $ UInt32# GetRepLen1Pricecxx . . $ GetRepLen1Price(7cf65a242ae0f065).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# state, UInt32cxx . . $ UInt32# posState) |
| 890 | { |
| 891 | return |
| 892 | GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isRepG0[state]) + |
| 893 | GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isRep0Long[state][posState]); |
| 894 | } |
| 895 | |
| 896 | static UInt32cxx . . $ UInt32# GetPureRepPricecxx . . $ GetPureRepPrice(162e27b8e1941687).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# repIndex, UInt32cxx . . $ UInt32# state, UInt32cxx . . $ UInt32# posState) |
| 897 | { |
| 898 | UInt32cxx . . $ UInt32# price; |
| 899 | if (repIndex == 0) |
| 900 | { |
| 901 | price = GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isRepG0[state]); |
| 902 | price += GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRep0Long[state][posState]); |
| 903 | } |
| 904 | else |
| 905 | { |
| 906 | price = GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRepG0[state]); |
| 907 | if (repIndex == 1) |
| 908 | price += GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isRepG1[state]); |
| 909 | else |
| 910 | { |
| 911 | price += GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRepG1[state]); |
| 912 | price += GET_PRICEcxx . . $ `compression/lzma/LzmaEnc.c:657:9`!(p->isRepG2[state], repIndex - 2); |
| 913 | } |
| 914 | } |
| 915 | return price; |
| 916 | } |
| 917 | |
| 918 | static UInt32cxx . . $ UInt32# GetRepPricecxx . . $ GetRepPrice(4dbe00a9b9c89324).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# repIndex, UInt32cxx . . $ UInt32# len, UInt32cxx . . $ UInt32# state, UInt32cxx . . $ UInt32# posState) |
| 919 | { |
| 920 | return p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc..pricescxx . . $ CLenPriceEnc#prices.[posState][len - LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!] + |
| 921 | GetPureRepPricecxx . . $ GetPureRepPrice(162e27b8e1941687).(p, repIndex, state, posState); |
| 922 | } |
| 923 | |
| 924 | static UInt32cxx . . $ UInt32# Backwardcxx . . $ Backward(10df9d42b5608658).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# *backRes, UInt32cxx . . $ UInt32# cur) |
| 925 | { |
| 926 | UInt32cxx . . $ UInt32# posMem = p->optcxx . . $ _CLzmaEnc#opt.[cur].posPrevcxx . . $ _COptimal#posPrev.; |
| 927 | UInt32cxx . . $ UInt32# backMem = p->optcxx . . $ _CLzmaEnc#opt.[cur].backPrevcxx . . $ _COptimal#backPrev.; |
| 928 | p->optimumEndIndexcxx . . $ _CLzmaEnc#optimumEndIndex. = cur; |
| 929 | do |
| 930 | { |
| 931 | if (p->optcxx . . $ _CLzmaEnc#opt.[cur].prev1IsCharcxx . . $ _COptimal#prev1IsChar.) |
| 932 | { |
| 933 | MakeAsCharcxx . . $ `compression/lzma/LzmaEnc.c:885:9`!(&p->opt[posMem]) |
| 934 | p->optcxx . . $ _CLzmaEnc#opt.[posMem].posPrevcxx . . $ _COptimal#posPrev. = posMem - 1; |
| 935 | if (p->optcxx . . $ _CLzmaEnc#opt.[cur].prev2cxx . . $ _COptimal#prev2.) |
| 936 | { |
| 937 | p->optcxx . . $ _CLzmaEnc#opt.[posMem - 1].prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 938 | p->optcxx . . $ _CLzmaEnc#opt.[posMem - 1].posPrevcxx . . $ _COptimal#posPrev. = p->optcxx . . $ _CLzmaEnc#opt.[cur].posPrev2cxx . . $ _COptimal#posPrev2.; |
| 939 | p->optcxx . . $ _CLzmaEnc#opt.[posMem - 1].backPrevcxx . . $ _COptimal#backPrev. = p->optcxx . . $ _CLzmaEnc#opt.[cur].backPrev2cxx . . $ _COptimal#backPrev2.; |
| 940 | } |
| 941 | } |
| 942 | { |
| 943 | UInt32cxx . . $ UInt32# posPrev = posMem; |
| 944 | UInt32cxx . . $ UInt32# backCur = backMem; |
| 945 | |
| 946 | backMem = p->optcxx . . $ _CLzmaEnc#opt.[posPrev].backPrevcxx . . $ _COptimal#backPrev.; |
| 947 | posMem = p->optcxx . . $ _CLzmaEnc#opt.[posPrev].posPrevcxx . . $ _COptimal#posPrev.; |
| 948 | |
| 949 | p->optcxx . . $ _CLzmaEnc#opt.[posPrev].backPrevcxx . . $ _COptimal#backPrev. = backCur; |
| 950 | p->optcxx . . $ _CLzmaEnc#opt.[posPrev].posPrevcxx . . $ _COptimal#posPrev. = cur; |
| 951 | cur = posPrev; |
| 952 | } |
| 953 | } |
| 954 | while (cur != 0); |
| 955 | *backRes = p->optcxx . . $ _CLzmaEnc#opt.[0].backPrevcxx . . $ _COptimal#backPrev.; |
| 956 | p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex. = p->optcxx . . $ _CLzmaEnc#opt.[0].posPrevcxx . . $ _COptimal#posPrev.; |
| 957 | return p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex.; |
| 958 | } |
| 959 | |
| 960 | #define LIT_PROBScxx . . $ `compression/lzma/LzmaEnc.c:960:9`!(pos, prevByte) (p->litProbs + ((((pos) & p->lpMask) << p->lc) + (UInt32) ((prevByte) >> (8 - p->lc))) * 0x300) /*MAB cast UInt32 */ |
| 961 | |
| 962 | static UInt32cxx . . $ UInt32# GetOptimumcxx . . $ GetOptimum(3b4a516735ed5bee).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# position, UInt32cxx . . $ UInt32# *backRes) |
| 963 | { |
| 964 | UInt32cxx . . $ UInt32# numAvail, mainLen, repMaxIndex, i, lenEnd, len, cur; |
| 965 | /*MAB: Changed numPairs_, posState_ avoid hiding a variable later */ |
| 966 | UInt32cxx . . $ UInt32# numPairs_, posState_; |
| 967 | /*MAB: Changed matchPrice_, repMatchPrice_ avoid hiding a variable later */ |
| 968 | UInt32cxx . . $ UInt32# matchPrice_, repMatchPrice_, |
| 969 | normalMatchPrice; |
| 970 | UInt32cxx . . $ UInt32# reps[LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!], repLens[LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!]; |
| 971 | UInt32cxx . . $ UInt32# *matches; |
| 972 | /*MAB: Changed from data to avoid hiding a variable later */ |
| 973 | const Bytecxx . . $ Byte# *data_; |
| 974 | /*MAB: Changed from matchByte to avoid hiding a variable later */ |
| 975 | Bytecxx . . $ Byte# curByte_, matchByte_; |
| 976 | if (p->optimumEndIndexcxx . . $ _CLzmaEnc#optimumEndIndex. != p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex.) |
| 977 | { |
| 978 | const COptimalcxx . . $ COptimal# *opt = &p->optcxx . . $ _CLzmaEnc#opt.[p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex.]; |
| 979 | UInt32cxx . . $ UInt32# lenRes = opt->posPrevcxx . . $ _COptimal#posPrev. - p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex.; |
| 980 | *backRes = opt->backPrevcxx . . $ _COptimal#backPrev.; |
| 981 | p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex. = opt->posPrevcxx . . $ _COptimal#posPrev.; |
| 982 | return lenRes; |
| 983 | } |
| 984 | p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex. = p->optimumEndIndexcxx . . $ _CLzmaEnc#optimumEndIndex. = 0; |
| 985 | |
| 986 | if (p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset. == 0) |
| 987 | mainLen = ReadMatchDistancescxx . . $ ReadMatchDistances(a4099a4a91d7b59b).(p, &numPairs_); |
| 988 | else |
| 989 | { |
| 990 | mainLen = p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength.; |
| 991 | numPairs_ = p->numPairscxx . . $ _CLzmaEnc#numPairs.; |
| 992 | } |
| 993 | |
| 994 | numAvail = p->numAvailcxx . . $ _CLzmaEnc#numAvail.; |
| 995 | if (numAvail < 2) |
| 996 | { |
| 997 | *backRes = (UInt32cxx . . $ UInt32#)(-1); |
| 998 | return 1; |
| 999 | } |
| 1000 | if (numAvail > LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!) |
| 1001 | numAvail = LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!; |
| 1002 | |
| 1003 | data_ = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetPointerToCurrentPoscxx . . $ _IMatchFinder#GetPointerToCurrentPos.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) - 1; |
| 1004 | repMaxIndex = 0; |
| 1005 | for (i = 0; i < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i++) |
| 1006 | { |
| 1007 | UInt32cxx . . $ UInt32# lenTest; |
| 1008 | const Bytecxx . . $ Byte# *data2; |
| 1009 | reps[i] = p->repscxx . . $ _CLzmaEnc#reps.[i]; |
| 1010 | data2 = data_ - (reps[i] + 1); |
| 1011 | if (data_[0] != data2[0] || data_[1] != data2[1]) |
| 1012 | { |
| 1013 | repLens[i] = 0; |
| 1014 | continue; |
| 1015 | } |
| 1016 | for (lenTest = 2; lenTest < numAvail && data_[lenTest] == data2[lenTest]; lenTest++); |
| 1017 | repLens[i] = lenTest; |
| 1018 | if (lenTest > repLens[repMaxIndex]) |
| 1019 | repMaxIndex = i; |
| 1020 | } |
| 1021 | if (repLens[repMaxIndex] >= p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.) |
| 1022 | { |
| 1023 | UInt32cxx . . $ UInt32# lenRes; |
| 1024 | *backRes = repMaxIndex; |
| 1025 | lenRes = repLens[repMaxIndex]; |
| 1026 | MovePoscxx . . $ MovePos(f2b1754a7ad3e15d).(p, lenRes - 1); |
| 1027 | return lenRes; |
| 1028 | } |
| 1029 | |
| 1030 | matches = p->matchescxx . . $ _CLzmaEnc#matches.; |
| 1031 | if (mainLen >= p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.) |
| 1032 | { |
| 1033 | *backRes = matches[numPairs_ - 1] + LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; |
| 1034 | MovePoscxx . . $ MovePos(f2b1754a7ad3e15d).(p, mainLen - 1); |
| 1035 | return mainLen; |
| 1036 | } |
| 1037 | curByte_ = *data_; |
| 1038 | matchByte_ = *(data_ - (reps[0] + 1)); |
| 1039 | |
| 1040 | if (mainLen < 2 && curByte_ != matchByte_ && repLens[repMaxIndex] < 2) |
| 1041 | { |
| 1042 | *backRes = (UInt32cxx . . $ UInt32#)-1; |
| 1043 | return 1; |
| 1044 | } |
| 1045 | |
| 1046 | p->optcxx . . $ _CLzmaEnc#opt.[0].statecxx . . $ _COptimal#state. = (CStatecxx . . $ CState#)p->statecxx . . $ _CLzmaEnc#state.; |
| 1047 | |
| 1048 | posState_ = (position & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.); |
| 1049 | |
| 1050 | { |
| 1051 | const CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs = LIT_PROBScxx . . $ `compression/lzma/LzmaEnc.c:960:9`!(position, *(data_ - 1)); |
| 1052 | p->optcxx . . $ _CLzmaEnc#opt.[1].pricecxx . . $ _COptimal#price. = GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isMatch[p->state][posState_]) + |
| 1053 | (!IsCharStatecxx . . $ `compression/lzma/LzmaEnc.c:482:9`!(p->state) ? |
| 1054 | LitEnc_GetPriceMatchedcxx . . $ LitEnc_GetPriceMatched(e455c4847037b245).(probs, curByte_, matchByte_, p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.) : |
| 1055 | LitEnc_GetPricecxx . . $ LitEnc_GetPrice(87c8c2a7b36bc868).(probs, curByte_, p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.)); |
| 1056 | } |
| 1057 | |
| 1058 | MakeAsCharcxx . . $ `compression/lzma/LzmaEnc.c:885:9`!(&p->opt[1]); |
| 1059 | |
| 1060 | matchPrice_ = GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isMatch[p->state][posState_]); |
| 1061 | repMatchPrice_ = matchPrice_ + GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRep[p->state]); |
| 1062 | |
| 1063 | if (matchByte_ == curByte_) |
| 1064 | { |
| 1065 | UInt32cxx . . $ UInt32# shortRepPrice = repMatchPrice_ + GetRepLen1Pricecxx . . $ GetRepLen1Price(7cf65a242ae0f065).(p, p->statecxx . . $ _CLzmaEnc#state., posState_); |
| 1066 | if (shortRepPrice < p->optcxx . . $ _CLzmaEnc#opt.[1].pricecxx . . $ _COptimal#price.) |
| 1067 | { |
| 1068 | p->optcxx . . $ _CLzmaEnc#opt.[1].pricecxx . . $ _COptimal#price. = shortRepPrice; |
| 1069 | MakeAsShortRepcxx . . $ `compression/lzma/LzmaEnc.c:886:9`!(&p->opt[1]); |
| 1070 | } |
| 1071 | } |
| 1072 | lenEnd = ((mainLen >= repLens[repMaxIndex]) ? mainLen : repLens[repMaxIndex]); |
| 1073 | |
| 1074 | if (lenEnd < 2) |
| 1075 | { |
| 1076 | *backRes = p->optcxx . . $ _CLzmaEnc#opt.[1].backPrevcxx . . $ _COptimal#backPrev.; |
| 1077 | return 1; |
| 1078 | } |
| 1079 | |
| 1080 | p->optcxx . . $ _CLzmaEnc#opt.[1].posPrevcxx . . $ _COptimal#posPrev. = 0; |
| 1081 | for (i = 0; i < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i++) |
| 1082 | p->optcxx . . $ _CLzmaEnc#opt.[0].backscxx . . $ _COptimal#backs.[i] = reps[i]; |
| 1083 | |
| 1084 | len = lenEnd; |
| 1085 | do |
| 1086 | p->optcxx . . $ _CLzmaEnc#opt.[len--].pricecxx . . $ _COptimal#price. = kInfinityPricecxx . . $ `compression/lzma/LzmaEnc.c:486:9`!; |
| 1087 | while (len >= 2); |
| 1088 | |
| 1089 | for (i = 0; i < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i++) |
| 1090 | { |
| 1091 | UInt32cxx . . $ UInt32# repLen = repLens[i]; |
| 1092 | UInt32cxx . . $ UInt32# price; |
| 1093 | if (repLen < 2) |
| 1094 | continue; |
| 1095 | price = repMatchPrice_ + GetPureRepPricecxx . . $ GetPureRepPrice(162e27b8e1941687).(p, i, p->statecxx . . $ _CLzmaEnc#state., posState_); |
| 1096 | do |
| 1097 | { |
| 1098 | UInt32cxx . . $ UInt32# curAndLenPrice = price + p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc..pricescxx . . $ CLenPriceEnc#prices.[posState_][repLen - 2]; |
| 1099 | COptimalcxx . . $ COptimal# *opt = &p->optcxx . . $ _CLzmaEnc#opt.[repLen]; |
| 1100 | if (curAndLenPrice < opt->pricecxx . . $ _COptimal#price.) |
| 1101 | { |
| 1102 | opt->pricecxx . . $ _COptimal#price. = curAndLenPrice; |
| 1103 | opt->posPrevcxx . . $ _COptimal#posPrev. = 0; |
| 1104 | opt->backPrevcxx . . $ _COptimal#backPrev. = i; |
| 1105 | opt->prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 1106 | } |
| 1107 | } |
| 1108 | while (--repLen >= 2); |
| 1109 | } |
| 1110 | |
| 1111 | normalMatchPrice = matchPrice_ + GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isRep[p->state]); |
| 1112 | |
| 1113 | len = ((repLens[0] >= 2) ? repLens[0] + 1 : 2); |
| 1114 | if (len <= mainLen) |
| 1115 | { |
| 1116 | UInt32cxx . . $ UInt32# offs = 0; |
| 1117 | while (len > matches[offs]) |
| 1118 | offs += 2; |
| 1119 | for (; ; len++) |
| 1120 | { |
| 1121 | COptimalcxx . . $ COptimal# *opt; |
| 1122 | UInt32cxx . . $ UInt32# distance = matches[offs + 1]; |
| 1123 | |
| 1124 | UInt32cxx . . $ UInt32# curAndLenPrice = normalMatchPrice + p->lenEnccxx . . $ _CLzmaEnc#lenEnc..pricescxx . . $ CLenPriceEnc#prices.[posState_][len - LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!]; |
| 1125 | UInt32cxx . . $ UInt32# lenToPosState = GetLenToPosStatecxx . . $ `compression/lzma/LzmaEnc.c:484:9`!(len); |
| 1126 | if (distance < kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!) |
| 1127 | curAndLenPrice += p->distancesPricescxx . . $ _CLzmaEnc#distancesPrices.[lenToPosState][distance]; |
| 1128 | else |
| 1129 | { |
| 1130 | UInt32cxx . . $ UInt32# slot; |
| 1131 | GetPosSlot2cxx . . $ `compression/lzma/LzmaEnc.c:137:9`!(distance, slot); |
| 1132 | curAndLenPrice += p->alignPricescxx . . $ _CLzmaEnc#alignPrices.[distance & kAlignMaskcxx . . $ `compression/lzma/LzmaEnc.c:174:9`!] + p->posSlotPricescxx . . $ _CLzmaEnc#posSlotPrices.[lenToPosState][slot]; |
| 1133 | } |
| 1134 | opt = &p->optcxx . . $ _CLzmaEnc#opt.[len]; |
| 1135 | if (curAndLenPrice < opt->pricecxx . . $ _COptimal#price.) |
| 1136 | { |
| 1137 | opt->pricecxx . . $ _COptimal#price. = curAndLenPrice; |
| 1138 | opt->posPrevcxx . . $ _COptimal#posPrev. = 0; |
| 1139 | opt->backPrevcxx . . $ _COptimal#backPrev. = distance + LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; |
| 1140 | opt->prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 1141 | } |
| 1142 | if (len == matches[offs]) |
| 1143 | { |
| 1144 | offs += 2; |
| 1145 | if (offs == numPairs_) |
| 1146 | break; |
| 1147 | } |
| 1148 | } |
| 1149 | } |
| 1150 | |
| 1151 | cur = 0; |
| 1152 | |
| 1153 | #ifdef SHOW_STAT2 |
| 1154 | if (position >= 0) |
| 1155 | { |
| 1156 | unsigned i__; |
| 1157 | printf("\n pos = %4X", position); |
| 1158 | for (i__ = cur; i__ <= lenEnd; i__++) |
| 1159 | printf("\nprice[%4X] = %d", position - cur + i__, p->opt[i__].price); |
| 1160 | } |
| 1161 | #endif |
| 1162 | |
| 1163 | for (;;) |
| 1164 | { |
| 1165 | UInt32cxx . . $ UInt32# numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; |
| 1166 | UInt32cxx . . $ UInt32# curPrice, curAnd1Price, matchPrice, repMatchPrice; |
| 1167 | Boolcxx . . $ Bool# nextIsChar; |
| 1168 | Bytecxx . . $ Byte# curByte, matchByte; |
| 1169 | const Bytecxx . . $ Byte# *data; |
| 1170 | COptimalcxx . . $ COptimal# *curOpt; |
| 1171 | COptimalcxx . . $ COptimal# *nextOpt; |
| 1172 | |
| 1173 | cur++; |
| 1174 | if (cur == lenEnd) |
| 1175 | return Backwardcxx . . $ Backward(10df9d42b5608658).(p, backRes, cur); |
| 1176 | |
| 1177 | newLen = ReadMatchDistancescxx . . $ ReadMatchDistances(a4099a4a91d7b59b).(p, &numPairs); |
| 1178 | if (newLen >= p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.) |
| 1179 | { |
| 1180 | p->numPairscxx . . $ _CLzmaEnc#numPairs. = numPairs; |
| 1181 | p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength. = newLen; |
| 1182 | return Backwardcxx . . $ Backward(10df9d42b5608658).(p, backRes, cur); |
| 1183 | } |
| 1184 | position++; |
| 1185 | curOpt = &p->optcxx . . $ _CLzmaEnc#opt.[cur]; |
| 1186 | posPrev = curOpt->posPrevcxx . . $ _COptimal#posPrev.; |
| 1187 | if (curOpt->prev1IsCharcxx . . $ _COptimal#prev1IsChar.) |
| 1188 | { |
| 1189 | posPrev--; |
| 1190 | if (curOpt->prev2cxx . . $ _COptimal#prev2.) |
| 1191 | { |
| 1192 | state = p->optcxx . . $ _CLzmaEnc#opt.[curOpt->posPrev2cxx . . $ _COptimal#posPrev2.].statecxx . . $ _COptimal#state.; |
| 1193 | if (curOpt->backPrev2cxx . . $ _COptimal#backPrev2. < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!) |
| 1194 | state = (UInt32cxx . . $ UInt32#) kRepNextStatescxx . . $ kRepNextStates.[state]; /*MAB casts */ |
| 1195 | else |
| 1196 | state = (UInt32cxx . . $ UInt32#) kMatchNextStatescxx . . $ kMatchNextStates.[state]; /*MAB casts */ |
| 1197 | } |
| 1198 | else |
| 1199 | state = p->optcxx . . $ _CLzmaEnc#opt.[posPrev].statecxx . . $ _COptimal#state.; |
| 1200 | state = (UInt32cxx . . $ UInt32#) kLiteralNextStatescxx . . $ kLiteralNextStates.[state]; /*MAB casts */ |
| 1201 | } |
| 1202 | else |
| 1203 | state = p->optcxx . . $ _CLzmaEnc#opt.[posPrev].statecxx . . $ _COptimal#state.; |
| 1204 | if (posPrev == cur - 1) |
| 1205 | { |
| 1206 | if (IsShortRepcxx . . $ `compression/lzma/LzmaEnc.c:887:9`!(curOpt)) |
| 1207 | state = (UInt32cxx . . $ UInt32#) kShortRepNextStatescxx . . $ kShortRepNextStates.[state]; /*MAB casts */ |
| 1208 | else |
| 1209 | state = (UInt32cxx . . $ UInt32#) kLiteralNextStatescxx . . $ kLiteralNextStates.[state]; /*MAB casts */ |
| 1210 | } |
| 1211 | else |
| 1212 | { |
| 1213 | UInt32cxx . . $ UInt32# pos; |
| 1214 | const COptimalcxx . . $ COptimal# *prevOpt; |
| 1215 | if (curOpt->prev1IsCharcxx . . $ _COptimal#prev1IsChar. && curOpt->prev2cxx . . $ _COptimal#prev2.) |
| 1216 | { |
| 1217 | posPrev = curOpt->posPrev2cxx . . $ _COptimal#posPrev2.; |
| 1218 | pos = curOpt->backPrev2cxx . . $ _COptimal#backPrev2.; |
| 1219 | state = (UInt32cxx . . $ UInt32#) kRepNextStatescxx . . $ kRepNextStates.[state]; /*MAB casts */ |
| 1220 | } |
| 1221 | else |
| 1222 | { |
| 1223 | pos = curOpt->backPrevcxx . . $ _COptimal#backPrev.; |
| 1224 | if (pos < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!) |
| 1225 | state = (UInt32cxx . . $ UInt32#) kRepNextStatescxx . . $ kRepNextStates.[state]; /*MAB casts */ |
| 1226 | else |
| 1227 | state = (UInt32cxx . . $ UInt32#) kMatchNextStatescxx . . $ kMatchNextStates.[state]; /*MAB casts */ |
| 1228 | } |
| 1229 | prevOpt = &p->optcxx . . $ _CLzmaEnc#opt.[posPrev]; |
| 1230 | if (pos < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!) |
| 1231 | { |
| 1232 | /*MAB: i changed to i__ to avoid hiding a variable */ |
| 1233 | UInt32cxx . . $ UInt32# i__; |
| 1234 | reps[0] = prevOpt->backscxx . . $ _COptimal#backs.[pos]; |
| 1235 | for (i__ = 1; i__ <= pos; i__++) |
| 1236 | reps[i__] = prevOpt->backscxx . . $ _COptimal#backs.[i__ - 1]; |
| 1237 | for (; i__ < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i__++) |
| 1238 | reps[i__] = prevOpt->backscxx . . $ _COptimal#backs.[i__]; |
| 1239 | } |
| 1240 | else |
| 1241 | { |
| 1242 | /*MAB: i changed to i__ to avoid hiding a variable */ |
| 1243 | UInt32cxx . . $ UInt32# i__; |
| 1244 | reps[0] = (pos - LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!); |
| 1245 | for (i__ = 1; i__ < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i__++) |
| 1246 | reps[i__] = prevOpt->backscxx . . $ _COptimal#backs.[i__ - 1]; |
| 1247 | } |
| 1248 | } |
| 1249 | curOpt->statecxx . . $ _COptimal#state. = (CStatecxx . . $ CState#)state; |
| 1250 | |
| 1251 | curOpt->backscxx . . $ _COptimal#backs.[0] = reps[0]; |
| 1252 | curOpt->backscxx . . $ _COptimal#backs.[1] = reps[1]; |
| 1253 | curOpt->backscxx . . $ _COptimal#backs.[2] = reps[2]; |
| 1254 | curOpt->backscxx . . $ _COptimal#backs.[3] = reps[3]; |
| 1255 | |
| 1256 | curPrice = curOpt->pricecxx . . $ _COptimal#price.; |
| 1257 | nextIsChar = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 1258 | data = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetPointerToCurrentPoscxx . . $ _IMatchFinder#GetPointerToCurrentPos.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) - 1; |
| 1259 | curByte = *data; |
| 1260 | matchByte = *(data - (reps[0] + 1)); |
| 1261 | |
| 1262 | posState = (position & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.); |
| 1263 | |
| 1264 | curAnd1Price = curPrice + GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isMatch[state][posState]); |
| 1265 | { |
| 1266 | const CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs = LIT_PROBScxx . . $ `compression/lzma/LzmaEnc.c:960:9`!(position, *(data - 1)); |
| 1267 | curAnd1Price += |
| 1268 | (!IsCharStatecxx . . $ `compression/lzma/LzmaEnc.c:482:9`!(state) ? |
| 1269 | LitEnc_GetPriceMatchedcxx . . $ LitEnc_GetPriceMatched(e455c4847037b245).(probs, curByte, matchByte, p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.) : |
| 1270 | LitEnc_GetPricecxx . . $ LitEnc_GetPrice(87c8c2a7b36bc868).(probs, curByte, p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.)); |
| 1271 | } |
| 1272 | |
| 1273 | nextOpt = &p->optcxx . . $ _CLzmaEnc#opt.[cur + 1]; |
| 1274 | |
| 1275 | if (curAnd1Price < nextOpt->pricecxx . . $ _COptimal#price.) |
| 1276 | { |
| 1277 | nextOpt->pricecxx . . $ _COptimal#price. = curAnd1Price; |
| 1278 | nextOpt->posPrevcxx . . $ _COptimal#posPrev. = cur; |
| 1279 | MakeAsCharcxx . . $ `compression/lzma/LzmaEnc.c:885:9`!(nextOpt); |
| 1280 | nextIsChar = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1281 | } |
| 1282 | |
| 1283 | matchPrice = curPrice + GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isMatch[state][posState]); |
| 1284 | repMatchPrice = matchPrice + GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRep[state]); |
| 1285 | |
| 1286 | if (matchByte == curByte && !(nextOpt->posPrevcxx . . $ _COptimal#posPrev. < cur && nextOpt->backPrevcxx . . $ _COptimal#backPrev. == 0)) |
| 1287 | { |
| 1288 | UInt32cxx . . $ UInt32# shortRepPrice = repMatchPrice + GetRepLen1Pricecxx . . $ GetRepLen1Price(7cf65a242ae0f065).(p, state, posState); |
| 1289 | if (shortRepPrice <= nextOpt->pricecxx . . $ _COptimal#price.) |
| 1290 | { |
| 1291 | nextOpt->pricecxx . . $ _COptimal#price. = shortRepPrice; |
| 1292 | nextOpt->posPrevcxx . . $ _COptimal#posPrev. = cur; |
| 1293 | MakeAsShortRepcxx . . $ `compression/lzma/LzmaEnc.c:886:9`!(nextOpt); |
| 1294 | nextIsChar = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1295 | } |
| 1296 | } |
| 1297 | numAvailFull = p->numAvailcxx . . $ _CLzmaEnc#numAvail.; |
| 1298 | { |
| 1299 | UInt32cxx . . $ UInt32# temp = kNumOptscxx . . $ `compression/lzma/LzmaEnc.c:163:9`! - 1 - cur; |
| 1300 | if (temp < numAvailFull) |
| 1301 | numAvailFull = temp; |
| 1302 | } |
| 1303 | |
| 1304 | if (numAvailFull < 2) |
| 1305 | continue; |
| 1306 | numAvail = (numAvailFull <= p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes. ? numAvailFull : p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.); |
| 1307 | |
| 1308 | if (!nextIsChar && matchByte != curByte) /* speed optimization */ |
| 1309 | { |
| 1310 | /* try Literal + rep0 */ |
| 1311 | UInt32cxx . . $ UInt32# temp; |
| 1312 | UInt32cxx . . $ UInt32# lenTest2; |
| 1313 | const Bytecxx . . $ Byte# *data2 = data - (reps[0] + 1); |
| 1314 | UInt32cxx . . $ UInt32# limit = p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes. + 1; |
| 1315 | if (limit > numAvailFull) |
| 1316 | limit = numAvailFull; |
| 1317 | |
| 1318 | for (temp = 1; temp < limit && data[temp] == data2[temp]; temp++); |
| 1319 | lenTest2 = temp - 1; |
| 1320 | if (lenTest2 >= 2) |
| 1321 | { |
| 1322 | UInt32cxx . . $ UInt32# state2 = (UInt32cxx . . $ UInt32#) kLiteralNextStatescxx . . $ kLiteralNextStates.[state]; /*MAB casts */ |
| 1323 | UInt32cxx . . $ UInt32# posStateNext = (position + 1) & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.; |
| 1324 | UInt32cxx . . $ UInt32# nextRepMatchPrice = curAnd1Price + |
| 1325 | GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isMatch[state2][posStateNext]) + |
| 1326 | GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRep[state2]); |
| 1327 | /* for (; lenTest2 >= 2; lenTest2--) */ |
| 1328 | { |
| 1329 | UInt32cxx . . $ UInt32# curAndLenPrice; |
| 1330 | COptimalcxx . . $ COptimal# *opt; |
| 1331 | UInt32cxx . . $ UInt32# offset = cur + 1 + lenTest2; |
| 1332 | while (lenEnd < offset) |
| 1333 | p->optcxx . . $ _CLzmaEnc#opt.[++lenEnd].pricecxx . . $ _COptimal#price. = kInfinityPricecxx . . $ `compression/lzma/LzmaEnc.c:486:9`!; |
| 1334 | curAndLenPrice = nextRepMatchPrice + GetRepPricecxx . . $ GetRepPrice(4dbe00a9b9c89324).(p, 0, lenTest2, state2, posStateNext); |
| 1335 | opt = &p->optcxx . . $ _CLzmaEnc#opt.[offset]; |
| 1336 | if (curAndLenPrice < opt->pricecxx . . $ _COptimal#price.) |
| 1337 | { |
| 1338 | opt->pricecxx . . $ _COptimal#price. = curAndLenPrice; |
| 1339 | opt->posPrevcxx . . $ _COptimal#posPrev. = cur + 1; |
| 1340 | opt->backPrevcxx . . $ _COptimal#backPrev. = 0; |
| 1341 | opt->prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1342 | opt->prev2cxx . . $ _COptimal#prev2. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 1343 | } |
| 1344 | } |
| 1345 | } |
| 1346 | } |
| 1347 | |
| 1348 | startLen = 2; /* speed optimization */ |
| 1349 | { |
| 1350 | UInt32cxx . . $ UInt32# repIndex; |
| 1351 | for (repIndex = 0; repIndex < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; repIndex++) |
| 1352 | { |
| 1353 | UInt32cxx . . $ UInt32# lenTest; |
| 1354 | UInt32cxx . . $ UInt32# lenTestTemp; |
| 1355 | UInt32cxx . . $ UInt32# price; |
| 1356 | const Bytecxx . . $ Byte# *data2 = data - (reps[repIndex] + 1); |
| 1357 | if (data[0] != data2[0] || data[1] != data2[1]) |
| 1358 | continue; |
| 1359 | for (lenTest = 2; lenTest < numAvail && data[lenTest] == data2[lenTest]; lenTest++); |
| 1360 | while (lenEnd < cur + lenTest) |
| 1361 | p->optcxx . . $ _CLzmaEnc#opt.[++lenEnd].pricecxx . . $ _COptimal#price. = kInfinityPricecxx . . $ `compression/lzma/LzmaEnc.c:486:9`!; |
| 1362 | lenTestTemp = lenTest; |
| 1363 | price = repMatchPrice + GetPureRepPricecxx . . $ GetPureRepPrice(162e27b8e1941687).(p, repIndex, state, posState); |
| 1364 | do |
| 1365 | { |
| 1366 | UInt32cxx . . $ UInt32# curAndLenPrice = price + p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc..pricescxx . . $ CLenPriceEnc#prices.[posState][lenTest - 2]; |
| 1367 | COptimalcxx . . $ COptimal# *opt = &p->optcxx . . $ _CLzmaEnc#opt.[cur + lenTest]; |
| 1368 | if (curAndLenPrice < opt->pricecxx . . $ _COptimal#price.) |
| 1369 | { |
| 1370 | opt->pricecxx . . $ _COptimal#price. = curAndLenPrice; |
| 1371 | opt->posPrevcxx . . $ _COptimal#posPrev. = cur; |
| 1372 | opt->backPrevcxx . . $ _COptimal#backPrev. = repIndex; |
| 1373 | opt->prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 1374 | } |
| 1375 | } |
| 1376 | while (--lenTest >= 2); |
| 1377 | lenTest = lenTestTemp; |
| 1378 | |
| 1379 | if (repIndex == 0) |
| 1380 | startLen = lenTest + 1; |
| 1381 | |
| 1382 | /* if (_maxMode) */ |
| 1383 | { |
| 1384 | UInt32cxx . . $ UInt32# lenTest2 = lenTest + 1; |
| 1385 | UInt32cxx . . $ UInt32# limit = lenTest2 + p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.; |
| 1386 | UInt32cxx . . $ UInt32# nextRepMatchPrice; |
| 1387 | if (limit > numAvailFull) |
| 1388 | limit = numAvailFull; |
| 1389 | for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); |
| 1390 | lenTest2 -= lenTest + 1; |
| 1391 | if (lenTest2 >= 2) |
| 1392 | { |
| 1393 | UInt32cxx . . $ UInt32# state2 = (UInt32cxx . . $ UInt32#) kRepNextStatescxx . . $ kRepNextStates.[state]; /*MAB casts */ |
| 1394 | UInt32cxx . . $ UInt32# posStateNext = (position + lenTest) & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.; |
| 1395 | UInt32cxx . . $ UInt32# curAndLenCharPrice = |
| 1396 | price + p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc..pricescxx . . $ CLenPriceEnc#prices.[posState][lenTest - 2] + |
| 1397 | GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isMatch[state2][posStateNext]) + |
| 1398 | LitEnc_GetPriceMatchedcxx . . $ LitEnc_GetPriceMatched(e455c4847037b245).(LIT_PROBScxx . . $ `compression/lzma/LzmaEnc.c:960:9`!(position + lenTest, data[lenTest - 1]), |
| 1399 | data[lenTest], data2[lenTest], p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1400 | state2 = (UInt32cxx . . $ UInt32#) kLiteralNextStatescxx . . $ kLiteralNextStates.[state2]; /*MAB casts */ |
| 1401 | posStateNext = (position + lenTest + 1) & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.; |
| 1402 | nextRepMatchPrice = curAndLenCharPrice + |
| 1403 | GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isMatch[state2][posStateNext]) + |
| 1404 | GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRep[state2]); |
| 1405 | |
| 1406 | /* for (; lenTest2 >= 2; lenTest2--) */ |
| 1407 | { |
| 1408 | UInt32cxx . . $ UInt32# curAndLenPrice; |
| 1409 | COptimalcxx . . $ COptimal# *opt; |
| 1410 | UInt32cxx . . $ UInt32# offset = cur + lenTest + 1 + lenTest2; |
| 1411 | while (lenEnd < offset) |
| 1412 | p->optcxx . . $ _CLzmaEnc#opt.[++lenEnd].pricecxx . . $ _COptimal#price. = kInfinityPricecxx . . $ `compression/lzma/LzmaEnc.c:486:9`!; |
| 1413 | curAndLenPrice = nextRepMatchPrice + GetRepPricecxx . . $ GetRepPrice(4dbe00a9b9c89324).(p, 0, lenTest2, state2, posStateNext); |
| 1414 | opt = &p->optcxx . . $ _CLzmaEnc#opt.[offset]; |
| 1415 | if (curAndLenPrice < opt->pricecxx . . $ _COptimal#price.) |
| 1416 | { |
| 1417 | opt->pricecxx . . $ _COptimal#price. = curAndLenPrice; |
| 1418 | opt->posPrevcxx . . $ _COptimal#posPrev. = cur + lenTest + 1; |
| 1419 | opt->backPrevcxx . . $ _COptimal#backPrev. = 0; |
| 1420 | opt->prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1421 | opt->prev2cxx . . $ _COptimal#prev2. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1422 | opt->posPrev2cxx . . $ _COptimal#posPrev2. = cur; |
| 1423 | opt->backPrev2cxx . . $ _COptimal#backPrev2. = repIndex; |
| 1424 | } |
| 1425 | } |
| 1426 | } |
| 1427 | } |
| 1428 | } |
| 1429 | } |
| 1430 | /* for (UInt32 lenTest = 2; lenTest <= newLen; lenTest++) */ |
| 1431 | if (newLen > numAvail) |
| 1432 | { |
| 1433 | newLen = numAvail; |
| 1434 | for (numPairs = 0; newLen > matches[numPairs]; numPairs += 2); |
| 1435 | matches[numPairs] = newLen; |
| 1436 | numPairs += 2; |
| 1437 | } |
| 1438 | if (newLen >= startLen) |
| 1439 | { |
| 1440 | /*MAB: normalMatchPrice changed to normalMatchPrice__ not to hide a variable later */ |
| 1441 | UInt32cxx . . $ UInt32# normalMatchPrice__ = matchPrice + GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isRep[state]); |
| 1442 | UInt32cxx . . $ UInt32# offs, curBack, posSlot; |
| 1443 | UInt32cxx . . $ UInt32# lenTest; |
| 1444 | while (lenEnd < cur + newLen) |
| 1445 | p->optcxx . . $ _CLzmaEnc#opt.[++lenEnd].pricecxx . . $ _COptimal#price. = kInfinityPricecxx . . $ `compression/lzma/LzmaEnc.c:486:9`!; |
| 1446 | |
| 1447 | offs = 0; |
| 1448 | while (startLen > matches[offs]) |
| 1449 | offs += 2; |
| 1450 | curBack = matches[offs + 1]; |
| 1451 | GetPosSlot2cxx . . $ `compression/lzma/LzmaEnc.c:137:9`!(curBack, posSlot); |
| 1452 | for (lenTest = /*2*/ startLen; ; lenTest++) |
| 1453 | { |
| 1454 | /*MAB: curAndLenPrice changed to curAndLenPrice__ not to hide a variable later */ |
| 1455 | UInt32cxx . . $ UInt32# curAndLenPrice__ = normalMatchPrice__ + p->lenEnccxx . . $ _CLzmaEnc#lenEnc..pricescxx . . $ CLenPriceEnc#prices.[posState][lenTest - LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!]; |
| 1456 | UInt32cxx . . $ UInt32# lenToPosState = GetLenToPosStatecxx . . $ `compression/lzma/LzmaEnc.c:484:9`!(lenTest); |
| 1457 | /*MAB: opt changed to opt__ not to hide a variable later */ |
| 1458 | COptimalcxx . . $ COptimal# *opt__; |
| 1459 | if (curBack < kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!) |
| 1460 | curAndLenPrice__ += p->distancesPricescxx . . $ _CLzmaEnc#distancesPrices.[lenToPosState][curBack]; |
| 1461 | else |
| 1462 | curAndLenPrice__ += p->posSlotPricescxx . . $ _CLzmaEnc#posSlotPrices.[lenToPosState][posSlot] + p->alignPricescxx . . $ _CLzmaEnc#alignPrices.[curBack & kAlignMaskcxx . . $ `compression/lzma/LzmaEnc.c:174:9`!]; |
| 1463 | |
| 1464 | opt__ = &p->optcxx . . $ _CLzmaEnc#opt.[cur + lenTest]; |
| 1465 | if (curAndLenPrice__ < opt__->pricecxx . . $ _COptimal#price.) |
| 1466 | { |
| 1467 | opt__->pricecxx . . $ _COptimal#price. = curAndLenPrice__; |
| 1468 | opt__->posPrevcxx . . $ _COptimal#posPrev. = cur; |
| 1469 | opt__->backPrevcxx . . $ _COptimal#backPrev. = curBack + LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; |
| 1470 | opt__->prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 1471 | } |
| 1472 | |
| 1473 | if (/*_maxMode && */lenTest == matches[offs]) |
| 1474 | { |
| 1475 | /* Try Match + Literal + Rep0 */ |
| 1476 | const Bytecxx . . $ Byte# *data2 = data - (curBack + 1); |
| 1477 | UInt32cxx . . $ UInt32# lenTest2 = lenTest + 1; |
| 1478 | UInt32cxx . . $ UInt32# limit = lenTest2 + p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.; |
| 1479 | UInt32cxx . . $ UInt32# nextRepMatchPrice; |
| 1480 | if (limit > numAvailFull) |
| 1481 | limit = numAvailFull; |
| 1482 | for (; lenTest2 < limit && data[lenTest2] == data2[lenTest2]; lenTest2++); |
| 1483 | lenTest2 -= lenTest + 1; |
| 1484 | if (lenTest2 >= 2) |
| 1485 | { |
| 1486 | UInt32cxx . . $ UInt32# state2 = (UInt32cxx . . $ UInt32#) kMatchNextStatescxx . . $ kMatchNextStates.[state]; /*MAB casts */ |
| 1487 | UInt32cxx . . $ UInt32# posStateNext = (position + lenTest) & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.; |
| 1488 | UInt32cxx . . $ UInt32# curAndLenCharPrice = curAndLenPrice__ + |
| 1489 | GET_PRICE_0cxx . . $ `compression/lzma/LzmaEnc.c:663:9`!(p->isMatch[state2][posStateNext]) + |
| 1490 | LitEnc_GetPriceMatchedcxx . . $ LitEnc_GetPriceMatched(e455c4847037b245).(LIT_PROBScxx . . $ `compression/lzma/LzmaEnc.c:960:9`!(position + lenTest, data[lenTest - 1]), |
| 1491 | data[lenTest], data2[lenTest], p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1492 | state2 = (UInt32cxx . . $ UInt32#) kLiteralNextStatescxx . . $ kLiteralNextStates.[state2]; /*MAB casts */ |
| 1493 | posStateNext = (posStateNext + 1) & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.; |
| 1494 | nextRepMatchPrice = curAndLenCharPrice + |
| 1495 | GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isMatch[state2][posStateNext]) + |
| 1496 | GET_PRICE_1cxx . . $ `compression/lzma/LzmaEnc.c:664:9`!(p->isRep[state2]); |
| 1497 | |
| 1498 | /* for (; lenTest2 >= 2; lenTest2--) */ |
| 1499 | { |
| 1500 | UInt32cxx . . $ UInt32# offset = cur + lenTest + 1 + lenTest2; |
| 1501 | UInt32cxx . . $ UInt32# curAndLenPrice; |
| 1502 | COptimalcxx . . $ COptimal# *opt; |
| 1503 | while (lenEnd < offset) |
| 1504 | p->optcxx . . $ _CLzmaEnc#opt.[++lenEnd].pricecxx . . $ _COptimal#price. = kInfinityPricecxx . . $ `compression/lzma/LzmaEnc.c:486:9`!; |
| 1505 | curAndLenPrice = nextRepMatchPrice + GetRepPricecxx . . $ GetRepPrice(4dbe00a9b9c89324).(p, 0, lenTest2, state2, posStateNext); |
| 1506 | opt = &p->optcxx . . $ _CLzmaEnc#opt.[offset]; |
| 1507 | if (curAndLenPrice < opt->pricecxx . . $ _COptimal#price.) |
| 1508 | { |
| 1509 | opt->pricecxx . . $ _COptimal#price. = curAndLenPrice; |
| 1510 | opt->posPrevcxx . . $ _COptimal#posPrev. = cur + lenTest + 1; |
| 1511 | opt->backPrevcxx . . $ _COptimal#backPrev. = 0; |
| 1512 | opt->prev1IsCharcxx . . $ _COptimal#prev1IsChar. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1513 | opt->prev2cxx . . $ _COptimal#prev2. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1514 | opt->posPrev2cxx . . $ _COptimal#posPrev2. = cur; |
| 1515 | opt->backPrev2cxx . . $ _COptimal#backPrev2. = curBack + LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; |
| 1516 | } |
| 1517 | } |
| 1518 | } |
| 1519 | offs += 2; |
| 1520 | if (offs == numPairs) |
| 1521 | break; |
| 1522 | curBack = matches[offs + 1]; |
| 1523 | if (curBack >= kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!) |
| 1524 | GetPosSlot2cxx . . $ `compression/lzma/LzmaEnc.c:137:9`!(curBack, posSlot); |
| 1525 | } |
| 1526 | } |
| 1527 | } |
| 1528 | } |
| 1529 | } |
| 1530 | |
| 1531 | #define ChangePaircxx . . $ `compression/lzma/LzmaEnc.c:1531:9`!(smallDist, bigDist) (((bigDist) >> 7) > (smallDist)) |
| 1532 | |
| 1533 | static UInt32cxx . . $ UInt32# GetOptimumFastcxx . . $ GetOptimumFast(a4099a4a91d7b59b).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# *backRes) |
| 1534 | { |
| 1535 | UInt32cxx . . $ UInt32# numAvail, mainLen, mainDist, numPairs, repIndex, repLen, i; |
| 1536 | const Bytecxx . . $ Byte# *data; |
| 1537 | const UInt32cxx . . $ UInt32# *matches; |
| 1538 | |
| 1539 | if (p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset. == 0) |
| 1540 | mainLen = ReadMatchDistancescxx . . $ ReadMatchDistances(a4099a4a91d7b59b).(p, &numPairs); |
| 1541 | else |
| 1542 | { |
| 1543 | mainLen = p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength.; |
| 1544 | numPairs = p->numPairscxx . . $ _CLzmaEnc#numPairs.; |
| 1545 | } |
| 1546 | |
| 1547 | numAvail = p->numAvailcxx . . $ _CLzmaEnc#numAvail.; |
| 1548 | *backRes = (UInt32cxx . . $ UInt32#)-1; |
| 1549 | if (numAvail < 2) |
| 1550 | return 1; |
| 1551 | if (numAvail > LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!) |
| 1552 | numAvail = LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!; |
| 1553 | data = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetPointerToCurrentPoscxx . . $ _IMatchFinder#GetPointerToCurrentPos.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) - 1; |
| 1554 | |
| 1555 | repLen = repIndex = 0; |
| 1556 | for (i = 0; i < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i++) |
| 1557 | { |
| 1558 | UInt32cxx . . $ UInt32# len; |
| 1559 | const Bytecxx . . $ Byte# *data2 = data - (p->repscxx . . $ _CLzmaEnc#reps.[i] + 1); |
| 1560 | if (data[0] != data2[0] || data[1] != data2[1]) |
| 1561 | continue; |
| 1562 | for (len = 2; len < numAvail && data[len] == data2[len]; len++); |
| 1563 | if (len >= p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.) |
| 1564 | { |
| 1565 | *backRes = i; |
| 1566 | MovePoscxx . . $ MovePos(f2b1754a7ad3e15d).(p, len - 1); |
| 1567 | return len; |
| 1568 | } |
| 1569 | if (len > repLen) |
| 1570 | { |
| 1571 | repIndex = i; |
| 1572 | repLen = len; |
| 1573 | } |
| 1574 | } |
| 1575 | |
| 1576 | matches = p->matchescxx . . $ _CLzmaEnc#matches.; |
| 1577 | if (mainLen >= p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes.) |
| 1578 | { |
| 1579 | *backRes = matches[numPairs - 1] + LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; |
| 1580 | MovePoscxx . . $ MovePos(f2b1754a7ad3e15d).(p, mainLen - 1); |
| 1581 | return mainLen; |
| 1582 | } |
| 1583 | |
| 1584 | mainDist = 0; /* for GCC */ |
| 1585 | if (mainLen >= 2) |
| 1586 | { |
| 1587 | mainDist = matches[numPairs - 1]; |
| 1588 | while (numPairs > 2 && mainLen == matches[numPairs - 4] + 1) |
| 1589 | { |
| 1590 | if (!ChangePaircxx . . $ `compression/lzma/LzmaEnc.c:1531:9`!(matches[numPairs - 3], mainDist)) |
| 1591 | break; |
| 1592 | numPairs -= 2; |
| 1593 | mainLen = matches[numPairs - 2]; |
| 1594 | mainDist = matches[numPairs - 1]; |
| 1595 | } |
| 1596 | if (mainLen == 2 && mainDist >= 0x80) |
| 1597 | mainLen = 1; |
| 1598 | } |
| 1599 | |
| 1600 | if (repLen >= 2 && ( |
| 1601 | (repLen + 1 >= mainLen) || |
| 1602 | (repLen + 2 >= mainLen && mainDist >= (1 << 9)) || |
| 1603 | (repLen + 3 >= mainLen && mainDist >= (1 << 15)))) |
| 1604 | { |
| 1605 | *backRes = repIndex; |
| 1606 | MovePoscxx . . $ MovePos(f2b1754a7ad3e15d).(p, repLen - 1); |
| 1607 | return repLen; |
| 1608 | } |
| 1609 | |
| 1610 | if (mainLen < 2 || numAvail <= 2) |
| 1611 | return 1; |
| 1612 | |
| 1613 | p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength. = ReadMatchDistancescxx . . $ ReadMatchDistances(a4099a4a91d7b59b).(p, &p->numPairscxx . . $ _CLzmaEnc#numPairs.); |
| 1614 | if (p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength. >= 2) |
| 1615 | { |
| 1616 | UInt32cxx . . $ UInt32# newDistance = matches[p->numPairscxx . . $ _CLzmaEnc#numPairs. - 1]; |
| 1617 | if ((p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength. >= mainLen && newDistance < mainDist) || |
| 1618 | (p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength. == mainLen + 1 && !ChangePaircxx . . $ `compression/lzma/LzmaEnc.c:1531:9`!(mainDist, newDistance)) || |
| 1619 | (p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength. > mainLen + 1) || |
| 1620 | (p->longestMatchLengthcxx . . $ _CLzmaEnc#longestMatchLength. + 1 >= mainLen && mainLen >= 3 && ChangePaircxx . . $ `compression/lzma/LzmaEnc.c:1531:9`!(newDistance, mainDist))) |
| 1621 | return 1; |
| 1622 | } |
| 1623 | |
| 1624 | data = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetPointerToCurrentPoscxx . . $ _IMatchFinder#GetPointerToCurrentPos.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) - 1; |
| 1625 | for (i = 0; i < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i++) |
| 1626 | { |
| 1627 | UInt32cxx . . $ UInt32# len, limit; |
| 1628 | const Bytecxx . . $ Byte# *data2 = data - (p->repscxx . . $ _CLzmaEnc#reps.[i] + 1); |
| 1629 | if (data[0] != data2[0] || data[1] != data2[1]) |
| 1630 | continue; |
| 1631 | limit = mainLen - 1; |
| 1632 | for (len = 2; len < limit && data[len] == data2[len]; len++); |
| 1633 | if (len >= limit) |
| 1634 | return 1; |
| 1635 | } |
| 1636 | *backRes = mainDist + LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; |
| 1637 | MovePoscxx . . $ MovePos(f2b1754a7ad3e15d).(p, mainLen - 2); |
| 1638 | return mainLen; |
| 1639 | } |
| 1640 | |
| 1641 | static void WriteEndMarkercxx . . $ WriteEndMarker(f2b1754a7ad3e15d).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# posState) |
| 1642 | { |
| 1643 | UInt32cxx . . $ UInt32# len; |
| 1644 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isMatchcxx . . $ _CLzmaEnc#isMatch.[p->statecxx . . $ _CLzmaEnc#state.][posState], 1); |
| 1645 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepcxx . . $ _CLzmaEnc#isRep.[p->statecxx . . $ _CLzmaEnc#state.], 0); |
| 1646 | p->statecxx . . $ _CLzmaEnc#state. = (UInt32cxx . . $ UInt32#) kMatchNextStatescxx . . $ kMatchNextStates.[p->statecxx . . $ _CLzmaEnc#state.]; /*MAB casts */ |
| 1647 | len = LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!; |
| 1648 | LenEnc_Encode2cxx . . $ LenEnc_Encode2(b90f9a3d4ca2a8ad).(&p->lenEnccxx . . $ _CLzmaEnc#lenEnc., &p->rccxx . . $ _CLzmaEnc#rc., len - LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!, posState, !p->fastModecxx . . $ _CLzmaEnc#fastMode., p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1649 | RcTree_Encodecxx . . $ RcTree_Encode(5f22b0202e1ec115).(&p->rccxx . . $ _CLzmaEnc#rc., p->posSlotEncodercxx . . $ _CLzmaEnc#posSlotEncoder.[GetLenToPosStatecxx . . $ `compression/lzma/LzmaEnc.c:484:9`!(len)], kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`!, (1 << kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`!) - 1); |
| 1650 | RangeEnc_EncodeDirectBitscxx . . $ RangeEnc_EncodeDirectBits(676cf8ae91c30878).(&p->rccxx . . $ _CLzmaEnc#rc., (((UInt32cxx . . $ UInt32#)1 << 30) - 1) >> kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!, 30 - kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!); |
| 1651 | RcTree_ReverseEncodecxx . . $ RcTree_ReverseEncode(5f22b0202e1ec115).(&p->rccxx . . $ _CLzmaEnc#rc., p->posAlignEncodercxx . . $ _CLzmaEnc#posAlignEncoder., kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!, kAlignMaskcxx . . $ `compression/lzma/LzmaEnc.c:174:9`!); |
| 1652 | } |
| 1653 | |
| 1654 | static SRescxx . . $ SRes# CheckErrorscxx . . $ CheckErrors(ea2adb1c0e751503).(CLzmaEnccxx . . $ CLzmaEnc# *p) |
| 1655 | { |
| 1656 | if (p->resultcxx . . $ _CLzmaEnc#result. != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 1657 | return p->resultcxx . . $ _CLzmaEnc#result.; |
| 1658 | if (p->rccxx . . $ _CLzmaEnc#rc..rescxx . . $ _CRangeEnc#res. != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 1659 | p->resultcxx . . $ _CLzmaEnc#result. = SZ_ERROR_WRITEcxx . . $ `compression/lzma/Types.h:23:9`!; |
| 1660 | if (p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase..resultcxx . . $ _CMatchFinder#result. != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 1661 | p->resultcxx . . $ _CLzmaEnc#result. = SZ_ERROR_READcxx . . $ `compression/lzma/Types.h:22:9`!; |
| 1662 | if (p->resultcxx . . $ _CLzmaEnc#result. != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 1663 | p->finishedcxx . . $ _CLzmaEnc#finished. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1664 | return p->resultcxx . . $ _CLzmaEnc#result.; |
| 1665 | } |
| 1666 | |
| 1667 | static SRescxx . . $ SRes# Flushcxx . . $ Flush(d9d0588d6bbe9725).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# nowPos) |
| 1668 | { |
| 1669 | /* ReleaseMFStream(); */ |
| 1670 | p->finishedcxx . . $ _CLzmaEnc#finished. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 1671 | if (p->writeEndMarkcxx . . $ _CLzmaEnc#writeEndMark.) |
| 1672 | WriteEndMarkercxx . . $ WriteEndMarker(f2b1754a7ad3e15d).(p, nowPos & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.); |
| 1673 | RangeEnc_FlushDatacxx . . $ RangeEnc_FlushData(d97b4104f7cae7a0).(&p->rccxx . . $ _CLzmaEnc#rc.); |
| 1674 | RangeEnc_FlushStreamcxx . . $ RangeEnc_FlushStream(d97b4104f7cae7a0).(&p->rccxx . . $ _CLzmaEnc#rc.); |
| 1675 | return CheckErrorscxx . . $ CheckErrors(ea2adb1c0e751503).(p); |
| 1676 | } |
| 1677 | |
| 1678 | static void FillAlignPricescxx . . $ FillAlignPrices(771aca6ad7359413).(CLzmaEnccxx . . $ CLzmaEnc# *p) |
| 1679 | { |
| 1680 | UInt32cxx . . $ UInt32# i; |
| 1681 | for (i = 0; i < kAlignTableSizecxx . . $ `compression/lzma/LzmaEnc.c:173:9`!; i++) |
| 1682 | p->alignPricescxx . . $ _CLzmaEnc#alignPrices.[i] = RcTree_ReverseGetPricecxx . . $ RcTree_ReverseGetPrice(b6dfaeb572b0790a).(p->posAlignEncodercxx . . $ _CLzmaEnc#posAlignEncoder., kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!, i, p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1683 | p->alignPriceCountcxx . . $ _CLzmaEnc#alignPriceCount. = 0; |
| 1684 | } |
| 1685 | |
| 1686 | static void FillDistancesPricescxx . . $ FillDistancesPrices(771aca6ad7359413).(CLzmaEnccxx . . $ CLzmaEnc# *p) |
| 1687 | { |
| 1688 | UInt32cxx . . $ UInt32# tempPrices[kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!]; |
| 1689 | /*MAB: i changed to j to avoid warnings later of hiding i */ |
| 1690 | UInt32cxx . . $ UInt32# j, lenToPosState; |
| 1691 | for (j = kStartPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:176:9`!; j < kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!; j++) |
| 1692 | { |
| 1693 | UInt32cxx . . $ UInt32# posSlot = GetPosSlot1cxx . . $ `compression/lzma/LzmaEnc.c:136:9`!(j); |
| 1694 | UInt32cxx . . $ UInt32# footerBits = ((posSlot >> 1) - 1); |
| 1695 | UInt32cxx . . $ UInt32# base = ((2 | (posSlot & 1)) << footerBits); |
| 1696 | tempPrices[j] = RcTree_ReverseGetPricecxx . . $ RcTree_ReverseGetPrice(b6dfaeb572b0790a).(p->posEncoderscxx . . $ _CLzmaEnc#posEncoders. + base - posSlot - 1, (int)footerBits, j - base, p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); /*MAB casts */ |
| 1697 | } |
| 1698 | |
| 1699 | for (lenToPosState = 0; lenToPosState < kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`!; lenToPosState++) |
| 1700 | { |
| 1701 | UInt32cxx . . $ UInt32# posSlot; |
| 1702 | const CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *encoder = p->posSlotEncodercxx . . $ _CLzmaEnc#posSlotEncoder.[lenToPosState]; |
| 1703 | UInt32cxx . . $ UInt32# *posSlotPrices = p->posSlotPricescxx . . $ _CLzmaEnc#posSlotPrices.[lenToPosState]; |
| 1704 | for (posSlot = 0; posSlot < p->distTableSizecxx . . $ _CLzmaEnc#distTableSize.; posSlot++) |
| 1705 | posSlotPrices[posSlot] = RcTree_GetPricecxx . . $ RcTree_GetPrice(b6dfaeb572b0790a).(encoder, kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`!, posSlot, p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1706 | for (posSlot = kEndPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:177:9`!; posSlot < p->distTableSizecxx . . $ _CLzmaEnc#distTableSize.; posSlot++) |
| 1707 | posSlotPrices[posSlot] += ((((posSlot >> 1) - 1) - kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!) << kNumBitPriceShiftBitscxx . . $ `compression/lzma/LzmaEnc.c:42:9`!); |
| 1708 | |
| 1709 | { |
| 1710 | UInt32cxx . . $ UInt32# *distancesPrices = p->distancesPricescxx . . $ _CLzmaEnc#distancesPrices.[lenToPosState]; |
| 1711 | /*MAB: i changed to i__ to avoid hiding a variable */ |
| 1712 | UInt32cxx . . $ UInt32# i__; |
| 1713 | for (i__ = 0; i__ < kStartPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:176:9`!; i__++) |
| 1714 | distancesPrices[i__] = posSlotPrices[i__]; |
| 1715 | for (; i__ < kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`!; i__++) |
| 1716 | distancesPrices[i__] = posSlotPrices[GetPosSlot1cxx . . $ `compression/lzma/LzmaEnc.c:136:9`!(i__)] + tempPrices[i__]; |
| 1717 | } |
| 1718 | } |
| 1719 | p->matchPriceCountcxx . . $ _CLzmaEnc#matchPriceCount. = 0; |
| 1720 | } |
| 1721 | |
| 1722 | /*MAB: static added */ |
| 1723 | static void LzmaEnc_Constructcxx . . $ LzmaEnc_Construct(771aca6ad7359413).(CLzmaEnccxx . . $ CLzmaEnc# *p) |
| 1724 | { |
| 1725 | RangeEnc_Constructcxx . . $ RangeEnc_Construct(d97b4104f7cae7a0).(&p->rccxx . . $ _CLzmaEnc#rc.); |
| 1726 | MatchFinder_Constructcxx . . $ MatchFinder_Construct(3e1b07d4842a3f23).(&p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase.); |
| 1727 | #ifdef COMPRESS_MF_MT |
| 1728 | MatchFinderMt_Construct(&p->matchFinderMt); |
| 1729 | p->matchFinderMt.MatchFinder = &p->matchFinderBase; |
| 1730 | #endif |
| 1731 | |
| 1732 | { |
| 1733 | CLzmaEncPropscxx . . $ CLzmaEncProps# props; |
| 1734 | LzmaEncProps_Initcxx . . $ LzmaEncProps_Init(8b45acebcbbd4466).(&props); |
| 1735 | LzmaEnc_SetPropscxx . . $ LzmaEnc_SetProps(56f3369ab02c17f).(p, &props); |
| 1736 | } |
| 1737 | |
| 1738 | #ifndef LZMA_LOG_BSR |
| 1739 | LzmaEnc_FastPosInitcxx . . $ LzmaEnc_FastPosInit(f25546b61a629de7).(p->g_FastPoscxx . . $ _CLzmaEnc#g_FastPos.); |
| 1740 | #endif |
| 1741 | |
| 1742 | LzmaEnc_InitPriceTablescxx . . $ LzmaEnc_InitPriceTables(218b13e5e7cbf689).(p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1743 | p->litProbscxx . . $ _CLzmaEnc#litProbs. = 0; |
| 1744 | p->saveStatecxx . . $ _CLzmaEnc#saveState..litProbscxx . . $ CSaveState#litProbs. = 0; |
| 1745 | } |
| 1746 | |
| 1747 | CLzmaEncHandlecxx . . $ CLzmaEncHandle# LzmaEnc_Createcxx . . $ LzmaEnc_Create(2b2f2d4c05393eec).(ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 1748 | { |
| 1749 | void *p; |
| 1750 | p = alloc->Alloccxx . . $ ISzAlloc#Alloc.(alloc, sizeof(CLzmaEnccxx . . $ CLzmaEnc#)); |
| 1751 | if (p != 0) |
| 1752 | LzmaEnc_Constructcxx . . $ LzmaEnc_Construct(771aca6ad7359413).((CLzmaEnccxx . . $ CLzmaEnc# *)p); |
| 1753 | return p; |
| 1754 | } |
| 1755 | |
| 1756 | /*MAB: static added */ |
| 1757 | static void LzmaEnc_FreeLitscxx . . $ LzmaEnc_FreeLits(eb61222c86f34e31).(CLzmaEnccxx . . $ CLzmaEnc# *p, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 1758 | { |
| 1759 | alloc->Freecxx . . $ ISzAlloc#Free.(alloc, p->litProbscxx . . $ _CLzmaEnc#litProbs.); |
| 1760 | alloc->Freecxx . . $ ISzAlloc#Free.(alloc, p->saveStatecxx . . $ _CLzmaEnc#saveState..litProbscxx . . $ CSaveState#litProbs.); |
| 1761 | p->litProbscxx . . $ _CLzmaEnc#litProbs. = 0; |
| 1762 | p->saveStatecxx . . $ _CLzmaEnc#saveState..litProbscxx . . $ CSaveState#litProbs. = 0; |
| 1763 | } |
| 1764 | |
| 1765 | /*MAB: static added */ |
| 1766 | static void LzmaEnc_Destructcxx . . $ LzmaEnc_Destruct(4c75249780cbd1b7).(CLzmaEnccxx . . $ CLzmaEnc# *p, ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 1767 | { |
| 1768 | #ifdef COMPRESS_MF_MT |
| 1769 | MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); |
| 1770 | #endif |
| 1771 | MatchFinder_Freecxx . . $ MatchFinder_Free(e0c953fe8ccde46b).(&p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase., allocBig); |
| 1772 | LzmaEnc_FreeLitscxx . . $ LzmaEnc_FreeLits(eb61222c86f34e31).(p, alloc); |
| 1773 | RangeEnc_Freecxx . . $ RangeEnc_Free(b02bb5f954b00114).(&p->rccxx . . $ _CLzmaEnc#rc., alloc); |
| 1774 | } |
| 1775 | |
| 1776 | void LzmaEnc_Destroycxx . . $ LzmaEnc_Destroy(651218bf81b64962).(CLzmaEncHandlecxx . . $ CLzmaEncHandle# p, ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 1777 | { |
| 1778 | LzmaEnc_Destructcxx . . $ LzmaEnc_Destruct(4c75249780cbd1b7).((CLzmaEnccxx . . $ CLzmaEnc# *)p, alloc, allocBig); |
| 1779 | alloc->Freecxx . . $ ISzAlloc#Free.(alloc, p); |
| 1780 | } |
| 1781 | |
| 1782 | static SRescxx . . $ SRes# LzmaEnc_CodeOneBlockcxx . . $ LzmaEnc_CodeOneBlock(5785bd0f89aeacee).(CLzmaEnccxx . . $ CLzmaEnc# *p, Boolcxx . . $ Bool# useLimits, UInt32cxx . . $ UInt32# maxPackSize, UInt32cxx . . $ UInt32# maxUnpackSize) |
| 1783 | { |
| 1784 | UInt32cxx . . $ UInt32# nowPos32, startPos32; |
| 1785 | if (p->inStreamcxx . . $ _CLzmaEnc#inStream. != 0) |
| 1786 | { |
| 1787 | p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase..streamcxx . . $ _CMatchFinder#stream. = p->inStreamcxx . . $ _CLzmaEnc#inStream.; |
| 1788 | p->matchFindercxx . . $ _CLzmaEnc#matchFinder..Initcxx . . $ _IMatchFinder#Init.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.); |
| 1789 | p->inStreamcxx . . $ _CLzmaEnc#inStream. = 0; |
| 1790 | } |
| 1791 | |
| 1792 | if (p->finishedcxx . . $ _CLzmaEnc#finished.) |
| 1793 | return p->resultcxx . . $ _CLzmaEnc#result.; |
| 1794 | RINOKcxx . . $ `compression/lzma/Types.h:40:9`!(CheckErrors(p)); |
| 1795 | |
| 1796 | nowPos32 = (UInt32cxx . . $ UInt32#)p->nowPos64cxx . . $ _CLzmaEnc#nowPos64.; |
| 1797 | startPos32 = nowPos32; |
| 1798 | |
| 1799 | if (p->nowPos64cxx . . $ _CLzmaEnc#nowPos64. == 0) |
| 1800 | { |
| 1801 | UInt32cxx . . $ UInt32# numPairs; |
| 1802 | Bytecxx . . $ Byte# curByte; |
| 1803 | if (p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetNumAvailableBytescxx . . $ _IMatchFinder#GetNumAvailableBytes.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) == 0) |
| 1804 | return Flushcxx . . $ Flush(d9d0588d6bbe9725).(p, nowPos32); |
| 1805 | ReadMatchDistancescxx . . $ ReadMatchDistances(a4099a4a91d7b59b).(p, &numPairs); |
| 1806 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isMatchcxx . . $ _CLzmaEnc#isMatch.[p->statecxx . . $ _CLzmaEnc#state.][0], 0); |
| 1807 | p->statecxx . . $ _CLzmaEnc#state. = (UInt32cxx . . $ UInt32#) kLiteralNextStatescxx . . $ kLiteralNextStates.[p->statecxx . . $ _CLzmaEnc#state.]; /*MAB casts */ |
| 1808 | curByte = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetIndexBytecxx . . $ _IMatchFinder#GetIndexByte.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj., (Int32cxx . . $ Int32#)(0 - p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset.)); /*MAB casts */ |
| 1809 | LitEnc_Encodecxx . . $ LitEnc_Encode(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., p->litProbscxx . . $ _CLzmaEnc#litProbs., curByte); |
| 1810 | p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset.--; |
| 1811 | nowPos32++; |
| 1812 | } |
| 1813 | |
| 1814 | if (p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetNumAvailableBytescxx . . $ _IMatchFinder#GetNumAvailableBytes.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) != 0) |
| 1815 | for (;;) |
| 1816 | { |
| 1817 | UInt32cxx . . $ UInt32# pos, len, posState; |
| 1818 | |
| 1819 | if (p->fastModecxx . . $ _CLzmaEnc#fastMode.) |
| 1820 | len = GetOptimumFastcxx . . $ GetOptimumFast(a4099a4a91d7b59b).(p, &pos); |
| 1821 | else |
| 1822 | len = GetOptimumcxx . . $ GetOptimum(3b4a516735ed5bee).(p, nowPos32, &pos); |
| 1823 | |
| 1824 | #ifdef SHOW_STAT2 |
| 1825 | printf("\n pos = %4X, len = %d pos = %d", nowPos32, len, pos); |
| 1826 | #endif |
| 1827 | |
| 1828 | posState = nowPos32 & p->pbMaskcxx . . $ _CLzmaEnc#pbMask.; |
| 1829 | if (len == 1 && pos == (UInt32cxx . . $ UInt32#)-1) |
| 1830 | { |
| 1831 | Bytecxx . . $ Byte# curByte; |
| 1832 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs; |
| 1833 | const Bytecxx . . $ Byte# *data; |
| 1834 | |
| 1835 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isMatchcxx . . $ _CLzmaEnc#isMatch.[p->statecxx . . $ _CLzmaEnc#state.][posState], 0); |
| 1836 | data = p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetPointerToCurrentPoscxx . . $ _IMatchFinder#GetPointerToCurrentPos.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) - p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset.; |
| 1837 | curByte = *data; |
| 1838 | probs = LIT_PROBScxx . . $ `compression/lzma/LzmaEnc.c:960:9`!(nowPos32, *(data - 1)); |
| 1839 | if (IsCharStatecxx . . $ `compression/lzma/LzmaEnc.c:482:9`!(p->state)) |
| 1840 | LitEnc_Encodecxx . . $ LitEnc_Encode(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., probs, curByte); |
| 1841 | else |
| 1842 | LitEnc_EncodeMatchedcxx . . $ LitEnc_EncodeMatched(d9d99b7691bbb741).(&p->rccxx . . $ _CLzmaEnc#rc., probs, curByte, *(data - p->repscxx . . $ _CLzmaEnc#reps.[0] - 1)); |
| 1843 | p->statecxx . . $ _CLzmaEnc#state. = (UInt32cxx . . $ UInt32#) kLiteralNextStatescxx . . $ kLiteralNextStates.[p->statecxx . . $ _CLzmaEnc#state.]; /*MAB casts */ |
| 1844 | } |
| 1845 | else |
| 1846 | { |
| 1847 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isMatchcxx . . $ _CLzmaEnc#isMatch.[p->statecxx . . $ _CLzmaEnc#state.][posState], 1); |
| 1848 | if (pos < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!) |
| 1849 | { |
| 1850 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepcxx . . $ _CLzmaEnc#isRep.[p->statecxx . . $ _CLzmaEnc#state.], 1); |
| 1851 | if (pos == 0) |
| 1852 | { |
| 1853 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepG0cxx . . $ _CLzmaEnc#isRepG0.[p->statecxx . . $ _CLzmaEnc#state.], 0); |
| 1854 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRep0Longcxx . . $ _CLzmaEnc#isRep0Long.[p->statecxx . . $ _CLzmaEnc#state.][posState], ((len == 1) ? 0 : 1)); |
| 1855 | } |
| 1856 | else |
| 1857 | { |
| 1858 | UInt32cxx . . $ UInt32# distance = p->repscxx . . $ _CLzmaEnc#reps.[pos]; |
| 1859 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepG0cxx . . $ _CLzmaEnc#isRepG0.[p->statecxx . . $ _CLzmaEnc#state.], 1); |
| 1860 | if (pos == 1) |
| 1861 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepG1cxx . . $ _CLzmaEnc#isRepG1.[p->statecxx . . $ _CLzmaEnc#state.], 0); |
| 1862 | else |
| 1863 | { |
| 1864 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepG1cxx . . $ _CLzmaEnc#isRepG1.[p->statecxx . . $ _CLzmaEnc#state.], 1); |
| 1865 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepG2cxx . . $ _CLzmaEnc#isRepG2.[p->statecxx . . $ _CLzmaEnc#state.], pos - 2); |
| 1866 | if (pos == 3) |
| 1867 | p->repscxx . . $ _CLzmaEnc#reps.[3] = p->repscxx . . $ _CLzmaEnc#reps.[2]; |
| 1868 | p->repscxx . . $ _CLzmaEnc#reps.[2] = p->repscxx . . $ _CLzmaEnc#reps.[1]; |
| 1869 | } |
| 1870 | p->repscxx . . $ _CLzmaEnc#reps.[1] = p->repscxx . . $ _CLzmaEnc#reps.[0]; |
| 1871 | p->repscxx . . $ _CLzmaEnc#reps.[0] = distance; |
| 1872 | } |
| 1873 | if (len == 1) |
| 1874 | p->statecxx . . $ _CLzmaEnc#state. = (UInt32cxx . . $ UInt32#) kShortRepNextStatescxx . . $ kShortRepNextStates.[p->statecxx . . $ _CLzmaEnc#state.]; /*MAB casts */ |
| 1875 | else |
| 1876 | { |
| 1877 | LenEnc_Encode2cxx . . $ LenEnc_Encode2(b90f9a3d4ca2a8ad).(&p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc., &p->rccxx . . $ _CLzmaEnc#rc., len - LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!, posState, !p->fastModecxx . . $ _CLzmaEnc#fastMode., p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1878 | p->statecxx . . $ _CLzmaEnc#state. = (UInt32cxx . . $ UInt32#) kRepNextStatescxx . . $ kRepNextStates.[p->statecxx . . $ _CLzmaEnc#state.]; /*MAB casts */ |
| 1879 | } |
| 1880 | } |
| 1881 | else |
| 1882 | { |
| 1883 | UInt32cxx . . $ UInt32# posSlot; |
| 1884 | RangeEnc_EncodeBitcxx . . $ RangeEnc_EncodeBit(3aa722912e2e9d51).(&p->rccxx . . $ _CLzmaEnc#rc., &p->isRepcxx . . $ _CLzmaEnc#isRep.[p->statecxx . . $ _CLzmaEnc#state.], 0); |
| 1885 | p->statecxx . . $ _CLzmaEnc#state. = (UInt32cxx . . $ UInt32#) kMatchNextStatescxx . . $ kMatchNextStates.[p->statecxx . . $ _CLzmaEnc#state.]; /*MAB casts */ |
| 1886 | LenEnc_Encode2cxx . . $ LenEnc_Encode2(b90f9a3d4ca2a8ad).(&p->lenEnccxx . . $ _CLzmaEnc#lenEnc., &p->rccxx . . $ _CLzmaEnc#rc., len - LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!, posState, !p->fastModecxx . . $ _CLzmaEnc#fastMode., p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); |
| 1887 | pos -= LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; |
| 1888 | GetPosSlotcxx . . $ `compression/lzma/LzmaEnc.c:138:9`!(pos, posSlot); |
| 1889 | RcTree_Encodecxx . . $ RcTree_Encode(5f22b0202e1ec115).(&p->rccxx . . $ _CLzmaEnc#rc., p->posSlotEncodercxx . . $ _CLzmaEnc#posSlotEncoder.[GetLenToPosStatecxx . . $ `compression/lzma/LzmaEnc.c:484:9`!(len)], kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`!, posSlot); |
| 1890 | |
| 1891 | if (posSlot >= kStartPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:176:9`!) |
| 1892 | { |
| 1893 | UInt32cxx . . $ UInt32# footerBits = ((posSlot >> 1) - 1); |
| 1894 | UInt32cxx . . $ UInt32# base = ((2 | (posSlot & 1)) << footerBits); |
| 1895 | UInt32cxx . . $ UInt32# posReduced = pos - base; |
| 1896 | |
| 1897 | if (posSlot < kEndPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:177:9`!) |
| 1898 | RcTree_ReverseEncodecxx . . $ RcTree_ReverseEncode(5f22b0202e1ec115).(&p->rccxx . . $ _CLzmaEnc#rc., p->posEncoderscxx . . $ _CLzmaEnc#posEncoders. + base - posSlot - 1, (int)footerBits, posReduced); /*MAB casts */ |
| 1899 | else |
| 1900 | { |
| 1901 | RangeEnc_EncodeDirectBitscxx . . $ RangeEnc_EncodeDirectBits(676cf8ae91c30878).(&p->rccxx . . $ _CLzmaEnc#rc., posReduced >> kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!, (int)footerBits - kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!); /*MAB casts */ |
| 1902 | RcTree_ReverseEncodecxx . . $ RcTree_ReverseEncode(5f22b0202e1ec115).(&p->rccxx . . $ _CLzmaEnc#rc., p->posAlignEncodercxx . . $ _CLzmaEnc#posAlignEncoder., kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!, posReduced & kAlignMaskcxx . . $ `compression/lzma/LzmaEnc.c:174:9`!); |
| 1903 | p->alignPriceCountcxx . . $ _CLzmaEnc#alignPriceCount.++; |
| 1904 | } |
| 1905 | } |
| 1906 | p->repscxx . . $ _CLzmaEnc#reps.[3] = p->repscxx . . $ _CLzmaEnc#reps.[2]; |
| 1907 | p->repscxx . . $ _CLzmaEnc#reps.[2] = p->repscxx . . $ _CLzmaEnc#reps.[1]; |
| 1908 | p->repscxx . . $ _CLzmaEnc#reps.[1] = p->repscxx . . $ _CLzmaEnc#reps.[0]; |
| 1909 | p->repscxx . . $ _CLzmaEnc#reps.[0] = pos; |
| 1910 | p->matchPriceCountcxx . . $ _CLzmaEnc#matchPriceCount.++; |
| 1911 | } |
| 1912 | } |
| 1913 | p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset. -= len; |
| 1914 | nowPos32 += len; |
| 1915 | if (p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset. == 0) |
| 1916 | { |
| 1917 | UInt32cxx . . $ UInt32# processed; |
| 1918 | if (!p->fastModecxx . . $ _CLzmaEnc#fastMode.) |
| 1919 | { |
| 1920 | if (p->matchPriceCountcxx . . $ _CLzmaEnc#matchPriceCount. >= (1 << 7)) |
| 1921 | FillDistancesPricescxx . . $ FillDistancesPrices(771aca6ad7359413).(p); |
| 1922 | if (p->alignPriceCountcxx . . $ _CLzmaEnc#alignPriceCount. >= kAlignTableSizecxx . . $ `compression/lzma/LzmaEnc.c:173:9`!) |
| 1923 | FillAlignPricescxx . . $ FillAlignPrices(771aca6ad7359413).(p); |
| 1924 | } |
| 1925 | if (p->matchFindercxx . . $ _CLzmaEnc#matchFinder..GetNumAvailableBytescxx . . $ _IMatchFinder#GetNumAvailableBytes.(p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj.) == 0) |
| 1926 | break; |
| 1927 | processed = nowPos32 - startPos32; |
| 1928 | |
| 1929 | if (useLimits) |
| 1930 | { |
| 1931 | if (processed + kNumOptscxx . . $ `compression/lzma/LzmaEnc.c:163:9`! + 300 >= maxUnpackSize || |
| 1932 | RangeEnc_GetProcessedcxx . . $ `compression/lzma/LzmaEnc.c:494:9`!(&p->rc) + kNumOptscxx . . $ `compression/lzma/LzmaEnc.c:163:9`! * 2 >= maxPackSize) |
| 1933 | break; |
| 1934 | } |
| 1935 | else if (processed >= (1 << 15)) |
| 1936 | { |
| 1937 | p->nowPos64cxx . . $ _CLzmaEnc#nowPos64. += nowPos32 - startPos32; |
| 1938 | return CheckErrorscxx . . $ CheckErrors(ea2adb1c0e751503).(p); |
| 1939 | } |
| 1940 | } |
| 1941 | } |
| 1942 | p->nowPos64cxx . . $ _CLzmaEnc#nowPos64. += nowPos32 - startPos32; |
| 1943 | return Flushcxx . . $ Flush(d9d0588d6bbe9725).(p, nowPos32); |
| 1944 | } |
| 1945 | |
| 1946 | #define kBigHashDicLimitcxx . . $ `compression/lzma/LzmaEnc.c:1946:9`! ((UInt32)1 << 24) |
| 1947 | |
| 1948 | static SRescxx . . $ SRes# LzmaEnc_Alloccxx . . $ LzmaEnc_Alloc(90529b4a5bd83068).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# keepWindowSize, ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 1949 | { |
| 1950 | UInt32cxx . . $ UInt32# beforeSize = kNumOptscxx . . $ `compression/lzma/LzmaEnc.c:163:9`!; |
| 1951 | #ifdef COMPRESS_MF_MT |
| 1952 | Bool btMode; /*MAB: this line wrap inside the compilation ifdef, btMode not used without it */ |
| 1953 | #endif |
| 1954 | |
| 1955 | if (!RangeEnc_Alloccxx . . $ RangeEnc_Alloc(a619cf74c1da9906).(&p->rccxx . . $ _CLzmaEnc#rc., alloc)) |
| 1956 | return SZ_ERROR_MEMcxx . . $ `compression/lzma/Types.h:16:9`!; |
| 1957 | |
| 1958 | #ifdef COMPRESS_MF_MT |
| 1959 | btMode = (p->matchFinderBase.btMode != 0); /*MAB: this line moved inside the compilation ifdef, btMode not used without it */ |
| 1960 | |
| 1961 | p->mtMode = (p->multiThread && !p->fastMode && btMode); |
| 1962 | #endif |
| 1963 | |
| 1964 | { |
| 1965 | unsigned lclp = p->lccxx . . $ _CLzmaEnc#lc. + p->lpcxx . . $ _CLzmaEnc#lp.; |
| 1966 | if (p->litProbscxx . . $ _CLzmaEnc#litProbs. == 0 || p->saveStatecxx . . $ _CLzmaEnc#saveState..litProbscxx . . $ CSaveState#litProbs. == 0 || p->lclpcxx . . $ _CLzmaEnc#lclp. != lclp) |
| 1967 | { |
| 1968 | LzmaEnc_FreeLitscxx . . $ LzmaEnc_FreeLits(eb61222c86f34e31).(p, alloc); |
| 1969 | p->litProbscxx . . $ _CLzmaEnc#litProbs. = (CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *)alloc->Alloccxx . . $ ISzAlloc#Alloc.(alloc, (0x300u << lclp) * sizeof(CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`!)); /*MAB 0x300 vs 0x300u*/ |
| 1970 | p->saveStatecxx . . $ _CLzmaEnc#saveState..litProbscxx . . $ CSaveState#litProbs. = (CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *)alloc->Alloccxx . . $ ISzAlloc#Alloc.(alloc, (0x300u << lclp) * sizeof(CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`!)); /*MAB 0x300 vs 0x300u*/ |
| 1971 | if (p->litProbscxx . . $ _CLzmaEnc#litProbs. == 0 || p->saveStatecxx . . $ _CLzmaEnc#saveState..litProbscxx . . $ CSaveState#litProbs. == 0) |
| 1972 | { |
| 1973 | LzmaEnc_FreeLitscxx . . $ LzmaEnc_FreeLits(eb61222c86f34e31).(p, alloc); |
| 1974 | return SZ_ERROR_MEMcxx . . $ `compression/lzma/Types.h:16:9`!; |
| 1975 | } |
| 1976 | p->lclpcxx . . $ _CLzmaEnc#lclp. = lclp; |
| 1977 | } |
| 1978 | } |
| 1979 | |
| 1980 | p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase..bigHashcxx . . $ _CMatchFinder#bigHash. = (p->dictSizecxx . . $ _CLzmaEnc#dictSize. > kBigHashDicLimitcxx . . $ `compression/lzma/LzmaEnc.c:1946:9`!); |
| 1981 | |
| 1982 | if (beforeSize + p->dictSizecxx . . $ _CLzmaEnc#dictSize. < keepWindowSize) |
| 1983 | beforeSize = keepWindowSize - p->dictSizecxx . . $ _CLzmaEnc#dictSize.; |
| 1984 | |
| 1985 | #ifdef COMPRESS_MF_MT |
| 1986 | if (p->mtMode) |
| 1987 | { |
| 1988 | RINOK(MatchFinderMt_Create(&p->matchFinderMt, p->dictSize, beforeSize, p->numFastBytes, LZMA_MATCH_LEN_MAX, allocBig)); |
| 1989 | p->matchFinderObj = &p->matchFinderMt; |
| 1990 | MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); |
| 1991 | } |
| 1992 | else |
| 1993 | #endif |
| 1994 | { |
| 1995 | if (!MatchFinder_Createcxx . . $ MatchFinder_Create(64a49c537c4f0f0e).(&p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase., p->dictSizecxx . . $ _CLzmaEnc#dictSize., beforeSize, p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes., LZMA_MATCH_LEN_MAXcxx . . $ `compression/lzma/LzmaEnc.c:205:9`!, allocBig)) |
| 1996 | return SZ_ERROR_MEMcxx . . $ `compression/lzma/Types.h:16:9`!; |
| 1997 | p->matchFinderObjcxx . . $ _CLzmaEnc#matchFinderObj. = &p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase.; |
| 1998 | MatchFinder_CreateVTablecxx . . $ MatchFinder_CreateVTable(e9ccc59caa59e7a6).(&p->matchFinderBasecxx . . $ _CLzmaEnc#matchFinderBase., &p->matchFindercxx . . $ _CLzmaEnc#matchFinder.); |
| 1999 | } |
| 2000 | return SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 2001 | } |
| 2002 | |
| 2003 | /*MAB: static added */ |
| 2004 | static void LzmaEnc_Initcxx . . $ LzmaEnc_Init(771aca6ad7359413).(CLzmaEnccxx . . $ CLzmaEnc# *p) |
| 2005 | { |
| 2006 | UInt32cxx . . $ UInt32# i; |
| 2007 | p->statecxx . . $ _CLzmaEnc#state. = 0; |
| 2008 | for (i = 0 ; i < LZMA_NUM_REPScxx . . $ `compression/lzma/LzmaEnc.c:143:9`!; i++) |
| 2009 | p->repscxx . . $ _CLzmaEnc#reps.[i] = 0; |
| 2010 | |
| 2011 | RangeEnc_Initcxx . . $ RangeEnc_Init(d97b4104f7cae7a0).(&p->rccxx . . $ _CLzmaEnc#rc.); |
| 2012 | |
| 2013 | |
| 2014 | for (i = 0; i < kNumStatescxx . . $ `compression/lzma/LzmaEnc.c:207:9`!; i++) |
| 2015 | { |
| 2016 | UInt32cxx . . $ UInt32# j; |
| 2017 | for (j = 0; j < LZMA_NUM_PB_STATES_MAXcxx . . $ `compression/lzma/LzmaEnc.c:192:9`!; j++) |
| 2018 | { |
| 2019 | p->isMatchcxx . . $ _CLzmaEnc#isMatch.[i][j] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2020 | p->isRep0Longcxx . . $ _CLzmaEnc#isRep0Long.[i][j] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2021 | } |
| 2022 | p->isRepcxx . . $ _CLzmaEnc#isRep.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2023 | p->isRepG0cxx . . $ _CLzmaEnc#isRepG0.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2024 | p->isRepG1cxx . . $ _CLzmaEnc#isRepG1.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2025 | p->isRepG2cxx . . $ _CLzmaEnc#isRepG2.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2026 | } |
| 2027 | |
| 2028 | { |
| 2029 | UInt32cxx . . $ UInt32# num = (UInt32cxx . . $ UInt32#) (0x300 << (p->lpcxx . . $ _CLzmaEnc#lp. + p->lccxx . . $ _CLzmaEnc#lc.)); /*MAB casts */ |
| 2030 | for (i = 0; i < num; i++) |
| 2031 | p->litProbscxx . . $ _CLzmaEnc#litProbs.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2032 | } |
| 2033 | |
| 2034 | { |
| 2035 | for (i = 0; i < kNumLenToPosStatescxx . . $ `compression/lzma/LzmaEnc.c:165:9`!; i++) |
| 2036 | { |
| 2037 | CLzmaProbcxx . . $ `compression/lzma/LzmaEnc.c:185:9`! *probs = p->posSlotEncodercxx . . $ _CLzmaEnc#posSlotEncoder.[i]; |
| 2038 | UInt32cxx . . $ UInt32# j; |
| 2039 | for (j = 0; j < (1 << kNumPosSlotBitscxx . . $ `compression/lzma/LzmaEnc.c:166:9`!); j++) |
| 2040 | probs[j] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2041 | } |
| 2042 | } |
| 2043 | { |
| 2044 | for (i = 0; i < kNumFullDistancescxx . . $ `compression/lzma/LzmaEnc.c:180:9`! - kEndPosModelIndexcxx . . $ `compression/lzma/LzmaEnc.c:177:9`!; i++) |
| 2045 | p->posEncoderscxx . . $ _CLzmaEnc#posEncoders.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2046 | } |
| 2047 | |
| 2048 | LenEnc_Initcxx . . $ LenEnc_Init(d20878b51efee4f5).(&p->lenEnccxx . . $ _CLzmaEnc#lenEnc..pcxx . . $ CLenPriceEnc#p.); |
| 2049 | LenEnc_Initcxx . . $ LenEnc_Init(d20878b51efee4f5).(&p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc..pcxx . . $ CLenPriceEnc#p.); |
| 2050 | |
| 2051 | for (i = 0; i < (1 << kNumAlignBitscxx . . $ `compression/lzma/LzmaEnc.c:172:9`!); i++) |
| 2052 | p->posAlignEncodercxx . . $ _CLzmaEnc#posAlignEncoder.[i] = kProbInitValuecxx . . $ `compression/lzma/LzmaEnc.c:39:9`!; |
| 2053 | |
| 2054 | p->optimumEndIndexcxx . . $ _CLzmaEnc#optimumEndIndex. = 0; |
| 2055 | p->optimumCurrentIndexcxx . . $ _CLzmaEnc#optimumCurrentIndex. = 0; |
| 2056 | p->additionalOffsetcxx . . $ _CLzmaEnc#additionalOffset. = 0; |
| 2057 | |
| 2058 | p->pbMaskcxx . . $ _CLzmaEnc#pbMask. = (1u << p->pbcxx . . $ _CLzmaEnc#pb.) - 1u; /*MAB 1u */ |
| 2059 | p->lpMaskcxx . . $ _CLzmaEnc#lpMask. = (1u << p->lpcxx . . $ _CLzmaEnc#lp.) - 1u; /*MAB 1u */ |
| 2060 | } |
| 2061 | |
| 2062 | /*MAB: static added */ |
| 2063 | static void LzmaEnc_InitPricescxx . . $ LzmaEnc_InitPrices(771aca6ad7359413).(CLzmaEnccxx . . $ CLzmaEnc# *p) |
| 2064 | { |
| 2065 | if (!p->fastModecxx . . $ _CLzmaEnc#fastMode.) |
| 2066 | { |
| 2067 | FillDistancesPricescxx . . $ FillDistancesPrices(771aca6ad7359413).(p); |
| 2068 | FillAlignPricescxx . . $ FillAlignPrices(771aca6ad7359413).(p); |
| 2069 | } |
| 2070 | |
| 2071 | p->lenEnccxx . . $ _CLzmaEnc#lenEnc..tableSizecxx . . $ CLenPriceEnc#tableSize. = |
| 2072 | p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc..tableSizecxx . . $ CLenPriceEnc#tableSize. = |
| 2073 | p->numFastBytescxx . . $ _CLzmaEnc#numFastBytes. + 1 - LZMA_MATCH_LEN_MINcxx . . $ `compression/lzma/LzmaEnc.c:204:9`!; |
| 2074 | LenPriceEnc_UpdateTablescxx . . $ LenPriceEnc_UpdateTables(80a8df4121d30fc3).(&p->lenEnccxx . . $ _CLzmaEnc#lenEnc., 1u << p->pbcxx . . $ _CLzmaEnc#pb., p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); /*MAB 1u */ |
| 2075 | LenPriceEnc_UpdateTablescxx . . $ LenPriceEnc_UpdateTables(80a8df4121d30fc3).(&p->repLenEnccxx . . $ _CLzmaEnc#repLenEnc., 1u << p->pbcxx . . $ _CLzmaEnc#pb., p->ProbPricescxx . . $ _CLzmaEnc#ProbPrices.); /*MAB 1u */ |
| 2076 | } |
| 2077 | |
| 2078 | static SRescxx . . $ SRes# LzmaEnc_AllocAndInitcxx . . $ LzmaEnc_AllocAndInit(90529b4a5bd83068).(CLzmaEnccxx . . $ CLzmaEnc# *p, UInt32cxx . . $ UInt32# keepWindowSize, ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 2079 | { |
| 2080 | UInt32cxx . . $ UInt32# i; |
| 2081 | for (i = 0; i < (UInt32cxx . . $ UInt32#)kDicLogSizeMaxCompresscxx . . $ `compression/lzma/LzmaEnc.c:106:9`!; i++) |
| 2082 | if (p->dictSizecxx . . $ _CLzmaEnc#dictSize. <= ((UInt32cxx . . $ UInt32#)1 << i)) |
| 2083 | break; |
| 2084 | p->distTableSizecxx . . $ _CLzmaEnc#distTableSize. = i * 2; |
| 2085 | |
| 2086 | p->finishedcxx . . $ _CLzmaEnc#finished. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 2087 | p->resultcxx . . $ _CLzmaEnc#result. = SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 2088 | RINOKcxx . . $ `compression/lzma/Types.h:40:9`!(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); |
| 2089 | LzmaEnc_Initcxx . . $ LzmaEnc_Init(771aca6ad7359413).(p); |
| 2090 | LzmaEnc_InitPricescxx . . $ LzmaEnc_InitPrices(771aca6ad7359413).(p); |
| 2091 | p->nowPos64cxx . . $ _CLzmaEnc#nowPos64. = 0; |
| 2092 | return SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 2093 | } |
| 2094 | |
| 2095 | static SRescxx . . $ SRes# LzmaEnc_Preparecxx . . $ LzmaEnc_Prepare(5ef0968fab526a70).(CLzmaEncHandlecxx . . $ CLzmaEncHandle# pp, ISeqInStreamcxx . . $ ISeqInStream# *inStream, ISeqOutStreamcxx . . $ ISeqOutStream# *outStream, |
| 2096 | ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 2097 | { |
| 2098 | CLzmaEnccxx . . $ CLzmaEnc# *p = (CLzmaEnccxx . . $ CLzmaEnc# *)pp; |
| 2099 | p->inStreamcxx . . $ _CLzmaEnc#inStream. = inStream; |
| 2100 | p->rccxx . . $ _CLzmaEnc#rc..outStreamcxx . . $ _CRangeEnc#outStream. = outStream; |
| 2101 | return LzmaEnc_AllocAndInitcxx . . $ LzmaEnc_AllocAndInit(90529b4a5bd83068).(p, 0, alloc, allocBig); |
| 2102 | } |
| 2103 | |
| 2104 | #if defined(USE_UNUSED_CODE) |
| 2105 | /*MAB: static added */ |
| 2106 | static SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, |
| 2107 | ISeqInStream *inStream, UInt32 keepWindowSize, |
| 2108 | ISzAlloc *alloc, ISzAlloc *allocBig) |
| 2109 | { |
| 2110 | CLzmaEnc *p = (CLzmaEnc *)pp; |
| 2111 | p->inStream = inStream; |
| 2112 | return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); |
| 2113 | } |
| 2114 | #endif |
| 2115 | |
| 2116 | static void LzmaEnc_SetInputBufcxx . . $ LzmaEnc_SetInputBuf(bc87fe8bbc701e66).(CLzmaEnccxx . . $ CLzmaEnc# *p, const Bytecxx . . $ Byte# *src, SizeTcxx . . $ SizeT# srcLen) |
| 2117 | { |
| 2118 | p->seqBufInStreamcxx . . $ _CLzmaEnc#seqBufInStream..funcTablecxx . . $ _CSeqInStreamBuf#funcTable..Readcxx . . $ ISeqInStream#Read. = MyReadcxx . . $ MyRead(a015fd6b590df30c).; |
| 2119 | p->seqBufInStreamcxx . . $ _CLzmaEnc#seqBufInStream..datacxx . . $ _CSeqInStreamBuf#data. = src; |
| 2120 | p->seqBufInStreamcxx . . $ _CLzmaEnc#seqBufInStream..remcxx . . $ _CSeqInStreamBuf#rem. = srcLen; |
| 2121 | } |
| 2122 | |
| 2123 | #if defined(USE_UNUSED_CODE) |
| 2124 | /*MAB: static added */ |
| 2125 | static SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, |
| 2126 | UInt32 keepWindowSize, ISzAlloc *alloc, ISzAlloc *allocBig) |
| 2127 | { |
| 2128 | CLzmaEnc *p = (CLzmaEnc *)pp; |
| 2129 | LzmaEnc_SetInputBuf(p, src, srcLen); |
| 2130 | p->inStream = &p->seqBufInStream.funcTable; |
| 2131 | return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); |
| 2132 | } |
| 2133 | #endif |
| 2134 | |
| 2135 | /*MAB: static added */ |
| 2136 | static void LzmaEnc_Finishcxx . . $ LzmaEnc_Finish(5d22bdacc48458e8).(CLzmaEncHandlecxx . . $ CLzmaEncHandle# pp) |
| 2137 | { |
| 2138 | #ifdef COMPRESS_MF_MT |
| 2139 | CLzmaEnc *p = (CLzmaEnc *)pp; |
| 2140 | if (p->mtMode) |
| 2141 | MatchFinderMt_ReleaseStream(&p->matchFinderMt); |
| 2142 | #else |
| 2143 | pp = pp; |
| 2144 | #endif |
| 2145 | } |
| 2146 | |
| 2147 | typedef struct _CSeqOutStreamBufcxx . . $ _CSeqOutStreamBuf# |
| 2148 | { |
| 2149 | ISeqOutStreamcxx . . $ ISeqOutStream# funcTablecxx . . $ _CSeqOutStreamBuf#funcTable.; |
| 2150 | Bytecxx . . $ Byte# *datacxx . . $ _CSeqOutStreamBuf#data.; |
| 2151 | SizeTcxx . . $ SizeT# remcxx . . $ _CSeqOutStreamBuf#rem.; |
| 2152 | Boolcxx . . $ Bool# overflowcxx . . $ _CSeqOutStreamBuf#overflow.; |
| 2153 | } CSeqOutStreamBufcxx . . $ CSeqOutStreamBuf#; |
| 2154 | |
| 2155 | static size_t MyWritecxx . . $ MyWrite(a5d9aa3f99a5f1cf).(void *pp, const void *data, size_t size) |
| 2156 | { |
| 2157 | CSeqOutStreamBufcxx . . $ CSeqOutStreamBuf# *p = (CSeqOutStreamBufcxx . . $ CSeqOutStreamBuf# *)pp; |
| 2158 | if (p->remcxx . . $ _CSeqOutStreamBuf#rem. < size) |
| 2159 | { |
| 2160 | size = p->remcxx . . $ _CSeqOutStreamBuf#rem.; |
| 2161 | p->overflowcxx . . $ _CSeqOutStreamBuf#overflow. = Truecxx . . $ `compression/lzma/Types.h:82:9`!; |
| 2162 | } |
| 2163 | memcpycxx . . $ memcpy(cc817cb175f282d).(p->datacxx . . $ _CSeqOutStreamBuf#data., data, size); |
| 2164 | p->remcxx . . $ _CSeqOutStreamBuf#rem. -= size; |
| 2165 | p->datacxx . . $ _CSeqOutStreamBuf#data. += size; |
| 2166 | return size; |
| 2167 | } |
| 2168 | |
| 2169 | #if defined(USE_UNUSED_CODE) |
| 2170 | /*MAB: static added */ |
| 2171 | static UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) |
| 2172 | { |
| 2173 | const CLzmaEnc *p = (CLzmaEnc *)pp; |
| 2174 | return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); |
| 2175 | } |
| 2176 | |
| 2177 | /*MAB: static added */ |
| 2178 | static |
| 2179 | const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) |
| 2180 | { |
| 2181 | const CLzmaEnc *p = (CLzmaEnc *)pp; |
| 2182 | return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; |
| 2183 | } |
| 2184 | |
| 2185 | /*MAB: static added */ |
| 2186 | static |
| 2187 | SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, Bool reInit, |
| 2188 | Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) |
| 2189 | { |
| 2190 | CLzmaEnc *p = (CLzmaEnc *)pp; |
| 2191 | UInt64 nowPos64; |
| 2192 | SRes res; |
| 2193 | CSeqOutStreamBuf outStream; |
| 2194 | |
| 2195 | outStream.funcTable.Write = MyWrite; |
| 2196 | outStream.data = dest; |
| 2197 | outStream.rem = *destLen; |
| 2198 | outStream.overflow = False; |
| 2199 | |
| 2200 | p->writeEndMark = False; |
| 2201 | p->finished = False; |
| 2202 | p->result = SZ_OK; |
| 2203 | |
| 2204 | if (reInit) |
| 2205 | LzmaEnc_Init(p); |
| 2206 | LzmaEnc_InitPrices(p); |
| 2207 | nowPos64 = p->nowPos64; |
| 2208 | RangeEnc_Init(&p->rc); |
| 2209 | p->rc.outStream = &outStream.funcTable; |
| 2210 | |
| 2211 | res = LzmaEnc_CodeOneBlock(p, True, desiredPackSize, *unpackSize); |
| 2212 | |
| 2213 | *unpackSize = (UInt32)(p->nowPos64 - nowPos64); |
| 2214 | *destLen -= outStream.rem; |
| 2215 | if (outStream.overflow) |
| 2216 | return SZ_ERROR_OUTPUT_EOF; |
| 2217 | |
| 2218 | return res; |
| 2219 | } |
| 2220 | #endif |
| 2221 | |
| 2222 | SRescxx . . $ SRes# LzmaEnc_Encodecxx . . $ LzmaEnc_Encode(13a78612ddeaed6a).(CLzmaEncHandlecxx . . $ CLzmaEncHandle# pp, ISeqOutStreamcxx . . $ ISeqOutStream# *outStream, ISeqInStreamcxx . . $ ISeqInStream# *inStream, ICompressProgresscxx . . $ ICompressProgress# *progress, |
| 2223 | ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 2224 | { |
| 2225 | CLzmaEnccxx . . $ CLzmaEnc# *p = (CLzmaEnccxx . . $ CLzmaEnc# *)pp; |
| 2226 | SRescxx . . $ SRes# res = SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 2227 | |
| 2228 | #ifdef COMPRESS_MF_MT |
| 2229 | Byte allocaDummy[0x300]; |
| 2230 | int i = 0; |
| 2231 | for (i = 0; i < 16; i++) |
| 2232 | allocaDummy[i] = (Byte)i; |
| 2233 | #endif |
| 2234 | |
| 2235 | RINOKcxx . . $ `compression/lzma/Types.h:40:9`!(LzmaEnc_Prepare(pp, inStream, outStream, alloc, allocBig)); |
| 2236 | |
| 2237 | for (;;) |
| 2238 | { |
| 2239 | res = LzmaEnc_CodeOneBlockcxx . . $ LzmaEnc_CodeOneBlock(5785bd0f89aeacee).(p, Falsecxx . . $ `compression/lzma/Types.h:83:9`!, 0, 0); |
| 2240 | if (res != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`! || p->finishedcxx . . $ _CLzmaEnc#finished. != 0) |
| 2241 | break; |
| 2242 | if (progress != 0) |
| 2243 | { |
| 2244 | res = progress->Progresscxx . . $ ICompressProgress#Progress.(progress, p->nowPos64cxx . . $ _CLzmaEnc#nowPos64., (UInt64cxx . . $ UInt64#) RangeEnc_GetProcessedcxx . . $ `compression/lzma/LzmaEnc.c:494:9`!(&p->rc)); /*MAB casts */ |
| 2245 | if (res != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 2246 | { |
| 2247 | res = SZ_ERROR_PROGRESScxx . . $ `compression/lzma/Types.h:24:9`!; |
| 2248 | break; |
| 2249 | } |
| 2250 | } |
| 2251 | } |
| 2252 | LzmaEnc_Finishcxx . . $ LzmaEnc_Finish(5d22bdacc48458e8).(pp); |
| 2253 | return res; |
| 2254 | } |
| 2255 | |
| 2256 | SRescxx . . $ SRes# LzmaEnc_WritePropertiescxx . . $ LzmaEnc_WriteProperties(c1234e765a538d13).(CLzmaEncHandlecxx . . $ CLzmaEncHandle# pp, Bytecxx . . $ Byte# *props, SizeTcxx . . $ SizeT# *size) |
| 2257 | { |
| 2258 | CLzmaEnccxx . . $ CLzmaEnc# *p = (CLzmaEnccxx . . $ CLzmaEnc# *)pp; |
| 2259 | int i; |
| 2260 | UInt32cxx . . $ UInt32# dictSize = p->dictSizecxx . . $ _CLzmaEnc#dictSize.; |
| 2261 | if (*size < LZMA_PROPS_SIZEcxx . . $ `compression/lzma/LzmaEnc.h:9:9`!) |
| 2262 | return SZ_ERROR_PARAMcxx . . $ `compression/lzma/Types.h:19:9`!; |
| 2263 | *size = LZMA_PROPS_SIZEcxx . . $ `compression/lzma/LzmaEnc.h:9:9`!; |
| 2264 | props[0] = (Bytecxx . . $ Byte#)((p->pbcxx . . $ _CLzmaEnc#pb. * 5 + p->lpcxx . . $ _CLzmaEnc#lp.) * 9 + p->lccxx . . $ _CLzmaEnc#lc.); |
| 2265 | |
| 2266 | for (i = 11; i <= 30; i++) |
| 2267 | { |
| 2268 | if (dictSize <= ((UInt32cxx . . $ UInt32#)2 << i)) |
| 2269 | { |
| 2270 | dictSize = (UInt32cxx . . $ UInt32#)(2 << i); /*MAB casts */ |
| 2271 | break; |
| 2272 | } |
| 2273 | if (dictSize <= ((UInt32cxx . . $ UInt32#)3 << i)) |
| 2274 | { |
| 2275 | dictSize = (UInt32cxx . . $ UInt32#)(3 << i); /*MAB casts */ |
| 2276 | break; |
| 2277 | } |
| 2278 | } |
| 2279 | |
| 2280 | for (i = 0; i < 4; i++) |
| 2281 | props[1 + i] = (Bytecxx . . $ Byte#)(dictSize >> (8 * i)); |
| 2282 | return SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 2283 | } |
| 2284 | |
| 2285 | SRescxx . . $ SRes# LzmaEnc_MemEncodecxx . . $ LzmaEnc_MemEncode(cedee8e9a4b69b5a).(CLzmaEncHandlecxx . . $ CLzmaEncHandle# pp, Bytecxx . . $ Byte# *dest, SizeTcxx . . $ SizeT# *destLen, const Bytecxx . . $ Byte# *src, SizeTcxx . . $ SizeT# srcLen, |
| 2286 | int writeEndMark, ICompressProgresscxx . . $ ICompressProgress# *progress, ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 2287 | { |
| 2288 | SRescxx . . $ SRes# res; |
| 2289 | CLzmaEnccxx . . $ CLzmaEnc# *p = (CLzmaEnccxx . . $ CLzmaEnc# *)pp; |
| 2290 | |
| 2291 | CSeqOutStreamBufcxx . . $ CSeqOutStreamBuf# outStream; |
| 2292 | |
| 2293 | LzmaEnc_SetInputBufcxx . . $ LzmaEnc_SetInputBuf(bc87fe8bbc701e66).(p, src, srcLen); |
| 2294 | |
| 2295 | outStream.funcTablecxx . . $ _CSeqOutStreamBuf#funcTable..Writecxx . . $ ISeqOutStream#Write. = MyWritecxx . . $ MyWrite(a5d9aa3f99a5f1cf).; |
| 2296 | outStream.datacxx . . $ _CSeqOutStreamBuf#data. = dest; |
| 2297 | outStream.remcxx . . $ _CSeqOutStreamBuf#rem. = *destLen; |
| 2298 | outStream.overflowcxx . . $ _CSeqOutStreamBuf#overflow. = Falsecxx . . $ `compression/lzma/Types.h:83:9`!; |
| 2299 | |
| 2300 | p->writeEndMarkcxx . . $ _CLzmaEnc#writeEndMark. = writeEndMark; |
| 2301 | res = LzmaEnc_Encodecxx . . $ LzmaEnc_Encode(13a78612ddeaed6a).(pp, &outStream.funcTablecxx . . $ _CSeqOutStreamBuf#funcTable., &p->seqBufInStreamcxx . . $ _CLzmaEnc#seqBufInStream..funcTablecxx . . $ _CSeqInStreamBuf#funcTable., |
| 2302 | progress, alloc, allocBig); |
| 2303 | |
| 2304 | *destLen -= outStream.remcxx . . $ _CSeqOutStreamBuf#rem.; |
| 2305 | if (outStream.overflowcxx . . $ _CSeqOutStreamBuf#overflow.) |
| 2306 | return SZ_ERROR_OUTPUT_EOFcxx . . $ `compression/lzma/Types.h:21:9`!; |
| 2307 | return res; |
| 2308 | } |
| 2309 | |
| 2310 | SRescxx . . $ SRes# LzmaEncodecxx . . $ LzmaEncode(368176730a281172).(Bytecxx . . $ Byte# *dest, SizeTcxx . . $ SizeT# *destLen, const Bytecxx . . $ Byte# *src, SizeTcxx . . $ SizeT# srcLen, |
| 2311 | const CLzmaEncPropscxx . . $ CLzmaEncProps# *props, Bytecxx . . $ Byte# *propsEncoded, SizeTcxx . . $ SizeT# *propsSize, int writeEndMark, |
| 2312 | ICompressProgresscxx . . $ ICompressProgress# *progress, ISzAlloccxx . . $ ISzAlloc# *alloc, ISzAlloccxx . . $ ISzAlloc# *allocBig) |
| 2313 | { |
| 2314 | CLzmaEnccxx . . $ CLzmaEnc# *p = (CLzmaEnccxx . . $ CLzmaEnc# *)LzmaEnc_Createcxx . . $ LzmaEnc_Create(2b2f2d4c05393eec).(alloc); |
| 2315 | SRescxx . . $ SRes# res; |
| 2316 | if (p == 0) |
| 2317 | return SZ_ERROR_MEMcxx . . $ `compression/lzma/Types.h:16:9`!; |
| 2318 | |
| 2319 | res = LzmaEnc_SetPropscxx . . $ LzmaEnc_SetProps(56f3369ab02c17f).(p, props); |
| 2320 | if (res == SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 2321 | { |
| 2322 | res = LzmaEnc_WritePropertiescxx . . $ LzmaEnc_WriteProperties(c1234e765a538d13).(p, propsEncoded, propsSize); |
| 2323 | if (res == SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 2324 | res = LzmaEnc_MemEncodecxx . . $ LzmaEnc_MemEncode(cedee8e9a4b69b5a).(p, dest, destLen, src, srcLen, |
| 2325 | writeEndMark, progress, alloc, allocBig); |
| 2326 | } |
| 2327 | |
| 2328 | LzmaEnc_Destroycxx . . $ LzmaEnc_Destroy(651218bf81b64962).(p, alloc, allocBig); |
| 2329 | return res; |
| 2330 | } |