Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Jpeg decoder cannot read image header

Gregory_Begelman
Beginner
884 Views
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
884 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.
0 Kudos
Gregory_Begelman
Beginner
884 Views
Other libraries successfully decode this image (like libjpeg-turbo). I suppose UIC should be able to decode it too.
0 Kudos
Vladimir_Dudnik
Employee
884 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
0 Kudos
Sergey_Ryadno
New Contributor I
884 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]
0 Kudos
Thomas_Jensen1
Beginner
884 Views
I can confirm that with this fix, the image in question can be decoded successfully.
0 Kudos
Reply