+ if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+ int i;
+ uint8_t *palette = pict->data[1];
+ chunkstart = s->buf;
+ bytestream_put_be32(&s->buf, 0);
+ bytestream_put_buffer(&s->buf, "pclr", 4);
+ bytestream_put_be16(&s->buf, AVPALETTE_COUNT);
+ bytestream_put_byte(&s->buf, 3); // colour channels
+ bytestream_put_be24(&s->buf, 0x070707); //colour depths
+ for (i = 0; i < AVPALETTE_COUNT; i++) {
+ bytestream_put_be24(&s->buf, HAVE_BIGENDIAN ? AV_RB24(palette + 1) : AV_RL24(palette));
+ palette += 4;
+ }
+ update_size(chunkstart, s->buf);
+ chunkstart = s->buf;
+ bytestream_put_be32(&s->buf, 0);
+ bytestream_put_buffer(&s->buf, "cmap", 4);
+ for (i = 0; i < 3; i++) {
+ bytestream_put_be16(&s->buf, 0); // component
+ bytestream_put_byte(&s->buf, 1); // palette mapping
+ bytestream_put_byte(&s->buf, i); // index
+ }
+ update_size(chunkstart, s->buf);
+ }