Commit 22673046 authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

whitespace cleanup for J

parent 5c932b03
CC = gcc CC = gcc
CFLAGS = -g -Wall CFLAGS = -g -Wall
objects = mytest.o aed.o objects = mytest.o aed.o
...@@ -21,4 +21,3 @@ test: mytest ...@@ -21,4 +21,3 @@ test: mytest
vtest: mytest vtest: mytest
valgrind -v ./mytest < ../data/example_data.szip > ../data/ae_out valgrind -v ./mytest < ../data/example_data.szip > ../data/ae_out
diff ../data/ae_out ../data/example_data diff ../data/ae_out ../data/example_data
...@@ -17,7 +17,8 @@ typedef struct _ae_stream ...@@ -17,7 +17,8 @@ typedef struct _ae_stream
uint32_t bit_per_sample; /* resolution in bits per sample (n = 1,..., 32) */ uint32_t bit_per_sample; /* resolution in bits per sample (n = 1,..., 32) */
uint32_t block_size; /* block size in samples (J = 8 or 16) */ uint32_t block_size; /* block size in samples (J = 8 or 16) */
uint32_t segment_size; /* set of blocks between consecutive reference samples */ uint32_t segment_size; /* set of blocks between consecutive reference
samples */
uint8_t pp; /* pre/post-processor used? */ uint8_t pp; /* pre/post-processor used? */
struct internal_state *state; struct internal_state *state;
......
...@@ -20,7 +20,7 @@ typedef struct internal_state { ...@@ -20,7 +20,7 @@ typedef struct internal_state {
int id; /* option ID */ int id; /* option ID */
uint32_t id_len; /* bit length of code option identification key */ uint32_t id_len; /* bit length of code option identification key */
int *id_table; /* table maps IDs to states */ int *id_table; /* table maps IDs to states */
size_t ref_int; /* reference sample is every ref_int samples */ size_t ref_int; /* reference sample is every ref_int samples */
uint32_t last_out; /* previous output for post-processing */ uint32_t last_out; /* previous output for post-processing */
int64_t xmin; /* minimum integer for post-processing */ int64_t xmin; /* minimum integer for post-processing */
int64_t xmax; /* maximum integer for post-processing */ int64_t xmax; /* maximum integer for post-processing */
...@@ -158,15 +158,15 @@ static inline void fast_split(ae_streamp strm) ...@@ -158,15 +158,15 @@ static inline void fast_split(ae_streamp strm)
{ {
start = 1; start = 1;
u_put(strm, u_get(strm, strm->bit_per_sample)); u_put(strm, u_get(strm, strm->bit_per_sample));
} }
for (i = start; i < strm->block_size; i++) for (i = start; i < strm->block_size; i++)
{ {
state->block[i] = u_get_fs(strm) << k; state->block[i] = u_get_fs(strm) << k;
} }
for (i = start; i < strm->block_size; i++) for (i = start; i < strm->block_size; i++)
{ {
state->block[i] += u_get(strm, k); state->block[i] += u_get(strm, k);
u_put(strm, state->block[i]); u_put(strm, state->block[i]);
} }
...@@ -188,12 +188,12 @@ static inline void fast_se(ae_streamp strm) ...@@ -188,12 +188,12 @@ static inline void fast_se(ae_streamp strm)
i = REFBLOCK? 1: 0; i = REFBLOCK? 1: 0;
while (i < strm->bit_per_sample) while (i < strm->bit_per_sample)
{ {
gamma = u_get_fs(strm); gamma = u_get_fs(strm);
beta = second_extension[gamma][0]; beta = second_extension[gamma][0];
ms = second_extension[gamma][1]; ms = second_extension[gamma][1];
delta1 = gamma - ms; delta1 = gamma - ms;
if ((i & 1) == 0) if ((i & 1) == 0)
{ {
u_put(strm, beta - delta1); u_put(strm, beta - delta1);
...@@ -239,7 +239,7 @@ int ae_decode_init(ae_streamp strm) ...@@ -239,7 +239,7 @@ int ae_decode_init(ae_streamp strm)
state->id_len = 3; state->id_len = 3;
state->ref_int = strm->block_size * strm->segment_size; state->ref_int = strm->block_size * strm->segment_size;
state->in_blklen = (strm->block_size * strm->bit_per_sample state->in_blklen = (strm->block_size * strm->bit_per_sample
+ state->id_len) / 8 + 1; + state->id_len) / 8 + 1;
modi = 1UL << state->id_len; modi = 1UL << state->id_len;
...@@ -282,7 +282,7 @@ int ae_decode_init(ae_streamp strm) ...@@ -282,7 +282,7 @@ int ae_decode_init(ae_streamp strm)
state->bitp += 8; \ state->bitp += 8; \
} \ } \
} while (0) } while (0)
#define GET(n) \ #define GET(n) \
((state->acc >> (state->bitp - (n))) & ((1ULL << (n)) - 1)) ((state->acc >> (state->bitp - (n))) & ((1ULL << (n)) - 1))
...@@ -326,7 +326,7 @@ int ae_decode(ae_streamp strm, int flush) ...@@ -326,7 +326,7 @@ int ae_decode(ae_streamp strm, int flush)
Can work with one byte input und one sample output buffers. If Can work with one byte input und one sample output buffers. If
enough buffer space is available, then faster implementations enough buffer space is available, then faster implementations
of the states are called. Inspired by zlib. of the states are called. Inspired by zlib.
TODO: Flush modes like in zlib TODO: Flush modes like in zlib
*/ */
...@@ -343,7 +343,7 @@ int ae_decode(ae_streamp strm, int flush) ...@@ -343,7 +343,7 @@ int ae_decode(ae_streamp strm, int flush)
{ {
case M_ID: case M_ID:
ASK(3); ASK(3);
state->id = GET(3); state->id = GET(3);
DROP(3); DROP(3);
state->mode = state->id_table[state->id]; state->mode = state->id_table[state->id];
break; break;
...@@ -429,7 +429,7 @@ int ae_decode(ae_streamp strm, int flush) ...@@ -429,7 +429,7 @@ int ae_decode(ae_streamp strm, int flush)
if (zero_blocks == ROS) if (zero_blocks == ROS)
{ {
zero_blocks = strm->segment_size - ( zero_blocks = strm->segment_size - (
(strm->total_out / strm->block_size) (strm->total_out / strm->block_size)
% strm->segment_size); % strm->segment_size);
} }
...@@ -498,7 +498,7 @@ int ae_decode(ae_streamp strm, int flush) ...@@ -498,7 +498,7 @@ int ae_decode(ae_streamp strm, int flush)
state->i++; state->i++;
state->mode = M_SE_DECODE; state->mode = M_SE_DECODE;
break; break;
case M_UNCOMP: case M_UNCOMP:
if (SAFE) if (SAFE)
{ {
......
...@@ -19,7 +19,7 @@ int main(int argc, char *argv[]) ...@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
chunk_in = CHUNK_IN; chunk_in = CHUNK_IN;
chunk_out = CHUNK_OUT; chunk_out = CHUNK_OUT;
if (argc == 3) if (argc == 3)
{ {
chunk_in = atoi(argv[1]); chunk_in = atoi(argv[1]);
...@@ -47,14 +47,14 @@ int main(int argc, char *argv[]) ...@@ -47,14 +47,14 @@ int main(int argc, char *argv[])
if (ae_decode_init(&strm) != AE_OK) if (ae_decode_init(&strm) != AE_OK)
return 1; return 1;
strm.next_in = in; strm.next_in = in;
strm.avail_in = chunk_in; strm.avail_in = chunk_in;
strm.next_out = out; strm.next_out = out;
strm.avail_out = chunk_out; strm.avail_out = chunk_out;
todo = 1; todo = 1;
total_out = 0; total_out = 0;
while(todo) while(todo)
{ {
todo = 0; todo = 0;
......
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