55 int outcnt = 0, maxcnt;
88 for (i = 0; i < 8; i++)
91 while (outcnt < maxcnt && buf_end - 2 >= buf) {
95 if (!(code & 0x8000)) {
101 if ((code & 0x6000) == 0x6000) {
103 int oidx = (code >> 10) & 7;
106 count = (code & 0x3FF) + 3;
108 if (offsets[oidx] < 0) {
109 if (buf_end - 3 < buf)
115 start = (outcnt + offsets[oidx]) % maxcnt;
117 if (maxcnt - start < count || maxcnt - outcnt < count)
122 "Frame reference does not exist\n");
126 memcpy(out + 2 * outcnt, prev + 2 * start, 2 * count);
129 int offset = (code & 0x1FFF) + 1;
131 if (!(code & 0x6000)) {
133 }
else if ((code & 0x6000) == 0x2000) {
136 if (buf_end - 1 < buf)
141 if (outcnt < offset || maxcnt - outcnt < count)