Commit fef349b5 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer Committed by Thomas Jahns

Reformatting

parent dfaddade
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
aec_stream strm; struct aec_stream strm;
uint8_t *in; uint8_t *in;
uint8_t *out; uint8_t *out;
int chunk, total_out, status, c; int chunk, total_out, status, c;
......
This diff is collapsed.
This diff is collapsed.
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
#define M_CONTINUE 1 #define M_CONTINUE 1
#define M_EXIT 0 #define M_EXIT 0
typedef struct internal_state { struct internal_state {
int (*mode)(aec_streamp); int (*mode)(struct aec_stream *);
void (*get_block)(aec_streamp); void (*get_block)(struct aec_stream *);
uint32_t (*get_sample)(aec_streamp); uint32_t (*get_sample)(struct aec_stream *);
void (*preprocess)(aec_streamp); void (*preprocess)(struct aec_stream *);
int id_len; /* bit length of code option identification key */ int id_len; /* bit length of code option identification key */
int64_t xmin; /* minimum integer for preprocessing */ int64_t xmin; /* minimum integer for preprocessing */
...@@ -35,6 +35,6 @@ typedef struct internal_state { ...@@ -35,6 +35,6 @@ typedef struct internal_state {
int zero_blocks; /* number of contiguous zero blocks */ int zero_blocks; /* number of contiguous zero blocks */
int k; /* splitting position */ int k; /* splitting position */
int flush; /* flush option copied from argument */ int flush; /* flush option copied from argument */
} encode_state; };
#endif /* ENCODE_H */ #endif /* ENCODE_H */
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
#include "encode.h" #include "encode.h"
#include "encode_accessors.h" #include "encode_accessors.h"
uint32_t get_8(aec_streamp strm) uint32_t get_8(struct aec_stream *strm)
{ {
strm->avail_in--; strm->avail_in--;
strm->total_in++; strm->total_in++;
return *strm->next_in++; return *strm->next_in++;
} }
uint32_t get_lsb_24(aec_streamp strm) uint32_t get_lsb_24(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -26,7 +26,7 @@ uint32_t get_lsb_24(aec_streamp strm) ...@@ -26,7 +26,7 @@ uint32_t get_lsb_24(aec_streamp strm)
return data; return data;
} }
uint32_t get_msb_24(aec_streamp strm) uint32_t get_msb_24(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -42,7 +42,7 @@ uint32_t get_msb_24(aec_streamp strm) ...@@ -42,7 +42,7 @@ uint32_t get_msb_24(aec_streamp strm)
#ifdef WORDS_BIGENDIAN #ifdef WORDS_BIGENDIAN
uint32_t get_lsb_16(aec_streamp strm) uint32_t get_lsb_16(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -55,7 +55,7 @@ uint32_t get_lsb_16(aec_streamp strm) ...@@ -55,7 +55,7 @@ uint32_t get_lsb_16(aec_streamp strm)
return data; return data;
} }
uint32_t get_msb_16(aec_streamp strm) uint32_t get_msb_16(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -66,7 +66,7 @@ uint32_t get_msb_16(aec_streamp strm) ...@@ -66,7 +66,7 @@ uint32_t get_msb_16(aec_streamp strm)
return data; return data;
} }
uint32_t get_lsb_32(aec_streamp strm) uint32_t get_lsb_32(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -81,7 +81,7 @@ uint32_t get_lsb_32(aec_streamp strm) ...@@ -81,7 +81,7 @@ uint32_t get_lsb_32(aec_streamp strm)
return data; return data;
} }
uint32_t get_msb_32(aec_streamp strm) uint32_t get_msb_32(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -93,7 +93,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -93,7 +93,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#else /* not WORDS_BIGENDIAN */ #else /* not WORDS_BIGENDIAN */
uint32_t get_lsb_16(aec_streamp strm) uint32_t get_lsb_16(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -104,7 +104,7 @@ uint32_t get_lsb_16(aec_streamp strm) ...@@ -104,7 +104,7 @@ uint32_t get_lsb_16(aec_streamp strm)
return data; return data;
} }
uint32_t get_msb_16(aec_streamp strm) uint32_t get_msb_16(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -117,7 +117,7 @@ uint32_t get_msb_16(aec_streamp strm) ...@@ -117,7 +117,7 @@ uint32_t get_msb_16(aec_streamp strm)
return data; return data;
} }
uint32_t get_lsb_32(aec_streamp strm) uint32_t get_lsb_32(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -128,7 +128,7 @@ uint32_t get_lsb_32(aec_streamp strm) ...@@ -128,7 +128,7 @@ uint32_t get_lsb_32(aec_streamp strm)
return data; return data;
} }
uint32_t get_msb_32(aec_streamp strm) uint32_t get_msb_32(struct aec_stream *strm)
{ {
uint32_t data; uint32_t data;
...@@ -145,7 +145,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -145,7 +145,7 @@ uint32_t get_msb_32(aec_streamp strm)
#endif /* not WORDS_BIGENDIAN */ #endif /* not WORDS_BIGENDIAN */
#define GET_BLOCK_8(BS) \ #define GET_BLOCK_8(BS) \
static void get_block_8_bs_##BS(aec_streamp strm) \ static void get_block_8_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -160,7 +160,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -160,7 +160,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_NATIVE_16(BS) \ #define GET_BLOCK_NATIVE_16(BS) \
static void get_block_native_16_bs_##BS(aec_streamp strm) \ static void get_block_native_16_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -176,7 +176,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -176,7 +176,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_LSB_16(BS) \ #define GET_BLOCK_LSB_16(BS) \
static void get_block_lsb_16_bs_##BS(aec_streamp strm) \ static void get_block_lsb_16_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -194,7 +194,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -194,7 +194,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_MSB_16(BS) \ #define GET_BLOCK_MSB_16(BS) \
static void get_block_msb_16_bs_##BS(aec_streamp strm) \ static void get_block_msb_16_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -211,7 +211,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -211,7 +211,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_LSB_24(BS) \ #define GET_BLOCK_LSB_24(BS) \
static void get_block_lsb_24_bs_##BS(aec_streamp strm) \ static void get_block_lsb_24_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -231,7 +231,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -231,7 +231,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_MSB_24(BS) \ #define GET_BLOCK_MSB_24(BS) \
static void get_block_msb_24_bs_##BS(aec_streamp strm) \ static void get_block_msb_24_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -251,7 +251,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -251,7 +251,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_NATIVE_32(BS) \ #define GET_BLOCK_NATIVE_32(BS) \
static void get_block_native_32_bs_##BS(aec_streamp strm) \ static void get_block_native_32_bs_##BS(struct aec_stream *strm) \
{ \ { \
memcpy(strm->state->block_buf, \ memcpy(strm->state->block_buf, \
strm->next_in, \ strm->next_in, \
...@@ -263,7 +263,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -263,7 +263,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_LSB_32(BS) \ #define GET_BLOCK_LSB_32(BS) \
static void get_block_lsb_32_bs_##BS(aec_streamp strm) \ static void get_block_lsb_32_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -285,7 +285,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -285,7 +285,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_MSB_32(BS) \ #define GET_BLOCK_MSB_32(BS) \
static void get_block_msb_32_bs_##BS(aec_streamp strm) \ static void get_block_msb_32_bs_##BS(struct aec_stream *strm) \
{ \ { \
int i, j; \ int i, j; \
uint32_t *block = strm->state->block_buf; \ uint32_t *block = strm->state->block_buf; \
...@@ -307,7 +307,7 @@ uint32_t get_msb_32(aec_streamp strm) ...@@ -307,7 +307,7 @@ uint32_t get_msb_32(aec_streamp strm)
} }
#define GET_BLOCK_FUNCS(A, B) \ #define GET_BLOCK_FUNCS(A, B) \
void (*get_block_funcs_##A[])(aec_streamp) = { \ void (*get_block_funcs_##A[])(struct aec_stream *) = { \
get_block_##B##_bs_8, \ get_block_##B##_bs_8, \
get_block_##B##_bs_16, \ get_block_##B##_bs_16, \
get_block_##B##_bs_32, \ get_block_##B##_bs_32, \
......
...@@ -4,20 +4,20 @@ ...@@ -4,20 +4,20 @@
#include <inttypes.h> #include <inttypes.h>
#include "libaec.h" #include "libaec.h"
uint32_t get_8(aec_streamp strm); uint32_t get_8(struct aec_stream *strm);
uint32_t get_lsb_16(aec_streamp strm); uint32_t get_lsb_16(struct aec_stream *strm);
uint32_t get_msb_16(aec_streamp strm); uint32_t get_msb_16(struct aec_stream *strm);
uint32_t get_lsb_32(aec_streamp strm); uint32_t get_lsb_32(struct aec_stream *strm);
uint32_t get_msb_24(aec_streamp strm); uint32_t get_msb_24(struct aec_stream *strm);
uint32_t get_lsb_24(aec_streamp strm); uint32_t get_lsb_24(struct aec_stream *strm);
uint32_t get_msb_32(aec_streamp strm); uint32_t get_msb_32(struct aec_stream *strm);
extern void (*get_block_funcs_8[4])(aec_streamp); extern void (*get_block_funcs_8[4])(struct aec_stream *);
extern void (*get_block_funcs_lsb_16[4])(aec_streamp); extern void (*get_block_funcs_lsb_16[4])(struct aec_stream *);
extern void (*get_block_funcs_msb_16[4])(aec_streamp); extern void (*get_block_funcs_msb_16[4])(struct aec_stream *);
extern void (*get_block_funcs_lsb_24[4])(aec_streamp); extern void (*get_block_funcs_lsb_24[4])(struct aec_stream *);
extern void (*get_block_funcs_msb_24[4])(aec_streamp); extern void (*get_block_funcs_msb_24[4])(struct aec_stream *);
extern void (*get_block_funcs_lsb_32[4])(aec_streamp); extern void (*get_block_funcs_lsb_32[4])(struct aec_stream *);
extern void (*get_block_funcs_msb_32[4])(aec_streamp); extern void (*get_block_funcs_msb_32[4])(struct aec_stream *);
#endif /* ENCODE_ACCESSORS_H */ #endif /* ENCODE_ACCESSORS_H */
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
struct internal_state; struct internal_state;
typedef struct _aec_stream struct aec_stream {
{
const uint8_t *next_in; const uint8_t *next_in;
size_t avail_in; /* number of bytes available at size_t avail_in; /* number of bytes available at
* next_in */ * next_in */
...@@ -25,9 +24,7 @@ typedef struct _aec_stream ...@@ -25,9 +24,7 @@ typedef struct _aec_stream
uint32_t flags; uint32_t flags;
struct internal_state *state; struct internal_state *state;
} aec_stream; };
typedef aec_stream *aec_streamp;
/* Coder flags */ /* Coder flags */
#define AEC_DATA_UNSIGNED 0 #define AEC_DATA_UNSIGNED 0
...@@ -60,12 +57,12 @@ typedef aec_stream *aec_streamp; ...@@ -60,12 +57,12 @@ typedef aec_stream *aec_streamp;
* padded with fill bits. * padded with fill bits.
*/ */
int aec_decode_init(aec_streamp strm); int aec_decode_init(struct aec_stream *strm);
int aec_decode(aec_streamp strm, int flush); int aec_decode(struct aec_stream *strm, int flush);
int aec_decode_end(aec_streamp strm); int aec_decode_end(struct aec_stream *strm);
int aec_encode_init(aec_streamp strm); int aec_encode_init(struct aec_stream *strm);
int aec_encode(aec_streamp strm, int flush); int aec_encode(struct aec_stream *strm, int flush);
int aec_encode_end(aec_streamp strm); int aec_encode_end(struct aec_stream *strm);
#endif /* LIBAEC_H */ #endif /* LIBAEC_H */
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param) int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param)
{ {
int status; int status;
aec_stream strm; struct aec_stream strm;
strm.bit_per_sample = param->bits_per_pixel; strm.bit_per_sample = param->bits_per_pixel;
strm.block_size = param->pixels_per_block; strm.block_size = param->pixels_per_block;
...@@ -33,7 +33,7 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_ ...@@ -33,7 +33,7 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, const void *source, size_
int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param) int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, const void *source, size_t sourceLen, SZ_com_t *param)
{ {
int status; int status;
aec_stream strm; struct aec_stream strm;
strm.bit_per_sample = param->bits_per_pixel; strm.bit_per_sample = param->bits_per_pixel;
strm.block_size = param->pixels_per_block; strm.block_size = param->pixels_per_block;
......
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