NCEPLIBS-g2c  1.8.0
pngunpack.c File Reference

Contains a function to unpack data packed with PNG compression. More...

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

Go to the source code of this file.

Functions

int g2c_pngunpackd (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, double *fld)
 This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010. More...
 
int g2c_pngunpackf (unsigned char *cpack, size_t len, int *idrstmpl, size_t ndpts, float *fld)
 This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010. More...
 
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 GRIB2 Data Representation Template 5.41 or 5.40010. More...
 
static int pngunpack_int (unsigned char *cpack, g2int len, g2int *idrstmpl, g2int ndpts, void *fld, int fld_is_double, int verbose)
 This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010. More...
 

Detailed Description

Contains a function to unpack data packed with PNG compression.

Author
Stephen Gilbert
Date
2003-08-27

Definition in file pngunpack.c.

Function Documentation

◆ g2c_pngunpackd()

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

This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010.

Parameters
cpackThe packed data field (character*1 array).
lenlength of packed field cpack().
idrstmplPointer to array of values for Data Representation Template 5.41 or 5.40010.
ndptsThe number of data values to unpack.
fldContains the unpacked data values.
Returns
Author
Ed Hartnett
Date
Aug 8, 2022

Definition at line 179 of file pngunpack.c.

References G2C_PNG_DRS_TEMPLATE_LEN, and pngunpack_int().

◆ g2c_pngunpackf()

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

This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010.

Parameters
cpackThe packed data field (character*1 array).
lenlength of packed field cpack().
idrstmplPointer to array of values for Data Representation Template 5.41 or 5.40010.
ndptsThe number of data values to unpack.
fldContains the unpacked data values.
Returns
Author
Ed Hartnett
Date
Sep 8, 2022

Definition at line 147 of file pngunpack.c.

References G2C_PNG_DRS_TEMPLATE_LEN, and pngunpack_int().

◆ pngunpack()

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 GRIB2 Data Representation Template 5.41 or 5.40010.

Parameters
cpackThe packed data field (character*1 array).
lenlength of packed field cpack().
idrstmplPointer to array of values for Data Representation Template 5.41 or 5.40010.
ndptsThe number of data values to unpack.
fldContains the unpacked data values.
Returns
Author
Stephen Gilbert
Date
2003-08-27
Author
Ed Hartnett

Definition at line 117 of file pngunpack.c.

References G2_JPCUNPACK_MEM, G2C_ENOMEM, and pngunpack_int().

Referenced by g2c_unpack7_int().

◆ pngunpack_int()

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

This subroutine unpacks a data field that was packed into a PNG image format using info from the GRIB2 Data Representation Template 5.41 or 5.40010.

Parameters
cpackThe packed data field (character*1 array).
lenThe length of packed field cpack().
idrstmplPointer to array of values for Data Representation Template 5.41 or 5.40010.
ndptsThe number of data values to unpack.
fldPointer that will get the unpacked data values.
fld_is_doubleIf non-zero, then fld will get data as double, otherwise float.
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
Stephen Gilbert, Ed Hartnett
Date
Aug 8, 2022

Definition at line 41 of file pngunpack.c.

References dec_png(), G2C_ENOMEM, gbits(), int_power(), LOG, and rdieee().

Referenced by g2c_pngunpackd(), g2c_pngunpackf(), and pngunpack().