46 void *fld,
int fld_is_double,
int verbose)
50 float ref, bscale, dscale;
54 LOG((2,
"jpcunpack_int len %ld ndpts %ld fld_is_double %d", len, ndpts, fld_is_double));
65 if (!(ifld = calloc(ndpts,
sizeof(
g2int))))
68 fprintf(stderr,
"Could not allocate space in jpcunpack.\n Data field NOT upacked.\n");
74 for (j = 0; j < ndpts; j++)
75 dfld[j] = (((
float)ifld[j] * bscale) + ref) * dscale;
79 for (j = 0; j < ndpts; j++)
80 ffld[j] = (((
float)ifld[j] * bscale) + ref) * dscale;
88 for (j = 0; j < ndpts; j++)
93 for (j = 0; j < ndpts; j++)
129 LOG((2,
"g2c_jpcunpack len %lld ndpts %lld", len, ndpts));
164 g2int len8 = len, ndpts8 = ndpts;
167 LOG((2,
"g2c_jpcunpackf len %d ndpts %lld", len, ndpts));
170 idrstmpl8[i] = idrstmpl[i];
172 return jpcunpack_int(cpack, len8, idrstmpl8, ndpts8, fld, 0, 0);
204 g2int len8 = len, ndpts8 = ndpts;
207 LOG((2,
"g2c_jpcunpackd len %lld ndpts %lld", len, ndpts));
210 idrstmpl8[i] = idrstmpl[i];
212 return jpcunpack_int(cpack, len8, idrstmpl8, ndpts8, fld, 1, 0);
int dec_jpeg2000(char *injpc, g2int bufsize, g2int *outfld)
This Function decodes a JPEG2000 code stream specified in the JPEG2000 Part-1 standard (i....
#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)
This subroutine reads 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)
This internal function will unpack JPEG2000 compressed data into an array of floats or doubles,...