Lines Matching refs:huffNode
305 static U32 HUF_setMaxHeight(nodeElt* huffNode, U32 lastNonNull, U32 maxNbBits) in HUF_setMaxHeight() argument
307 const U32 largestBits = huffNode[lastNonNull].nbBits; in HUF_setMaxHeight()
320 while (huffNode[n].nbBits > maxNbBits) { in HUF_setMaxHeight()
321 totalCost += baseCost - (1 << (largestBits - huffNode[n].nbBits)); in HUF_setMaxHeight()
322 huffNode[n].nbBits = (BYTE)maxNbBits; in HUF_setMaxHeight()
326 assert(huffNode[n].nbBits <= maxNbBits); in HUF_setMaxHeight()
328 while (huffNode[n].nbBits == maxNbBits) --n; in HUF_setMaxHeight()
345 if (huffNode[pos].nbBits >= currentNbBits) continue; in HUF_setMaxHeight()
346 currentNbBits = huffNode[pos].nbBits; /* < maxNbBits */ in HUF_setMaxHeight()
363 { U32 const highTotal = huffNode[highPos].count; in HUF_setMaxHeight()
364 U32 const lowTotal = 2 * huffNode[lowPos].count; in HUF_setMaxHeight()
375 huffNode[rankLast[nBitsToDecrease]].nbBits++; in HUF_setMaxHeight()
394 if (huffNode[rankLast[nBitsToDecrease]].nbBits != maxNbBits-nBitsToDecrease) in HUF_setMaxHeight()
410 while (huffNode[n].nbBits == maxNbBits) n--; in HUF_setMaxHeight()
411 huffNode[n+1].nbBits--; in HUF_setMaxHeight()
417 huffNode[ rankLast[1] + 1 ].nbBits--; in HUF_setMaxHeight()
471 MEM_STATIC int HUF_isSorted(nodeElt huffNode[], U32 const maxSymbolValue1) { in HUF_isSorted() argument
474 if (huffNode[i].count > huffNode[i-1].count) { in HUF_isSorted()
482 HINT_INLINE void HUF_insertionSort(nodeElt huffNode[], int const low, int const high) { in HUF_insertionSort() argument
485 huffNode += low; in HUF_insertionSort()
487 nodeElt const key = huffNode[i]; in HUF_insertionSort()
489 while (j >= 0 && huffNode[j].count < key.count) { in HUF_insertionSort()
490 huffNode[j + 1] = huffNode[j]; in HUF_insertionSort()
493 huffNode[j + 1] = key; in HUF_insertionSort()
547 static void HUF_sort(nodeElt huffNode[], const unsigned count[], U32 const maxSymbolValue, rankPos … in HUF_sort() argument
577 huffNode[pos].count = c; in HUF_sort()
578 huffNode[pos].byte = (BYTE)n; in HUF_sort()
587 HUF_simpleQuickSort(huffNode + bucketStartIdx, 0, bucketSize-1); in HUF_sort()
591 assert(HUF_isSorted(huffNode, maxSymbolValue1)); in HUF_sort()
607 static int HUF_buildTree(nodeElt* huffNode, U32 maxSymbolValue) in HUF_buildTree() argument
609 nodeElt* const huffNode0 = huffNode - 1; in HUF_buildTree()
616 while(huffNode[nonNullRank].count == 0) nonNullRank--; in HUF_buildTree()
618 huffNode[nodeNb].count = huffNode[lowS].count + huffNode[lowS-1].count; in HUF_buildTree()
619 huffNode[lowS].parent = huffNode[lowS-1].parent = (U16)nodeNb; in HUF_buildTree()
621 for (n=nodeNb; n<=nodeRoot; n++) huffNode[n].count = (U32)(1U<<30); in HUF_buildTree()
626 int const n1 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; in HUF_buildTree()
627 int const n2 = (huffNode[lowS].count < huffNode[lowN].count) ? lowS-- : lowN++; in HUF_buildTree()
628 huffNode[nodeNb].count = huffNode[n1].count + huffNode[n2].count; in HUF_buildTree()
629 huffNode[n1].parent = huffNode[n2].parent = (U16)nodeNb; in HUF_buildTree()
634 huffNode[nodeRoot].nbBits = 0; in HUF_buildTree()
636 huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; in HUF_buildTree()
638 huffNode[n].nbBits = huffNode[ huffNode[n].parent ].nbBits + 1; in HUF_buildTree()
653 static void HUF_buildCTableFromTree(HUF_CElt* CTable, nodeElt const* huffNode, int nonNullRank, U32… in HUF_buildCTableFromTree() argument
662 nbPerRank[huffNode[n].nbBits]++; in HUF_buildCTableFromTree()
671 …HUF_setNbBits(ct + huffNode[n].byte, huffNode[n].nbBits); /* push nbBits per symbol, symbol orde… in HUF_buildCTableFromTree()
681 nodeElt* const huffNode = huffNode0+1; in HUF_buildCTable_wksp() local
693 HUF_sort(huffNode, count, maxSymbolValue, wksp_tables->rankPosition); in HUF_buildCTable_wksp()
696 nonNullRank = HUF_buildTree(huffNode, maxSymbolValue); in HUF_buildCTable_wksp()
699 maxNbBits = HUF_setMaxHeight(huffNode, (U32)nonNullRank, maxNbBits); in HUF_buildCTable_wksp()
702 HUF_buildCTableFromTree(CTable, huffNode, nonNullRank, maxSymbolValue, maxNbBits); in HUF_buildCTable_wksp()