Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Gregory_Begelman
Beginner
139 Views

Jpeg decoder cannot read image header

Hello,
I use the UIC JPEG decoder to decode images. The method ReadHeader fails on the attached image. Can this be a bug in UIC?
Thank you.
0 Kudos
5 Replies
Thomas_Jensen1
Beginner
139 Views

I tested your jpeg using the latest IPP 7.4 Picnic sample app, and it fails loading it.
Windows 7 and LeadTools 16.5 can open it though. It appears to be an image saved by Photoshop on an Apple computer. It is probably corrupt in some way, and UIC cannot recover from the missing/bad data.
Gregory_Begelman
Beginner
139 Views

Other libraries successfully decode this image (like libjpeg-turbo). I suppose UIC should be able to decode it too.
Vladimir_Dudnik
Employee
139 Views

Hello,

we have tested this image with UIC JPEG decoder and can confirm that there is a bug in UIC implementation. We are working on providing the fix for this issue. I'll update you once it is ready.
Note, the issue affects UIC sample code only, no changes in IPP libraries are needed.

Regards,
Vladimir
Sergey_Ryadno
New Contributor I
139 Views

hi,
i think i found the reason for this problem. To resolve it in file bitstreamin.cpp function CheckByte() need some modification. Try this solution and write here your results.
[bash]JERRCODE CBitStreamInput::CheckByte(int pos, int* byte)
{
  JERRCODE jerr;

  if(m_currPos + pos >= m_DataLen)
  {
    //jerr = Seek(pos);
    jerr = FillBuffer();
    if(JPEG_OK != jerr)
      return jerr;

    //*byte = m_pData[0];
    *byte = m_pData[pos];
  }
  else
    *byte = m_pData[m_currPos + pos];

  return JPEG_OK;
} // CBitStreamInput::CheckByte()[/bash]
Thomas_Jensen1
Beginner
139 Views

I can confirm that with this fix, the image in question can be decoded successfully.
Reply