Lines Matching defs:code
36 * structure assignment. You'll need to fix this code if you have
102 * just count the Huffman symbols used and generate Huffman code tables.
187 unsigned int code;
189 /* Note that huffsize[] and huffcode[] are filled in code-length order,
208 /* Figure C.1: make table of Huffman code length for each symbol */
222 /* We also validate that the counts represent a legal Huffman code tree. */
224 code = 0;
229 huffcode[p++] = code;
230 code++;
232 /* code is now 1 more than the last code used for codelength si; but
233 * it must still fit in si bits, since no code is allowed to be all ones.
235 if (((JPEG_INT32) code) >= (((JPEG_INT32) 1) << si))
237 code <<= 1;
242 /* These are code and size indexed by symbol value */
244 /* Set all codeless symbols to have code length 0;
302 emit_bits (working_state * state, unsigned int code, int size)
306 register JPEG_INT32 put_buffer = (JPEG_INT32) code;
313 put_buffer &= (((JPEG_INT32) 1)<<size) - 1; /* mask off any extra bits in code */
367 /* This code assumes we are on a two's complement machine */
411 /* This code assumes we are on a two's complement machine */
437 /* If the last coef(s) were zero, emit an end-of-block code */
559 * that is to be Huffman-coded. (This process MUST agree with the code above.)
562 * assigned any code, which saves space in the DHT marker as well as in
633 /* If the last coef(s) were zero, emit an end-of-block code */
677 * Generate the best Huffman code table for the given counts, fill htbl.
682 * can't look like a valid code). Because of the canonical ordering of
687 * including it in the symbol set anyway should give a better Huffman code.
688 * But the theoretically better code actually seems to come out worse in
694 * must be adjusted to meet the code length restriction. We currently use
696 * optimal; it may not choose the best possible limited-length code. But
698 * lengths, so the code is almost optimal. Experimental comparisons against
699 * an optimal limited-length-code algorithm indicate that the difference is
707 #define MAX_CLEN 32 /* assumed maximum initial code length */
708 UINT8 bits[MAX_CLEN+1]; /* bits[k] = # of symbols with code length k */
709 int codesize[257]; /* codesize[k] = code length of symbol k */
724 * that no real symbol is given code-value of all ones, because 256
728 /* Huffman's basic algorithm to assign optimal code lengths to symbols */
778 /* Now count the number of symbols of each code length */
790 /* JPEG doesn't allow symbols with code lengths over 16 bits, so if the pure
793 * Since symbols are paired for the longest Huffman code, the symbols are
796 * skipping the BITS entry for that prefix length, a code word from the next
797 * shortest nonzero BITS entry is converted into a prefix for two code words
822 /* Return a list of the symbols sorted by code length */