MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / addPaddingBits

Function addPaddingBits

samples/shared/lodepng.cpp:5300–5320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5298}
5299
5300static void addPaddingBits(unsigned char* out, const unsigned char* in,
5301 size_t olinebits, size_t ilinebits, unsigned h)
5302{
5303 /*The opposite of the removePaddingBits function
5304 olinebits must be >= ilinebits*/
5305 unsigned y;
5306 size_t diff = olinebits - ilinebits;
5307 size_t obp = 0, ibp = 0; /*bit pointers*/
5308 for(y = 0; y < h; y++)
5309 {
5310 size_t x;
5311 for(x = 0; x < ilinebits; x++)
5312 {
5313 unsigned char bit = readBitFromReversedStream(&ibp, in);
5314 setBitOfReversedStream(&obp, out, bit);
5315 }
5316 /*obp += diff; --> no, fill in some value in the padding bits too, to avoid
5317 "Use of uninitialised value of size ###" warning from valgrind*/
5318 for(x = 0; x < diff; x++) setBitOfReversedStream(&obp, out, 0);
5319 }
5320}
5321
5322/*
5323in: non-interlaced image with size w*h

Callers 1

preProcessScanlinesFunction · 0.85

Calls 2

setBitOfReversedStreamFunction · 0.85

Tested by

no test coverage detected