What is the fastest way to decompress JPEG images in C #

I need to write a DICOM multi-frame image application. Each frame is stored in JPEG format. All frames are stored sequentially in one file. Right now I am reading the data of each frame and passing it to the following procedure to build a bitmap for display:

    Bitmap CreateBitmap(byte[] pixelBuffer, int frameSize)
    {
        Bitmap image = null;

        try
        {
            long startTicks = DateTime.Now.Ticks;
            MemoryStream pixelStream = new MemoryStream(pixelBuffer, 0, frameSize);
            image = new Bitmap(pixelStream);
            loadTime = DateTime.Now.Ticks - startTicks;
        }
        catch (Exception ex)
        {
            Log.LogException(ex);
        }

        return image;
    }

, , . 800x600 , , 0 15 ( ). 1024x768 , , 15 31 . - ( 1024x768) 60 . , JPEG 15 . , - ?

+5
4

0 15 , . QueryPerformanceCounter, .

WPF JPEG (System.Windows.Media.Imaging) , GDI +.

+6

, , , , JPEG, - , , MEPG Quicktime. JPEG , .

+2

, , System.Windows.Media.Imaging.JpegBitmapEncoder :

            JpegBitmapDecoder decoder = new JpegBitmapDecoder(pixelStream, BitmapCreateOptions.None, BitmapCacheOption.None);
            BitmapFrame frame = decoder.Frames[0];
            frame.CopyPixels(pixelBuffer, stride, 0);

, , 100% . WIC WPF. 1024x768 9-10 .

+2

WIC, Windows. , , WPF, .

0
source

All Articles