MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / addPaddingBits

Function addPaddingBits

src/lodepng.cpp:5451–5471  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5449}
5450
5451static void addPaddingBits(unsigned char* out, const unsigned char* in,
5452 size_t olinebits, size_t ilinebits, unsigned h)
5453{
5454 /*The opposite of the removePaddingBits function
5455 olinebits must be >= ilinebits*/
5456 unsigned y;
5457 size_t diff = olinebits - ilinebits;
5458 size_t obp = 0, ibp = 0; /*bit pointers*/
5459 for(y = 0; y < h; y++)
5460 {
5461 size_t x;
5462 for(x = 0; x < ilinebits; x++)
5463 {
5464 unsigned char bit = readBitFromReversedStream(&ibp, in);
5465 setBitOfReversedStream(&obp, out, bit);
5466 }
5467 /*obp += diff; --> no, fill in some value in the padding bits too, to avoid
5468 "Use of uninitialised value of size ###" warning from valgrind*/
5469 for(x = 0; x < diff; x++) setBitOfReversedStream(&obp, out, 0);
5470 }
5471}
5472
5473/*
5474in: non-interlaced image with size w*h

Callers 1

preProcessScanlinesFunction · 0.85

Calls 2

setBitOfReversedStreamFunction · 0.85

Tested by

no test coverage detected