Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl
@ 2022-10-02  7:58 Leo Izen
  2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 1/2] avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats Leo Izen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Leo Izen @ 2022-10-02  7:58 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Leo Izen

FFmpeg has supported these pixel formats since 7bb0afc245d093b0 and
libjxl supports receiving/sending these pixel formats so it makes
sense to add support to the libjxl wrapper for these formats.

Leo Izen (2):
  avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats
  avcodec/libjxl: use RGB32F or RGBA32F for 32-bit float JPEG XL

 libavcodec/libjxldec.c | 15 +++++++++------
 libavcodec/libjxlenc.c |  1 +
 libavutil/pixfmt.h     |  3 +++
 3 files changed, 13 insertions(+), 6 deletions(-)

-- 
2.37.3

_______________________________________________
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] 6+ messages in thread

* [FFmpeg-devel] [PATCH 1/2] avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats
  2022-10-02  7:58 [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl Leo Izen
@ 2022-10-02  7:58 ` Leo Izen
  2022-10-09 17:29   ` Michael Niedermayer
  2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 2/2] avcodec/libjxl: use RGB32F or RGBA32F for 32-bit float JPEG XL Leo Izen
  2022-10-09 11:58 ` [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl Leo Izen
  2 siblings, 1 reply; 6+ messages in thread
From: Leo Izen @ 2022-10-02  7:58 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Leo Izen

Add an AV_PIX_FMT_NE macro for RGB32FBE/RGB32FLE and also one for
RGBA32FBE/RGBA32FLE for packed 32-bit float RGB samples, and also
packed 32-bit float RGBA samples, respectively.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
 libavutil/pixfmt.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index f8b3c0514f..224670a731 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -495,6 +495,9 @@ enum AVPixelFormat {
 
 #define AV_PIX_FMT_RGBAF16    AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE)
 
+#define AV_PIX_FMT_RGBF32     AV_PIX_FMT_NE(RGBF32BE, RGBF32LE)
+#define AV_PIX_FMT_RGBAF32    AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE)
+
 /**
   * Chromaticity coordinates of the source primaries.
   * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273.
-- 
2.37.3

_______________________________________________
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] 6+ messages in thread

* [FFmpeg-devel] [PATCH 2/2] avcodec/libjxl: use RGB32F or RGBA32F for 32-bit float JPEG XL
  2022-10-02  7:58 [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl Leo Izen
  2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 1/2] avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats Leo Izen
@ 2022-10-02  7:58 ` Leo Izen
  2022-10-14 16:51   ` Leo Izen
  2022-10-09 11:58 ` [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl Leo Izen
  2 siblings, 1 reply; 6+ messages in thread
From: Leo Izen @ 2022-10-02  7:58 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Leo Izen

Use AV_PIX_FMT_RGB32F or AV_PIX_FMT_RGBA32F for encoding and decoding
JPEG XL files when encountered, rather than returning an error and
refusing to do anything.

Signed-off-by: Leo Izen <leo.izen@gmail.com>
---
 libavcodec/libjxldec.c | 15 +++++++++------
 libavcodec/libjxlenc.c |  1 +
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
index de48bea4b2..92b98388d4 100644
--- a/libavcodec/libjxldec.c
+++ b/libavcodec/libjxldec.c
@@ -104,9 +104,12 @@ static enum AVPixelFormat libjxl_get_pix_fmt(void *avctx, const JxlBasicInfo *ba
             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;
+            if (basic_info->alpha_bits) {
+                av_log(avctx, AV_LOG_WARNING, "Decoding gray+alpha JXL input as RGBA\n");
+                format->num_channels = 4;
+                return AV_PIX_FMT_RGBAF32;
+            }
             return AV_PIX_FMT_GRAYF32;
         }
         format->data_type = JXL_TYPE_UINT16;
@@ -119,10 +122,10 @@ static enum AVPixelFormat libjxl_get_pix_fmt(void *avctx, const JxlBasicInfo *ba
             format->data_type = JXL_TYPE_UINT8;
             return basic_info->alpha_bits ? AV_PIX_FMT_RGBA : AV_PIX_FMT_RGB24;
         }
-        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)
-            av_log(avctx, AV_LOG_WARNING, "Downsampling float to 16-bit integer 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;
     }
diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
index 0793ed251b..f9ae086e38 100644
--- a/libavcodec/libjxlenc.c
+++ b/libavcodec/libjxlenc.c
@@ -474,6 +474,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.37.3

_______________________________________________
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] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl
  2022-10-02  7:58 [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl Leo Izen
  2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 1/2] avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats Leo Izen
  2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 2/2] avcodec/libjxl: use RGB32F or RGBA32F for 32-bit float JPEG XL Leo Izen
@ 2022-10-09 11:58 ` Leo Izen
  2 siblings, 0 replies; 6+ messages in thread
From: Leo Izen @ 2022-10-09 11:58 UTC (permalink / raw)
  To: FFmpeg Development

On 10/2/22 03:58, Leo Izen wrote:
> FFmpeg has supported these pixel formats since 7bb0afc245d093b0 and
> libjxl supports receiving/sending these pixel formats so it makes
> sense to add support to the libjxl wrapper for these formats.
> 


Bumping for review.

- Leo Izen
_______________________________________________
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] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/2] avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats
  2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 1/2] avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats Leo Izen
@ 2022-10-09 17:29   ` Michael Niedermayer
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Niedermayer @ 2022-10-09 17:29 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 563 bytes --]

On Sun, Oct 02, 2022 at 03:58:34AM -0400, Leo Izen wrote:
> Add an AV_PIX_FMT_NE macro for RGB32FBE/RGB32FLE and also one for
> RGBA32FBE/RGBA32FLE for packed 32-bit float RGB samples, and also
> packed 32-bit float RGBA samples, respectively.
> 
> Signed-off-by: Leo Izen <leo.izen@gmail.com>
> ---
>  libavutil/pixfmt.h | 3 +++
>  1 file changed, 3 insertions(+)

should be ok

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 6+ messages in thread

* Re: [FFmpeg-devel] [PATCH 2/2] avcodec/libjxl: use RGB32F or RGBA32F for 32-bit float JPEG XL
  2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 2/2] avcodec/libjxl: use RGB32F or RGBA32F for 32-bit float JPEG XL Leo Izen
@ 2022-10-14 16:51   ` Leo Izen
  0 siblings, 0 replies; 6+ messages in thread
From: Leo Izen @ 2022-10-14 16:51 UTC (permalink / raw)
  To: ffmpeg-devel

On 10/2/22 03:58, Leo Izen wrote:
> Use AV_PIX_FMT_RGB32F or AV_PIX_FMT_RGBA32F for encoding and decoding
> JPEG XL files when encountered, rather than returning an error and
> refusing to do anything.
> 
> Signed-off-by: Leo Izen <leo.izen@gmail.com>
> ---
>   libavcodec/libjxldec.c | 15 +++++++++------
>   libavcodec/libjxlenc.c |  1 +
>   2 files changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/libavcodec/libjxldec.c b/libavcodec/libjxldec.c
> index de48bea4b2..92b98388d4 100644
> --- a/libavcodec/libjxldec.c
> +++ b/libavcodec/libjxldec.c
> @@ -104,9 +104,12 @@ static enum AVPixelFormat libjxl_get_pix_fmt(void *avctx, const JxlBasicInfo *ba
>               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;
> +            if (basic_info->alpha_bits) {
> +                av_log(avctx, AV_LOG_WARNING, "Decoding gray+alpha JXL input as RGBA\n");
> +                format->num_channels = 4;
> +                return AV_PIX_FMT_RGBAF32;
> +            }
>               return AV_PIX_FMT_GRAYF32;
>           }
>           format->data_type = JXL_TYPE_UINT16;
> @@ -119,10 +122,10 @@ static enum AVPixelFormat libjxl_get_pix_fmt(void *avctx, const JxlBasicInfo *ba
>               format->data_type = JXL_TYPE_UINT8;
>               return basic_info->alpha_bits ? AV_PIX_FMT_RGBA : AV_PIX_FMT_RGB24;
>           }
> -        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)
> -            av_log(avctx, AV_LOG_WARNING, "Downsampling float to 16-bit integer 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;
>       }
> diff --git a/libavcodec/libjxlenc.c b/libavcodec/libjxlenc.c
> index 0793ed251b..f9ae086e38 100644
> --- a/libavcodec/libjxlenc.c
> +++ b/libavcodec/libjxlenc.c
> @@ -474,6 +474,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,

Bump, thanks.

- Leo Izen (thebombzen)


_______________________________________________
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] 6+ messages in thread

end of thread, other threads:[~2022-10-14 16:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-02  7:58 [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl Leo Izen
2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 1/2] avutil/pixfmt.h: add native-endian RGB32F and RGBA32F formats Leo Izen
2022-10-09 17:29   ` Michael Niedermayer
2022-10-02  7:58 ` [FFmpeg-devel] [PATCH 2/2] avcodec/libjxl: use RGB32F or RGBA32F for 32-bit float JPEG XL Leo Izen
2022-10-14 16:51   ` Leo Izen
2022-10-09 11:58 ` [FFmpeg-devel] [PATCH 0/2] RGB(A)32F in libjxl 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