NCEPLIBS-g2c 2.0.0
Loading...
Searching...
No Matches
jpcunpack.c File Reference

Unpack a data field that was packed with JPEG2000. More...

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

Go to the source code of this file.

Functions

int g2c_jpcunpackd (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, double *fld)
 Unpack JPEG2000 compressed data into an array of doubles, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.
 
int g2c_jpcunpackf (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, float *fld)
 Unpack JPEG2000 compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.
 
g2int jpcunpack (unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, float *fld)
 Unpack JPEG2000 compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.
 
static int jpcunpack_int (unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, void *fld, int fld_is_double, int verbose)
 Unpack JPEG2000 compressed data into an array of floats or doubles, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.
 

Detailed Description

Unpack a data field that was packed with JPEG2000.

stream

Author
Stephem Gilbert
Date
2003-08-27

Definition in file jpcunpack.c.

Function Documentation

◆ g2c_jpcunpackd()

int g2c_jpcunpackd ( unsigned char *  cpack,
size_t  len,
int *  idrstmpl,
size_t  ndpts,
double *  fld 
)

Unpack JPEG2000 compressed data into an array of doubles, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.

This function is the V2 API version of jpcunpack() for doubles.

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.40 or 5.40000.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values as an array of double.
Returns
Author
Ed Hartnett
Date
2022-08-12

Definition at line 199 of file jpcunpack.c.

References G2C_JPEG_DRS_TEMPLATE_LEN, jpcunpack_int(), and LOG.

◆ g2c_jpcunpackf()

int g2c_jpcunpackf ( unsigned char *  cpack,
size_t  len,
int *  idrstmpl,
size_t  ndpts,
float *  fld 
)

Unpack JPEG2000 compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.40 or 5.40000.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values as an array of float.
Returns
Author
Ed Hartnett
Date
2022-09-08

Definition at line 159 of file jpcunpack.c.

References G2C_JPEG_DRS_TEMPLATE_LEN, jpcunpack_int(), and LOG.

◆ jpcunpack()

g2int jpcunpack ( unsigned char *  cpack,
g2int  len,
g2int idrstmpl,
g2int  ndpts,
float *  fld 
)

Unpack JPEG2000 compressed data into an array of floats, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.40 or 5.40000.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values as an array of float.
Returns
Author
Stephem Gilbert
Date
2003-08-27

Definition at line 123 of file jpcunpack.c.

References G2_JPCUNPACK_MEM, jpcunpack_int(), and LOG.

Referenced by g2c_unpack7_int().

◆ jpcunpack_int()

static int jpcunpack_int ( unsigned char *  cpack,
g2int  len,
g2int idrstmpl,
g2int  ndpts,
void *  fld,
int  fld_is_double,
int  verbose 
)
static

Unpack JPEG2000 compressed data into an array of floats or doubles, using info from the GRIB2 Data Representation Template 5.40 or 5.40000.

This function is used by jpcunpack(), g2c_jpcunpackf(), and g2c_jpcunpackd().

Parameters
cpackThe packed data.
lenThe length of the packed data.
idrstmplPointer to array of values for Data Representation Template 5.40 or 5.40000.
ndptsThe number of data values to unpack.
fldA pointer that gets the unpacked data values.
fld_is_doubleNon-zero if the data are to be unpacked into a double array, otherwise data will be unpacked into a float array.
verboseIf non-zero, error messages will be printed in case of error. Otherwise, error codes will be return but no error messages printed. Calls to the original g2c API may cause error messages to be printed in case of error. For the new g2c_ API, no error messages will be printed - instead an error code will be returned. Call g2c_strerror() to get the error message for any error code.
Returns
Author
Ed Hartnett
Date
2022-09-06

Definition at line 44 of file jpcunpack.c.

References dec_jpeg2000(), G2C_ENOMEM, G2C_NOERROR, int_power(), LOG, and rdieee().

Referenced by g2c_jpcunpackd(), g2c_jpcunpackf(), and jpcunpack().