This fixes RGB48 with libavcodec as decoder
Unified · Split
| @@ -1530,6 +1530,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 1529 unmodified lines | |||
| 1530 | int tileno, ret; | 1530 | int tileno, ret; |
| 1531 | Jpeg2000EncoderContext *s = avctx->priv_data; | 1531 | Jpeg2000EncoderContext *s = avctx->priv_data; |
| 1532 | uint8_t *chunkstart, *jp2cstart, *jp2hstart; | 1532 | uint8_t *chunkstart, *jp2cstart, *jp2hstart; |
| 1533 | const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); | ||
| 1533 | 1534 | ||
| 1534 | if ((ret = ff_alloc_packet(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) | 1535 | if ((ret = ff_alloc_packet(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE)) < 0) |
| 1535 | return ret; | 1536 | return ret; |
| @@ -1586,7 +1587,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 50 unmodified lines | |||
| 1586 | bytestream_put_byte(&s->buf, 1); | 1587 | bytestream_put_byte(&s->buf, 1); |
| 1587 | bytestream_put_byte(&s->buf, 0); | 1588 | bytestream_put_byte(&s->buf, 0); |
| 1588 | bytestream_put_byte(&s->buf, 0); | 1589 | bytestream_put_byte(&s->buf, 0); |
| 1589 | if (avctx->pix_fmt == AV_PIX_FMT_RGB24 || avctx->pix_fmt == AV_PIX_FMT_PAL8) { | 1590 | if ((desc->flags & AV_PIX_FMT_FLAG_RGB) || avctx->pix_fmt == AV_PIX_FMT_PAL8) { |
| 1590 | bytestream_put_be32(&s->buf, 16); | 1591 | bytestream_put_be32(&s->buf, 16); |
| 1591 | } else if (s->ncomponents == 1) { | 1592 | } else if (s->ncomponents == 1) { |
| 1592 | bytestream_put_be32(&s->buf, 17); | 1593 | bytestream_put_be32(&s->buf, 17); |