Closed ghost closed 3 years ago
I suspect that gwenview works in such way, that my plug-in is executed two times.
However I would like to have your huge testfile so I can verify things on my side.
Please try this file from Wikimedia instead.
cjxl 02F_Nov_21_2012_0225Z.jpg 02F_Nov_21_2012_0225Z.jxl
should produce a 56.8 MB file.
djxl
it to PPM takes around 15 seconds.
Gwenview takes around 24 seconds to load the image, with the following message:
org.kde.kdegraphics.gwenview.lib: Unresolved mime type "image/x-mng"
org.kde.kdegraphics.gwenview.lib: Unresolved raw mime type "image/x-nikon-nrw"
org.kde.kdegraphics.gwenview.lib: Unresolved raw mime type "image/x-samsung-srw"
color profile available
Beginning of a frame.
full image
color profile available
Beginning of a frame.
full image
org.kde.kdegraphics.gwenview.lib: Gwenview can only apply color profile on RGB32 or ARGB32 images
When you see this 2 times, it means that image was decoded two times (those are my debug messages):
color profile available
Beginning of a frame.
full image
Thanks for the test file!
This is a sequence that I have:
> gwenview CyberPunk2077.jxl
Icon theme "gnome" not found.
org.kde.kdegraphics.gwenview.lib: Unresolved mime type "image/x-mng"
org.kde.kdegraphics.gwenview.lib: Unresolved raw mime type "image/x-nikon-nrw"
org.kde.kdegraphics.gwenview.lib: Unresolved raw mime type "image/x-samsung-srw"
color profile available
Beginning of a frame.
full image
color profile available
Beginning of a frame.
full image
org.kde.kdegraphics.gwenview.lib: Gwenview can only apply color profile on RGB32 or ARGB32 images
color profile available
Beginning of a frame.
color profile available
Beginning of a frame.
full image
full image
color profile available
Beginning of a frame.
full image
Total 5 full image and Beginning of frame prints
@master-of-zen You have probably more .jxl files in the folder. I think gwenview preloads other images to display them faster.
I see. Is there any way to avoid decoding the image two times?
By the way, can this plugin switch to other QImage::Format
, similar to qt-avif-image-plugin
?
Premultiplied
formats if m_basicinfo.alpha_premultiplied
Qt docs notes that "rendering is best optimized to the Format_RGB32
and Format_ARGB32_Premultiplied
formats, and secondarily for rendering to the Format_RGB16
, Format_RGBX8888
, Format_RGBA8888_Premultiplied
, Format_RGBX64
and Format_RGBA64_Premultiplied
formats".
Also, Gwenview currently "can only apply color profile on RGB32 or ARGB32 images", so I think it will be a good idea if 32-bit formats are used for true color images.
I had to avoid to use 8bit/channel formats because libjxl use some unknown alignment/padding for the input/output buffers and the result is the https://github.com/novomesk/qt-jpegxl-image-plugin/issues/2 issue.
I'd like to have some testfile which has m_basicinfo.alpha_premultiplied
flag set on, I am unsure how the data are returned from libjxl. Maybe I have a bug. I am really missing some reference collection of testfiles.
I'd like to investigate the performance issue but I am waiting for new release of jpeg-xl so I can see what are the new changes in the C API I am using. Most probably I will be changing my implementation anyway.
In order to build the Qt viewer from jpeg-xl, try to run BUILD_DIR=/tmp/build ./ci.sh opt
or add -DJPEGXL_ENABLE_VIEWERS=ON
parameter to cmake.
I updated to the latest commit of this plugin and it seems that the issue has been solved - the image is no longer decoded 2 times. Gwenview now only needs 12 seconds to load the test image.
When I open the test file above (02F_Nov_21_2012_0225Z.jxl
) using Gwenview, @alistair7's qt-jxl-image-plugin (2c64aa2
) is faster and only needs 9-10 seconds to display the image (compared to this plugin's ab36054
).
Any idea why this happens?
Note 1: I am still using libjpeg-xl 0.2 so older commits are used. Note 2: I open the file 3 times for each plugin. This plugin always uses around 12 seconds, while alistair7's version takes around 12 seconds for the 1st time and only 9-10 seconds afterwards.
There are 3 reasons: 1) I support ImageOption Size and there is some processing related to that. 2) I decoded everything in 16bit and that’s slightly slower for huge images than requesting 8bit buffer. I enabled 8bit format buffer again for some images so it should partially help. 3) When image doesn’t have alpha channel I convert image to other QImage::Format to indicate that the image is not RGBA.
I am using this plugin with Gwenview to view a 16 MB JXL file (created with
cjxl -s 3 -d 0
) (image and monitor are both 24-bit true color) , but Gwenview shows the spinner for around 6 seconds before the image is displayed. Meanwhile,djxl
decodes the same file in less than 3 seconds.Any idea why this happens?
(It seems that the reference software has an example viewer program, but I don't know how to compile the viewer, so I can't make a comparison between the reference viewer and this plugin.)