MCPcopy Create free account
hub / github.com/DFHack/dfhack / addPaddingBits

Function addPaddingBits

depends/lodepng/lodepng.cpp:5638–5655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5636}
5637
5638static void addPaddingBits(unsigned char* out, const unsigned char* in,
5639 size_t olinebits, size_t ilinebits, unsigned h) {
5640 /*The opposite of the removePaddingBits function
5641 olinebits must be >= ilinebits*/
5642 unsigned y;
5643 size_t diff = olinebits - ilinebits;
5644 size_t obp = 0, ibp = 0; /*bit pointers*/
5645 for(y = 0; y != h; ++y) {
5646 size_t x;
5647 for(x = 0; x < ilinebits; ++x) {
5648 unsigned char bit = readBitFromReversedStream(&ibp, in);
5649 setBitOfReversedStream(&obp, out, bit);
5650 }
5651 /*obp += diff; --> no, fill in some value in the padding bits too, to avoid
5652 "Use of uninitialised value of size ###" warning from valgrind*/
5653 for(x = 0; x != diff; ++x) setBitOfReversedStream(&obp, out, 0);
5654 }
5655}
5656
5657/*
5658in: non-interlaced image with size w*h

Callers 1

preProcessScanlinesFunction · 0.85

Calls 2

setBitOfReversedStreamFunction · 0.85

Tested by

no test coverage detected