Here are the modifications made for this update:
1. Now the library is licensed under a MPL/GPL/LGPL tri-license (not only
LGPL);
2. Memory leak has been fixed in this version;
3. It was indeed identified that this decoder is not able to decode some kind
of jpeg files; comes from original jpegdec code, not our Delphi conversion; in
such cases, the original libjpeg library (i.e. default jpeg unit) must be used
instead.
Source code is available from http://synopse.info/files/jpegdec.zip
Note:
If I've time these days, I'll try to adapt the x86 SIMD extension for IJG JPEG
library version (from MIYASAKA
Masaru) into a pure Delphi unit. This version seems more compatible, but a
bit more tricky to adapt as a Delphi unit. Stay tuned!
Fast JPEG decoder using SSE/SSE2 version 1.1
2010-03-18. Permalink Open Source › Open Source libraries
The Fast JPEG decoder using SSE/SSE2 library file has been updated, and is now in version 1.1, released under a MPL/GPL/LGPL tri-license.
Add ping
Trackback URL : https://blog.synopse.info?trackback/208
2 reactions
1 From Esmond - 24/03/2010, 00:20
Wow! this seems more than twice as faster than the standard delphi jpeg decoder which already seemed fast. However, I've tried stress testing it by decoding lots of jpegs and it crashes after doing between 9958 and 9962 images with an EOutOfResources error.
I did the test with the demo program by moving the code in OnShow to the OnClick of a button put on the form and then wrapping it in a loop like:
procedure TForm1.Button1Click(Sender: TObject);
var Bmp: TBitmap; i : integer;
begin
for i := 0 to 50000 do begin
with TMemoryStream.Create do
try
LoadFromFile('c:\2.JPG'); //Sample Pictures\Tree.jpg');
Bmp := JpegDecode(Memory,Size);
if Bmp<>nil then
try
Image1.Picture.Bitmap := Bmp;
finally
Bmp.Free;
end;
caption := inttostr(i);
finally
Free;
end;
end;
end;
The size of the jpeg didn't appear to affect when it crashed, nor trying the test on different hardware. My knowledge of assembly is fuzzy so I'm a bit stuck. Can anyone else repeat this? (test with a small jpeg and it should take less than a minute to run)
thanks,
Esmond
2 From A.Bouchez - 24/03/2010, 10:08
There was indeed a resource leak in TJpegDecode.ToBitmap.
The HDC retrieved by GetDC(0) function was not released.
It's fixed now. Update can be downloaded from the same link above.
The other methods (like DrawTo) works fine.
Thanks for the feedback and good testing!