diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2023-03-30 18:57:56 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2023-04-21 01:55:21 +0200 |
commit | cc34df4f71809397ffcfce424c8e621802e1a2bd (patch) | |
tree | d161940d0760a78007ca9b73d05a9108b0c7e6d1 | |
parent | f8b3acf517b8a7f102486d0d6cf3825bb9a43f62 (diff) | |
download | ffmpeg-cc34df4f71809397ffcfce424c8e621802e1a2bd.tar.gz |
avcodec/j2kenc: Replace RGB24 special case by generic test
This fixes RGB48 with libavcodec as decoder
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ad4d647591dbd953a5cf3a32a779ee5e42465bbb)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r-- | libavcodec/j2kenc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c index 1931def765..df55c9c62e 100644 --- a/libavcodec/j2kenc.c +++ b/libavcodec/j2kenc.c @@ -1003,6 +1003,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, int tileno, ret; Jpeg2000EncoderContext *s = avctx->priv_data; uint8_t *chunkstart, *jp2cstart, *jp2hstart; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE, 0)) < 0) return ret; @@ -1055,7 +1056,7 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, bytestream_put_byte(&s->buf, 1); bytestream_put_byte(&s->buf, 0); bytestream_put_byte(&s->buf, 0); - if (avctx->pix_fmt == AV_PIX_FMT_RGB24 || avctx->pix_fmt == AV_PIX_FMT_PAL8) { + if ((desc->flags & AV_PIX_FMT_FLAG_RGB) || avctx->pix_fmt == AV_PIX_FMT_PAL8) { bytestream_put_be32(&s->buf, 16); } else if (s->ncomponents == 1) { bytestream_put_be32(&s->buf, 17); |