You are given a stream of 16-bit chunks. Each chunk is either a bit vector or a run-length encoded (RLE) segment. The high bit (bit 15) determines the type: if it is 1 the chunk is a bit vector, if it is 0 the chunk is RLE. Your task is to write a function that parses this stream and returns the sequence of bits it represents.
Bit vector chunk (bit 15 == 1): The remaining 15 bits (bits 14..0) are literal bits to be output in MSB→LSB order.
Run-length chunk (bit 15 == 0): Bit 14 is the fill value (0 or 1) and the low 14 bits (13..0) are the count of how many of that bit to output. The count may be zero, in which case nothing is emitted for this chunk.
Implement the following function:
vector<int> parseChunks(const vector<uint16_t>& chunks);
It should return a vector of integers (0 or 1) representing the concatenated bits from all chunks in order.