Media (Intel® Video Processing Library, Intel Media SDK)
Access community support with transcoding, decoding, and encoding in applications using media tools like Intel® oneAPI Video Processing Library and Intel® Media SDK
Announcements
The Intel Media SDK project is no longer active. For continued support and access to new features, Intel Media SDK users are encouraged to read the transition guide on upgrading from Intel® Media SDK to Intel® Video Processing Library (VPL), and to move to VPL as soon as possible.
For more information, see the VPL website.

Convert IJL methods to IPP methods

GAIL_N_
Beginner
443 Views

Hello,

Has anyone been through the process of converting C or C++ code which performed JPEG compression and decompression using IJL to using IPP? In particular, we create buffers of data to be compressed and decompressed since we have proprietary file formats. Below is a section of the code which compress a buffer. Note, this is a method in a class and some of the data is set in the class constructor.

As you will see, this code is very clean and simple unlike the IPP examples which seem to be only file based, i.e. reading headers and writing data to files, and also more complex. The documentation is also vast and broken up into small sections. So far it seems impenetrable. 

I will be most grateful for some guidance to usage documentation or an example. 

Thank you.

uint32
JpegCompressor::compress( uint8* buffer, uint32 factor,
                                           uint16 photometric_interpretation )
{
  JPEG_CORE_PROPERTIES jcprops;

  IJLERR stat;
  
  if ((stat = ijlInit(&jcprops)) != IJL_OK)
  {
    const char* err = (const char*)ijlErrorStr(stat);
    
    cerr << "IJLError: " << err << " UNABLE TO INIT JPEG CORE PROPS\n";
    
    ijlFree(&jcprops);
    return -1;
  }
  
  jcprops.DIBWidth = width;
  jcprops.DIBHeight = height;
  jcprops.DIBChannels = bands;
  jcprops.DIBColor = ( bands == 1 ) ? IJL_G : IJL_RGB;
  jcprops.DIBPadBytes = 0;
  jcprops.DIBBytes = buffer;
  
  int buffer_size = width*height*bands;
  compressed_data = new uint8 [buffer_size];
  jcprops.JPGBytes = compressed_data;
  jcprops.JPGSizeBytes = buffer_size;
  jcprops.JPGWidth = width;
  jcprops.JPGHeight = height;
  jcprops.JPGChannels = bands;

  IJL_COLOR out_photometric = IJL_G;
  if(bands == 3) 
  {
    out_photometric = (photometric_interpretation == PHOTOMETRIC_RGB) ?
      IJL_RGB : IJL_YCBCR;
  }
  jcprops.JPGColor = out_photometric;
  jcprops.JPGSubsampling = (IJL_JPGSUBSAMPLING) IJL_NONE;
  jcprops.jquality = factor;
  
  if((stat = ijlWrite(&jcprops, IJL_JBUFF_WRITEWHOLEIMAGE)) != IJL_OK)
  {
    const char* err = (const char*)ijlErrorStr(stat);
    cerr << "IJLError: " << err << " UNABLE TO COMPRESS JPEG IMAGE\n";

    ijlFree(&jcprops);
    return -1;
  }
  
  compressed_size = jcprops.JPGSizeBytes;
  
  ijlFree(&jcprops);  
  return compressed_size;  

}

We have lived happily with this old library but now plan to build a 64bit application and so we must upgrade to IPP. 

0 Kudos
2 Replies
Jonghak_K_Intel
Employee
443 Views

Hi Gail,

 

the whole JPEG support domain of IPP has been moved to Intel Media SDK and it will be supported and maintained from Intel Media SDK.

So I am moving this post to Media SDK forum and there will be answers you are seeking for.

 

Thank you

0 Kudos
GAIL_N_
Beginner
443 Views

Hello Jon J K.,

Thank you for moving my post. Could you please comment on whether or not the Media SDK is the correct forum for questions related to IPL to IPP ports?

Once again, thank you. 

0 Kudos
Reply