45 void *fld,
int fld_is_double,
int verbose)
49 float ref, bscale, dscale;
53 LOG((2,
"jpcunpack_int len %ld ndpts %ld fld_is_double %d", len, ndpts, fld_is_double));
64 if (!(ifld = calloc(ndpts,
sizeof(
g2int))))
67 fprintf(stderr,
"Could not allocate space in jpcunpack.\n Data field NOT upacked.\n");
73 for (j = 0; j < ndpts; j++)
74 dfld[j] = (((
float)ifld[j] * bscale) + ref) * dscale;
78 for (j = 0; j < ndpts; j++)
79 ffld[j] = (((
float)ifld[j] * bscale) + ref) * dscale;
87 for (j = 0; j < ndpts; j++)
92 for (j = 0; j < ndpts; j++)
128 LOG((2,
"g2c_jpcunpack len %lld ndpts %lld", len, ndpts));
163 g2int len8 = len, ndpts8 = ndpts;
166 LOG((2,
"g2c_jpcunpackf len %d ndpts %lld", len, ndpts));
169 idrstmpl8[i] = idrstmpl[i];
171 return jpcunpack_int(cpack, len8, idrstmpl8, ndpts8, fld, 0, 0);
203 g2int len8 = len, ndpts8 = ndpts;
206 LOG((2,
"g2c_jpcunpackd len %lld ndpts %lld", len, ndpts));
209 idrstmpl8[i] = idrstmpl[i];
211 return jpcunpack_int(cpack, len8, idrstmpl8, ndpts8, fld, 1, 0);
int dec_jpeg2000(char *injpc, g2int bufsize, g2int *outfld)
Decode a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i.e., ISO/IEC 15444-1) using...
#define G2C_JPEG_DRS_TEMPLATE_LEN
Length of the idrstmpl array for JPEG packing.
#define G2C_ENOMEM
Out of memory.
#define G2_JPCUNPACK_MEM
In jpcunpack() or other unpack function: out of memory.
int64_t g2int
Long integer type.
#define G2C_NOERROR
No error.
Header file with internal function prototypes NCEPLIBS-g2c library.
double int_power(double x, g2int y)
Function similar to C pow() power function.
#define LOG(e)
Ignore logging to stdout.
void rdieee(g2int *rieee, float *a, g2int num)
Read a list of real values in 32-bit IEEE floating point format.
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 Representatio...
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 Representati...
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 Representatio...
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 Re...