Skip to content

Commit

Permalink
testing changes for g2c_dec_png
Browse files Browse the repository at this point in the history
  • Loading branch information
AlysonStahl-NOAA committed Nov 1, 2024
1 parent 96119cc commit 4e8e67a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/developer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
export CFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0 -I/home/runner/g2c/include'
export FCFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
export FFLAGS='-Wall -g -fprofile-abs-path -fprofile-arcs -ftest-coverage -O0'
cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/jasper;~/g2c" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON -DMAKE_FTN_API=ON
cmake .. -DENABLE_DOCS=ON -DFTP_TEST_FILES=ON -DCMAKE_PREFIX_PATH="~/ip;~/jasper;~/g2c" -DTEST_FILE_DIR=/home/runner/data -DUSE_NETCDF4=ON -DUSE_AEC=ON -DUSE_IPOLATES=ON -DUSE_JASPER=ON -DUSE_PNG=ON -DMAKE_FTN_API=ON
make VERBOSE=1
ctest --verbose --output-on-failure --rerun-failed
gcovr --root .. -v --html-details --exclude ../tests --exclude CMakeFiles --print-summary -o test-coverage.html &> /dev/null
Expand Down
3 changes: 2 additions & 1 deletion spack/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ def url_for_version(self, version):
depends_on("jasper@:2", when="@3.2:3.4 +jasper")
depends_on("g2c", when="@develop +jasper")
depends_on("zlib-api", when="@3.2: +png")
depends_on("libpng", when="@3.2: +png")
depends_on("libpng", when="@3.2:3.4 +png")
depends_on("g2c +png", when="@develop +png")
depends_on("openjpeg", when="@3.2:3.4 +openjpeg")
depends_on("g2c +openjpeg", when="@develop +openjpeg")

Expand Down
2 changes: 1 addition & 1 deletion wgrib2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Alias.c Ave_test.c Ave_var.c Bbox.c bitstream.c Box_ave.c
Check_pdt_size.c Checksum.c Cluster.c cname.c codetable_4_230.c
CodeTable.c Code_Values.c Code_Values_JMA.c complex_pk.c Config.c
copy.c crc32.c Cress_lola.c Csv.c Csv_long.c cubed_sphere2ll.c
CubeFace2global.c Cyclic.c Data.c dec_png_clone.c
CubeFace2global.c Cyclic.c Data.c
Dump.c Earth.c Else.c End.c Endif.c Ensemble.c
Ens_processing.c Ens_qc.c EOF.c Export_lonlat.c ExtName.c
fatal_error.c Fcst_ave.c ffopen.c Fi.c File.c Fix_CFSv2_fcst.c
Expand Down
13 changes: 7 additions & 6 deletions wgrib2/unpk.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
#include "grib2.h"
#endif

#ifdef USE_PNG
#include <png.h>
int i;
#endif
//#ifdef USE_PNG
// #include <png.h>
// int i;
//#endif

#ifdef USE_AEC
#include <libaec.h>
Expand Down Expand Up @@ -47,7 +47,7 @@ int unpk_grib(unsigned char **sec, float *data) {
double bin_scale, dec_scale, b;

#ifdef USE_PNG
int width, height;
int width, height, i;
#endif

#if (defined USE_JASPER || defined USE_OPENJPEG)
Expand Down Expand Up @@ -251,7 +251,8 @@ int unpk_grib(unsigned char **sec, float *data) {
if ((c = (unsigned char *) malloc(4*sizeof(char) * (size_t) ndata)) == NULL)
fatal_error("unpk: png decode allocation error", "");

i = (int) dec_png_clone(sec[7]+5, &width, &height, (unsigned char *) c, &nbits, ndata);
//i = (int) dec_png_clone(sec[7]+5, &width, &height, (unsigned char *) c, &nbits, ndata);
i = (int) g2c_dec_png(sec[7]+5, &width, &height, (unsigned char *) c);
if (i) fatal_error_i("unpk: png decode error %d",i);
mask_pointer = (bitmap_flag == 255) ? NULL : sec[6] + 6;

Expand Down
2 changes: 1 addition & 1 deletion wgrib2/wgrib2.h
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ int wrt_sec(unsigned const char *sec0, unsigned const char *sec1, unsigned const
int scaling(unsigned char **sec, double *base, int *decimal, int *binary, int *nbits);
unsigned char *mk_bms(float *data, unsigned int *ndata);

int dec_png_clone(unsigned char *pngbuf,int *width,int *height, unsigned char *cout, int *grib2_bit_depth, unsigned int ndata);
//int dec_png_clone(unsigned char *pngbuf,int *width,int *height, unsigned char *cout, int *grib2_bit_depth, unsigned int ndata);
int ieee_grib_out(unsigned char **sec, float *data, unsigned int ndata, struct seq_file *out);
int jpeg_grib_out(unsigned char **sec, float *data, unsigned int ndata,
int nx, int ny, int use_scale, int dec_scale, int bin_scale, FILE *out);
Expand Down

0 comments on commit 4e8e67a

Please sign in to comment.