54 int outcnt = 0, maxcnt;
85 for (i = 0; i < 8; i++)
88 while (outcnt < maxcnt && buf_end - 2 >= buf) {
92 if (!(code & 0x8000)) {
98 if ((code & 0x6000) == 0x6000) {
100 int oidx = (code >> 10) & 7;
103 count = (code & 0x3FF) + 3;
105 if (offsets[oidx] < 0) {
106 if (buf_end - 3 < buf)
112 start = (outcnt + offsets[oidx]) % maxcnt;
114 if (maxcnt - start < count || maxcnt - outcnt < count)
119 "Frame reference does not exist\n");
123 memcpy(out + 2 * outcnt, prev + 2 * start, 2 * count);
126 int offset = (code & 0x1FFF) + 1;
128 if (!(code & 0x6000)) {
130 }
else if ((code & 0x6000) == 0x2000) {
133 if (buf_end - 1 < buf)
138 if (outcnt < offset || maxcnt - outcnt < count)