#1 Re: Fast JPEG decoder » Rendre jpegdec compatible multithread » 2011-08-03 23:45:04

Yes Arnaud I'm sure...I use your unit to make thumbnails (in a background thread) and display them (in the main app thread). If I use your unit in the 2 threads it raises an access violation. If I use it only in one thread (to make thumbs OR to display them) it works flawlessly. Or if I call you unit from the background thread through Synchronize (which calls it from the main thread) it works again...but has obviously no interest.

The EAccessViolation message is "Access violation at address xxxxxxxxxx. Write of adress 00000001."

I think that your unit allocate memory from one thread which is not accessible from the other one...

Thanks again.

PS : your email address abouchez-AT-magic.fr shared on your website http://bouchez.info/ is no more available (error 550 from the smtp server). Not found another way to contact you (I'm french also !)

#2 Fast JPEG decoder » Rendre jpegdec compatible multithread » 2011-08-03 12:04:43

Yann
Replies: 10

Hi Arnaud, I'm testing your jpegdec unit, it's a very good work but it isn't compatible with multithreading...is there a way to adapt it ? I've also tried GDI+ to read my jpg, but its slower than your unit and GDI+ raise some "GDI+ Out Of Memory" errors randomly...I would be verry happy with a multithreaded version of your unit which I use with Graphics32, here is a ToBitmap32 function that you may add to your unit :

function TJpegDecode.ToBitmap32: TBitmap32;
var
  BMI: TBitmapInfo;
begin
  result := TBitmap32.Create;
  ToBMI(BMI);
  result.SetSize( abs( BMI.bmiHeader.biWidth ), abs( BMI.bmiHeader.biHeight ) );
  CopyMemory( @Result.Bits[0], pRGB, result.width*result.height*(bitsPixel div 8));
end;

Thanks for your great work,

Regards,

Yann

Board footer

Powered by FluxBB