Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/d695d21817cbc1d4bdf0e1bdcafdd32dac025302
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/d695d21817cbc1d4bdf0e1bdcafdd32dac025302
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/d695d21817cbc1d4bdf0e1bdcafdd32dac025302

The branch, tlsa/vince/libjxl has been created
        at  d695d21817cbc1d4bdf0e1bdcafdd32dac025302 (commit)

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=d695d21817cbc1d4bdf0e1bdcafdd32dac025302
commit d695d21817cbc1d4bdf0e1bdcafdd32dac025302
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    jpegxl: Ensure decoded bitmap format is converted to front end format

diff --git a/content/handlers/image/jpegxl.c b/content/handlers/image/jpegxl.c
index 0451e2a..01c7045 100644
--- a/content/handlers/image/jpegxl.c
+++ b/content/handlers/image/jpegxl.c
@@ -97,6 +97,17 @@ jpegxl_cache_convert(struct content *c)
        const uint8_t *src_data;
        size_t src_size;
        uint8_t * output;
+       bitmap_fmt_t jxl_fmt = {
+               /** TODO: At the moment we have to set the layout to the only
+                *        pixel layout that libjxl supports. It looks like they
+                *        plan to add support for decoding to other layouts
+                *        in the future, as shown by the TODO in the docs:
+                *
+                * 
https://libjxl.readthedocs.io/en/latest/api_common.html#_CPPv414JxlPixelFormat
+                */
+               .layout = BITMAP_LAYOUT_R8G8B8A8,
+               .pma    = bitmap_fmt.pma,
+       };
 
        jxldec = JxlDecoderCreate(NULL);
        if (jxldec == NULL) {
@@ -180,8 +191,9 @@ jpegxl_cache_convert(struct content *c)
        
        JxlDecoderDestroy(jxldec);
 
+       bitmap_format_to_client(bitmap, &jxl_fmt);
        guit->bitmap->modified(bitmap);
-               
+
        return bitmap;
 }
 


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=12872ed3d5d402b6ab0b61f8cda4b8642e2c34f1
commit 12872ed3d5d402b6ab0b61f8cda4b8642e2c34f1
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    jpegxl: Tell libjxl to decode unpremultiply alpha if needed
    
    On some platforms our bitmap format does not use premultiplied alpha.

diff --git a/content/handlers/image/jpegxl.c b/content/handlers/image/jpegxl.c
index d5152fb..0451e2a 100644
--- a/content/handlers/image/jpegxl.c
+++ b/content/handlers/image/jpegxl.c
@@ -103,6 +103,15 @@ jpegxl_cache_convert(struct content *c)
                NSLOG(netsurf, ERROR, "Unable to allocate decoder");
                return NULL;
        }
+
+       decstatus = JxlDecoderSetUnpremultiplyAlpha(jxldec, !bitmap_fmt.pma);
+       if (decstatus != JXL_DEC_SUCCESS) {
+               NSLOG(netsurf, ERROR, "unable to set premultiplied alpha 
status: %d",
+                               decstatus);
+               JxlDecoderDestroy(jxldec);
+               return NULL;
+       }
+
        decstatus= JxlDecoderSubscribeEvents(jxldec, JXL_DEC_FULL_IMAGE);
        if (decstatus != JXL_DEC_SUCCESS) {
                NSLOG(netsurf, ERROR, "Unable to subscribe");


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=3dfe73af9a2282d7eb2f1329ab1dfe2688bea185
commit 3dfe73af9a2282d7eb2f1329ab1dfe2688bea185
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    jpegxl: Designated initialiser for output format struct
    
    So I could see the meanings of how we'd set up the decode.

diff --git a/content/handlers/image/jpegxl.c b/content/handlers/image/jpegxl.c
index ba385f3..d5152fb 100644
--- a/content/handlers/image/jpegxl.c
+++ b/content/handlers/image/jpegxl.c
@@ -49,7 +49,12 @@
 /**
  * output image format
  */
-static const JxlPixelFormat jxl_output_format = {4, JXL_TYPE_UINT8, 
JXL_LITTLE_ENDIAN, 0};
+static const JxlPixelFormat jxl_output_format = {
+       .num_channels = 4,
+       .data_type    = JXL_TYPE_UINT8,
+       .endianness   = JXL_LITTLE_ENDIAN,
+       .align        = 0,
+};
 
 /**
  * Content create entry point.


commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=cb5d8e58d436806cd69268e1f20156d8e8eb387e
commit cb5d8e58d436806cd69268e1f20156d8e8eb387e
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>

    Makefile: Set libjxl to AUTO

diff --git a/Makefile.defaults b/Makefile.defaults
index 85be748..bbff688 100644
--- a/Makefile.defaults
+++ b/Makefile.defaults
@@ -51,6 +51,10 @@ NETSURF_USE_GIF := AUTO
 # Valid options: YES, NO                                 (highly recommended)
 NETSURF_USE_JPEG := YES
 
+# Enable NetSurf's use of libjxl for displaying JPEGXLs
+# Valid options: YES, NO, AUTO                           (highly recommended)
+NETSURF_USE_JPEGXL := AUTO
+
 # Enable NetSurf's use of libpng for displaying PNGs.
 # Valid options: YES, NO, AUTO                           (highly recommended)
 NETSURF_USE_PNG := AUTO


-----------------------------------------------------------------------


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to