Go to the documentation of this file.
33 void *fld,
int fld_is_double)
36 g2int j, nbits, width, height;
37 float ref, bscale, dscale;
42 LOG((2,
"pngunpack_int len %ld ndpts %ld fld_is_double %d", len, ndpts, fld_is_double));
48 LOG((2,
"bscale %g dscale %g nbits %ld", bscale, dscale, nbits));
54 ifld = calloc(ndpts,
sizeof(
g2int));
55 ctemp = calloc(ndpts * 4, 1);
58 fprintf(stderr,
"Could not allocate space in jpcunpack.\n Data field NOT upacked.\n");
61 dec_png(cpack, &width, &height, ctemp);
62 gbits(ctemp, ifld, 0, nbits, 0, ndpts);
63 for (j = 0; j < ndpts; j++)
66 dfld[j] = (((double)ifld[j] * bscale) + ref) * dscale;
68 ffld[j] = (((float)ifld[j] * bscale) + ref) * dscale;
75 for (j = 0; j < ndpts; j++)
int dec_png(unsigned char *pngbuf, g2int *width, g2int *height, unsigned char *cout)
Decode PNG.
g2int pngunpackd(unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, double *fld)
This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB...
void rdieee(g2int *rieee, float *a, g2int num)
This subroutine reads a list of real values in 32-bit IEEE floating point format.
double int_power(double x, g2int y)
Function similar to C pow() power function.
#define LOG(e)
Ignore logging to stdout.
Header file with internal function prototypes NCEPLIBS-g2c library.
int64_t g2int
Long integer type.
void gbits(unsigned char *in, g2int *iout, g2int iskip, g2int nbits, g2int nskip, g2int n)
Get bits - unpack bits: Extract arbitrary size values from a packed bit string, right justifying each...
#define G2_JPCUNPACK_MEM
In jpcunpack() or other unpack function: out of memory.
static g2int pngunpack_int(unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, void *fld, int fld_is_double)
This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB...
g2int pngunpack(unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, float *fld)
This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB...