* [FFmpeg-devel] [PATCH 1/2] avcodec/libjxldec: produce rgbf32 and rgbaf32 frames
@ 2023-12-11 12:02 Leo Izen
2023-12-11 12:02 ` [FFmpeg-devel] [PATCH 2/2] avcodec/libjxlenc: accept " Leo Izen
0 siblings, 1 reply; 2+ messages in thread
From: Leo Izen @ 2023-12-11 12:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Leo Izen
These pixel formats have always been supported by libjxl, but at the
time this plugin was written, they were not in FFmpeg yet. Now that
they are in FFmpeg, we should support them.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
libavcodec/libjxldec.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index 494060ac8c..f763294eee 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -130,10 +130,11 @@ static enum AVPixelFormat libjxl_get_pix_fmt(AVCodecContext *avctx, LibJxlDecode
return basic_info->alpha_bits ? AV_PIX_FMT_YA8 : AV_PIX_FMT_GRAY8;
}
if (basic_info->exponent_bits_per_sample || basic_info->bits_per_sample > 16) {
- if (basic_info->alpha_bits)
- return AV_PIX_FMT_NONE;
- format->data_type = JXL_TYPE_FLOAT;
- return AV_PIX_FMT_GRAYF32;
+ if (!basic_info->alpha_bits) {
+ format->data_type = JXL_TYPE_FLOAT;
+ return AV_PIX_FMT_GRAYF32;
+ }
+ av_log(avctx, AV_LOG_WARNING, "Downsampling gray+alpha float to 16-bit integer via libjxl\n");
}
format->data_type = JXL_TYPE_UINT16;
return basic_info->alpha_bits ? AV_PIX_FMT_YA16 : AV_PIX_FMT_GRAY16;
@@ -145,10 +146,10 @@ static enum AVPixelFormat libjxl_get_pix_fmt(AVCodecContext *avctx, LibJxlDecode
format->data_type = JXL_TYPE_UINT8;
return basic_info->alpha_bits ? AV_PIX_FMT_RGBA : AV_PIX_FMT_RGB24;
}
- if (basic_info->exponent_bits_per_sample)
- av_log(avctx, AV_LOG_WARNING, "Downsampling float to 16-bit integer via libjxl\n");
- else if (basic_info->bits_per_sample > 16)
- av_log(avctx, AV_LOG_WARNING, "Downsampling larger integer to 16-bit via libjxl\n");
+ if (basic_info->exponent_bits_per_sample || basic_info->bits_per_sample > 16) {
+ format->data_type = JXL_TYPE_FLOAT;
+ return basic_info->alpha_bits ? AV_PIX_FMT_RGBAF32 : AV_PIX_FMT_RGBF32;
+ }
format->data_type = JXL_TYPE_UINT16;
return basic_info->alpha_bits ? AV_PIX_FMT_RGBA64 : AV_PIX_FMT_RGB48;
}
--
2.43.0
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
* [FFmpeg-devel] [PATCH 2/2] avcodec/libjxlenc: accept rgbf32 and rgbaf32 frames
2023-12-11 12:02 [FFmpeg-devel] [PATCH 1/2] avcodec/libjxldec: produce rgbf32 and rgbaf32 frames Leo Izen
@ 2023-12-11 12:02 ` Leo Izen
0 siblings, 0 replies; 2+ messages in thread
From: Leo Izen @ 2023-12-11 12:02 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Leo Izen
These pixel formats have always been supported by libjxl, but at the
time this plugin was written, they were not in FFmpeg yet. Now that
they are in FFmpeg, we should support them.
Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
libavcodec/libjxlenc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
index d707f3a61b..780dbb9e2e 100644
--- a/libavcodec/libjxlenc.c
+++ b/libavcodec/libjxlenc.c
@@ -493,6 +493,7 @@ const FFCodec ff_libjxl_encoder = {
.p.pix_fmts = (const enum AVPixelFormat[]) {
AV_PIX_FMT_RGB24, AV_PIX_FMT_RGBA,
AV_PIX_FMT_RGB48, AV_PIX_FMT_RGBA64,
+ AV_PIX_FMT_RGBF32, AV_PIX_FMT_RGBAF32,
AV_PIX_FMT_GRAY8, AV_PIX_FMT_YA8,
AV_PIX_FMT_GRAY16, AV_PIX_FMT_YA16,
AV_PIX_FMT_GRAYF32,
--
2.43.0
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-11 12:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-11 12:02 [FFmpeg-devel] [PATCH 1/2] avcodec/libjxldec: produce rgbf32 and rgbaf32 frames Leo Izen
2023-12-11 12:02 ` [FFmpeg-devel] [PATCH 2/2] avcodec/libjxlenc: accept " Leo Izen
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