Difference between revisions of "Applications/Libjpeg-turbo"

From HPC
Jump to: navigation , search
(Created page with "__TOC__ ==Application Details== *Description: libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, AVX2, NEON, AltiVec) to accelerate baseline JPEG comp...")
 
Line 46: Line 46:
  
 
Compilation is carried out below, in this example the '''gcc''' compiler is used. However, the applies similarly to the Intel compiler too.
 
Compilation is carried out below, in this example the '''gcc''' compiler is used. However, the applies similarly to the Intel compiler too.
 +
  
 
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
 
<pre style="background-color: #000000; color: white; border: 2px solid black; font-family: monospace, sans-serif;">
Line 52: Line 53:
  
 
</pre>
 
</pre>
 
 
  
  

Revision as of 10:40, 17 March 2017

Application Details

  • Description: libjpeg-turbo is a JPEG image codec that uses SIMD instructions (MMX, SSE2, AVX2, NEON, AltiVec) to accelerate baseline JPEG compression .
  • Version: 1.5.1 (compiled with gcc)
  • Module: gcc/1.5.1
  • Licence: GNU

Usage Examples

Module

[username@login01 ~]$ module add libjpeg-turbo/gcc/1.5.1

Compilation

Libjpeg-turbo is a library for use either with a compiled binary that requires it, or it could be required at compilation time also.

A typical code snippet (C++) requiring is shown below:


#include <turbojpeg.h>

const int JPEG_QUALITY = 85;
const int COLOR_COMPONENTS = 3;
int _width = 640;
int _height = 720;
long unsigned int _jpegSize = 0;
unsigned char* _compressedImage = NULL;
unsigned char buffer[_width*_height*COLOR_COMPONENTS];

tjhandle _jpegCompressor = tjInitCompress();

tjCompress2(_jpegCompressor, buffer, _width, 0, _height, TJPF_RGB,
          &_compressedImage, &_jpegSize, TJSAMP_444, JPEG_QUALITY,
          TJFLAG_FASTDCT);

tjDestroy(_jpegCompressor);

//to free the memory allocated by TurboJPEG 

tjFree(&_compressedImage);

Compilation is carried out below, in this example the gcc compiler is used. However, the applies similarly to the Intel compiler too.



gcc -o tjIMAGE tjIMAGE.cpp -lm -ljpeg


Further Information

http://www.libjpeg-turbo.org/