Lines Matching refs:huffNode

228 static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits)  in HUF_setMaxHeight()  argument
230 const U32 largestBits = huffNode[lastNonNull].nbBits; in HUF_setMaxHeight()
243 while (huffNode[n].nbBits > maxNbBits) { in HUF_setMaxHeight()
244 totalCost += baseCost - (1 << (largestBits - huffNode[n].nbBits)); in HUF_setMaxHeight()
245 huffNode[n].nbBits = (BYTE)maxNbBits; in HUF_setMaxHeight()
249 assert(huffNode[n].nbBits <= maxNbBits); in HUF_setMaxHeight()
251 while (huffNode[n].nbBits == maxNbBits) --n; in HUF_setMaxHeight()
268 if (huffNode[pos].nbBits >= currentNbBits) continue; in HUF_setMaxHeight()
269 currentNbBits = huffNode[pos].nbBits; /* < maxNbBits */ in HUF_setMaxHeight()
286 { U32 const highTotal = huffNode[highPos].count; in HUF_setMaxHeight()
287 U32 const lowTotal = 2 * huffNode[lowPos].count; in HUF_setMaxHeight()
298 huffNode[rankLast[nBitsToDecrease]].nbBits++; in HUF_setMaxHeight()
317 if (huffNode[rankLast[nBitsToDecrease]].nbBits != maxNbBits-nBitsToDecrease) in HUF_setMaxHeight()
333 while (huffNode[n].nbBits == maxNbBits) n--; in HUF_setMaxHeight()
334 huffNode[n+1].nbBits--; in HUF_setMaxHeight()
340 huffNode[ rankLast[1] + 1 ].nbBits--; in HUF_setMaxHeight()
374 static void HUF_sort(nodeElt* huffNode, const unsigned* count, U32 maxSymbolValue, rankPos* rankPos… in HUF_sort() argument
403 while ((pos > rankPosition[r].base) && (c > huffNode[pos-1].count)) { in HUF_sort()
404 huffNode[pos] = huffNode[pos-1]; in HUF_sort()
407 huffNode[pos].count = c; in HUF_sort()
408 huffNode[pos].byte = (BYTE)n; in HUF_sort()
426 static int HUF_buildTree(nodeElt* huffNode, U32 maxSymbolValue) in HUF_buildTree() argument
428 nodeElt* const huffNode0 = huffNode - 1; in HUF_buildTree()
435 while(huffNode[nonNullRank].count == 0) nonNullRank--; in HUF_buildTree()
437 huffNode[nodeNb].count = huffNode[lowS].count + huffNode[lowS-1].count; in HUF_buildTree()
438 huffNode[lowS].parent = huffNode[lowS-1].parent = (U16)nodeNb; in HUF_buildTree()
440 for (n=nodeNb; n<=nodeRoot; n++) huffNode[n].count = (U32)(1U<<30); in HUF_buildTree()
445 int const n1 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; in HUF_buildTree()
446 int const n2 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; in HUF_buildTree()
447 huffNode[nodeNb].count = huffNode[n1].count + huffNode[n2].count; in HUF_buildTree()
448 huffNode[n1].parent = huffNode[n2].parent = (U16)nodeNb; in HUF_buildTree()
453 huffNode[nodeRoot].nbBits = 0; in HUF_buildTree()
455 huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; in HUF_buildTree()
457 huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; in HUF_buildTree()
472 static void HUF_buildCTableFromTree(HUF_CElt* CTable, nodeElt const* huffNode, int nonNullRank, U32… in HUF_buildCTableFromTree() argument
480 nbPerRank[huffNode[n].nbBits]++; in HUF_buildCTableFromTree()
489 … CTable[huffNode[n].byte].nbBits = huffNode[n].nbBits; /* push nbBits per symbol, symbol order */ in HUF_buildCTableFromTree()
498 nodeElt* const huffNode = huffNode0+1; in HUF_buildCTable_wksp() local
511 HUF_sort(huffNode, count, maxSymbolValue, wksp_tables->rankPosition); in HUF_buildCTable_wksp()
514 nonNullRank = HUF_buildTree(huffNode, maxSymbolValue); in HUF_buildCTable_wksp()
517 maxNbBits = HUF_setMaxHeight(huffNode, (U32)nonNullRank, maxNbBits); in HUF_buildCTable_wksp()
520 HUF_buildCTableFromTree(tree, huffNode, nonNullRank, maxSymbolValue, maxNbBits); in HUF_buildCTable_wksp()