47 uint8_t *out_end,
int pixelstride)
49 unsigned char pixel, count;
50 unsigned char *orig = out_buf;
55 pixel = bytestream2_get_byteu(&s->
g);
56 if (!(count = (pixel & 0x7f))) {
57 return (out_buf - orig) / pixelstride;
61 if(out_buf + pixelstride * count >= 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;
91 unsigned int start_offset;
98 for (z = 0; z < s->
depth; z++) {
100 for (y = 0; y < s->
height; y++) {
102 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,
160 unsigned int dimension, rle;
171 if (bytestream2_get_be16(&s->
g) !=
SGI_MAGIC) {
176 rle = bytestream2_get_byte(&s->
g);
178 dimension = bytestream2_get_be16(&s->
g);
179 s->
width = bytestream2_get_be16(&s->
g);
180 s->
height = bytestream2_get_be16(&s->
g);
181 s->
depth = bytestream2_get_be16(&s->
g);
189 if (dimension != 2 && dimension != 3) {
220 out_buf = p->
data[0];