Easy to use JPEG to Bitmap converter for Delphi 6 that is efficient with memory usage?

790 Views Asked by At

Is there an easy to use JPEG converter (source code) for Delphi 6 that will convert a JPEG frame in a memory buffer to a DirectShow compatible bitmap quickly and without constant memory re-allocation? I'm trying to avoid the default JPEG unit in conjunction with TBitmap because it allocates a new bitmap with every conversion, and has some other initialize/teardown operations involved with each operation too.

I'll be receiving JPEG frames from an RTP server that I need to convert to bitmaps and push out through the FillBuffer() call of my DirectShow filter. Each frame will be exactly the same size and format since they are streamed from a video capture device using preset settings. Therefore, if I could allocate the bitmap only once, and then convert each incoming JPEG frame into the existing bitmap memory area, I could avoid re-allocating a chunk of memory 25 times a second and the overhead of any other ancillary data objects Delphi involves in the conversion process used in the JPEG unit along with TBitmap.

It doesn't have to be lightning fast from a CPU usage perspective. Just fast enough to handle a 640 x 480 JPEG frame conversion in less than 1/25 of a second (1/15 to be safe).

1

There are 1 best solutions below

2
On

Not sure about the memory usage but a very small JPEG-decoder with source that you can easily modify yourself is NanoJPEG: http://keyj.emphy.de/nanojpeg/

Delphi conversion here: http://www.emix8.org/static.php?page=nanoJpeg