getCode static method
Implementation
static int getCode(int po, int rlc, List<int> c_lc, InputBuffer input,
Uint16List? out, int oi, int oe) {
if (po == rlc) {
if (c_lc[1] < 8) {
getChar(c_lc, input);
}
c_lc[1] -= 8;
var cs = (c_lc[0] >> c_lc[1]) & 0xff;
if (oi + cs > oe) {
throw ImageException('Error in Huffman-encoded data '
'(decoded data are longer than expected).');
}
final s = out![oi - 1];
while (cs-- > 0) {
out[oi++] = s;
}
} else if (oi < oe) {
out![oi++] = po;
} else {
throw ImageException('Error in Huffman-encoded data '
'(decoded data are longer than expected).');
}
return oi;
}