Commit 72f36241 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer Committed by Thomas Jahns

Improve compatibility with HDF5 - all checks passed

parent b63f830b
......@@ -30,19 +30,18 @@ struct aec_stream {
};
/* Sample data description flags */
#define AEC_DATA_UNSIGNED 0 /* Samples are unsigned integers (default) */
#define AEC_DATA_SIGNED 1 /* Samples are signed. Telling libaec
#define AEC_DATA_SIGNED 1 /* Samples are signed. Telling libaec
* this results in a slightly better
* compression ratio.
* compression ratio. Default is
* unsigned.
*/
#define AEC_DATA_3BYTE 2 /* 24 bit samples are coded in 3 bytes */
#define AEC_DATA_MSB 16 /* Samples are stored with their most
#define AEC_DATA_3BYTE 2 /* 24 bit samples are coded in 3 bytes */
#define AEC_DATA_MSB 4 /* Samples are stored with their most
* significant bit first. This has
* nothing to do with the endianness
* of the host.
* of the host. Default is LSB.
*/
#define AEC_DATA_LSB 0 /* Samples are stored LSB first (default) */
#define AEC_DATA_PREPROCESS 32 /* Set if preprocessor should be used */
#define AEC_DATA_PREPROCESS 8 /* Set if preprocessor should be used */
/* Return codes of library functions */
#define AEC_OK 0
......
......@@ -3,6 +3,24 @@
#include "szlib.h"
#include "libaec.h"
#define NOPTS 129
static int convert_options(int sz_opts)
{
int co[NOPTS];
int i;
int opts = 0;
memset(co, 0, sizeof(int) * NOPTS);
co[SZ_MSB_OPTION_MASK] = AEC_DATA_MSB;
co[SZ_NN_OPTION_MASK] = AEC_DATA_PREPROCESS;
for (i = 1; i < NOPTS; i <<= 1)
opts |= co[i];
return opts;
}
int SZ_BufftoBuffCompress(void *dest, size_t *destLen,
const void *source, size_t sourceLen,
SZ_com_t *param)
......@@ -13,7 +31,7 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen,
strm.bit_per_sample = param->bits_per_pixel;
strm.block_size = param->pixels_per_block;
strm.rsi = param->pixels_per_scanline / param->pixels_per_block;
strm.flags = param->options_mask;
strm.flags = convert_options(param->options_mask);
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
strm.next_out = dest;
......@@ -37,7 +55,7 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen,
strm.bit_per_sample = param->bits_per_pixel;
strm.block_size = param->pixels_per_block;
strm.rsi = param->pixels_per_scanline / param->pixels_per_block;
strm.flags = param->options_mask;
strm.flags = convert_options(param->options_mask);
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
strm.next_out = dest;
......@@ -50,3 +68,8 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen,
*destLen = strm.total_out;
return SZ_OK;
}
int SZ_encoder_enabled(void)
{
return 1;
}
......@@ -3,16 +3,24 @@
#include "libaec.h"
#define SZ_ALLOW_K13_OPTION_MASK 1
#define SZ_CHIP_OPTION_MASK 2
#define SZ_EC_OPTION_MASK 4
#define SZ_LSB_OPTION_MASK 8
#define SZ_MSB_OPTION_MASK 16
#define SZ_NN_OPTION_MASK 32
#define SZ_RAW_OPTION_MASK 128
#define SZ_OK AEC_OK
#define SZ_NO_ENCODER_ERROR -1
#define SZ_PARAM_ERROR AEC_CONF_ERROR
#define SZ_MEM_ERROR AEC_MEM_ERROR
#define SZ_OUTBUFF_FULL -2
#define SZ_RAW_OPTION_MASK 128
#define SZ_NN_OPTION_MASK AEC_DATA_PREPROCESS
#define SZ_LSB_OPTION_MASK AEC_DATA_LSB
#define SZ_MSB_OPTION_MASK AEC_DATA_MSB
#define SZ_MAX_PIXELS_PER_BLOCK 32
#define SZ_MAX_BLOCKS_PER_SCANLINE 128
#define SZ_MAX_PIXELS_PER_SCANLINE \
(SZ_MAX_BLOCKS_PER_SCANLINE) * (SZ_MAX_PIXELS_PER_BLOCK)
typedef struct SZ_com_t_s
{
......@@ -29,4 +37,6 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen,
const void *source, size_t sourceLen,
SZ_com_t *param);
int SZ_encoder_enabled(void);
#endif /* SZLIB_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment