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

Function Adam7_getpassvalues

dependency/densecrf/examples/lodepng.cpp:3862–3888  ·  view source on GitHub ↗

Outputs various dimensions and positions in the image related to the Adam7 reduced images. passw: output containing the width of the 7 passes passh: output containing the height of the 7 passes filter_passstart: output containing the index of the start and end of each reduced image with filter bytes padded_passstart output containing the index of the start and end of each reduced image when

Source from the content-addressed store, hash-verified

3860 end at a full byte
3861 */
3862static void Adam7_getpassvalues(unsigned passw[7], unsigned passh[7], size_t filter_passstart[8],
3863 size_t padded_passstart[8], size_t passstart[8], unsigned w, unsigned h, unsigned bpp)
3864{
3865 /*the passstart values have 8 values: the 8th one indicates the byte after the end of the 7th (= last) pass*/
3866 unsigned i;
3867
3868 /*calculate width and height in pixels of each pass*/
3869 for(i = 0; i != 7; ++i)
3870 {
3871 passw[i] = (w + ADAM7_DX[i] - ADAM7_IX[i] - 1) / ADAM7_DX[i];
3872 passh[i] = (h + ADAM7_DY[i] - ADAM7_IY[i] - 1) / ADAM7_DY[i];
3873 if(passw[i] == 0) passh[i] = 0;
3874 if(passh[i] == 0) passw[i] = 0;
3875 }
3876
3877 filter_passstart[0] = padded_passstart[0] = passstart[0] = 0;
3878 for(i = 0; i != 7; ++i)
3879 {
3880 /*if passw[i] is 0, it's 0 bytes, not 1 (no filtertype-byte)*/
3881 filter_passstart[i + 1] = filter_passstart[i]
3882 + ((passw[i] && passh[i]) ? passh[i] * (1 + (passw[i] * bpp + 7) / 8) : 0);
3883 /*bits padded if needed to fill full byte at end of each scanline*/
3884 padded_passstart[i + 1] = padded_passstart[i] + passh[i] * ((passw[i] * bpp + 7) / 8);
3885 /*only padded at end of reduced image*/
3886 passstart[i + 1] = passstart[i] + (passh[i] * passw[i] * bpp + 7) / 8;
3887 }
3888}
3889
3890#ifdef LODEPNG_COMPILE_DECODER
3891

Callers 4

Adam7_deinterlaceFunction · 0.85
postProcessScanlinesFunction · 0.85
Adam7_interlaceFunction · 0.85
preProcessScanlinesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected