28 #define SGI_SINGLE_CHAN 2
29 #define SGI_MULTI_CHAN 3
39 if (avctx->
width > 65535 || avctx->
height > 65535) {
55 uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf, *buf;
56 int x,
y, z, length, tablesize, ret;
57 unsigned int width,
height,
depth, dimension, bytes_per_channel, pixmax, put_be;
58 unsigned char *end_buf;
66 bytes_per_channel = 1;
68 put_be = HAVE_BIGENDIAN;
84 put_be = !HAVE_BIGENDIAN;
87 bytes_per_channel = 2;
93 put_be = !HAVE_BIGENDIAN;
96 bytes_per_channel = 2;
102 put_be = !HAVE_BIGENDIAN;
105 bytes_per_channel = 2;
114 tablesize = depth * height * 4;
117 length += depth * height *
width;
119 length += tablesize * 2 + depth * height * (2 * width + 1);
129 bytestream_put_byte(&buf, bytes_per_channel);
130 bytestream_put_be16(&buf, dimension);
131 bytestream_put_be16(&buf, width);
132 bytestream_put_be16(&buf, height);
133 bytestream_put_be16(&buf, depth);
135 bytestream_put_be32(&buf, 0
L);
136 bytestream_put_be32(&buf, pixmax);
137 bytestream_put_be32(&buf, 0
L);
144 bytestream_put_be32(&buf, 0
L);
162 for (z = 0; z <
depth; z++) {
163 in_buf = p->
data[0] + p->
linesize[0] * (height - 1) + z;
165 for (y = 0; y <
height; y++) {
166 bytestream_put_be32(&offsettab, buf - pkt->
data);
168 for (x = 0; x <
width; x++)
169 encode_buf[x] = in_buf[depth * x];
171 if ((length =
ff_rle_encode(buf, end_buf - buf - 1, encode_buf, 1, width, 0, 0, 0x80, 0)) < 1) {
177 bytestream_put_byte(&buf, 0);
178 bytestream_put_be32(&lengthtab, length + 1);
185 for (z = 0; z <
depth; z++) {
186 in_buf = p->
data[0] + p->
linesize[0] * (height - 1) + z * bytes_per_channel;
188 for (y = 0; y <
height; y++) {
190 if (bytes_per_channel == 1) {
191 bytestream_put_byte(&buf, in_buf[x]);
194 bytestream_put_be16(&buf, ((uint16_t *)in_buf)[x]);
196 bytestream_put_le16(&buf, ((uint16_t *)in_buf)[x]);