aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/j2kenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2023-03-30 18:57:56 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2023-04-02 23:54:50 +0200
commitad4d647591dbd953a5cf3a32a779ee5e42465bbb (patch)
tree02203fb5f6836132306a7ffc63f98887955a6481 /libavcodec/j2kenc.c
parent7fb70d27a26bb4072edf68857636fa4343ee24a3 (diff)
downloadffmpeg-ad4d647591dbd953a5cf3a32a779ee5e42465bbb.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>
Diffstat (limited to 'libavcodec/j2kenc.c')
-rw-r--r--libavcodec/j2kenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index d837b8b949..8d9c1fdb1c 100644
--- a/libavcodec/j2kenc.c
+++ b/libavcodec/j2kenc.c
@@ -1530,6 +1530,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_packet(avctx, pkt, avctx->width*avctx->height*9 + AV_INPUT_BUFFER_MIN_SIZE)) < 0)
return ret;
@@ -1586,7 +1587,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);