Lines Matching refs:huffNode
244 static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits) in HUF_setMaxHeight() argument
246 const U32 largestBits = huffNode[lastNonNull].nbBits; in HUF_setMaxHeight()
259 while (huffNode[n].nbBits > maxNbBits) { in HUF_setMaxHeight()
260 totalCost += baseCost - (1 << (largestBits - huffNode[n].nbBits)); in HUF_setMaxHeight()
261 huffNode[n].nbBits = (BYTE)maxNbBits; in HUF_setMaxHeight()
265 assert(huffNode[n].nbBits <= maxNbBits); in HUF_setMaxHeight()
267 while (huffNode[n].nbBits == maxNbBits) --n; in HUF_setMaxHeight()
284 if (huffNode[pos].nbBits >= currentNbBits) continue; in HUF_setMaxHeight()
285 currentNbBits = huffNode[pos].nbBits; /* < maxNbBits */ in HUF_setMaxHeight()
302 { U32 const highTotal = huffNode[highPos].count; in HUF_setMaxHeight()
303 U32 const lowTotal = 2 * huffNode[lowPos].count; in HUF_setMaxHeight()
314 huffNode[rankLast[nBitsToDecrease]].nbBits++; in HUF_setMaxHeight()
333 if (huffNode[rankLast[nBitsToDecrease]].nbBits != maxNbBits-nBitsToDecrease) in HUF_setMaxHeight()
349 while (huffNode[n].nbBits == maxNbBits) n--; in HUF_setMaxHeight()
350 huffNode[n+1].nbBits--; in HUF_setMaxHeight()
356 huffNode[ rankLast[1] + 1 ].nbBits--; in HUF_setMaxHeight()
390 static void HUF_sort(nodeElt* huffNode, const unsigned* count, U32 maxSymbolValue, rankPos* rankPos… in HUF_sort() argument
419 while ((pos > rankPosition[r].base) && (c > huffNode[pos-1].count)) { in HUF_sort()
420 huffNode[pos] = huffNode[pos-1]; in HUF_sort()
423 huffNode[pos].count = c; in HUF_sort()
424 huffNode[pos].byte = (BYTE)n; in HUF_sort()
442 static int HUF_buildTree(nodeElt* huffNode, U32 maxSymbolValue) in HUF_buildTree() argument
444 nodeElt* const huffNode0 = huffNode - 1; in HUF_buildTree()
451 while(huffNode[nonNullRank].count == 0) nonNullRank--; in HUF_buildTree()
453 huffNode[nodeNb].count = huffNode[lowS].count + huffNode[lowS-1].count; in HUF_buildTree()
454 huffNode[lowS].parent = huffNode[lowS-1].parent = (U16)nodeNb; in HUF_buildTree()
456 for (n=nodeNb; n<=nodeRoot; n++) huffNode[n].count = (U32)(1U<<30); in HUF_buildTree()
461 int const n1 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; in HUF_buildTree()
462 int const n2 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; in HUF_buildTree()
463 huffNode[nodeNb].count = huffNode[n1].count + huffNode[n2].count; in HUF_buildTree()
464 huffNode[n1].parent = huffNode[n2].parent = (U16)nodeNb; in HUF_buildTree()
469 huffNode[nodeRoot].nbBits = 0; in HUF_buildTree()
471 huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; in HUF_buildTree()
473 huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; in HUF_buildTree()
488 static void HUF_buildCTableFromTree(HUF_CElt* CTable, nodeElt const* huffNode, int nonNullRank, U32… in HUF_buildCTableFromTree() argument
496 nbPerRank[huffNode[n].nbBits]++; in HUF_buildCTableFromTree()
505 … CTable[huffNode[n].byte].nbBits = huffNode[n].nbBits; /* push nbBits per symbol, symbol order */ in HUF_buildCTableFromTree()
514 nodeElt* const huffNode = huffNode0+1; in HUF_buildCTable_wksp() local
527 HUF_sort(huffNode, count, maxSymbolValue, wksp_tables->rankPosition); in HUF_buildCTable_wksp()
530 nonNullRank = HUF_buildTree(huffNode, maxSymbolValue); in HUF_buildCTable_wksp()
533 maxNbBits = HUF_setMaxHeight(huffNode, (U32)nonNullRank, maxNbBits); in HUF_buildCTable_wksp()
536 HUF_buildCTableFromTree(tree, huffNode, nonNullRank, maxSymbolValue, maxNbBits); in HUF_buildCTable_wksp()