53 int outcnt = 0, maxcnt;
82 for (i = 0; i < 8; i++)
85 while (outcnt < maxcnt && buf_end - 2 >= buf) {
89 if (!(code & 0x8000)) {
95 if ((code & 0x6000) == 0x6000) {
97 int oidx = (code >> 10) & 7;
100 count = (code & 0x3FF) + 3;
102 if (offsets[oidx] < 0) {
103 if (buf_end - 3 < buf)
109 start = (outcnt + offsets[oidx]) % maxcnt;
111 if (maxcnt - start < count || maxcnt - outcnt < count)
116 "Frame reference does not exist\n");
120 memcpy(out + 2 * outcnt, prev + 2 * start, 2 * count);
123 int offset = (code & 0x1FFF) + 1;
125 if (!(code & 0x6000)) {
127 }
else if ((code & 0x6000) == 0x2000) {
130 if (buf_end - 1 < buf)
135 if (outcnt < offset || maxcnt - outcnt < count)