History

avcodec/j2kenc: Replace RGB24 special case by generic test

This fixes RGB48 with libavcodec as decoder

Michael Niedermayer committed 3 years ago

Commit ad4d6471 parent 7fb70d21 file · +2 −1Browse files

Unified · Split

libavcodec/j2kenc.c+2−1
@@ -1530,6 +1530,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 1529 unmodified lines
15301530 int tileno, ret;
15311531 Jpeg2000EncoderContext *s = avctx->priv_data;
15321532 uint8_t *chunkstart, *jp2cstart, *jp2hstart;
1533+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
15331534
15341535 if ((ret = ff_alloc_packet(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE)) < 0)
15351536 return ret;
@@ -1586,7 +1587,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, · 50 unmodified lines
15861587 bytestream_put_byte(&s->buf, 1);
15871588 bytestream_put_byte(&s->buf, 0);
15881589 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) {
15901591 bytestream_put_be32(&s->buf, 16);
15911592 } else if (s->ncomponents == 1) {
15921593 bytestream_put_be32(&s->buf, 17);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t