Board index » delphi » Efficiency of JPEG conversion
Marc Pelletier
![]() Delphi Developer |
Efficiency of JPEG conversion2005-06-16 06:48:12 AM delphi42 Hello, I have written a video capture program for a digital camera. I have the option to store as bmp or jpg. I am saving the jpeg as shown below, while the bmp is done similarly but without the conversion. I've found that the conversion to jpeg is slowing down my app significantly. The frame rate goes down from 7+ to a little better than 5 frames per second. If I use the routines built into the camera control to save the images the opposite is true. It is able to save to jpeg much quicker than to bmp. Internally to the control the image is in YUV format, but I can not get at it, that may explain the differences. I'm hoping there is a quicker way of converting from bitmap to jpeg. The graphics32 library doesn't seem to be the answer. Any other ideas? cheers Marc Pelletier Goldak Airborne Surveys procedure TCamera.SaveJPeg(fBMP:TBitmap; Filename:string; Comp:integer ); var MyGraphic : TJPegImage; S: TFileStream; begin MyGraphic := TJpegImage.create; Try MyGraphic.CompressionQuality := Comp; MyGraphic.Assign( fBMP ); if fSaving then begin S := TFileStream.Create(Filename, fmCreate or fmShareExclusive); try MyGraphic.SaveToStream( S); finally S.Free; end; end; finally MyGraphic.Free; end; end; |