Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\zstd\entropy_common.c Create Date:2022-07-28 07:08:00
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:-*************************************************************** FSE NCount encoding-decoding

Proto:size_t FSE_readNCount(short *normalizedCounter, unsigned *maxSVPtr, unsigned *tableLogPtr, const void *headerBuffer, size_t hbSize)

Type:size_t

Parameter:

TypeParameterName
short *normalizedCounter
unsigned *maxSVPtr
unsigned *tableLogPtr
const void *headerBuffer
size_thbSize
61  istart = headerBuffer
62  iend = istart + hbSize
63  ip = istart
69  charnum = 0
70  previous0 = 0
72  If hbSize < 4 Then Return -***************************************** Error codes handling(srcSize_wrong)
74  bitStream = ZSTD_readLE32(ip)
75  nbBits = (bitStream & 0xF) + FSE_MIN_TABLELOG
76  If nbBits > FSE_TABLELOG_ABSOLUTE_MAX Then Return -***************************************** Error codes handling(tableLog_tooLarge)
78  bitStream >>= 4
79  bitCount = 4
80  tableLogPtr = nbBits
81  remaining = (1 << nbBits) + 1
82  threshold = 1 << nbBits
83  nbBits++
85  When remaining > 1 & charnum <= maxSVPtr cycle
86  If previous0 Then
87  n0 = charnum
88  When (bitStream & 0xFFFF) == 0xFFFF cycle
89  n0 += 24
90  If ip < iend - 5 Then
91  ip += 2
93  Else
94  bitStream >>= 16
95  bitCount += 16
98  When (bitStream & 3) == 3 cycle
99  n0 += 3
100  bitStream >>= 2
101  bitCount += 2
103  n0 += bitStream & 3
104  bitCount += 2
107  When charnum < n0 cycle
108  normalizedCounter[charnum++] = 0
109  If ip <= iend - 7 || ip + (bitCount >> 3) <= iend - 4 Then
110  ip += bitCount >> 3
111  bitCount &= 7
113  Else
114  bitStream >>= 2
118  max = 2 * threshold - 1 - remaining
121  If (bitStream & threshold - 1 ) < max Then
122  count = bitStream & threshold - 1
123  bitCount += nbBits - 1
124  Else
125  count = bitStream & 2 * threshold - 1
126  If count >= threshold Then count -= max
128  bitCount += nbBits
131  count--
132  remaining -= If count < 0 Then -count Else count
134  previous0 = Not count
135  When remaining < threshold cycle
136  nbBits--
137  threshold >>= 1
140  If ip <= iend - 7 || ip + (bitCount >> 3) <= iend - 4 Then
141  ip += bitCount >> 3
142  bitCount &= 7
143  Else
144  bitCount -= 8 * ( iend - 4 - ip)
145  ip = iend - 4
147  bitStream = ZSTD_readLE32(ip) >> (bitCount & 31)
150  If remaining != 1 Then Return -***************************************** Error codes handling(corruption_detected)
152  If bitCount > 32 Then Return -***************************************** Error codes handling(corruption_detected)
154  maxSVPtr = charnum - 1
156  ip += bitCount + 7 >> 3
157  Return ip - istart
Caller
NameDescribe
ZSTD_loadZstdDictionary : 0, or an error code
FSE_decompress_wksp
ZSTD_buildSeqTable : nb bytes read from src,
ZSTD_loadEntropy : size of entropy tables read