}
if (s->invert) {
- dst = p->data[0];
+ dst = p->data[plane];
for (i = 0; i < s->height; i++) {
- for (j = 0; j < p->linesize[0]; j++)
- dst[j] = 255 - dst[j];
+ for (j = 0; j < p->linesize[plane]; j++)
+ dst[j] = (s->avctx->pix_fmt == AV_PIX_FMT_PAL8 ? (1<<s->bpp) - 1 : 255) - dst[j];
- dst += p->linesize[plane];
+ dst += stride;
}
}
+ }
+
+ if (s->planar && s->bppcount > 2) {
+ FFSWAP(uint8_t*, p->data[0], p->data[2]);
+ FFSWAP(int, p->linesize[0], p->linesize[2]);
+ FFSWAP(uint8_t*, p->data[0], p->data[1]);
+ FFSWAP(int, p->linesize[0], p->linesize[1]);
+ }
+
*got_frame = 1;
- return buf_size;
+ return avpkt->size;
}
static av_cold int tiff_init(AVCodecContext *avctx)