Lines Matching defs:numcodes
492 unsigned numcodes; /*number of symbols in the alphabet = number of codes*/
499 std::cout << "tree. length: " << tree->numcodes << " maxbitlen: " << tree->maxbitlen << std::endl;
526 unsigned treepos = 0; /*position in the tree (1 of the numcodes columns)*/
529 tree->tree2d = (unsigned*)lodepng_malloc(tree->numcodes * 2 * sizeof(unsigned));
534 uninited, a value >= numcodes is an address to another bit, a value < numcodes
542 for(n = 0; n < tree->numcodes * 2; n++)
547 for(n = 0; n < tree->numcodes; n++) /*the codes*/
552 if(treepos > tree->numcodes - 2) return 55; /*oversubscribed, see comment in lodepng_error_text*/
565 /*addresses encoded with numcodes added to it*/
566 tree->tree2d[2 * treepos + bit] = nodefilled + tree->numcodes;
570 else treepos = tree->tree2d[2 * treepos + bit] - tree->numcodes;
574 for(n = 0; n < tree->numcodes * 2; n++)
584 numcodes, lengths and maxbitlen must already be filled in correctly. return
596 tree->tree1d = (unsigned*)lodepng_malloc(tree->numcodes * sizeof(unsigned));
606 for(bits = 0; bits < tree->numcodes; bits++) blcount.data[tree->lengths[bits]]++;
613 for(n = 0; n < tree->numcodes; n++)
632 size_t numcodes, unsigned maxbitlen)
635 tree->lengths = (unsigned*)lodepng_malloc(numcodes * sizeof(unsigned));
637 for(i = 0; i < numcodes; i++) tree->lengths[i] = bitlen[i];
638 tree->numcodes = (unsigned)numcodes; /*number of symbols*/
698 static unsigned append_symbol_coins(Coin* coins, const unsigned* frequencies, unsigned numcodes, size_t sum)
702 for(i = 0; i < numcodes; i++)
715 size_t numcodes, unsigned maxbitlen)
725 if(numcodes == 0) return 80; /*error: a tree of 0 symbols is not supposed to be made*/
727 for(i = 0; i < numcodes; i++)
736 for(i = 0; i < numcodes; i++) lengths[i] = 0;
749 for(i = 0; i < numcodes; i++)
777 error = append_symbol_coins(coins, frequencies, numcodes, sum);
807 error = append_symbol_coins(coins + numcoins, frequencies, numcodes, sum);
835 size_t mincodes, size_t numcodes, unsigned maxbitlen)
838 while(!frequencies[numcodes - 1] && numcodes > mincodes) numcodes--; /*trim zeroes*/
840 tree->numcodes = (unsigned)numcodes; /*number of symbols*/
841 tree->lengths = (unsigned*)lodepng_realloc(tree->lengths, numcodes * sizeof(unsigned));
844 memset(tree->lengths, 0, numcodes * sizeof(unsigned));
846 error = lodepng_huffman_code_lengths(tree->lengths, frequencies, numcodes, maxbitlen);
915 if(ct < codetree->numcodes) return ct; /*the symbol is decoded, return it*/
916 else treepos = ct - codetree->numcodes; /*symbol not yet decoded, instead move tree position*/
918 if(treepos >= codetree->numcodes) return (unsigned)(-1); /*error: it appeared outside the codetree*/
1766 numcodes_ll = tree_ll.numcodes; if(numcodes_ll > 286) numcodes_ll = 286;
1767 numcodes_d = tree_d.numcodes; if(numcodes_d > 30) numcodes_d = 30;
1834 if(!uivector_resize(&bitlen_cl, tree_cl.numcodes)) ERROR_BREAK(83 /*alloc fail*/);
1835 for(i = 0; i < tree_cl.numcodes; i++)