47 int len,
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 (pixelstride * (count - 1) >= len) {
68 *out_buf = bytestream2_get_byte(&s->
g);
69 out_buf += pixelstride;
72 pixel = bytestream2_get_byte(&s->
g);
76 out_buf += pixelstride;
94 unsigned int start_offset;
101 for (z = 0; z < s->
depth; z++) {
103 for (y = 0; y < s->
height; y++) {
105 start_offset = bytestream2_get_be32(&g_table);
135 for (z = 0; z < s->
depth; z++) {
140 for (y = s->
height - 1; y >= 0; y--) {
141 out_end = out_buf + (y * s->
linesize);
143 for (x = s->
width; x > 0; x--)
144 for (z = 0; z < s->
depth; z++)
145 *out_end++ = bytestream2_get_byteu(&gp[z]);
147 uint16_t *out16 = (uint16_t *)out_end;
148 for (x = s->
width; x > 0; x--)
149 for (z = 0; z < s->
depth; z++)
157 void *
data,
int *data_size,
163 unsigned int dimension, rle;
165 uint8_t *out_buf, *out_end;
174 if (bytestream2_get_be16(&s->
g) !=
SGI_MAGIC) {
179 rle = bytestream2_get_byte(&s->
g);
181 dimension = bytestream2_get_be16(&s->
g);
182 s->
width = bytestream2_get_be16(&s->
g);
183 s->
height = bytestream2_get_be16(&s->
g);
184 s->
depth = bytestream2_get_be16(&s->
g);
192 if (dimension != 2 && dimension != 3) {
223 out_buf = p->
data[0];