47 uint8_t *out_end,
int pixelstride)
50 unsigned char *orig = out_buf;
52 while (out_buf < out_end) {
55 pixel = bytestream2_get_byteu(&s->
g);
56 if (!(count = (pixel & 0x7f))) {
61 if(out_buf + pixelstride * (count-1) >= out_end)
return -1;
65 *out_buf = bytestream2_get_byte(&s->
g);
66 out_buf += pixelstride;
69 pixel = bytestream2_get_byte(&s->
g);
73 out_buf += pixelstride;
77 return (out_buf - orig) / pixelstride;
92 unsigned int start_offset;
99 for (z = 0; z < s->
depth; z++) {
101 for (y = 0; y < s->
height; y++) {
103 start_offset = bytestream2_get_be32(&g_table);
132 for (z = 0; z < s->
depth; z++) {
137 for (y = s->
height - 1; y >= 0; y--) {
138 out_end = out_buf + (y * s->
linesize);
140 for (x = s->
width; x > 0; x--)
141 for (z = 0; z < s->
depth; z++)
142 *out_end++ = bytestream2_get_byteu(&gp[z]);
144 uint16_t *out16 = (uint16_t *)out_end;
145 for (x = s->
width; x > 0; x--)
146 for (z = 0; z < s->
depth; z++)
154 void *
data,
int *got_frame,
159 unsigned int dimension, rle;
170 if (bytestream2_get_be16u(&s->
g) !=
SGI_MAGIC) {
175 rle = bytestream2_get_byteu(&s->
g);
177 dimension = bytestream2_get_be16u(&s->
g);
178 s->
width = bytestream2_get_be16u(&s->
g);
179 s->
height = bytestream2_get_be16u(&s->
g);
180 s->
depth = bytestream2_get_be16u(&s->
g);
188 if (dimension != 2 && dimension != 3) {
213 out_buf = p->
data[0];