Function report |
Source Code:lib\zstd\compress.c |
Create Date:2022-07-28 07:03:17 |
| Last Modify:2020-03-12 14:18:49 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:ZSTD_compressSequences_internal
Proto:ZSTD_STATIC size_t ZSTD_compressSequences_internal(ZSTD_CCtx *zc, void *dst, size_t dstCapacity)
Type:size_t
Parameter:
| Type | Parameter | Name |
|---|---|---|
| ZSTD_CCtx * | zc | |
| void * | dst | |
| size_t | dstCapacity |
| 589 | seqStorePtr = &seqStore |
| 594 | sequences = sequencesStart |
| 595 | ofCodeTable = ofCode |
| 596 | llCodeTable = llCode |
| 597 | mlCodeTable = mlCode |
| 599 | oend = ostart + dstCapacity |
| 601 | nbSeq = sequences - sequencesStart |
| 607 | workspaceSize = size of tmpCounters |
| 609 | spaceUsed32 = 0 |
| 610 | count = tmpCounters + spaceUsed32 |
| 611 | spaceUsed32 += Assumption : MaxOff < MaxLL,MaxML + 1 |
| 612 | norm = tmpCounters + spaceUsed32 |
| 613 | spaceUsed32 += @a is a power of 2 value (sizeof(S16) * (Assumption : MaxOff < MaxLL,MaxML + 1), sizeof(U32)) >> 2 |
| 615 | workspace = tmpCounters + spaceUsed32 |
| 616 | workspaceSize -= spaceUsed32 << 2 |
| 623 | cSize = ZSTD_compressLiterals(zc, op, dstCapacity, literals, litSize) |
| 630 | If oend - op < 3 + 1 Then Return -***************************************** Error codes handling(dstSize_tooSmall) |
| 653 | mostFrequent = FSE_countFast_wksp() :* Same as FSE_countFast(), but using an externally provided scratch buffer.* `workSpace` size must be table of >= `1024` unsigned |
| 654 | If mostFrequent == nbSeq && nbSeq > 2 Then |
| 655 | op++ = llCodeTable[0] |
| 658 | Else if flagStaticTables && nbSeq < MAX_SEQ_FOR_STATIC_FSE Then |
| 659 | LLtype = set_repeat |
| 660 | Else if nbSeq < seqHead : flags for FSE encoding type || mostFrequent < nbSeq >> LL_defaultNormLog - 1 Then |
| 663 | Else |
| 665 | tableLog = FSE_optimalTableLog(LLFSELog, nbSeq, max) |
| 666 | If count[llCodeTable[nbSeq - 1]] > 1 Then |
| 667 | count[llCodeTable[nbSeq - 1]]-- |
| 668 | nbSeq_1-- |
| 672 | NCountSize = FSE_writeNCount(op, oend - op, norm, max, tableLog) |
| 673 | If Error Management Then Return NCountSize |
| 675 | op += NCountSize |
| 678 | LLtype = set_compressed |
| 685 | mostFrequent = FSE_countFast_wksp() :* Same as FSE_countFast(), but using an externally provided scratch buffer.* `workSpace` size must be table of >= `1024` unsigned |
| 686 | If mostFrequent == nbSeq && nbSeq > 2 Then |
| 687 | op++ = ofCodeTable[0] |
| 690 | Else if flagStaticTables && nbSeq < MAX_SEQ_FOR_STATIC_FSE Then |
| 691 | Offtype = set_repeat |
| 692 | Else if nbSeq < seqHead : flags for FSE encoding type || mostFrequent < nbSeq >> OF_defaultNormLog - 1 Then |
| 695 | Else |
| 697 | tableLog = FSE_optimalTableLog(OffFSELog, nbSeq, max) |
| 698 | If count[ofCodeTable[nbSeq - 1]] > 1 Then |
| 699 | count[ofCodeTable[nbSeq - 1]]-- |
| 700 | nbSeq_1-- |
| 704 | NCountSize = FSE_writeNCount(op, oend - op, norm, max, tableLog) |
| 705 | If Error Management Then Return NCountSize |
| 707 | op += NCountSize |
| 710 | Offtype = set_compressed |
| 717 | mostFrequent = FSE_countFast_wksp() :* Same as FSE_countFast(), but using an externally provided scratch buffer.* `workSpace` size must be table of >= `1024` unsigned |
| 718 | If mostFrequent == nbSeq && nbSeq > 2 Then |
| 722 | Else if flagStaticTables && nbSeq < MAX_SEQ_FOR_STATIC_FSE Then |
| 723 | MLtype = set_repeat |
| 724 | Else if nbSeq < seqHead : flags for FSE encoding type || mostFrequent < nbSeq >> ML_defaultNormLog - 1 Then |
| 727 | Else |
| 729 | tableLog = FSE_optimalTableLog(MLFSELog, nbSeq, max) |
| 730 | If count[mlCodeTable[nbSeq - 1]] > 1 Then |
| 731 | count[mlCodeTable[nbSeq - 1]]-- |
| 732 | nbSeq_1-- |
| 736 | NCountSize = FSE_writeNCount(op, oend - op, norm, max, tableLog) |
| 737 | If Error Management Then Return NCountSize |
| 739 | op += NCountSize |
| 742 | MLtype = set_compressed |
| 747 | flagStaticTables = 0 |
| 762 | BIT_addBits( & blockStream, litLength, LL_bits[llCodeTable[nbSeq - 1]]) |
| 763 | If -*************************************************************** Memory I/O Then BIT_flushBits( & blockStream) |
| 765 | BIT_addBits( & blockStream, matchLength, ML_bits[mlCodeTable[nbSeq - 1]]) |
| 766 | If -*************************************************************** Memory I/O Then BIT_flushBits( & blockStream) |
| 768 | If longOffsets Then |
| 769 | ofBits = ofCodeTable[nbSeq - 1] |
| 770 | extraBits = ofBits - -************************************** shared macros(ofBits, STREAM_ACCUMULATOR_MIN - 1) |
| 771 | If extraBits Then |
| 772 | BIT_addBits( & blockStream, offset, extraBits) |
| 773 | BIT_flushBits( & blockStream) |
| 775 | BIT_addBits( & blockStream, offset >> extraBits, ofBits - extraBits) |
| 776 | Else |
| 777 | BIT_addBits( & blockStream, offset, ofCodeTable[nbSeq - 1]) |
| 779 | BIT_flushBits( & blockStream) |
| 784 | llCode = llCodeTable[n] |
| 785 | ofCode = ofCodeTable[n] |
| 786 | mlCode = mlCodeTable[n] |
| 791 | FSE_encodeSymbol( & blockStream, & stateOffsetBits, ofCode) |
| 792 | FSE_encodeSymbol( & blockStream, & stateMatchLength, mlCode) |
| 793 | If -*************************************************************** Memory I/O Then BIT_flushBits( & blockStream) |
| 795 | FSE_encodeSymbol( & blockStream, & stateLitLength, llCode) |
| 796 | If -*************************************************************** Memory I/O || ofBits + mlBits + llBits >= 64 - 7 - LLFSELog + MLFSELog + OffFSELog Then BIT_flushBits( & blockStream) |
| 798 | BIT_addBits( & blockStream, litLength, llBits) |
| 799 | If -*************************************************************** Memory I/O && llBits + mlBits > 24 Then BIT_flushBits( & blockStream) |
| 801 | BIT_addBits( & blockStream, matchLength, mlBits) |
| 802 | If -*************************************************************** Memory I/O Then BIT_flushBits( & blockStream) |
| 804 | If longOffsets Then |
| 805 | extraBits = ofBits - -************************************** shared macros(ofBits, STREAM_ACCUMULATOR_MIN - 1) |
| 806 | If extraBits Then |
| 807 | BIT_addBits( & blockStream, offset, extraBits) |
| 808 | BIT_flushBits( & blockStream) |
| 810 | BIT_addBits( & blockStream, offset >> extraBits, ofBits - extraBits) |
| 811 | Else |
| 812 | BIT_addBits( & blockStream, offset, ofBits) |
| 814 | BIT_flushBits( & blockStream) |
| 818 | FSE_flushCState( & blockStream, & stateMatchLength) |
| 819 | FSE_flushCState( & blockStream, & stateOffsetBits) |
| 820 | FSE_flushCState( & blockStream, & stateLitLength) |
| 823 | streamSize = BIT_closeCStream( & blockStream) |
| 824 | If streamSize == 0 Then Return -***************************************** Error codes handling(dstSize_tooSmall) |
| 826 | op += streamSize |
| Name | Describe |
|---|---|
| ZSTD_compressSequences |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |