46 uint8_t *out_end,
int pixelstride)
48 unsigned char pixel, count;
49 unsigned char *orig = out_buf;
54 pixel = bytestream2_get_byteu(&s->
g);
55 if (!(count = (pixel & 0x7f))) {
56 return (out_buf - orig) / pixelstride;
60 if(out_buf + pixelstride * count >= out_end)
return -1;
64 *out_buf = bytestream2_get_byte(&s->
g);
65 out_buf += pixelstride;
68 pixel = bytestream2_get_byte(&s->
g);
72 out_buf += pixelstride;
90 unsigned int start_offset;
97 for (z = 0; z < s->
depth; z++) {
99 for (y = 0; y < s->
height; y++) {
101 start_offset = bytestream2_get_be32(&g_table);
131 for (z = 0; z < s->
depth; z++) {
136 for (y = s->
height - 1; y >= 0; y--) {
137 out_end = out_buf + (y * s->
linesize);
139 for (x = s->
width; x > 0; x--)
140 for (z = 0; z < s->
depth; z++)
141 *out_end++ = bytestream2_get_byteu(&gp[z]);
143 uint16_t *out16 = (uint16_t *)out_end;
144 for (x = s->
width; x > 0; x--)
145 for (z = 0; z < s->
depth; z++)
153 void *
data,
int *data_size,
159 unsigned int dimension, rle;
161 uint8_t *out_buf, *out_end;
170 if (bytestream2_get_be16(&s->
g) !=
SGI_MAGIC) {
175 rle = bytestream2_get_byte(&s->
g);
177 dimension = bytestream2_get_be16(&s->
g);
178 s->
width = bytestream2_get_be16(&s->
g);
179 s->
height = bytestream2_get_be16(&s->
g);
180 s->
depth = bytestream2_get_be16(&s->
g);
188 if (dimension != 2 && dimension != 3) {
219 out_buf = p->
data[0];