Results 1 to 10 of 10

Thread: Image Conversion on Multiple Threads

  1. #1
    Join Date
    May 2011
    Posts
    14

    Default Image Conversion on Multiple Threads

    Hello,

    I am trying to use several threads to convert images from Nikon's NEF format to TIFF using ImgSource v5 and SARAW 2.2 (both are the latest versions), but the resulting images are corrupt. This works if I convert a single image at a time, but not when I run multiple threads...

    I initialise the libraries once using:

    is5_Initialize();
    SARAW_Initialize();

    Then on each thread I set the hooks using:

    if (HISEXTHK hHk = is5_GetExtHook(0))
    {
    SARAW_SetImgSourceHooks(hHk);
    GlobalFree(hHk);
    }

    and then convert the NEF image to TIFF using:

    if (HISSRC hSrc = is5_OpenFileSourceW(pNefFile))
    {
    UINT32 uiW = 0;
    UINT32 uiH = 0;
    if (HGLOBAL hImg = SARAW_ReadRAW(hSrc, &uiW, &uiH, 24, 1.0, 3, -1, 0, 0, 0, 0, (1<< 9)))
    {

    if (HISDEST hDest = is5_OpenFileDestW(pTiffFile, FALSE))
    {

    is5_WriteTIFF(hDest, (BYTE*) hImg, uiW, uiH, 24, uiW*3, 0, 1, 0, 0);
    is5_CloseDest(hDest);
    }
    GlobalFree(hImg);
    }
    is5_CloseSource(hSrc);
    }

    Can anyone see what I have done wrong please?

  2. #2
    Join Date
    Mar 2006
    Posts
    811

    Default Re: Image Conversion on Multiple Threads

    i don't see anything obviously wrong with your code.

    just as an experiment, do you get good output files if you convert JPG or BMP to TIFF (ex. replace that SARAW call with is5_ReadJPG, or is5_ReadBMP) ? just wondering if the problem is in SARAW...

  3. #3
    Join Date
    May 2011
    Posts
    14

    Default Re: Image Conversion on Multiple Threads

    Hi there,

    I've just tried your suggestion of converting JPG and BMP images into TIFF on 2 parallel threads within the same process - both of these work correctly. So this would suggest that there seems to be a problem with SARAW.

    Do you have any suggestions?

    Regards,
    sibo

  4. #4
    Join Date
    May 2011
    Posts
    14

    Default Re: Image Conversion on Multiple Threads

    Hi,

    I've just tried to reply, but my post has disappeared, so I'll try again.

    I tried to convert JPG and BMP images into TIFF format on 2 concurrent threads within the same process and I got the correct results. So does this suggest that there is indeed a problem with SARAW?

    Do you have any suggestions to fix the situation

    Regards,
    sibo

  5. #5
    Join Date
    Mar 2006
    Posts
    811

    Default Re: Image Conversion on Multiple Threads

    i'm going to have to take a look at the SARAW code to see what's going on. AFAIK, the code is thread-safe. but obviously it might not be.

  6. #6
    Join Date
    Mar 2006
    Posts
    811

    Default Re: Image Conversion on Multiple Threads

    also... do you know which camera(s) your RAW files came from ?
    (helps to know which decoder to focus on)

  7. #7
    Join Date
    Mar 2006
    Posts
    811

    Default Re: Image Conversion on Multiple Threads

    hi,
    we've just uploaded a new SARAW package (v2.2.6.2). this should fix the problem you're seeing.

  8. #8
    Join Date
    May 2011
    Posts
    14

    Default Re: Image Conversion on Multiple Threads

    It was taken from a D90.

  9. #9
    Join Date
    May 2011
    Posts
    14

    Default Re: Image Conversion on Multiple Threads

    Great thank you very much - now that's good service!

  10. #10
    Join Date
    May 2011
    Posts
    14

    Default Re: Image Conversion on Multiple Threads

    Hi,

    I can confirm that this fix works in my application - many thanks for your prompt attention.

    Regards,
    sibo

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •