| 5496 | } |
| 5497 | |
| 5498 | static void addPaddingBits(unsigned char* out, const unsigned char* in, |
| 5499 | size_t olinebits, size_t ilinebits, unsigned h) |
| 5500 | { |
| 5501 | /*The opposite of the removePaddingBits function |
| 5502 | olinebits must be >= ilinebits*/ |
| 5503 | unsigned y; |
| 5504 | size_t diff = olinebits - ilinebits; |
| 5505 | size_t obp = 0, ibp = 0; /*bit pointers*/ |
| 5506 | for(y = 0; y != h; ++y) |
| 5507 | { |
| 5508 | size_t x; |
| 5509 | for(x = 0; x < ilinebits; ++x) |
| 5510 | { |
| 5511 | unsigned char bit = readBitFromReversedStream(&ibp, in); |
| 5512 | setBitOfReversedStream(&obp, out, bit); |
| 5513 | } |
| 5514 | /*obp += diff; --> no, fill in some value in the padding bits too, to avoid |
| 5515 | "Use of uninitialised value of size ###" warning from valgrind*/ |
| 5516 | for(x = 0; x != diff; ++x) setBitOfReversedStream(&obp, out, 0); |
| 5517 | } |
| 5518 | } |
| 5519 | |
| 5520 | /* |
| 5521 | in: non-interlaced image with size w*h |
no test coverage detected