NCEPLIBS-g2c  1.7.0
enc_jpeg2000.c File Reference

Encodes JPEG2000 code stream. More...

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

Go to the source code of this file.

Macros

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

Functions

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...
 

Detailed Description

Encodes JPEG2000 code stream.

Author
Stephen Gilbert
Date
2002-12-02

Definition in file enc_jpeg2000.c.

Macro Definition Documentation

◆ MAXOPTSSIZE

#define MAXOPTSSIZE   1024

Maximum size of options.

Definition at line 11 of file enc_jpeg2000.c.

Function Documentation

◆ 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.

Program History Log

Date Programmer Comments
2002-12-02 Gilbert Initial
2004-12-16 Gilbert Added retry argument allowing increased guard bits.
2022-04-15 Hartnett Converted to use jas_ instead of jpc_ functions.
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 51 of file enc_jpeg2000.c.

References G2_JASPER_ENCODE, G2_JASPER_INIT, G2C_JASPER_JPEG_FORMAT_NAME, and MAXOPTSSIZE.

Referenced by jpcpack_int().