48 uint8_t *out_end,
int pixelstride)
50 unsigned char pixel, count;
51 unsigned char *orig = out_buf;
53 while (out_buf < out_end) {
56 pixel = bytestream2_get_byteu(&s->
g);
57 if (!(count = (pixel & 0x7f))) {
62 if(out_buf + pixelstride * (count-1) >= out_end)
return -1;
66 *out_buf = bytestream2_get_byte(&s->
g);
67 out_buf += pixelstride;
70 pixel = bytestream2_get_byte(&s->
g);
74 out_buf += pixelstride;
78 return (out_buf - orig) / pixelstride;
93 unsigned int start_offset;
100 for (z = 0; z < s->
depth; z++) {
102 for (y = 0; y < s->
height; y++) {
104 start_offset = bytestream2_get_be32(&g_table);
133 for (z = 0; z < s->
depth; z++) {
138 for (y = s->
height - 1; y >= 0; y--) {
139 out_end = out_buf + (y * s->
linesize);
141 for (x = s->
width; x > 0; x--)
142 for (z = 0; z < s->
depth; z++)
143 *out_end++ = bytestream2_get_byteu(&gp[z]);
145 uint16_t *out16 = (uint16_t *)out_end;
146 for (x = s->
width; x > 0; x--)
147 for (z = 0; z < s->
depth; z++)
155 void *
data,
int *got_frame,
161 unsigned int dimension, rle;
172 if (bytestream2_get_be16(&s->
g) !=
SGI_MAGIC) {
177 rle = bytestream2_get_byte(&s->
g);
179 dimension = bytestream2_get_be16(&s->
g);
180 s->
width = bytestream2_get_be16(&s->
g);
181 s->
height = bytestream2_get_be16(&s->
g);
182 s->
depth = bytestream2_get_be16(&s->
g);
190 if (dimension != 2 && dimension != 3) {
221 out_buf = p->
data[0];