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

Function checkColorValidity

dependency/densecrf/examples/lodepng.cpp:2548–2560  ·  view source on GitHub ↗

return type is a LodePNG error code*/

Source from the content-addressed store, hash-verified

2546
2547/*return type is a LodePNG error code*/
2548static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd = bitdepth*/
2549{
2550 switch(colortype)
2551 {
2552 case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/
2553 case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/
2554 case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/
2555 case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/
2556 case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/
2557 default: return 31;
2558 }
2559 return 0; /*allowed color type / bits combination*/
2560}
2561
2562static unsigned getNumColorChannels(LodePNGColorType colortype)
2563{

Callers 2

lodepng_inspectFunction · 0.85
lodepng_encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected