Lines Matching refs:bits
606 static unsigned reverseBits(unsigned bits, unsigned num) { in reverseBits() argument
609 for(i = 0; i < num; i++) result |= ((bits >> (num - i - 1u)) & 1u) << i; in reverseBits()
813 unsigned bits, n; in HuffmanTree_makeFromLengths2() local
823 for(bits = 0; bits != tree->numcodes; ++bits) ++blcount[tree->lengths[bits]]; in HuffmanTree_makeFromLengths2()
825 for(bits = 1; bits <= tree->maxbitlen; ++bits) { in HuffmanTree_makeFromLengths2()
826 nextcode[bits] = (nextcode[bits - 1] + blcount[bits - 1]) << 1u; in HuffmanTree_makeFromLengths2()
3095 static void addColorBits(unsigned char* out, size_t index, unsigned bits, unsigned in) { in addColorBits() argument
3096 unsigned m = bits == 1 ? 7 : bits == 2 ? 3 : 1; /*8 / bits - 1*/ in addColorBits()
3099 in &= (1u << bits) - 1u; /*filter out any other bits of the input value*/ in addColorBits()
3100 in = in << (bits * (m - p)); in addColorBits()
3101 if(p == 0) out[index * bits / 8u] = in; in addColorBits()
3102 else out[index * bits / 8u] |= in; in addColorBits()
3667 stats->bits = 1; in lodepng_color_stats_init()
3708 unsigned bits_done = (stats->bits == 1 && bpp == 1) ? 1 : 0; in lodepng_compute_color_stats()
3724 if(stats->bits == 16) numcolors_done = 1; in lodepng_compute_color_stats()
3725 if(stats->bits >= bpp) bits_done = 1; in lodepng_compute_color_stats()
3743 stats->bits = 16; in lodepng_compute_color_stats()
3800 if(!bits_done && stats->bits < 8) { in lodepng_compute_color_stats()
3802 unsigned bits = getValueRequiredBits(r); in lodepng_compute_color_stats() local
3803 if(bits > stats->bits) stats->bits = bits; in lodepng_compute_color_stats()
3805 bits_done = (stats->bits >= bpp); in lodepng_compute_color_stats()
3810 … if(stats->bits < 8) stats->bits = 8; /*PNG has no colored modes with less than 8-bit per channel*/ in lodepng_compute_color_stats()
3819 …if(stats->bits < 8) stats->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per chan… in lodepng_compute_color_stats()
3830 …if(stats->bits < 8) stats->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per chan… in lodepng_compute_color_stats()
3862 …if(stats->bits < 8) stats->bits = 8; /*PNG has no alphachannel modes with less than 8-bit per chan… in lodepng_compute_color_stats()
3916 unsigned bits = stats->bits; in auto_choose_color() local
3923 if(bits < 8) bits = 8; /*PNG has no alphachannel modes with less than 8-bit per channel*/ in auto_choose_color()
3928 if(!gray_ok && bits < 8) bits = 8; in auto_choose_color()
3932 palette_ok = n <= 256 && bits <= 8 && n != 0; /*n==0 means likely numcolors wasn't computed*/ in auto_choose_color()
3934 if(gray_ok && !alpha && bits <= palettebits) palette_ok = 0; /*gray is less overhead*/ in auto_choose_color()
3955 mode_out->bitdepth = bits; in auto_choose_color()