MCPcopy Create free account
hub / github.com/HiLab-git/SimpleCRF / color_tree_get

Function color_tree_get

dependency/densecrf/examples/lodepng.cpp:3027–3037  ·  view source on GitHub ↗

returns -1 if color not present, its index otherwise*/

Source from the content-addressed store, hash-verified

3025
3026/*returns -1 if color not present, its index otherwise*/
3027static int color_tree_get(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
3028{
3029 int bit = 0;
3030 for(bit = 0; bit < 8; ++bit)
3031 {
3032 int i = 8 * ((r >> bit) & 1) + 4 * ((g >> bit) & 1) + 2 * ((b >> bit) & 1) + 1 * ((a >> bit) & 1);
3033 if(!tree->children[i]) return -1;
3034 else tree = tree->children[i];
3035 }
3036 return tree ? tree->index : -1;
3037}
3038
3039#ifdef LODEPNG_COMPILE_ENCODER
3040static int color_tree_has(ColorTree* tree, unsigned char r, unsigned char g, unsigned char b, unsigned char a)

Callers 2

color_tree_hasFunction · 0.85
rgba8ToPixelFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected