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

JPG encoding error (ijl15)

alexkn
Beginner
587 Views
Hello forum!

I scan a color document in B/W mode and get an image, that cutted on the corners (s.Attachment). For encoding I use the ijl15. This is my EncodeJPGFileFromDIB method:

BOOL WINAPI EncodeJPGFileFromDIB(LPCSTR lpszPathName,LPBITMAPINFOHEADER bmih) {
 BOOL bres = FALSE;
 JPEG_CORE_PROPERTIES jcprops;
 DWORD dib_pad_bytes;

if (bmih ) {
  __try {
   IJLERR err = ijlInit(&jcprops);
   if (err == IJL_OK){
    
    BOOL bColorDib = bmih->biBitCount > 8;

DWORD dwColorSize = (DWORD)(BmiColorCount(bmih) * sizeof(RGBQUAD));
    jcprops.DIBBytes  = reinterpret_cast(bmih) + 
           bmih->biSize + 
           dwColorSize;
    jcprops.DIBWidth  = bmih->biWidth;
    jcprops.DIBHeight  = abs(bmih->biHeight);
    jcprops.DIBHeight  *= -1; // Otherwise the bmih is upside down
    jcprops.DIBChannels  = bmih->biBitCount / 8;

jcprops.DIBPadBytes = IJL_DIB_PAD_BYTES(bmih->biWidth, jcprops.DIBChannels);

jcprops.DIBColor = bColorDib ? IJL_BGR : IJL_G;
    jcprops.JPGFile   = (LPTSTR)lpszPathName;
    jcprops.JPGWidth  = bmih->biWidth;
    jcprops.JPGHeight  = abs(bmih->biHeight);
    jcprops.JPGChannels  = bmih->
biBitCount / 8;
    jcprops.JPGColor  = bColorDib ? IJL_YCBCR : IJL_G;
    jcprops.JPGSubsampling = bColorDib ? IJL_411 : IJL_NONE;
    
    jcprops.jquality  = nJpegQuality; // Defaults to 75

// Remove the file form the temp area beforee wiring a new one
    DeleteFile(lpszPathName);
    err = ijlWrite(&jcprops, IJL_JFILE_WRITEWHOLEIMAGE);
    if (err == IJL_OK) {
     bres = TRUE;
    } 
   } 
  } // end try

__finally
  {
   // Clean up the Intel JPEG Library.
   ijlFree(&jcprops);
  }
 }
 return bres;
} // EncodeJPGFileFromDIB()

What is wrong? Where could be an error?

Thx, Alex
0 Kudos
1 Reply
Vladimir_Dudnik
Employee
587 Views

Hi Alex,

The original Intel JPEG Library product was end of lifed several years ago. We do not support it anymore.

I would recommend you to download IPP and IPP sample package which contain new implementation of JPEG codec based on IPP functions. This new JPEG codec implementation supports threading in both encoding and decoding modes. It also contains optimization for the latest Intel processors and support additional JPEG compression modes, like 12-bit extended baseline compression mode or 16-bit JPEG lossless compression mode.

Regards,
Vladimir

0 Kudos
Reply