Page 1 of 1
LoadBrush() with progressive JPEG
Posted: Sun Sep 18, 2022 11:32 am
by Flinx
While experimenting with the image cache of my music player, I noticed that loading a specific image causes problems. When loading from the local drive it is not very noticeable, but with the low-performance SMB server of my AVM router
LoadBrush() takes almost five minutes (tested with Windows and Linux). I had a look with ProcessMonitor and there are about 395000 ReadFile attempts far outside the file size.
Maybe something can be improved there.
Here is a test script
Code: Select all
filename$="p2983.jpg"
If IsPicture(filename$)
Local id=LoadBrush(Nil,filename$)
DisplayBrush(id, #CENTER, #CENTER)
EndIf
Wait(300)
The image is
here and it's from
here (it was imported with MP3Tag).
Ralf
Re: LoadBrush() with progressive JPEG
Posted: Sat Sep 24, 2022 11:35 pm
by airsoftsoftwair
Can you test the following on Windows?
Code: Select all
Local id = LoadBrush(Nil, filename$, {Loader = "native"})
This will load the brush through the Windows Imaging Component (WIC) instead of Hollywood's internal image loader. Does it make a difference?
Re: LoadBrush() with progressive JPEG
Posted: Sun Sep 25, 2022 11:00 am
by Flinx
It has a similar effect, but only 265000 ReadFile attempts instead of 395000.
Re: LoadBrush() with progressive JPEG
Posted: Sun Sep 25, 2022 7:17 pm
by airsoftsoftwair
There's probably not much I can do here because that's just how libjpeg works. Have you tried converting the JPEG to a string using
FileToString() and then define a virtual file on that string using
DefineVirtualFileFromString() and then loading the image from the virtual file?
Re: LoadBrush() with progressive JPEG
Posted: Mon Sep 26, 2022 5:31 pm
by Flinx
Thanks, that helps (although I don't like that this libjpeg doesn't stop reading at the first end-of-file message).
I didn't know
DefineVirtualFileFromString() yet, and of course it helps with extracting the cover images from the ID3 tags too.