48 int len,
int pixelstride)
51 unsigned char *orig = out_buf;
54 while (out_buf < out_end) {
57 pixel = bytestream2_get_byteu(&s->
g);
58 if (!(count = (pixel & 0x7f))) {
63 if (out_end - out_buf <= pixelstride * (count - 1)) {
70 *out_buf = bytestream2_get_byte(&s->
g);
71 out_buf += pixelstride;
74 pixel = bytestream2_get_byte(&s->
g);
78 out_buf += pixelstride;
82 return (out_buf - orig) / pixelstride;
97 unsigned int start_offset;
104 for (z = 0; z < s->
depth; z++) {
106 for (y = 0; y < s->
height; y++) {
108 start_offset = bytestream2_get_be32(&g_table);
137 for (z = 0; z < s->
depth; z++) {
142 for (y = s->
height - 1; y >= 0; y--) {
143 out_end = out_buf + (y * s->
linesize);
145 for (x = s->
width; x > 0; x--)
146 for (z = 0; z < s->
depth; z++)
147 *out_end++ = bytestream2_get_byteu(&gp[z]);
149 uint16_t *out16 = (uint16_t *)out_end;
150 for (x = s->
width; x > 0; x--)
151 for (z = 0; z < s->
depth; z++)
159 void *
data,
int *got_frame,
164 unsigned int dimension, rle;
175 if (bytestream2_get_be16u(&s->
g) !=
SGI_MAGIC) {
180 rle = bytestream2_get_byteu(&s->
g);
182 dimension = bytestream2_get_be16u(&s->
g);
183 s->
width = bytestream2_get_be16u(&s->
g);
184 s->
height = bytestream2_get_be16u(&s->
g);
185 s->
depth = bytestream2_get_be16u(&s->
g);
193 if (dimension != 2 && dimension != 3) {
218 out_buf = p->
data[0];