NCEPLIBS-g2  3.5.0
g2cjpeg2000.c File Reference

These functions code/decode a jpeg2000 stream. More...

#include <stdio.h>
#include <stdlib.h>
#include "jasper/jasper.h"
#include "jpeg.h"

Go to the source code of this file.

Macros

#define MAXOPTSSIZE   1024
 Maximum size of options. More...
 

Functions

int dec_jpeg2000 (char *injpc, g2int bufsize, g2int *outfld)
 This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. More...
 
int enc_jpeg2000 (unsigned char *cin, g2int width, g2int height, g2int nbits, g2int ltype, g2int ratio, g2int retry, char *outjpc, g2int jpclen)
 This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. More...
 
int g2c_dec_jpeg2000 (char *injpc, size_t bufsize, int *outfld)
 This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. More...
 
int g2c_enc_jpeg2000 (unsigned char *cin, int width, int height, int nbits, int ltype, int ratio, int retry, char *outjpc, size_t jpclen)
 This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. More...
 
static int int_dec_jpeg2000 (char *injpc, g2int bufsize, void *outfld, int out_is_g2int)
 This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software. More...
 

Detailed Description

These functions code/decode a jpeg2000 stream.

Author
Ed Hartnett
Date
Mar 5, 2024

Definition in file g2cjpeg2000.c.

Macro Definition Documentation

◆ MAXOPTSSIZE

#define MAXOPTSSIZE   1024

Maximum size of options.

Definition at line 11 of file g2cjpeg2000.c.

Function Documentation

◆ dec_jpeg2000()

int dec_jpeg2000 ( char *  injpc,
g2int  bufsize,
g2int outfld 
)

This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.

Parameters
injpcPointer to buffer that holds the input JPEG2000 code stream.
bufsizeLength (in bytes) of the buffer that holds the input JPEG2000 code stream.
outfldPointer to g2int array, already allocated, that gets the unpacked data.
Returns
Author
Stephen Gilbert, Ed Hartnett

Definition at line 367 of file g2cjpeg2000.c.

References int_dec_jpeg2000().

Referenced by jpcunpack().

◆ enc_jpeg2000()

int enc_jpeg2000 ( unsigned char *  cin,
g2int  width,
g2int  height,
g2int  nbits,
g2int  ltype,
g2int  ratio,
g2int  retry,
char *  outjpc,
g2int  jpclen 
)

This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.

Parameters
cinPacked matrix of Grayscale image values to encode.
widthwidth of image.
heightheight of image.
nbitsdepth (in bits) of image. i.e number of bits used to hold each data value.
ltypeindicator of lossless or lossy compression.
  • 1, for lossy compression
  • != 1, for lossless compression
ratiotarget compression ratio. (ratio:1) Used only when ltype == 1.
retryIf 1 try increasing number of guard bits.
outjpcOutput encoded JPEG2000 code stream.
jpclenNumber of bytes allocated for the output JPEG2000 code stream in outjpc.
Returns
  • > 0 = Length in bytes of encoded JPEG2000 code stream
  • G2_JASPER_INIT Error initializing jasper library.
  • G2_JASPER_ENCODE Error encode jpeg2000 code stream.
Note
Requires JasPer Software version 1.500.4 or 1.700.2 or later.
Author
Stephen Gilbert
Date
2002-12-02
Author
Ed Hartnett

Definition at line 44 of file g2cjpeg2000.c.

References G2_JASPER_ENCODE, G2_JASPER_INIT, G2C_JASPER_JPEG_FORMAT_NAME, G2C_JASPER_MAX_MEMORY, and MAXOPTSSIZE.

Referenced by g2c_enc_jpeg2000(), and jpcpack().

◆ g2c_dec_jpeg2000()

int g2c_dec_jpeg2000 ( char *  injpc,
size_t  bufsize,
int *  outfld 
)

This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.

Parameters
injpcPointer to buffer that holds the input JPEG2000 code stream.
bufsizeLength (in bytes) of the buffer that holds the input JPEG2000 code stream.
outfldPointer to int array, already allocated, that gets the unpacked data.
Returns
Author
Ed Hartnett
Date
9/7/22

Definition at line 340 of file g2cjpeg2000.c.

References int_dec_jpeg2000().

◆ g2c_enc_jpeg2000()

int g2c_enc_jpeg2000 ( unsigned char *  cin,
int  width,
int  height,
int  nbits,
int  ltype,
int  ratio,
int  retry,
char *  outjpc,
size_t  jpclen 
)

This Function encodes a grayscale image into a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.

Parameters
cinPacked matrix of Grayscale image values to encode.
widthwidth of image.
heightheight of image.
nbitsdepth (in bits) of image. i.e number of bits used to hold each data value.
ltypeindicator of lossless or lossy compression.
  • 1, for lossy compression
  • != 1, for lossless compression
ratiotarget compression ratio. (ratio:1) Used only when ltype == 1.
retryIf 1 try increasing number of guard bits.
outjpcOutput encoded JPEG2000 code stream.
jpclenNumber of bytes allocated for the output JPEG2000 code stream in outjpc.
Returns
  • > 0 = Length in bytes of encoded JPEG2000 code stream
  • G2_JASPER_INIT Error initializing jasper library.
  • G2_JASPER_ENCODE Error encode jpeg2000 code stream.
Note
Requires JasPer Software version 1.500.4 or 1.700.2 or later.
Author
Stephen Gilbert
Date
2002-12-02
Author
Ed Hartnett

Definition at line 176 of file g2cjpeg2000.c.

References enc_jpeg2000().

◆ int_dec_jpeg2000()

static int int_dec_jpeg2000 ( char *  injpc,
g2int  bufsize,
void *  outfld,
int  out_is_g2int 
)
static

This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using JasPer Software.

Parameters
injpcPointer to buffer that holds the input JPEG2000 code stream.
bufsizeLength (in bytes) of the buffer that holds the input JPEG2000 code stream.
outfldPointer to either int or g2int array, already allocated, that gets the unpacked data.
out_is_g2intNon-zero if the output array is of type g2int (i.e. 64-bit ints), zero if output is an int array (32-bits).
Returns
Author
Stephen Gilbert
Date
2002-12-02
Author
Ed Hartnett

Definition at line 212 of file g2cjpeg2000.c.

References G2_JASPER_DECODE, G2_JASPER_DECODE_COLOR, G2_JASPER_INIT, G2C_JASPER_JPEG_FORMAT_NAME, G2C_JASPER_MAX_MEMORY, and drstemplates::j.

Referenced by dec_jpeg2000(), and g2c_dec_jpeg2000().