48 int len,
int pixelstride)
50 unsigned char pixel, count;
51 unsigned char *orig = out_buf;
56 pixel = bytestream2_get_byteu(&s->
g);
57 if (!(count = (pixel & 0x7f))) {
58 return (out_buf - orig) / pixelstride;
62 if (pixelstride * (count - 1) >= len) {
69 *out_buf = bytestream2_get_byte(&s->
g);
70 out_buf += pixelstride;
73 pixel = bytestream2_get_byte(&s->
g);
77 out_buf += pixelstride;
95 unsigned int start_offset;
102 for (z = 0; z < s->
depth; z++) {
104 for (y = 0; y < s->
height; y++) {
106 start_offset = bytestream2_get_be32(&g_table);
136 for (z = 0; z < s->
depth; z++) {
141 for (y = s->
height - 1; y >= 0; y--) {
142 out_end = out_buf + (y * s->
linesize);
144 for (x = s->
width; x > 0; x--)
145 for (z = 0; z < s->
depth; z++)
146 *out_end++ = bytestream2_get_byteu(&gp[z]);
148 uint16_t *out16 = (uint16_t *)out_end;
149 for (x = s->
width; x > 0; x--)
150 for (z = 0; z < s->
depth; z++)
158 void *
data,
int *got_frame,
164 unsigned int dimension, rle;
175 if (bytestream2_get_be16(&s->
g) !=
SGI_MAGIC) {
180 rle = bytestream2_get_byte(&s->
g);
182 dimension = bytestream2_get_be16(&s->
g);
183 s->
width = bytestream2_get_be16(&s->
g);
184 s->
height = bytestream2_get_be16(&s->
g);
185 s->
depth = bytestream2_get_be16(&s->
g);
193 if (dimension != 2 && dimension != 3) {
224 out_buf = p->
data[0];