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

Function addPaddingBits

dependency/densecrf/examples/lodepng.cpp:5423–5443  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5421}
5422
5423static void addPaddingBits(unsigned char* out, const unsigned char* in,
5424 size_t olinebits, size_t ilinebits, unsigned h)
5425{
5426 /*The opposite of the removePaddingBits function
5427 olinebits must be >= ilinebits*/
5428 unsigned y;
5429 size_t diff = olinebits - ilinebits;
5430 size_t obp = 0, ibp = 0; /*bit pointers*/
5431 for(y = 0; y != h; ++y)
5432 {
5433 size_t x;
5434 for(x = 0; x < ilinebits; ++x)
5435 {
5436 unsigned char bit = readBitFromReversedStream(&ibp, in);
5437 setBitOfReversedStream(&obp, out, bit);
5438 }
5439 /*obp += diff; --> no, fill in some value in the padding bits too, to avoid
5440 "Use of uninitialised value of size ###" warning from valgrind*/
5441 for(x = 0; x != diff; ++x) setBitOfReversedStream(&obp, out, 0);
5442 }
5443}
5444
5445/*
5446 in: non-interlaced image with size w*h

Callers 1

preProcessScanlinesFunction · 0.85

Calls 2

setBitOfReversedStreamFunction · 0.85

Tested by

no test coverage detected