Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Michael Niedermayer <michael@niedermayer.cc>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 07/11] avcodec/j2kenc: Replace RGB24 special case by generic test
Date: Thu, 30 Mar 2023 20:01:02 +0200
Message-ID: <20230330180106.11275-7-michael@niedermayer.cc> (raw)
In-Reply-To: <20230330180106.11275-1-michael@niedermayer.cc>

This fixes RGB48 with libavcodec as decoder

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavcodec/j2kenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/j2kenc.c b/libavcodec/j2kenc.c
index d837b8b949e..8d9c1fdb1c0 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);
-- 
2.17.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-03-30 18:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 18:00 [FFmpeg-devel] [PATCH 01/11] avcodec/j2kenc: fix 5/3 DWT identifer Michael Niedermayer
2023-03-30 18:00 ` [FFmpeg-devel] [PATCH 02/11] avcodec/j2kenc: remove misleading pred value Michael Niedermayer
2023-03-30 18:00 ` [FFmpeg-devel] [PATCH 03/11] avcodec/j2kenc: Fix funky bpno errors on decoding Michael Niedermayer
2023-03-30 18:00 ` [FFmpeg-devel] [PATCH 04/11] avcodec/j2kenc: Add AV_PIX_FMT_YUV440P Michael Niedermayer
2023-03-30 18:01 ` [FFmpeg-devel] [PATCH 05/11] avcodec/j2kenc: simplify pixel format setup Michael Niedermayer
2023-03-30 18:01 ` [FFmpeg-devel] [PATCH 06/11] avcodec/j2kenc: Replace BGR48 / GRAY16 test by test for number of bits Michael Niedermayer
2023-03-30 18:01 ` Michael Niedermayer [this message]
2023-03-30 18:01 ` [FFmpeg-devel] [PATCH 08/11] avcodec/j2kenc: Planar RGB support Michael Niedermayer
2023-03-31 14:19   ` Anton Khirnov
2023-04-02 21:19     ` Michael Niedermayer
2023-03-30 18:01 ` [FFmpeg-devel] [PATCH 09/11] avcodec/j2kenc: More complete list of supported pixel formats Michael Niedermayer
2023-03-30 18:01 ` [FFmpeg-devel] [PATCH 10/11] avcodec/j2kenc: support threads Michael Niedermayer
2023-03-30 18:01 ` [FFmpeg-devel] [PATCH 11/11] Remove libopenjpeg decoder Michael Niedermayer
2023-04-02 21:20 ` [FFmpeg-devel] [PATCH 01/11] avcodec/j2kenc: fix 5/3 DWT identifer Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330180106.11275-7-michael@niedermayer.cc \
    --to=michael@niedermayer.cc \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git