diff options
Diffstat (limited to 'C/LzmaEnc.c')
-rw-r--r-- | C/LzmaEnc.c | 380 |
1 files changed, 181 insertions, 199 deletions
diff --git a/C/LzmaEnc.c b/C/LzmaEnc.c index c8b31a1..6d13cac 100644 --- a/C/LzmaEnc.c +++ b/C/LzmaEnc.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* LzmaEnc.c -- LZMA Encoder | 1 | /* LzmaEnc.c -- LZMA Encoder |
2 | 2022-07-15: Igor Pavlov : Public domain */ | 2 | 2023-04-13: Igor Pavlov : Public domain */ |
3 | 3 | ||
4 | #include "Precomp.h" | 4 | #include "Precomp.h" |
5 | 5 | ||
@@ -16,22 +16,22 @@ | |||
16 | #include "LzmaEnc.h" | 16 | #include "LzmaEnc.h" |
17 | 17 | ||
18 | #include "LzFind.h" | 18 | #include "LzFind.h" |
19 | #ifndef _7ZIP_ST | 19 | #ifndef Z7_ST |
20 | #include "LzFindMt.h" | 20 | #include "LzFindMt.h" |
21 | #endif | 21 | #endif |
22 | 22 | ||
23 | /* the following LzmaEnc_* declarations is internal LZMA interface for LZMA2 encoder */ | 23 | /* the following LzmaEnc_* declarations is internal LZMA interface for LZMA2 encoder */ |
24 | 24 | ||
25 | SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize, | 25 | SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle p, ISeqInStreamPtr inStream, UInt32 keepWindowSize, |
26 | ISzAllocPtr alloc, ISzAllocPtr allocBig); | 26 | ISzAllocPtr alloc, ISzAllocPtr allocBig); |
27 | SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, | 27 | SRes LzmaEnc_MemPrepare(CLzmaEncHandle p, const Byte *src, SizeT srcLen, |
28 | UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig); | 28 | UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig); |
29 | SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit, | 29 | SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle p, BoolInt reInit, |
30 | Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize); | 30 | Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize); |
31 | const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp); | 31 | const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle p); |
32 | void LzmaEnc_Finish(CLzmaEncHandle pp); | 32 | void LzmaEnc_Finish(CLzmaEncHandle p); |
33 | void LzmaEnc_SaveState(CLzmaEncHandle pp); | 33 | void LzmaEnc_SaveState(CLzmaEncHandle p); |
34 | void LzmaEnc_RestoreState(CLzmaEncHandle pp); | 34 | void LzmaEnc_RestoreState(CLzmaEncHandle p); |
35 | 35 | ||
36 | #ifdef SHOW_STAT | 36 | #ifdef SHOW_STAT |
37 | static unsigned g_STAT_OFFSET = 0; | 37 | static unsigned g_STAT_OFFSET = 0; |
@@ -40,8 +40,8 @@ static unsigned g_STAT_OFFSET = 0; | |||
40 | /* for good normalization speed we still reserve 256 MB before 4 GB range */ | 40 | /* for good normalization speed we still reserve 256 MB before 4 GB range */ |
41 | #define kLzmaMaxHistorySize ((UInt32)15 << 28) | 41 | #define kLzmaMaxHistorySize ((UInt32)15 << 28) |
42 | 42 | ||
43 | #define kNumTopBits 24 | 43 | // #define kNumTopBits 24 |
44 | #define kTopValue ((UInt32)1 << kNumTopBits) | 44 | #define kTopValue ((UInt32)1 << 24) |
45 | 45 | ||
46 | #define kNumBitModelTotalBits 11 | 46 | #define kNumBitModelTotalBits 11 |
47 | #define kBitModelTotal (1 << kNumBitModelTotalBits) | 47 | #define kBitModelTotal (1 << kNumBitModelTotalBits) |
@@ -60,6 +60,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p) | |||
60 | p->dictSize = p->mc = 0; | 60 | p->dictSize = p->mc = 0; |
61 | p->reduceSize = (UInt64)(Int64)-1; | 61 | p->reduceSize = (UInt64)(Int64)-1; |
62 | p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; | 62 | p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1; |
63 | p->numHashOutBits = 0; | ||
63 | p->writeEndMark = 0; | 64 | p->writeEndMark = 0; |
64 | p->affinity = 0; | 65 | p->affinity = 0; |
65 | } | 66 | } |
@@ -99,7 +100,7 @@ void LzmaEncProps_Normalize(CLzmaEncProps *p) | |||
99 | 100 | ||
100 | if (p->numThreads < 0) | 101 | if (p->numThreads < 0) |
101 | p->numThreads = | 102 | p->numThreads = |
102 | #ifndef _7ZIP_ST | 103 | #ifndef Z7_ST |
103 | ((p->btMode && p->algo) ? 2 : 1); | 104 | ((p->btMode && p->algo) ? 2 : 1); |
104 | #else | 105 | #else |
105 | 1; | 106 | 1; |
@@ -293,7 +294,7 @@ typedef struct | |||
293 | #define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) | 294 | #define kNumFullDistances (1 << (kEndPosModelIndex >> 1)) |
294 | 295 | ||
295 | typedef | 296 | typedef |
296 | #ifdef _LZMA_PROB32 | 297 | #ifdef Z7_LZMA_PROB32 |
297 | UInt32 | 298 | UInt32 |
298 | #else | 299 | #else |
299 | UInt16 | 300 | UInt16 |
@@ -350,7 +351,7 @@ typedef struct | |||
350 | Byte *buf; | 351 | Byte *buf; |
351 | Byte *bufLim; | 352 | Byte *bufLim; |
352 | Byte *bufBase; | 353 | Byte *bufBase; |
353 | ISeqOutStream *outStream; | 354 | ISeqOutStreamPtr outStream; |
354 | UInt64 processed; | 355 | UInt64 processed; |
355 | SRes res; | 356 | SRes res; |
356 | } CRangeEnc; | 357 | } CRangeEnc; |
@@ -383,7 +384,7 @@ typedef struct | |||
383 | typedef UInt32 CProbPrice; | 384 | typedef UInt32 CProbPrice; |
384 | 385 | ||
385 | 386 | ||
386 | typedef struct | 387 | struct CLzmaEnc |
387 | { | 388 | { |
388 | void *matchFinderObj; | 389 | void *matchFinderObj; |
389 | IMatchFinder2 matchFinder; | 390 | IMatchFinder2 matchFinder; |
@@ -426,7 +427,7 @@ typedef struct | |||
426 | UInt32 dictSize; | 427 | UInt32 dictSize; |
427 | SRes result; | 428 | SRes result; |
428 | 429 | ||
429 | #ifndef _7ZIP_ST | 430 | #ifndef Z7_ST |
430 | BoolInt mtMode; | 431 | BoolInt mtMode; |
431 | // begin of CMatchFinderMt is used in LZ thread | 432 | // begin of CMatchFinderMt is used in LZ thread |
432 | CMatchFinderMt matchFinderMt; | 433 | CMatchFinderMt matchFinderMt; |
@@ -439,7 +440,7 @@ typedef struct | |||
439 | 440 | ||
440 | // we suppose that we have 8-bytes alignment after CMatchFinder | 441 | // we suppose that we have 8-bytes alignment after CMatchFinder |
441 | 442 | ||
442 | #ifndef _7ZIP_ST | 443 | #ifndef Z7_ST |
443 | Byte pad[128]; | 444 | Byte pad[128]; |
444 | #endif | 445 | #endif |
445 | 446 | ||
@@ -479,77 +480,59 @@ typedef struct | |||
479 | CSaveState saveState; | 480 | CSaveState saveState; |
480 | 481 | ||
481 | // BoolInt mf_Failure; | 482 | // BoolInt mf_Failure; |
482 | #ifndef _7ZIP_ST | 483 | #ifndef Z7_ST |
483 | Byte pad2[128]; | 484 | Byte pad2[128]; |
484 | #endif | 485 | #endif |
485 | } CLzmaEnc; | 486 | }; |
486 | 487 | ||
487 | 488 | ||
488 | #define MFB (p->matchFinderBase) | 489 | #define MFB (p->matchFinderBase) |
489 | /* | 490 | /* |
490 | #ifndef _7ZIP_ST | 491 | #ifndef Z7_ST |
491 | #define MFB (p->matchFinderMt.MatchFinder) | 492 | #define MFB (p->matchFinderMt.MatchFinder) |
492 | #endif | 493 | #endif |
493 | */ | 494 | */ |
494 | 495 | ||
495 | #define COPY_ARR(dest, src, arr) memcpy(dest->arr, src->arr, sizeof(src->arr)); | 496 | // #define GET_CLzmaEnc_p CLzmaEnc *p = (CLzmaEnc*)(void *)p; |
496 | 497 | // #define GET_const_CLzmaEnc_p const CLzmaEnc *p = (const CLzmaEnc*)(const void *)p; | |
497 | void LzmaEnc_SaveState(CLzmaEncHandle pp) | 498 | |
498 | { | 499 | #define COPY_ARR(dest, src, arr) memcpy((dest)->arr, (src)->arr, sizeof((src)->arr)); |
499 | CLzmaEnc *p = (CLzmaEnc *)pp; | 500 | |
500 | CSaveState *dest = &p->saveState; | 501 | #define COPY_LZMA_ENC_STATE(d, s, p) \ |
501 | 502 | (d)->state = (s)->state; \ | |
502 | dest->state = p->state; | 503 | COPY_ARR(d, s, reps) \ |
503 | 504 | COPY_ARR(d, s, posAlignEncoder) \ | |
504 | dest->lenProbs = p->lenProbs; | 505 | COPY_ARR(d, s, isRep) \ |
505 | dest->repLenProbs = p->repLenProbs; | 506 | COPY_ARR(d, s, isRepG0) \ |
506 | 507 | COPY_ARR(d, s, isRepG1) \ | |
507 | COPY_ARR(dest, p, reps); | 508 | COPY_ARR(d, s, isRepG2) \ |
508 | 509 | COPY_ARR(d, s, isMatch) \ | |
509 | COPY_ARR(dest, p, posAlignEncoder); | 510 | COPY_ARR(d, s, isRep0Long) \ |
510 | COPY_ARR(dest, p, isRep); | 511 | COPY_ARR(d, s, posSlotEncoder) \ |
511 | COPY_ARR(dest, p, isRepG0); | 512 | COPY_ARR(d, s, posEncoders) \ |
512 | COPY_ARR(dest, p, isRepG1); | 513 | (d)->lenProbs = (s)->lenProbs; \ |
513 | COPY_ARR(dest, p, isRepG2); | 514 | (d)->repLenProbs = (s)->repLenProbs; \ |
514 | COPY_ARR(dest, p, isMatch); | 515 | memcpy((d)->litProbs, (s)->litProbs, ((UInt32)0x300 << (p)->lclp) * sizeof(CLzmaProb)); |
515 | COPY_ARR(dest, p, isRep0Long); | 516 | |
516 | COPY_ARR(dest, p, posSlotEncoder); | 517 | void LzmaEnc_SaveState(CLzmaEncHandle p) |
517 | COPY_ARR(dest, p, posEncoders); | 518 | { |
518 | 519 | // GET_CLzmaEnc_p | |
519 | memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << p->lclp) * sizeof(CLzmaProb)); | 520 | CSaveState *v = &p->saveState; |
521 | COPY_LZMA_ENC_STATE(v, p, p) | ||
520 | } | 522 | } |
521 | 523 | ||
522 | 524 | void LzmaEnc_RestoreState(CLzmaEncHandle p) | |
523 | void LzmaEnc_RestoreState(CLzmaEncHandle pp) | ||
524 | { | 525 | { |
525 | CLzmaEnc *dest = (CLzmaEnc *)pp; | 526 | // GET_CLzmaEnc_p |
526 | const CSaveState *p = &dest->saveState; | 527 | const CSaveState *v = &p->saveState; |
527 | 528 | COPY_LZMA_ENC_STATE(p, v, p) | |
528 | dest->state = p->state; | ||
529 | |||
530 | dest->lenProbs = p->lenProbs; | ||
531 | dest->repLenProbs = p->repLenProbs; | ||
532 | |||
533 | COPY_ARR(dest, p, reps); | ||
534 | |||
535 | COPY_ARR(dest, p, posAlignEncoder); | ||
536 | COPY_ARR(dest, p, isRep); | ||
537 | COPY_ARR(dest, p, isRepG0); | ||
538 | COPY_ARR(dest, p, isRepG1); | ||
539 | COPY_ARR(dest, p, isRepG2); | ||
540 | COPY_ARR(dest, p, isMatch); | ||
541 | COPY_ARR(dest, p, isRep0Long); | ||
542 | COPY_ARR(dest, p, posSlotEncoder); | ||
543 | COPY_ARR(dest, p, posEncoders); | ||
544 | |||
545 | memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << dest->lclp) * sizeof(CLzmaProb)); | ||
546 | } | 529 | } |
547 | 530 | ||
548 | 531 | ||
549 | 532 | Z7_NO_INLINE | |
550 | SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) | 533 | SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props2) |
551 | { | 534 | { |
552 | CLzmaEnc *p = (CLzmaEnc *)pp; | 535 | // GET_CLzmaEnc_p |
553 | CLzmaEncProps props = *props2; | 536 | CLzmaEncProps props = *props2; |
554 | LzmaEncProps_Normalize(&props); | 537 | LzmaEncProps_Normalize(&props); |
555 | 538 | ||
@@ -585,6 +568,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) | |||
585 | p->fastMode = (props.algo == 0); | 568 | p->fastMode = (props.algo == 0); |
586 | // p->_maxMode = True; | 569 | // p->_maxMode = True; |
587 | MFB.btMode = (Byte)(props.btMode ? 1 : 0); | 570 | MFB.btMode = (Byte)(props.btMode ? 1 : 0); |
571 | // MFB.btMode = (Byte)(props.btMode); | ||
588 | { | 572 | { |
589 | unsigned numHashBytes = 4; | 573 | unsigned numHashBytes = 4; |
590 | if (props.btMode) | 574 | if (props.btMode) |
@@ -595,13 +579,15 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) | |||
595 | if (props.numHashBytes >= 5) numHashBytes = 5; | 579 | if (props.numHashBytes >= 5) numHashBytes = 5; |
596 | 580 | ||
597 | MFB.numHashBytes = numHashBytes; | 581 | MFB.numHashBytes = numHashBytes; |
582 | // MFB.numHashBytes_Min = 2; | ||
583 | MFB.numHashOutBits = (Byte)props.numHashOutBits; | ||
598 | } | 584 | } |
599 | 585 | ||
600 | MFB.cutValue = props.mc; | 586 | MFB.cutValue = props.mc; |
601 | 587 | ||
602 | p->writeEndMark = (BoolInt)props.writeEndMark; | 588 | p->writeEndMark = (BoolInt)props.writeEndMark; |
603 | 589 | ||
604 | #ifndef _7ZIP_ST | 590 | #ifndef Z7_ST |
605 | /* | 591 | /* |
606 | if (newMultiThread != _multiThread) | 592 | if (newMultiThread != _multiThread) |
607 | { | 593 | { |
@@ -618,9 +604,9 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2) | |||
618 | } | 604 | } |
619 | 605 | ||
620 | 606 | ||
621 | void LzmaEnc_SetDataSize(CLzmaEncHandle pp, UInt64 expectedDataSiize) | 607 | void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize) |
622 | { | 608 | { |
623 | CLzmaEnc *p = (CLzmaEnc *)pp; | 609 | // GET_CLzmaEnc_p |
624 | MFB.expectedDataSize = expectedDataSiize; | 610 | MFB.expectedDataSize = expectedDataSiize; |
625 | } | 611 | } |
626 | 612 | ||
@@ -684,7 +670,7 @@ static void RangeEnc_Init(CRangeEnc *p) | |||
684 | p->res = SZ_OK; | 670 | p->res = SZ_OK; |
685 | } | 671 | } |
686 | 672 | ||
687 | MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p) | 673 | Z7_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p) |
688 | { | 674 | { |
689 | const size_t num = (size_t)(p->buf - p->bufBase); | 675 | const size_t num = (size_t)(p->buf - p->bufBase); |
690 | if (p->res == SZ_OK) | 676 | if (p->res == SZ_OK) |
@@ -696,7 +682,7 @@ MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p) | |||
696 | p->buf = p->bufBase; | 682 | p->buf = p->bufBase; |
697 | } | 683 | } |
698 | 684 | ||
699 | MY_NO_INLINE static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p) | 685 | Z7_NO_INLINE static void Z7_FASTCALL RangeEnc_ShiftLow(CRangeEnc *p) |
700 | { | 686 | { |
701 | UInt32 low = (UInt32)p->low; | 687 | UInt32 low = (UInt32)p->low; |
702 | unsigned high = (unsigned)(p->low >> 32); | 688 | unsigned high = (unsigned)(p->low >> 32); |
@@ -741,9 +727,9 @@ static void RangeEnc_FlushData(CRangeEnc *p) | |||
741 | ttt = *(prob); \ | 727 | ttt = *(prob); \ |
742 | newBound = (range >> kNumBitModelTotalBits) * ttt; | 728 | newBound = (range >> kNumBitModelTotalBits) * ttt; |
743 | 729 | ||
744 | // #define _LZMA_ENC_USE_BRANCH | 730 | // #define Z7_LZMA_ENC_USE_BRANCH |
745 | 731 | ||
746 | #ifdef _LZMA_ENC_USE_BRANCH | 732 | #ifdef Z7_LZMA_ENC_USE_BRANCH |
747 | 733 | ||
748 | #define RC_BIT(p, prob, bit) { \ | 734 | #define RC_BIT(p, prob, bit) { \ |
749 | RC_BIT_PRE(p, prob) \ | 735 | RC_BIT_PRE(p, prob) \ |
@@ -811,7 +797,7 @@ static void LitEnc_Encode(CRangeEnc *p, CLzmaProb *probs, UInt32 sym) | |||
811 | CLzmaProb *prob = probs + (sym >> 8); | 797 | CLzmaProb *prob = probs + (sym >> 8); |
812 | UInt32 bit = (sym >> 7) & 1; | 798 | UInt32 bit = (sym >> 7) & 1; |
813 | sym <<= 1; | 799 | sym <<= 1; |
814 | RC_BIT(p, prob, bit); | 800 | RC_BIT(p, prob, bit) |
815 | } | 801 | } |
816 | while (sym < 0x10000); | 802 | while (sym < 0x10000); |
817 | p->range = range; | 803 | p->range = range; |
@@ -833,7 +819,7 @@ static void LitEnc_EncodeMatched(CRangeEnc *p, CLzmaProb *probs, UInt32 sym, UIn | |||
833 | bit = (sym >> 7) & 1; | 819 | bit = (sym >> 7) & 1; |
834 | sym <<= 1; | 820 | sym <<= 1; |
835 | offs &= ~(matchByte ^ sym); | 821 | offs &= ~(matchByte ^ sym); |
836 | RC_BIT(p, prob, bit); | 822 | RC_BIT(p, prob, bit) |
837 | } | 823 | } |
838 | while (sym < 0x10000); | 824 | while (sym < 0x10000); |
839 | p->range = range; | 825 | p->range = range; |
@@ -867,10 +853,10 @@ static void LzmaEnc_InitPriceTables(CProbPrice *ProbPrices) | |||
867 | 853 | ||
868 | 854 | ||
869 | #define GET_PRICE(prob, bit) \ | 855 | #define GET_PRICE(prob, bit) \ |
870 | p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; | 856 | p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits] |
871 | 857 | ||
872 | #define GET_PRICEa(prob, bit) \ | 858 | #define GET_PRICEa(prob, bit) \ |
873 | ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]; | 859 | ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits] |
874 | 860 | ||
875 | #define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] | 861 | #define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits] |
876 | #define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] | 862 | #define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits] |
@@ -921,7 +907,7 @@ static void RcTree_ReverseEncode(CRangeEnc *rc, CLzmaProb *probs, unsigned numBi | |||
921 | unsigned bit = sym & 1; | 907 | unsigned bit = sym & 1; |
922 | // RangeEnc_EncodeBit(rc, probs + m, bit); | 908 | // RangeEnc_EncodeBit(rc, probs + m, bit); |
923 | sym >>= 1; | 909 | sym >>= 1; |
924 | RC_BIT(rc, probs + m, bit); | 910 | RC_BIT(rc, probs + m, bit) |
925 | m = (m << 1) | bit; | 911 | m = (m << 1) | bit; |
926 | } | 912 | } |
927 | while (--numBits); | 913 | while (--numBits); |
@@ -944,15 +930,15 @@ static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, unsigned posS | |||
944 | UInt32 range, ttt, newBound; | 930 | UInt32 range, ttt, newBound; |
945 | CLzmaProb *probs = p->low; | 931 | CLzmaProb *probs = p->low; |
946 | range = rc->range; | 932 | range = rc->range; |
947 | RC_BIT_PRE(rc, probs); | 933 | RC_BIT_PRE(rc, probs) |
948 | if (sym >= kLenNumLowSymbols) | 934 | if (sym >= kLenNumLowSymbols) |
949 | { | 935 | { |
950 | RC_BIT_1(rc, probs); | 936 | RC_BIT_1(rc, probs) |
951 | probs += kLenNumLowSymbols; | 937 | probs += kLenNumLowSymbols; |
952 | RC_BIT_PRE(rc, probs); | 938 | RC_BIT_PRE(rc, probs) |
953 | if (sym >= kLenNumLowSymbols * 2) | 939 | if (sym >= kLenNumLowSymbols * 2) |
954 | { | 940 | { |
955 | RC_BIT_1(rc, probs); | 941 | RC_BIT_1(rc, probs) |
956 | rc->range = range; | 942 | rc->range = range; |
957 | // RcTree_Encode(rc, p->high, kLenNumHighBits, sym - kLenNumLowSymbols * 2); | 943 | // RcTree_Encode(rc, p->high, kLenNumHighBits, sym - kLenNumLowSymbols * 2); |
958 | LitEnc_Encode(rc, p->high, sym - kLenNumLowSymbols * 2); | 944 | LitEnc_Encode(rc, p->high, sym - kLenNumLowSymbols * 2); |
@@ -965,11 +951,11 @@ static void LenEnc_Encode(CLenEnc *p, CRangeEnc *rc, unsigned sym, unsigned posS | |||
965 | { | 951 | { |
966 | unsigned m; | 952 | unsigned m; |
967 | unsigned bit; | 953 | unsigned bit; |
968 | RC_BIT_0(rc, probs); | 954 | RC_BIT_0(rc, probs) |
969 | probs += (posState << (1 + kLenNumLowBits)); | 955 | probs += (posState << (1 + kLenNumLowBits)); |
970 | bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit); m = (1 << 1) + bit; | 956 | bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit) m = (1 << 1) + bit; |
971 | bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit); m = (m << 1) + bit; | 957 | bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit) m = (m << 1) + bit; |
972 | bit = sym & 1; RC_BIT(rc, probs + m, bit); | 958 | bit = sym & 1; RC_BIT(rc, probs + m, bit) |
973 | rc->range = range; | 959 | rc->range = range; |
974 | } | 960 | } |
975 | } | 961 | } |
@@ -990,7 +976,7 @@ static void SetPrices_3(const CLzmaProb *probs, UInt32 startPrice, UInt32 *price | |||
990 | } | 976 | } |
991 | 977 | ||
992 | 978 | ||
993 | MY_NO_INLINE static void MY_FAST_CALL LenPriceEnc_UpdateTables( | 979 | Z7_NO_INLINE static void Z7_FASTCALL LenPriceEnc_UpdateTables( |
994 | CLenPriceEnc *p, | 980 | CLenPriceEnc *p, |
995 | unsigned numPosStates, | 981 | unsigned numPosStates, |
996 | const CLenEnc *enc, | 982 | const CLenEnc *enc, |
@@ -1152,7 +1138,7 @@ static unsigned ReadMatchDistances(CLzmaEnc *p, unsigned *numPairsRes) | |||
1152 | + GET_PRICE_1(p->isRep[state]) \ | 1138 | + GET_PRICE_1(p->isRep[state]) \ |
1153 | + GET_PRICE_0(p->isRepG0[state]) | 1139 | + GET_PRICE_0(p->isRepG0[state]) |
1154 | 1140 | ||
1155 | MY_FORCE_INLINE | 1141 | Z7_FORCE_INLINE |
1156 | static UInt32 GetPrice_PureRep(const CLzmaEnc *p, unsigned repIndex, size_t state, size_t posState) | 1142 | static UInt32 GetPrice_PureRep(const CLzmaEnc *p, unsigned repIndex, size_t state, size_t posState) |
1157 | { | 1143 | { |
1158 | UInt32 price; | 1144 | UInt32 price; |
@@ -1331,7 +1317,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1331 | LitEnc_GetPrice(probs, curByte, p->ProbPrices)); | 1317 | LitEnc_GetPrice(probs, curByte, p->ProbPrices)); |
1332 | } | 1318 | } |
1333 | 1319 | ||
1334 | MakeAs_Lit(&p->opt[1]); | 1320 | MakeAs_Lit(&p->opt[1]) |
1335 | 1321 | ||
1336 | matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); | 1322 | matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]); |
1337 | repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); | 1323 | repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]); |
@@ -1343,7 +1329,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1343 | if (shortRepPrice < p->opt[1].price) | 1329 | if (shortRepPrice < p->opt[1].price) |
1344 | { | 1330 | { |
1345 | p->opt[1].price = shortRepPrice; | 1331 | p->opt[1].price = shortRepPrice; |
1346 | MakeAs_ShortRep(&p->opt[1]); | 1332 | MakeAs_ShortRep(&p->opt[1]) |
1347 | } | 1333 | } |
1348 | if (last < 2) | 1334 | if (last < 2) |
1349 | { | 1335 | { |
@@ -1410,7 +1396,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1410 | else | 1396 | else |
1411 | { | 1397 | { |
1412 | unsigned slot; | 1398 | unsigned slot; |
1413 | GetPosSlot2(dist, slot); | 1399 | GetPosSlot2(dist, slot) |
1414 | price += p->alignPrices[dist & kAlignMask]; | 1400 | price += p->alignPrices[dist & kAlignMask]; |
1415 | price += p->posSlotPrices[lenToPosState][slot]; | 1401 | price += p->posSlotPrices[lenToPosState][slot]; |
1416 | } | 1402 | } |
@@ -1486,7 +1472,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1486 | unsigned delta = best - cur; | 1472 | unsigned delta = best - cur; |
1487 | if (delta != 0) | 1473 | if (delta != 0) |
1488 | { | 1474 | { |
1489 | MOVE_POS(p, delta); | 1475 | MOVE_POS(p, delta) |
1490 | } | 1476 | } |
1491 | } | 1477 | } |
1492 | cur = best; | 1478 | cur = best; |
@@ -1633,7 +1619,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1633 | { | 1619 | { |
1634 | nextOpt->price = litPrice; | 1620 | nextOpt->price = litPrice; |
1635 | nextOpt->len = 1; | 1621 | nextOpt->len = 1; |
1636 | MakeAs_Lit(nextOpt); | 1622 | MakeAs_Lit(nextOpt) |
1637 | nextIsLit = True; | 1623 | nextIsLit = True; |
1638 | } | 1624 | } |
1639 | } | 1625 | } |
@@ -1667,7 +1653,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1667 | { | 1653 | { |
1668 | nextOpt->price = shortRepPrice; | 1654 | nextOpt->price = shortRepPrice; |
1669 | nextOpt->len = 1; | 1655 | nextOpt->len = 1; |
1670 | MakeAs_ShortRep(nextOpt); | 1656 | MakeAs_ShortRep(nextOpt) |
1671 | nextIsLit = False; | 1657 | nextIsLit = False; |
1672 | } | 1658 | } |
1673 | } | 1659 | } |
@@ -1871,7 +1857,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1871 | dist = MATCHES[(size_t)offs + 1]; | 1857 | dist = MATCHES[(size_t)offs + 1]; |
1872 | 1858 | ||
1873 | // if (dist >= kNumFullDistances) | 1859 | // if (dist >= kNumFullDistances) |
1874 | GetPosSlot2(dist, posSlot); | 1860 | GetPosSlot2(dist, posSlot) |
1875 | 1861 | ||
1876 | for (len = /*2*/ startLen; ; len++) | 1862 | for (len = /*2*/ startLen; ; len++) |
1877 | { | 1863 | { |
@@ -1962,7 +1948,7 @@ static unsigned GetOptimum(CLzmaEnc *p, UInt32 position) | |||
1962 | break; | 1948 | break; |
1963 | dist = MATCHES[(size_t)offs + 1]; | 1949 | dist = MATCHES[(size_t)offs + 1]; |
1964 | // if (dist >= kNumFullDistances) | 1950 | // if (dist >= kNumFullDistances) |
1965 | GetPosSlot2(dist, posSlot); | 1951 | GetPosSlot2(dist, posSlot) |
1966 | } | 1952 | } |
1967 | } | 1953 | } |
1968 | } | 1954 | } |
@@ -2138,7 +2124,7 @@ static void WriteEndMarker(CLzmaEnc *p, unsigned posState) | |||
2138 | { | 2124 | { |
2139 | UInt32 ttt, newBound; | 2125 | UInt32 ttt, newBound; |
2140 | RC_BIT_PRE(p, probs + m) | 2126 | RC_BIT_PRE(p, probs + m) |
2141 | RC_BIT_1(&p->rc, probs + m); | 2127 | RC_BIT_1(&p->rc, probs + m) |
2142 | m = (m << 1) + 1; | 2128 | m = (m << 1) + 1; |
2143 | } | 2129 | } |
2144 | while (m < (1 << kNumPosSlotBits)); | 2130 | while (m < (1 << kNumPosSlotBits)); |
@@ -2163,7 +2149,7 @@ static void WriteEndMarker(CLzmaEnc *p, unsigned posState) | |||
2163 | { | 2149 | { |
2164 | UInt32 ttt, newBound; | 2150 | UInt32 ttt, newBound; |
2165 | RC_BIT_PRE(p, probs + m) | 2151 | RC_BIT_PRE(p, probs + m) |
2166 | RC_BIT_1(&p->rc, probs + m); | 2152 | RC_BIT_1(&p->rc, probs + m) |
2167 | m = (m << 1) + 1; | 2153 | m = (m << 1) + 1; |
2168 | } | 2154 | } |
2169 | while (m < kAlignTableSize); | 2155 | while (m < kAlignTableSize); |
@@ -2179,7 +2165,7 @@ static SRes CheckErrors(CLzmaEnc *p) | |||
2179 | if (p->rc.res != SZ_OK) | 2165 | if (p->rc.res != SZ_OK) |
2180 | p->result = SZ_ERROR_WRITE; | 2166 | p->result = SZ_ERROR_WRITE; |
2181 | 2167 | ||
2182 | #ifndef _7ZIP_ST | 2168 | #ifndef Z7_ST |
2183 | if ( | 2169 | if ( |
2184 | // p->mf_Failure || | 2170 | // p->mf_Failure || |
2185 | (p->mtMode && | 2171 | (p->mtMode && |
@@ -2187,7 +2173,7 @@ static SRes CheckErrors(CLzmaEnc *p) | |||
2187 | p->matchFinderMt.failure_LZ_BT)) | 2173 | p->matchFinderMt.failure_LZ_BT)) |
2188 | ) | 2174 | ) |
2189 | { | 2175 | { |
2190 | p->result = MY_HRES_ERROR__INTERNAL_ERROR; | 2176 | p->result = MY_HRES_ERROR_INTERNAL_ERROR; |
2191 | // printf("\nCheckErrors p->matchFinderMt.failureLZ\n"); | 2177 | // printf("\nCheckErrors p->matchFinderMt.failureLZ\n"); |
2192 | } | 2178 | } |
2193 | #endif | 2179 | #endif |
@@ -2201,7 +2187,7 @@ static SRes CheckErrors(CLzmaEnc *p) | |||
2201 | } | 2187 | } |
2202 | 2188 | ||
2203 | 2189 | ||
2204 | MY_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos) | 2190 | Z7_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos) |
2205 | { | 2191 | { |
2206 | /* ReleaseMFStream(); */ | 2192 | /* ReleaseMFStream(); */ |
2207 | p->finished = True; | 2193 | p->finished = True; |
@@ -2213,7 +2199,7 @@ MY_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos) | |||
2213 | } | 2199 | } |
2214 | 2200 | ||
2215 | 2201 | ||
2216 | MY_NO_INLINE static void FillAlignPrices(CLzmaEnc *p) | 2202 | Z7_NO_INLINE static void FillAlignPrices(CLzmaEnc *p) |
2217 | { | 2203 | { |
2218 | unsigned i; | 2204 | unsigned i; |
2219 | const CProbPrice *ProbPrices = p->ProbPrices; | 2205 | const CProbPrice *ProbPrices = p->ProbPrices; |
@@ -2237,7 +2223,7 @@ MY_NO_INLINE static void FillAlignPrices(CLzmaEnc *p) | |||
2237 | } | 2223 | } |
2238 | 2224 | ||
2239 | 2225 | ||
2240 | MY_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p) | 2226 | Z7_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p) |
2241 | { | 2227 | { |
2242 | // int y; for (y = 0; y < 100; y++) { | 2228 | // int y; for (y = 0; y < 100; y++) { |
2243 | 2229 | ||
@@ -2337,7 +2323,7 @@ static void LzmaEnc_Construct(CLzmaEnc *p) | |||
2337 | RangeEnc_Construct(&p->rc); | 2323 | RangeEnc_Construct(&p->rc); |
2338 | MatchFinder_Construct(&MFB); | 2324 | MatchFinder_Construct(&MFB); |
2339 | 2325 | ||
2340 | #ifndef _7ZIP_ST | 2326 | #ifndef Z7_ST |
2341 | p->matchFinderMt.MatchFinder = &MFB; | 2327 | p->matchFinderMt.MatchFinder = &MFB; |
2342 | MatchFinderMt_Construct(&p->matchFinderMt); | 2328 | MatchFinderMt_Construct(&p->matchFinderMt); |
2343 | #endif | 2329 | #endif |
@@ -2345,7 +2331,7 @@ static void LzmaEnc_Construct(CLzmaEnc *p) | |||
2345 | { | 2331 | { |
2346 | CLzmaEncProps props; | 2332 | CLzmaEncProps props; |
2347 | LzmaEncProps_Init(&props); | 2333 | LzmaEncProps_Init(&props); |
2348 | LzmaEnc_SetProps(p, &props); | 2334 | LzmaEnc_SetProps((CLzmaEncHandle)(void *)p, &props); |
2349 | } | 2335 | } |
2350 | 2336 | ||
2351 | #ifndef LZMA_LOG_BSR | 2337 | #ifndef LZMA_LOG_BSR |
@@ -2376,7 +2362,7 @@ static void LzmaEnc_FreeLits(CLzmaEnc *p, ISzAllocPtr alloc) | |||
2376 | 2362 | ||
2377 | static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig) | 2363 | static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig) |
2378 | { | 2364 | { |
2379 | #ifndef _7ZIP_ST | 2365 | #ifndef Z7_ST |
2380 | MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); | 2366 | MatchFinderMt_Destruct(&p->matchFinderMt, allocBig); |
2381 | #endif | 2367 | #endif |
2382 | 2368 | ||
@@ -2387,21 +2373,22 @@ static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBi | |||
2387 | 2373 | ||
2388 | void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig) | 2374 | void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig) |
2389 | { | 2375 | { |
2390 | LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig); | 2376 | // GET_CLzmaEnc_p |
2377 | LzmaEnc_Destruct(p, alloc, allocBig); | ||
2391 | ISzAlloc_Free(alloc, p); | 2378 | ISzAlloc_Free(alloc, p); |
2392 | } | 2379 | } |
2393 | 2380 | ||
2394 | 2381 | ||
2395 | MY_NO_INLINE | 2382 | Z7_NO_INLINE |
2396 | static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpackSize) | 2383 | static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpackSize) |
2397 | { | 2384 | { |
2398 | UInt32 nowPos32, startPos32; | 2385 | UInt32 nowPos32, startPos32; |
2399 | if (p->needInit) | 2386 | if (p->needInit) |
2400 | { | 2387 | { |
2401 | #ifndef _7ZIP_ST | 2388 | #ifndef Z7_ST |
2402 | if (p->mtMode) | 2389 | if (p->mtMode) |
2403 | { | 2390 | { |
2404 | RINOK(MatchFinderMt_InitMt(&p->matchFinderMt)); | 2391 | RINOK(MatchFinderMt_InitMt(&p->matchFinderMt)) |
2405 | } | 2392 | } |
2406 | #endif | 2393 | #endif |
2407 | p->matchFinder.Init(p->matchFinderObj); | 2394 | p->matchFinder.Init(p->matchFinderObj); |
@@ -2410,7 +2397,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa | |||
2410 | 2397 | ||
2411 | if (p->finished) | 2398 | if (p->finished) |
2412 | return p->result; | 2399 | return p->result; |
2413 | RINOK(CheckErrors(p)); | 2400 | RINOK(CheckErrors(p)) |
2414 | 2401 | ||
2415 | nowPos32 = (UInt32)p->nowPos64; | 2402 | nowPos32 = (UInt32)p->nowPos64; |
2416 | startPos32 = nowPos32; | 2403 | startPos32 = nowPos32; |
@@ -2473,7 +2460,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa | |||
2473 | const Byte *data; | 2460 | const Byte *data; |
2474 | unsigned state; | 2461 | unsigned state; |
2475 | 2462 | ||
2476 | RC_BIT_0(&p->rc, probs); | 2463 | RC_BIT_0(&p->rc, probs) |
2477 | p->rc.range = range; | 2464 | p->rc.range = range; |
2478 | data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; | 2465 | data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; |
2479 | probs = LIT_PROBS(nowPos32, *(data - 1)); | 2466 | probs = LIT_PROBS(nowPos32, *(data - 1)); |
@@ -2487,53 +2474,53 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa | |||
2487 | } | 2474 | } |
2488 | else | 2475 | else |
2489 | { | 2476 | { |
2490 | RC_BIT_1(&p->rc, probs); | 2477 | RC_BIT_1(&p->rc, probs) |
2491 | probs = &p->isRep[p->state]; | 2478 | probs = &p->isRep[p->state]; |
2492 | RC_BIT_PRE(&p->rc, probs) | 2479 | RC_BIT_PRE(&p->rc, probs) |
2493 | 2480 | ||
2494 | if (dist < LZMA_NUM_REPS) | 2481 | if (dist < LZMA_NUM_REPS) |
2495 | { | 2482 | { |
2496 | RC_BIT_1(&p->rc, probs); | 2483 | RC_BIT_1(&p->rc, probs) |
2497 | probs = &p->isRepG0[p->state]; | 2484 | probs = &p->isRepG0[p->state]; |
2498 | RC_BIT_PRE(&p->rc, probs) | 2485 | RC_BIT_PRE(&p->rc, probs) |
2499 | if (dist == 0) | 2486 | if (dist == 0) |
2500 | { | 2487 | { |
2501 | RC_BIT_0(&p->rc, probs); | 2488 | RC_BIT_0(&p->rc, probs) |
2502 | probs = &p->isRep0Long[p->state][posState]; | 2489 | probs = &p->isRep0Long[p->state][posState]; |
2503 | RC_BIT_PRE(&p->rc, probs) | 2490 | RC_BIT_PRE(&p->rc, probs) |
2504 | if (len != 1) | 2491 | if (len != 1) |
2505 | { | 2492 | { |
2506 | RC_BIT_1_BASE(&p->rc, probs); | 2493 | RC_BIT_1_BASE(&p->rc, probs) |
2507 | } | 2494 | } |
2508 | else | 2495 | else |
2509 | { | 2496 | { |
2510 | RC_BIT_0_BASE(&p->rc, probs); | 2497 | RC_BIT_0_BASE(&p->rc, probs) |
2511 | p->state = kShortRepNextStates[p->state]; | 2498 | p->state = kShortRepNextStates[p->state]; |
2512 | } | 2499 | } |
2513 | } | 2500 | } |
2514 | else | 2501 | else |
2515 | { | 2502 | { |
2516 | RC_BIT_1(&p->rc, probs); | 2503 | RC_BIT_1(&p->rc, probs) |
2517 | probs = &p->isRepG1[p->state]; | 2504 | probs = &p->isRepG1[p->state]; |
2518 | RC_BIT_PRE(&p->rc, probs) | 2505 | RC_BIT_PRE(&p->rc, probs) |
2519 | if (dist == 1) | 2506 | if (dist == 1) |
2520 | { | 2507 | { |
2521 | RC_BIT_0_BASE(&p->rc, probs); | 2508 | RC_BIT_0_BASE(&p->rc, probs) |
2522 | dist = p->reps[1]; | 2509 | dist = p->reps[1]; |
2523 | } | 2510 | } |
2524 | else | 2511 | else |
2525 | { | 2512 | { |
2526 | RC_BIT_1(&p->rc, probs); | 2513 | RC_BIT_1(&p->rc, probs) |
2527 | probs = &p->isRepG2[p->state]; | 2514 | probs = &p->isRepG2[p->state]; |
2528 | RC_BIT_PRE(&p->rc, probs) | 2515 | RC_BIT_PRE(&p->rc, probs) |
2529 | if (dist == 2) | 2516 | if (dist == 2) |
2530 | { | 2517 | { |
2531 | RC_BIT_0_BASE(&p->rc, probs); | 2518 | RC_BIT_0_BASE(&p->rc, probs) |
2532 | dist = p->reps[2]; | 2519 | dist = p->reps[2]; |
2533 | } | 2520 | } |
2534 | else | 2521 | else |
2535 | { | 2522 | { |
2536 | RC_BIT_1_BASE(&p->rc, probs); | 2523 | RC_BIT_1_BASE(&p->rc, probs) |
2537 | dist = p->reps[3]; | 2524 | dist = p->reps[3]; |
2538 | p->reps[3] = p->reps[2]; | 2525 | p->reps[3] = p->reps[2]; |
2539 | } | 2526 | } |
@@ -2557,7 +2544,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa | |||
2557 | else | 2544 | else |
2558 | { | 2545 | { |
2559 | unsigned posSlot; | 2546 | unsigned posSlot; |
2560 | RC_BIT_0(&p->rc, probs); | 2547 | RC_BIT_0(&p->rc, probs) |
2561 | p->rc.range = range; | 2548 | p->rc.range = range; |
2562 | p->state = kMatchNextStates[p->state]; | 2549 | p->state = kMatchNextStates[p->state]; |
2563 | 2550 | ||
@@ -2571,7 +2558,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa | |||
2571 | p->reps[0] = dist + 1; | 2558 | p->reps[0] = dist + 1; |
2572 | 2559 | ||
2573 | p->matchPriceCount++; | 2560 | p->matchPriceCount++; |
2574 | GetPosSlot(dist, posSlot); | 2561 | GetPosSlot(dist, posSlot) |
2575 | // RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], posSlot); | 2562 | // RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], posSlot); |
2576 | { | 2563 | { |
2577 | UInt32 sym = (UInt32)posSlot + (1 << kNumPosSlotBits); | 2564 | UInt32 sym = (UInt32)posSlot + (1 << kNumPosSlotBits); |
@@ -2582,7 +2569,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa | |||
2582 | CLzmaProb *prob = probs + (sym >> kNumPosSlotBits); | 2569 | CLzmaProb *prob = probs + (sym >> kNumPosSlotBits); |
2583 | UInt32 bit = (sym >> (kNumPosSlotBits - 1)) & 1; | 2570 | UInt32 bit = (sym >> (kNumPosSlotBits - 1)) & 1; |
2584 | sym <<= 1; | 2571 | sym <<= 1; |
2585 | RC_BIT(&p->rc, prob, bit); | 2572 | RC_BIT(&p->rc, prob, bit) |
2586 | } | 2573 | } |
2587 | while (sym < (1 << kNumPosSlotBits * 2)); | 2574 | while (sym < (1 << kNumPosSlotBits * 2)); |
2588 | p->rc.range = range; | 2575 | p->rc.range = range; |
@@ -2626,10 +2613,10 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpa | |||
2626 | { | 2613 | { |
2627 | unsigned m = 1; | 2614 | unsigned m = 1; |
2628 | unsigned bit; | 2615 | unsigned bit; |
2629 | bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit; | 2616 | bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit; |
2630 | bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit; | 2617 | bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit; |
2631 | bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit; | 2618 | bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit; |
2632 | bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); | 2619 | bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) |
2633 | p->rc.range = range; | 2620 | p->rc.range = range; |
2634 | // p->alignPriceCount++; | 2621 | // p->alignPriceCount++; |
2635 | } | 2622 | } |
@@ -2704,7 +2691,7 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, | |||
2704 | if (!RangeEnc_Alloc(&p->rc, alloc)) | 2691 | if (!RangeEnc_Alloc(&p->rc, alloc)) |
2705 | return SZ_ERROR_MEM; | 2692 | return SZ_ERROR_MEM; |
2706 | 2693 | ||
2707 | #ifndef _7ZIP_ST | 2694 | #ifndef Z7_ST |
2708 | p->mtMode = (p->multiThread && !p->fastMode && (MFB.btMode != 0)); | 2695 | p->mtMode = (p->multiThread && !p->fastMode && (MFB.btMode != 0)); |
2709 | #endif | 2696 | #endif |
2710 | 2697 | ||
@@ -2748,15 +2735,14 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr alloc, | |||
2748 | (numFastBytes + LZMA_MATCH_LEN_MAX + 1) | 2735 | (numFastBytes + LZMA_MATCH_LEN_MAX + 1) |
2749 | */ | 2736 | */ |
2750 | 2737 | ||
2751 | #ifndef _7ZIP_ST | 2738 | #ifndef Z7_ST |
2752 | if (p->mtMode) | 2739 | if (p->mtMode) |
2753 | { | 2740 | { |
2754 | RINOK(MatchFinderMt_Create(&p->matchFinderMt, dictSize, beforeSize, | 2741 | RINOK(MatchFinderMt_Create(&p->matchFinderMt, dictSize, beforeSize, |
2755 | p->numFastBytes, LZMA_MATCH_LEN_MAX + 1 /* 18.04 */ | 2742 | p->numFastBytes, LZMA_MATCH_LEN_MAX + 1 /* 18.04 */ |
2756 | , allocBig)); | 2743 | , allocBig)) |
2757 | p->matchFinderObj = &p->matchFinderMt; | 2744 | p->matchFinderObj = &p->matchFinderMt; |
2758 | MFB.bigHash = (Byte)( | 2745 | MFB.bigHash = (Byte)(MFB.hashMask >= 0xFFFFFF ? 1 : 0); |
2759 | (p->dictSize > kBigHashDicLimit && MFB.hashMask >= 0xFFFFFF) ? 1 : 0); | ||
2760 | MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); | 2746 | MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder); |
2761 | } | 2747 | } |
2762 | else | 2748 | else |
@@ -2872,59 +2858,53 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEnc *p, UInt32 keepWindowSize, ISzAllocPtr | |||
2872 | 2858 | ||
2873 | p->finished = False; | 2859 | p->finished = False; |
2874 | p->result = SZ_OK; | 2860 | p->result = SZ_OK; |
2875 | RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)); | 2861 | p->nowPos64 = 0; |
2862 | p->needInit = 1; | ||
2863 | RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig)) | ||
2876 | LzmaEnc_Init(p); | 2864 | LzmaEnc_Init(p); |
2877 | LzmaEnc_InitPrices(p); | 2865 | LzmaEnc_InitPrices(p); |
2878 | p->nowPos64 = 0; | ||
2879 | return SZ_OK; | 2866 | return SZ_OK; |
2880 | } | 2867 | } |
2881 | 2868 | ||
2882 | static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, | 2869 | static SRes LzmaEnc_Prepare(CLzmaEncHandle p, |
2870 | ISeqOutStreamPtr outStream, | ||
2871 | ISeqInStreamPtr inStream, | ||
2883 | ISzAllocPtr alloc, ISzAllocPtr allocBig) | 2872 | ISzAllocPtr alloc, ISzAllocPtr allocBig) |
2884 | { | 2873 | { |
2885 | CLzmaEnc *p = (CLzmaEnc *)pp; | 2874 | // GET_CLzmaEnc_p |
2886 | MFB.stream = inStream; | 2875 | MatchFinder_SET_STREAM(&MFB, inStream) |
2887 | p->needInit = 1; | ||
2888 | p->rc.outStream = outStream; | 2876 | p->rc.outStream = outStream; |
2889 | return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); | 2877 | return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig); |
2890 | } | 2878 | } |
2891 | 2879 | ||
2892 | SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, | 2880 | SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle p, |
2893 | ISeqInStream *inStream, UInt32 keepWindowSize, | 2881 | ISeqInStreamPtr inStream, UInt32 keepWindowSize, |
2894 | ISzAllocPtr alloc, ISzAllocPtr allocBig) | 2882 | ISzAllocPtr alloc, ISzAllocPtr allocBig) |
2895 | { | 2883 | { |
2896 | CLzmaEnc *p = (CLzmaEnc *)pp; | 2884 | // GET_CLzmaEnc_p |
2897 | MFB.stream = inStream; | 2885 | MatchFinder_SET_STREAM(&MFB, inStream) |
2898 | p->needInit = 1; | ||
2899 | return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); | 2886 | return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); |
2900 | } | 2887 | } |
2901 | 2888 | ||
2902 | static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen) | 2889 | SRes LzmaEnc_MemPrepare(CLzmaEncHandle p, |
2903 | { | 2890 | const Byte *src, SizeT srcLen, |
2904 | MFB.directInput = 1; | 2891 | UInt32 keepWindowSize, |
2905 | MFB.bufferBase = (Byte *)src; | 2892 | ISzAllocPtr alloc, ISzAllocPtr allocBig) |
2906 | MFB.directInputRem = srcLen; | ||
2907 | } | ||
2908 | |||
2909 | SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen, | ||
2910 | UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig) | ||
2911 | { | 2893 | { |
2912 | CLzmaEnc *p = (CLzmaEnc *)pp; | 2894 | // GET_CLzmaEnc_p |
2913 | LzmaEnc_SetInputBuf(p, src, srcLen); | 2895 | MatchFinder_SET_DIRECT_INPUT_BUF(&MFB, src, srcLen) |
2914 | p->needInit = 1; | 2896 | LzmaEnc_SetDataSize(p, srcLen); |
2915 | |||
2916 | LzmaEnc_SetDataSize(pp, srcLen); | ||
2917 | return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); | 2897 | return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig); |
2918 | } | 2898 | } |
2919 | 2899 | ||
2920 | void LzmaEnc_Finish(CLzmaEncHandle pp) | 2900 | void LzmaEnc_Finish(CLzmaEncHandle p) |
2921 | { | 2901 | { |
2922 | #ifndef _7ZIP_ST | 2902 | #ifndef Z7_ST |
2923 | CLzmaEnc *p = (CLzmaEnc *)pp; | 2903 | // GET_CLzmaEnc_p |
2924 | if (p->mtMode) | 2904 | if (p->mtMode) |
2925 | MatchFinderMt_ReleaseStream(&p->matchFinderMt); | 2905 | MatchFinderMt_ReleaseStream(&p->matchFinderMt); |
2926 | #else | 2906 | #else |
2927 | UNUSED_VAR(pp); | 2907 | UNUSED_VAR(p) |
2928 | #endif | 2908 | #endif |
2929 | } | 2909 | } |
2930 | 2910 | ||
@@ -2933,13 +2913,13 @@ typedef struct | |||
2933 | { | 2913 | { |
2934 | ISeqOutStream vt; | 2914 | ISeqOutStream vt; |
2935 | Byte *data; | 2915 | Byte *data; |
2936 | SizeT rem; | 2916 | size_t rem; |
2937 | BoolInt overflow; | 2917 | BoolInt overflow; |
2938 | } CLzmaEnc_SeqOutStreamBuf; | 2918 | } CLzmaEnc_SeqOutStreamBuf; |
2939 | 2919 | ||
2940 | static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, size_t size) | 2920 | static size_t SeqOutStreamBuf_Write(ISeqOutStreamPtr pp, const void *data, size_t size) |
2941 | { | 2921 | { |
2942 | CLzmaEnc_SeqOutStreamBuf *p = CONTAINER_FROM_VTBL(pp, CLzmaEnc_SeqOutStreamBuf, vt); | 2922 | Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CLzmaEnc_SeqOutStreamBuf) |
2943 | if (p->rem < size) | 2923 | if (p->rem < size) |
2944 | { | 2924 | { |
2945 | size = p->rem; | 2925 | size = p->rem; |
@@ -2956,25 +2936,25 @@ static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, s | |||
2956 | 2936 | ||
2957 | 2937 | ||
2958 | /* | 2938 | /* |
2959 | UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp) | 2939 | UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle p) |
2960 | { | 2940 | { |
2961 | const CLzmaEnc *p = (CLzmaEnc *)pp; | 2941 | GET_const_CLzmaEnc_p |
2962 | return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); | 2942 | return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj); |
2963 | } | 2943 | } |
2964 | */ | 2944 | */ |
2965 | 2945 | ||
2966 | const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp) | 2946 | const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle p) |
2967 | { | 2947 | { |
2968 | const CLzmaEnc *p = (CLzmaEnc *)pp; | 2948 | // GET_const_CLzmaEnc_p |
2969 | return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; | 2949 | return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset; |
2970 | } | 2950 | } |
2971 | 2951 | ||
2972 | 2952 | ||
2973 | // (desiredPackSize == 0) is not allowed | 2953 | // (desiredPackSize == 0) is not allowed |
2974 | SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit, | 2954 | SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle p, BoolInt reInit, |
2975 | Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) | 2955 | Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize) |
2976 | { | 2956 | { |
2977 | CLzmaEnc *p = (CLzmaEnc *)pp; | 2957 | // GET_CLzmaEnc_p |
2978 | UInt64 nowPos64; | 2958 | UInt64 nowPos64; |
2979 | SRes res; | 2959 | SRes res; |
2980 | CLzmaEnc_SeqOutStreamBuf outStream; | 2960 | CLzmaEnc_SeqOutStreamBuf outStream; |
@@ -3006,12 +2986,12 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit, | |||
3006 | } | 2986 | } |
3007 | 2987 | ||
3008 | 2988 | ||
3009 | MY_NO_INLINE | 2989 | Z7_NO_INLINE |
3010 | static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) | 2990 | static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgressPtr progress) |
3011 | { | 2991 | { |
3012 | SRes res = SZ_OK; | 2992 | SRes res = SZ_OK; |
3013 | 2993 | ||
3014 | #ifndef _7ZIP_ST | 2994 | #ifndef Z7_ST |
3015 | Byte allocaDummy[0x300]; | 2995 | Byte allocaDummy[0x300]; |
3016 | allocaDummy[0] = 0; | 2996 | allocaDummy[0] = 0; |
3017 | allocaDummy[1] = allocaDummy[0]; | 2997 | allocaDummy[1] = allocaDummy[0]; |
@@ -3033,7 +3013,7 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) | |||
3033 | } | 3013 | } |
3034 | } | 3014 | } |
3035 | 3015 | ||
3036 | LzmaEnc_Finish(p); | 3016 | LzmaEnc_Finish((CLzmaEncHandle)(void *)p); |
3037 | 3017 | ||
3038 | /* | 3018 | /* |
3039 | if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&MFB)) | 3019 | if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&MFB)) |
@@ -3045,21 +3025,22 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress) | |||
3045 | } | 3025 | } |
3046 | 3026 | ||
3047 | 3027 | ||
3048 | SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress, | 3028 | SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream, ICompressProgressPtr progress, |
3049 | ISzAllocPtr alloc, ISzAllocPtr allocBig) | 3029 | ISzAllocPtr alloc, ISzAllocPtr allocBig) |
3050 | { | 3030 | { |
3051 | RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig)); | 3031 | // GET_CLzmaEnc_p |
3052 | return LzmaEnc_Encode2((CLzmaEnc *)pp, progress); | 3032 | RINOK(LzmaEnc_Prepare(p, outStream, inStream, alloc, allocBig)) |
3033 | return LzmaEnc_Encode2(p, progress); | ||
3053 | } | 3034 | } |
3054 | 3035 | ||
3055 | 3036 | ||
3056 | SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) | 3037 | SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *props, SizeT *size) |
3057 | { | 3038 | { |
3058 | if (*size < LZMA_PROPS_SIZE) | 3039 | if (*size < LZMA_PROPS_SIZE) |
3059 | return SZ_ERROR_PARAM; | 3040 | return SZ_ERROR_PARAM; |
3060 | *size = LZMA_PROPS_SIZE; | 3041 | *size = LZMA_PROPS_SIZE; |
3061 | { | 3042 | { |
3062 | const CLzmaEnc *p = (const CLzmaEnc *)pp; | 3043 | // GET_CLzmaEnc_p |
3063 | const UInt32 dictSize = p->dictSize; | 3044 | const UInt32 dictSize = p->dictSize; |
3064 | UInt32 v; | 3045 | UInt32 v; |
3065 | props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); | 3046 | props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc); |
@@ -3083,23 +3064,24 @@ SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size) | |||
3083 | while (v < dictSize); | 3064 | while (v < dictSize); |
3084 | } | 3065 | } |
3085 | 3066 | ||
3086 | SetUi32(props + 1, v); | 3067 | SetUi32(props + 1, v) |
3087 | return SZ_OK; | 3068 | return SZ_OK; |
3088 | } | 3069 | } |
3089 | } | 3070 | } |
3090 | 3071 | ||
3091 | 3072 | ||
3092 | unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle pp) | 3073 | unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p) |
3093 | { | 3074 | { |
3094 | return (unsigned)((CLzmaEnc *)pp)->writeEndMark; | 3075 | // GET_CLzmaEnc_p |
3076 | return (unsigned)p->writeEndMark; | ||
3095 | } | 3077 | } |
3096 | 3078 | ||
3097 | 3079 | ||
3098 | SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, | 3080 | SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, |
3099 | int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig) | 3081 | int writeEndMark, ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig) |
3100 | { | 3082 | { |
3101 | SRes res; | 3083 | SRes res; |
3102 | CLzmaEnc *p = (CLzmaEnc *)pp; | 3084 | // GET_CLzmaEnc_p |
3103 | 3085 | ||
3104 | CLzmaEnc_SeqOutStreamBuf outStream; | 3086 | CLzmaEnc_SeqOutStreamBuf outStream; |
3105 | 3087 | ||
@@ -3111,7 +3093,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte | |||
3111 | p->writeEndMark = writeEndMark; | 3093 | p->writeEndMark = writeEndMark; |
3112 | p->rc.outStream = &outStream.vt; | 3094 | p->rc.outStream = &outStream.vt; |
3113 | 3095 | ||
3114 | res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig); | 3096 | res = LzmaEnc_MemPrepare(p, src, srcLen, 0, alloc, allocBig); |
3115 | 3097 | ||
3116 | if (res == SZ_OK) | 3098 | if (res == SZ_OK) |
3117 | { | 3099 | { |
@@ -3120,7 +3102,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte | |||
3120 | res = SZ_ERROR_FAIL; | 3102 | res = SZ_ERROR_FAIL; |
3121 | } | 3103 | } |
3122 | 3104 | ||
3123 | *destLen -= outStream.rem; | 3105 | *destLen -= (SizeT)outStream.rem; |
3124 | if (outStream.overflow) | 3106 | if (outStream.overflow) |
3125 | return SZ_ERROR_OUTPUT_EOF; | 3107 | return SZ_ERROR_OUTPUT_EOF; |
3126 | return res; | 3108 | return res; |
@@ -3129,9 +3111,9 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte | |||
3129 | 3111 | ||
3130 | SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, | 3112 | SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, |
3131 | const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, | 3113 | const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark, |
3132 | ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig) | 3114 | ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig) |
3133 | { | 3115 | { |
3134 | CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc); | 3116 | CLzmaEncHandle p = LzmaEnc_Create(alloc); |
3135 | SRes res; | 3117 | SRes res; |
3136 | if (!p) | 3118 | if (!p) |
3137 | return SZ_ERROR_MEM; | 3119 | return SZ_ERROR_MEM; |
@@ -3151,10 +3133,10 @@ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen, | |||
3151 | 3133 | ||
3152 | 3134 | ||
3153 | /* | 3135 | /* |
3154 | #ifndef _7ZIP_ST | 3136 | #ifndef Z7_ST |
3155 | void LzmaEnc_GetLzThreads(CLzmaEncHandle pp, HANDLE lz_threads[2]) | 3137 | void LzmaEnc_GetLzThreads(CLzmaEncHandle p, HANDLE lz_threads[2]) |
3156 | { | 3138 | { |
3157 | const CLzmaEnc *p = (CLzmaEnc *)pp; | 3139 | GET_const_CLzmaEnc_p |
3158 | lz_threads[0] = p->matchFinderMt.hashSync.thread; | 3140 | lz_threads[0] = p->matchFinderMt.hashSync.thread; |
3159 | lz_threads[1] = p->matchFinderMt.btSync.thread; | 3141 | lz_threads[1] = p->matchFinderMt.btSync.thread; |
3160 | } | 3142 | } |