Leptonica 1.84.1
Image processing and image analysis suite
Loading...
Searching...
No Matches
jp2kio.c File Reference
#include <string.h>
#include "allheaders.h"

Go to the source code of this file.

Detailed Description


   Read jp2k from file
         PIX                *pixReadJp2k()  [special top level]
         PIX                *pixReadStreamJp2k()

   Write jp2k to file
         l_int32             pixWriteJp2k()  [special top level]
         l_int32             pixWriteStreamJp2k()
         static opj_image_t *pixConvertToOpjImage()

   Read/write to memory
         PIX                *pixReadMemJp2k()
         l_int32             pixWriteMemJp2k()

   Static functions from opj 2.0 to retain file stream interface
         static opj_stream_t  *opjCreateStream()
         [other static helpers]

   Based on the OpenJPEG distribution:
       http://www.openjpeg.org/
   The ISO/IEC reference for jpeg2000 is:
       http://www.jpeg.org/public/15444-1annexi.pdf

   Compressing to memory and decompressing from memory
   ---------------------------------------------------
   On systems like Windows without fmemopen() and open_memstream(),
   we write data to a temp file and read it back for operations
   between pix and compressed-data, such as pixReadMemJp2k() and
   pixWriteMemJp2k().

   Pdf can accept jp2k compressed strings directly
   -----------------------------------------------
   Transcoding (with the uncompress/compress cycle) is not required
   to wrap images that have already been compressed with jp2k in pdf,
   because the pdf format for jp2k includes the full string of the
   jp2k compressed images.  This is also true for jpeg compressed
   strings.

   N.B.
   * Reading and writing jp2k are supported here for releases 2.1 and later.
   * The openjpeg.h file is installed in an openjpeg-2.X subdirectory.
   * In openjpeg-2.X, reading is slow compared to jpeg or webp,
     and writing is very slow compared to jpeg or webp.
   * Specifying a quality factor for jpeg2000 requires caution.  Unlike
     jpeg and webp, which have a sensible scale that goes from 0 (very poor)
     to 100 (nearly lossless), kakadu and openjpeg use idiosyncratic and
     non-intuitive numbers.  kakadu uses "rate/distortion" numbers in
     a narrow range around 50,000; openjpeg (and our write interface)
     use SNR.  The visually apparent artifacts introduced by compression
     are strongly content-dependent and vary in a highly non-linear
     way with SNR.  We take SNR = 34 as default, roughly similar in
     quality to jpeg's default standard of 75.  For document images,
     SNR = 25 is very poor, whereas SNR = 45 is nearly lossless.  If you
     use the latter, you will pay dearly in the size of the compressed file.
   * The openjpeg interface was massively changed from 1.X to 2.0.
     There were also changes from 2.0 to 2.1.  From 2.0 to 2.1, the
     ability to interface to a C file stream was removed permanently.
     Leptonica supports both file stream and memory buffer interfaces
     for every image I/O library, and it requires the libraries to
     support at least one of these.  However, because openjpeg-2.1+ provides
     neither, we have brought several static functions over from
     openjpeg-2.0 in order to retain the file stream interface.
     See, for example, our static function opjCreateStream().

Definition in file jp2kio.c.