Commit 3d5b023d authored by Mathis Rosenhauer's avatar Mathis Rosenhauer Committed by Thomas Jahns

pluralization

parent 2a2e588b
...@@ -25,7 +25,7 @@ int main(int argc, char *argv[]) ...@@ -25,7 +25,7 @@ int main(int argc, char *argv[])
int dflag = 0; int dflag = 0;
chunk = CHUNK; chunk = CHUNK;
strm.bit_per_sample = 8; strm.bits_per_sample = 8;
strm.block_size = 8; strm.block_size = 8;
strm.rsi = 2; strm.rsi = 2;
strm.flags = AEC_DATA_PREPROCESS; strm.flags = AEC_DATA_PREPROCESS;
...@@ -41,7 +41,7 @@ int main(int argc, char *argv[]) ...@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
chunk = atoi(optarg); chunk = atoi(optarg);
break; break;
case 'B': case 'B':
strm.bit_per_sample = atoi(optarg); strm.bits_per_sample = atoi(optarg);
break; break;
case 'J': case 'J':
strm.block_size = atoi(optarg); strm.block_size = atoi(optarg);
...@@ -85,14 +85,14 @@ int main(int argc, char *argv[]) ...@@ -85,14 +85,14 @@ int main(int argc, char *argv[])
exit(-1); exit(-1);
} }
if (strm.bit_per_sample > 16) if (strm.bits_per_sample > 16)
{ {
if (strm.bit_per_sample <= 24 && strm.flags & AEC_DATA_3BYTE) if (strm.bits_per_sample <= 24 && strm.flags & AEC_DATA_3BYTE)
chunk *= 3; chunk *= 3;
else else
chunk *= 4; chunk *= 4;
} }
else if (strm.bit_per_sample > 8) else if (strm.bits_per_sample > 8)
{ {
chunk *= 2; chunk *= 2;
} }
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
state->last_out = state->buf[0]; \ state->last_out = state->buf[0]; \
\ \
if (strm->flags & AEC_DATA_SIGNED) { \ if (strm->flags & AEC_DATA_SIGNED) { \
m = 1ULL << (strm->bit_per_sample - 1); \ m = 1ULL << (strm->bits_per_sample - 1); \
/* Reference samples have to be sign extended */ \ /* Reference samples have to be sign extended */ \
state->last_out = (state->last_out ^ m) - m; \ state->last_out = (state->last_out ^ m) - m; \
} \ } \
...@@ -136,8 +136,8 @@ static void put_sample(struct aec_stream *strm, uint32_t s) ...@@ -136,8 +136,8 @@ static void put_sample(struct aec_stream *strm, uint32_t s)
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
state->buf[state->buf_i++] = s; state->buf[state->buf_i++] = s;
strm->avail_out -= state->byte_per_sample; strm->avail_out -= state->bytes_per_sample;
strm->total_out += state->byte_per_sample; strm->total_out += state->bytes_per_sample;
if (state->buf_i == state->buf_size) { if (state->buf_i == state->buf_size) {
state->flush_output(strm); state->flush_output(strm);
...@@ -206,7 +206,7 @@ static void fast_split(struct aec_stream *strm) ...@@ -206,7 +206,7 @@ static void fast_split(struct aec_stream *strm)
k = state->id - 1; k = state->id - 1;
if (state->ref) if (state->ref)
put_sample(strm, direct_get(strm, strm->bit_per_sample)); put_sample(strm, direct_get(strm, strm->bits_per_sample));
for (i = state->ref; i < strm->block_size; i++) for (i = state->ref; i < strm->block_size; i++)
state->block[i] = direct_get_fs(strm) << k; state->block[i] = direct_get_fs(strm) << k;
...@@ -249,7 +249,7 @@ static void fast_uncomp(struct aec_stream *strm) ...@@ -249,7 +249,7 @@ static void fast_uncomp(struct aec_stream *strm)
int i; int i;
for (i = 0; i < strm->block_size; i++) for (i = 0; i < strm->block_size; i++)
put_sample(strm, direct_get(strm, strm->bit_per_sample)); put_sample(strm, direct_get(strm, strm->bits_per_sample));
} }
static uint32_t bits_ask(struct aec_stream *strm, int n) static uint32_t bits_ask(struct aec_stream *strm, int n)
...@@ -310,12 +310,12 @@ static void fs_drop(struct aec_stream *strm) ...@@ -310,12 +310,12 @@ static void fs_drop(struct aec_stream *strm)
static uint32_t copysample(struct aec_stream *strm) static uint32_t copysample(struct aec_stream *strm)
{ {
if (bits_ask(strm, strm->bit_per_sample) == 0 if (bits_ask(strm, strm->bits_per_sample) == 0
|| strm->avail_out == 0) || strm->avail_out == 0)
return 0; return 0;
put_sample(strm, bits_get(strm, strm->bit_per_sample)); put_sample(strm, bits_get(strm, strm->bits_per_sample));
bits_drop(strm, strm->bit_per_sample); bits_drop(strm, strm->bits_per_sample);
return 1; return 1;
} }
...@@ -429,7 +429,7 @@ static int m_zero_block(struct aec_stream *strm) ...@@ -429,7 +429,7 @@ static int m_zero_block(struct aec_stream *strm)
else else
state->i = zero_blocks * strm->block_size; state->i = zero_blocks * strm->block_size;
if (strm->avail_out >= state->i * state->byte_per_sample) { if (strm->avail_out >= state->i * state->bytes_per_sample) {
fast_zero(strm); fast_zero(strm);
state->mode = m_id; state->mode = m_id;
return M_CONTINUE; return M_CONTINUE;
...@@ -559,7 +559,7 @@ int aec_decode_init(struct aec_stream *strm) ...@@ -559,7 +559,7 @@ int aec_decode_init(struct aec_stream *strm)
int i, modi; int i, modi;
struct internal_state *state; struct internal_state *state;
if (strm->bit_per_sample > 32 || strm->bit_per_sample == 0) if (strm->bits_per_sample > 32 || strm->bits_per_sample == 0)
return AEC_CONF_ERROR; return AEC_CONF_ERROR;
state = (struct internal_state *) malloc(sizeof(struct internal_state)); state = (struct internal_state *) malloc(sizeof(struct internal_state));
...@@ -574,27 +574,27 @@ int aec_decode_init(struct aec_stream *strm) ...@@ -574,27 +574,27 @@ int aec_decode_init(struct aec_stream *strm)
strm->state = state; strm->state = state;
if (strm->bit_per_sample > 16) { if (strm->bits_per_sample > 16) {
state->id_len = 5; state->id_len = 5;
if (strm->bit_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) { if (strm->bits_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) {
state->byte_per_sample = 3; state->bytes_per_sample = 3;
if (strm->flags & AEC_DATA_MSB) if (strm->flags & AEC_DATA_MSB)
state->flush_output = flush_msb_24; state->flush_output = flush_msb_24;
else else
state->flush_output = flush_lsb_24; state->flush_output = flush_lsb_24;
} else { } else {
state->byte_per_sample = 4; state->bytes_per_sample = 4;
if (strm->flags & AEC_DATA_MSB) if (strm->flags & AEC_DATA_MSB)
state->flush_output = flush_msb_32; state->flush_output = flush_msb_32;
else else
state->flush_output = flush_lsb_32; state->flush_output = flush_lsb_32;
} }
state->out_blklen = strm->block_size state->out_blklen = strm->block_size
* state->byte_per_sample; * state->bytes_per_sample;
} }
else if (strm->bit_per_sample > 8) { else if (strm->bits_per_sample > 8) {
state->byte_per_sample = 2; state->bytes_per_sample = 2;
state->id_len = 4; state->id_len = 4;
state->out_blklen = strm->block_size * 2; state->out_blklen = strm->block_size * 2;
if (strm->flags & AEC_DATA_MSB) if (strm->flags & AEC_DATA_MSB)
...@@ -602,22 +602,22 @@ int aec_decode_init(struct aec_stream *strm) ...@@ -602,22 +602,22 @@ int aec_decode_init(struct aec_stream *strm)
else else
state->flush_output = flush_lsb_16; state->flush_output = flush_lsb_16;
} else { } else {
state->byte_per_sample = 1; state->bytes_per_sample = 1;
state->id_len = 3; state->id_len = 3;
state->out_blklen = strm->block_size; state->out_blklen = strm->block_size;
state->flush_output = flush_8; state->flush_output = flush_8;
} }
if (strm->flags & AEC_DATA_SIGNED) { if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1ULL << (strm->bit_per_sample - 1)); state->xmin = -(1ULL << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bit_per_sample - 1)) - 1; state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
} else { } else {
state->xmin = 0; state->xmin = 0;
state->xmax = (1ULL << strm->bit_per_sample) - 1; state->xmax = (1ULL << strm->bits_per_sample) - 1;
} }
state->ref_int = strm->block_size * strm->rsi; state->ref_int = strm->block_size * strm->rsi;
state->in_blklen = (strm->block_size * strm->bit_per_sample state->in_blklen = (strm->block_size * strm->bits_per_sample
+ state->id_len) / 8 + 1; + state->id_len) / 8 + 1;
modi = 1UL << state->id_len; modi = 1UL << state->id_len;
......
...@@ -39,7 +39,7 @@ struct internal_state { ...@@ -39,7 +39,7 @@ struct internal_state {
int fs; /* last fundamental sequence in accumulator */ int fs; /* last fundamental sequence in accumulator */
int ref; /* 1 if current block has reference sample */ int ref; /* 1 if current block has reference sample */
int pp; /* 1 if postprocessor has to be used */ int pp; /* 1 if postprocessor has to be used */
int byte_per_sample; int bytes_per_sample;
int *se_table; int *se_table;
uint32_t *buf; uint32_t *buf;
uint32_t buf_i; uint32_t buf_i;
......
...@@ -202,7 +202,7 @@ static void preprocess_signed(struct aec_stream *strm) ...@@ -202,7 +202,7 @@ static void preprocess_signed(struct aec_stream *strm)
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
uint32_t *d = state->data_pp; uint32_t *d = state->data_pp;
int32_t *x = (int32_t *)state->data_raw; int32_t *x = (int32_t *)state->data_raw;
uint64_t m = 1ULL << (strm->bit_per_sample - 1); uint64_t m = 1ULL << (strm->bits_per_sample - 1);
int64_t xmax = state->xmax; int64_t xmax = state->xmax;
int64_t xmin = state->xmin; int64_t xmin = state->xmin;
uint32_t rsi = strm->rsi * strm->block_size - 1; uint32_t rsi = strm->rsi * strm->block_size - 1;
...@@ -272,7 +272,7 @@ static int assess_splitting_option(struct aec_stream *strm) ...@@ -272,7 +272,7 @@ static int assess_splitting_option(struct aec_stream *strm)
Length of CDS encoded with splitting option and optimal k. Length of CDS encoded with splitting option and optimal k.
In Rice coding each sample in a block of samples is split at In Rice coding each sample in a block of samples is split at
the same position into k LSB and bit_per_sample - k MSB. The the same position into k LSB and bits_per_sample - k MSB. The
LSB part is left binary and the MSB part is coded as a LSB part is left binary and the MSB part is coded as a
fundamental sequence a.k.a. unary (see CCSDS 121.0-B-2). The fundamental sequence a.k.a. unary (see CCSDS 121.0-B-2). The
function of the length of the Coded Data Set (CDS) depending on function of the length of the Coded Data Set (CDS) depending on
...@@ -438,7 +438,7 @@ static int m_encode_splitting(struct aec_stream *strm) ...@@ -438,7 +438,7 @@ static int m_encode_splitting(struct aec_stream *strm)
if (state->ref) if (state->ref)
{ {
emit(state, state->block[0], strm->bit_per_sample); emit(state, state->block[0], strm->bits_per_sample);
emitblock_fs_1(strm, k); emitblock_fs_1(strm, k);
if (k) if (k)
emitblock_1(strm, k); emitblock_1(strm, k);
...@@ -458,7 +458,7 @@ static int m_encode_uncomp(struct aec_stream *strm) ...@@ -458,7 +458,7 @@ static int m_encode_uncomp(struct aec_stream *strm)
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
emit(state, (1U << state->id_len) - 1, state->id_len); emit(state, (1U << state->id_len) - 1, state->id_len);
emitblock_0(strm, strm->bit_per_sample); emitblock_0(strm, strm->bits_per_sample);
return m_flush_block(strm); return m_flush_block(strm);
} }
...@@ -471,7 +471,7 @@ static int m_encode_se(struct aec_stream *strm) ...@@ -471,7 +471,7 @@ static int m_encode_se(struct aec_stream *strm)
emit(state, 1, state->id_len + 1); emit(state, 1, state->id_len + 1);
if (state->ref) if (state->ref)
emit(state, state->block[0], strm->bit_per_sample); emit(state, state->block[0], strm->bits_per_sample);
for (i = 0; i < strm->block_size; i+= 2) { for (i = 0; i < strm->block_size; i+= 2) {
d = state->block[i] + state->block[i + 1]; d = state->block[i] + state->block[i + 1];
...@@ -488,7 +488,7 @@ static int m_encode_zero(struct aec_stream *strm) ...@@ -488,7 +488,7 @@ static int m_encode_zero(struct aec_stream *strm)
emit(state, 0, state->id_len + 1); emit(state, 0, state->id_len + 1);
if (state->zero_ref) if (state->zero_ref)
emit(state, state->zero_ref_sample, strm->bit_per_sample); emit(state, state->zero_ref_sample, strm->bits_per_sample);
if (state->zero_blocks == ROS) if (state->zero_blocks == ROS)
emitfs(state, 4); emitfs(state, 4);
...@@ -513,7 +513,7 @@ static int m_select_code_option(struct aec_stream *strm) ...@@ -513,7 +513,7 @@ static int m_select_code_option(struct aec_stream *strm)
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
uncomp_len = (strm->block_size - state->ref) uncomp_len = (strm->block_size - state->ref)
* strm->bit_per_sample; * strm->bits_per_sample;
split_len = assess_splitting_option(strm); split_len = assess_splitting_option(strm);
se_len = assess_se_option(split_len, strm); se_len = assess_se_option(split_len, strm);
...@@ -688,7 +688,7 @@ int aec_encode_init(struct aec_stream *strm) ...@@ -688,7 +688,7 @@ int aec_encode_init(struct aec_stream *strm)
{ {
struct internal_state *state; struct internal_state *state;
if (strm->bit_per_sample > 32 || strm->bit_per_sample == 0) if (strm->bits_per_sample > 32 || strm->bits_per_sample == 0)
return AEC_CONF_ERROR; return AEC_CONF_ERROR;
if (strm->block_size != 8 if (strm->block_size != 8
...@@ -707,11 +707,11 @@ int aec_encode_init(struct aec_stream *strm) ...@@ -707,11 +707,11 @@ int aec_encode_init(struct aec_stream *strm)
memset(state, 0, sizeof(struct internal_state)); memset(state, 0, sizeof(struct internal_state));
strm->state = state; strm->state = state;
if (strm->bit_per_sample > 16) { if (strm->bits_per_sample > 16) {
/* 24/32 input bit settings */ /* 24/32 input bit settings */
state->id_len = 5; state->id_len = 5;
if (strm->bit_per_sample <= 24 if (strm->bits_per_sample <= 24
&& strm->flags & AEC_DATA_3BYTE) { && strm->flags & AEC_DATA_3BYTE) {
state->block_len = 3 * strm->block_size; state->block_len = 3 * strm->block_size;
if (strm->flags & AEC_DATA_MSB) { if (strm->flags & AEC_DATA_MSB) {
...@@ -732,7 +732,7 @@ int aec_encode_init(struct aec_stream *strm) ...@@ -732,7 +732,7 @@ int aec_encode_init(struct aec_stream *strm)
} }
} }
} }
else if (strm->bit_per_sample > 8) { else if (strm->bits_per_sample > 8) {
/* 16 bit settings */ /* 16 bit settings */
state->id_len = 4; state->id_len = 4;
state->block_len = 2 * strm->block_size; state->block_len = 2 * strm->block_size;
...@@ -754,12 +754,12 @@ int aec_encode_init(struct aec_stream *strm) ...@@ -754,12 +754,12 @@ int aec_encode_init(struct aec_stream *strm)
} }
if (strm->flags & AEC_DATA_SIGNED) { if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1ULL << (strm->bit_per_sample - 1)); state->xmin = -(1ULL << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bit_per_sample - 1)) - 1; state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
state->preprocess = preprocess_signed; state->preprocess = preprocess_signed;
} else { } else {
state->xmin = 0; state->xmin = 0;
state->xmax = (1ULL << strm->bit_per_sample) - 1; state->xmax = (1ULL << strm->bits_per_sample) - 1;
state->preprocess = preprocess_unsigned; state->preprocess = preprocess_unsigned;
} }
......
...@@ -16,7 +16,7 @@ struct aec_stream { ...@@ -16,7 +16,7 @@ struct aec_stream {
unsigned char *next_out; unsigned char *next_out;
size_t avail_out; /* remaining free space at next_out */ size_t avail_out; /* remaining free space at next_out */
size_t total_out; /* total number of bytes output so far */ size_t total_out; /* total number of bytes output so far */
int bit_per_sample; /* resolution in bits per sample (n = int bits_per_sample; /* resolution in bits per sample (n =
* 1, ..., 32) * 1, ..., 32)
*/ */
int block_size; /* block size in samples */ int block_size; /* block size in samples */
......
...@@ -133,17 +133,17 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen, ...@@ -133,17 +133,17 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen,
interleave = param->bits_per_pixel == 32 || param->bits_per_pixel == 64; interleave = param->bits_per_pixel == 32 || param->bits_per_pixel == 64;
if (interleave) { if (interleave) {
strm.bit_per_sample = 8; strm.bits_per_sample = 8;
buf = malloc(sourceLen); buf = malloc(sourceLen);
if (buf == NULL) if (buf == NULL)
return SZ_MEM_ERROR; return SZ_MEM_ERROR;
interleave_buffer(buf, source, sourceLen, param->bits_per_pixel / 8); interleave_buffer(buf, source, sourceLen, param->bits_per_pixel / 8);
} else { } else {
strm.bit_per_sample = param->bits_per_pixel; strm.bits_per_sample = param->bits_per_pixel;
buf = (void *)source; buf = (void *)source;
} }
pixel_size = bits_to_bytes(strm.bit_per_sample); pixel_size = bits_to_bytes(strm.bits_per_sample);
if (pad_scanline) { if (pad_scanline) {
scanlines = (sourceLen / pixel_size + param->pixels_per_scanline - 1) scanlines = (sourceLen / pixel_size + param->pixels_per_scanline - 1)
...@@ -213,11 +213,11 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen, ...@@ -213,11 +213,11 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen,
extra_buffer = pad_scanline || deinterleave; extra_buffer = pad_scanline || deinterleave;
if (deinterleave) if (deinterleave)
strm.bit_per_sample = 8; strm.bits_per_sample = 8;
else else
strm.bit_per_sample = param->bits_per_pixel; strm.bits_per_sample = param->bits_per_pixel;
pixel_size = bits_to_bytes(strm.bit_per_sample); pixel_size = bits_to_bytes(strm.bits_per_sample);
if (extra_buffer) { if (extra_buffer) {
if (pad_scanline) { if (pad_scanline) {
......
...@@ -25,21 +25,21 @@ int update_state(struct test_state *state) ...@@ -25,21 +25,21 @@ int update_state(struct test_state *state)
{ {
struct aec_stream *strm = state->strm; struct aec_stream *strm = state->strm;
if (strm->bit_per_sample > 16) { if (strm->bits_per_sample > 16) {
state->id_len = 5; state->id_len = 5;
if (strm->bit_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) { if (strm->bits_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) {
state->byte_per_sample = 3; state->bytes_per_sample = 3;
} else { } else {
state->byte_per_sample = 4; state->bytes_per_sample = 4;
} }
} }
else if (strm->bit_per_sample > 8) { else if (strm->bits_per_sample > 8) {
state->id_len = 4; state->id_len = 4;
state->byte_per_sample = 2; state->bytes_per_sample = 2;
} else { } else {
state->id_len = 3; state->id_len = 3;
state->byte_per_sample = 1; state->bytes_per_sample = 1;
} }
if (strm->flags & AEC_DATA_MSB) if (strm->flags & AEC_DATA_MSB)
...@@ -48,11 +48,11 @@ int update_state(struct test_state *state) ...@@ -48,11 +48,11 @@ int update_state(struct test_state *state)
state->out = out_lsb; state->out = out_lsb;
if (strm->flags & AEC_DATA_SIGNED) { if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1ULL << (strm->bit_per_sample - 1)); state->xmin = -(1ULL << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bit_per_sample - 1)) - 1; state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
} else { } else {
state->xmin = 0; state->xmin = 0;
state->xmax = (1ULL << strm->bit_per_sample) - 1; state->xmax = (1ULL << strm->bits_per_sample) - 1;
} }
return 0; return 0;
...@@ -75,15 +75,15 @@ int encode_decode_small(struct test_state *state) ...@@ -75,15 +75,15 @@ int encode_decode_small(struct test_state *state)
avail_out = 1; avail_out = 1;
total_out = 0; total_out = 0;
strm->next_in = state->ubuf; strm->next_in = state->ubuf;
strm->avail_in = state->byte_per_sample; strm->avail_in = state->bytes_per_sample;
strm->avail_out = 1; strm->avail_out = 1;
strm->next_out = state->cbuf; strm->next_out = state->cbuf;
while ((avail_in || avail_out) && total_out < state->cbuf_len) { while ((avail_in || avail_out) && total_out < state->cbuf_len) {
if (strm->avail_in == 0 && avail_in) { if (strm->avail_in == 0 && avail_in) {
n_in += state->byte_per_sample; n_in += state->bytes_per_sample;
if (n_in < state->buf_len) { if (n_in < state->buf_len) {
strm->avail_in = state->byte_per_sample; strm->avail_in = state->bytes_per_sample;
strm->next_in = state->ubuf + n_in; strm->next_in = state->ubuf + n_in;
} else { } else {
avail_in = 0; avail_in = 0;
...@@ -120,7 +120,7 @@ int encode_decode_small(struct test_state *state) ...@@ -120,7 +120,7 @@ int encode_decode_small(struct test_state *state)
strm->avail_in = 1; strm->avail_in = 1;
strm->next_in = state->cbuf; strm->next_in = state->cbuf;
strm->avail_out = state->byte_per_sample; strm->avail_out = state->bytes_per_sample;
strm->next_out = state->obuf; strm->next_out = state->obuf;
status = aec_decode_init(strm); status = aec_decode_init(strm);
...@@ -135,7 +135,7 @@ int encode_decode_small(struct test_state *state) ...@@ -135,7 +135,7 @@ int encode_decode_small(struct test_state *state)
total_out = 0; total_out = 0;
strm->next_in = state->cbuf; strm->next_in = state->cbuf;
strm->avail_in = 1; strm->avail_in = 1;
strm->avail_out = state->byte_per_sample; strm->avail_out = state->bytes_per_sample;
strm->next_out = state->obuf; strm->next_out = state->obuf;
while ((avail_in || avail_out) && total_out < state->buf_len) { while ((avail_in || avail_out) && total_out < state->buf_len) {
...@@ -158,7 +158,7 @@ int encode_decode_small(struct test_state *state) ...@@ -158,7 +158,7 @@ int encode_decode_small(struct test_state *state)
if (strm->total_out - total_out > 0 if (strm->total_out - total_out > 0
&& total_out < state->buf_len) { && total_out < state->buf_len) {
total_out = strm->total_out; total_out = strm->total_out;
strm->avail_out = state->byte_per_sample; strm->avail_out = state->bytes_per_sample;
strm->next_out = state->obuf + total_out; strm->next_out = state->obuf + total_out;
avail_out = 1; avail_out = 1;
} else { } else {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
struct test_state { struct test_state {
int (* codec)(struct test_state *state); int (* codec)(struct test_state *state);
int id_len; int id_len;
int byte_per_sample; int bytes_per_sample;
unsigned char *ubuf; unsigned char *ubuf;
unsigned char *cbuf; unsigned char *cbuf;
unsigned char *obuf; unsigned char *obuf;
......
...@@ -13,7 +13,7 @@ int check_block_sizes(struct test_state *state) ...@@ -13,7 +13,7 @@ int check_block_sizes(struct test_state *state)
for (bs = 8; bs <= 64; bs *= 2) { for (bs = 8; bs <= 64; bs *= 2) {
state->strm->block_size = bs; state->strm->block_size = bs;
state->strm->rsi = state->buf_len / (bs * state->byte_per_sample); state->strm->rsi = state->buf_len / (bs * state->bytes_per_sample);
status = encode_decode_large(state); status = encode_decode_large(state);
if (status) if (status)
...@@ -30,7 +30,7 @@ int check_block_sizes_short(struct test_state *state) ...@@ -30,7 +30,7 @@ int check_block_sizes_short(struct test_state *state)
tmp = state->ibuf_len; tmp = state->ibuf_len;
for (bs = 8; bs <= 64; bs *= 2) { for (bs = 8; bs <= 64; bs *= 2) {
state->strm->block_size = bs; state->strm->block_size = bs;
state->strm->rsi = state->buf_len / (bs * state->byte_per_sample); state->strm->rsi = state->buf_len / (bs * state->bytes_per_sample);
state->ibuf_len = state->buf_len - 2 * bs + 4; state->ibuf_len = state->buf_len - 2 * bs + 4;
status = encode_decode_large(state); status = encode_decode_large(state);
if (status) if (status)
...@@ -51,11 +51,11 @@ int check_rsi(struct test_state *state) ...@@ -51,11 +51,11 @@ int check_rsi(struct test_state *state)
int status, size; int status, size;
unsigned char *tmp; unsigned char *tmp;
size = state->byte_per_sample; size = state->bytes_per_sample;
for (tmp = state->ubuf; for (tmp = state->ubuf;
tmp < state->ubuf + state->buf_len; tmp < state->ubuf + state->buf_len;
tmp += 2 * state->byte_per_sample) { tmp += 2 * state->bytes_per_sample) {
state->out(tmp, state->xmax, size); state->out(tmp, state->xmax, size);
state->out(tmp + size, state->xmin, size); state->out(tmp + size, state->xmin, size);
} }
...@@ -96,7 +96,7 @@ int main (void) ...@@ -96,7 +96,7 @@ int main (void)
strm.flags = AEC_DATA_PREPROCESS; strm.flags = AEC_DATA_PREPROCESS;
state.strm = &strm; state.strm = &strm;
strm.bit_per_sample = 32; strm.bits_per_sample = 32;
update_state(&state); update_state(&state);
status = check_rsi(&state); status = check_rsi(&state);
......
...@@ -14,7 +14,7 @@ int check_block_sizes(struct test_state *state, int id, int id_len) ...@@ -14,7 +14,7 @@ int check_block_sizes(struct test_state *state, int id, int id_len)
for (bs = 8; bs <= 64; bs *= 2) { for (bs = 8; bs <= 64; bs *= 2) {
state->strm->block_size = bs; state->strm->block_size = bs;
max_rsi = state->buf_len / (bs * state->byte_per_sample); max_rsi = state->buf_len / (bs * state->bytes_per_sample);
if (max_rsi > 4096) if (max_rsi > 4096)
max_rsi = 4096; max_rsi = 4096;
...@@ -54,11 +54,11 @@ int check_splitting(struct test_state *state, int k) ...@@ -54,11 +54,11 @@ int check_splitting(struct test_state *state, int k)
int status, size; int status, size;
unsigned char *tmp; unsigned char *tmp;
size = state->byte_per_sample; size = state->bytes_per_sample;
for (tmp = state->ubuf; for (tmp = state->ubuf;
tmp < state->ubuf + state->buf_len