54 int outcnt = 0, maxcnt;
83 for (i = 0; i < 8; i++)
86 while (outcnt < maxcnt && buf_end - 2 >= buf) {
90 if (!(code & 0x8000)) {
96 if ((code & 0x6000) == 0x6000) {
98 int oidx = (code >> 10) & 7;
101 count = (code & 0x3FF) + 3;
103 if (offsets[oidx] < 0) {
104 if (buf_end - 3 < buf)
110 start = (outcnt + offsets[oidx]) % maxcnt;
112 if (maxcnt - start < count || maxcnt - outcnt < count)
117 "Frame reference does not exist\n");
121 memcpy(out + 2 * outcnt, prev + 2 * start, 2 * count);
124 int offset = (code & 0x1FFF) + 1;
126 if (!(code & 0x6000)) {
128 }
else if ((code & 0x6000) == 0x2000) {
131 if (buf_end - 1 < buf)
136 if (outcnt < offset || maxcnt - outcnt < count)