35 unsigned int w, h, depth, type, maptype, maplength,
stride, x, y,
len, alen;
100 if (buf_end - buf < maplength)
103 if (depth != 8 && maplength) {
104 av_log(avctx,
AV_LOG_WARNING,
"useless colormap found or file is corrupted, trying to recover\n");
106 }
else if (maplength) {
107 unsigned int len = maplength / 3;
109 if (maplength % 3 || maplength > 768) {
115 for (x = 0; x <
len; x++, ptr += 4)
116 *(uint32_t *)ptr = (buf[x] << 16) + (buf[len + x] << 8) + buf[len + len + x];
125 len = (depth * w + 7) >> 3;
126 alen = len + (len & 1);
133 while (ptr != end && buf < buf_end) {
135 if (buf_end - buf < 1)
155 for (y = 0; y < h; y++) {
156 if (buf_end - buf < len)
158 memcpy(ptr, buf, len);
166 return buf - bufstart;