ECC-1467: Minor changes

This commit is contained in:
Eugen Betke 2023-03-08 16:13:17 +00:00
parent 58ee3be165
commit 8425eeb03c
7 changed files with 10 additions and 26 deletions

View File

@ -41,7 +41,6 @@ or edit "accessor.class" and rerun ./make_class.pl
static int get_native_type(grib_accessor*);
static int pack_double(grib_accessor*, const double* val, size_t* len);
template <typename T> static int unpack(grib_accessor*, T* val, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_float(grib_accessor*, float* val, size_t* len);
static int value_count(grib_accessor*, long*);
@ -190,7 +189,7 @@ static int unpack(grib_accessor* a, T* val, size_t* len)
long* pl = 0;
double* values = 0;
double* pvalues = 0;
T* pval = 0;
T* pval = 0;
size_t valuesSize = 0;
long i, j;
int ret;

View File

@ -50,7 +50,6 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int pack_double(grib_accessor*, const double* val, size_t* len);
template <typename T> static int unpack(grib_accessor* a, T* val, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_float(grib_accessor*, float* val, size_t* len);
static int value_count(grib_accessor*, long*);
@ -551,13 +550,13 @@ static int unpack(grib_accessor* a, T* val, size_t* len)
buf = (unsigned char*)hand->buffer->data;
buf += grib_byte_offset(a);
strm.flags = ccsds_flags;
strm.bits_per_sample = bits_per_value;
strm.block_size = ccsds_block_size;
strm.rsi = ccsds_rsi;
strm.flags = ccsds_flags;
strm.bits_per_sample = bits_per_value;
strm.block_size = ccsds_block_size;
strm.rsi = ccsds_rsi;
strm.next_in = buf;
strm.avail_in = buflen;
strm.next_in = buf;
strm.avail_in = buflen;
bits8 = ((bits_per_value + 7) / 8) * 8;
size = n_vals * ((bits_per_value + 7) / 8);
@ -576,9 +575,9 @@ strm.avail_in = buflen;
__PRETTY_FUNCTION__, err, aec_get_error_message(err));
err = GRIB_ENCODING_ERROR;
goto cleanup;
}
}
pos = 0;
pos = 0;
/* ECC-1427: Performance improvement */
//grib_decode_float_array(decoded, &pos, bits8 , reference_value, bscale, dscale, n_vals, val);

View File

@ -11,7 +11,6 @@
* Enrico Fucile
****************************/
#include "grib_api_internal.h"
#include "grib_api_internal_cpp.h"
#define PRE_PROCESSING_NONE 0

View File

@ -53,7 +53,6 @@ or edit "accessor.class" and rerun ./make_class.pl
*/
static int pack_double(grib_accessor*, const double* val, size_t* len);
template <typename T> static int unpack(grib_accessor* a, T* val, size_t* len);
static int unpack_double(grib_accessor*, double* val, size_t* len);
static int unpack_float(grib_accessor*, float* val, size_t* len);
static int value_count(grib_accessor*, long*);

View File

@ -314,16 +314,6 @@ static int unpack_long(grib_accessor* a, long* v, size_t* len)
return GRIB_NOT_IMPLEMENTED;
}
template <typename T> inline T _strtod(const char* val, char** last);
template <> inline float _strtod(const char* val, char** last) {
double v = strtod(val, last);
assert(v <= std::numeric_limits<float>::max());
return v;
}
template <> inline double _strtod(const char* val, char** last) {
return strtod(val, last);
}
template <typename T>
static int unpack(grib_accessor* a, T* v, size_t* len)
{
@ -343,7 +333,6 @@ static int unpack(grib_accessor* a, T* v, size_t* len)
char* last = NULL;
grib_unpack_string(a, val, &l);
//*v = _strtod<T>(val, &last);
*v = strtod(val, &last);
if (*last == 0) { /* conversion of string to double worked */
grib_context_log(a->context, GRIB_LOG_DEBUG, "Casting string %s to long", a->name);

View File

@ -12,7 +12,6 @@
* Enrico Fucile *
***************************************************************************/
#include "grib_api_internal_cpp.h"
#include "grib_value.h"
#include <float.h>

View File

@ -51,8 +51,8 @@ int main(int argc, char** argv)
fvalues = (float*)malloc(values_len * sizeof(float));
dvalues = (double*)malloc(values_len * sizeof(double));
CODES_CHECK(codes_get_double_array(h, "values", dvalues, &values_len), 0);
CODES_CHECK(codes_get_float_array(h, "values", fvalues, &values_len), 0);
CODES_CHECK(codes_get_double_array(h, "values", dvalues, &values_len), 0);
for (i = 0; i < values_len; i++) {
abs_error = fabs(dvalues[i] - (double)fvalues[i]);