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[])
int dflag = 0;
chunk = CHUNK;
strm.bit_per_sample = 8;
strm.bits_per_sample = 8;
strm.block_size = 8;
strm.rsi = 2;
strm.flags = AEC_DATA_PREPROCESS;
......@@ -41,7 +41,7 @@ int main(int argc, char *argv[])
chunk = atoi(optarg);
break;
case 'B':
strm.bit_per_sample = atoi(optarg);
strm.bits_per_sample = atoi(optarg);
break;
case 'J':
strm.block_size = atoi(optarg);
......@@ -85,14 +85,14 @@ int main(int argc, char *argv[])
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;
else
chunk *= 4;
}
else if (strm.bit_per_sample > 8)
else if (strm.bits_per_sample > 8)
{
chunk *= 2;
}
......
......@@ -35,7 +35,7 @@
state->last_out = state->buf[0]; \
\
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 */ \
state->last_out = (state->last_out ^ m) - m; \
} \
......@@ -136,8 +136,8 @@ static void put_sample(struct aec_stream *strm, uint32_t s)
struct internal_state *state = strm->state;
state->buf[state->buf_i++] = s;
strm->avail_out -= state->byte_per_sample;
strm->total_out += state->byte_per_sample;
strm->avail_out -= state->bytes_per_sample;
strm->total_out += state->bytes_per_sample;
if (state->buf_i == state->buf_size) {
state->flush_output(strm);
......@@ -206,7 +206,7 @@ static void fast_split(struct aec_stream *strm)
k = state->id - 1;
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++)
state->block[i] = direct_get_fs(strm) << k;
......@@ -249,7 +249,7 @@ static void fast_uncomp(struct aec_stream *strm)
int 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)
......@@ -310,12 +310,12 @@ static void fs_drop(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)
return 0;
put_sample(strm, bits_get(strm, strm->bit_per_sample));
bits_drop(strm, strm->bit_per_sample);
put_sample(strm, bits_get(strm, strm->bits_per_sample));
bits_drop(strm, strm->bits_per_sample);
return 1;
}
......@@ -429,7 +429,7 @@ static int m_zero_block(struct aec_stream *strm)
else
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);
state->mode = m_id;
return M_CONTINUE;
......@@ -559,7 +559,7 @@ int aec_decode_init(struct aec_stream *strm)
int i, modi;
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;
state = (struct internal_state *) malloc(sizeof(struct internal_state));
......@@ -574,27 +574,27 @@ int aec_decode_init(struct aec_stream *strm)
strm->state = state;
if (strm->bit_per_sample > 16) {
if (strm->bits_per_sample > 16) {
state->id_len = 5;
if (strm->bit_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) {
state->byte_per_sample = 3;
if (strm->bits_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) {
state->bytes_per_sample = 3;
if (strm->flags & AEC_DATA_MSB)
state->flush_output = flush_msb_24;
else
state->flush_output = flush_lsb_24;
} else {
state->byte_per_sample = 4;
state->bytes_per_sample = 4;
if (strm->flags & AEC_DATA_MSB)
state->flush_output = flush_msb_32;
else
state->flush_output = flush_lsb_32;
}
state->out_blklen = strm->block_size
* state->byte_per_sample;
* state->bytes_per_sample;
}
else if (strm->bit_per_sample > 8) {
state->byte_per_sample = 2;
else if (strm->bits_per_sample > 8) {
state->bytes_per_sample = 2;
state->id_len = 4;
state->out_blklen = strm->block_size * 2;
if (strm->flags & AEC_DATA_MSB)
......@@ -602,22 +602,22 @@ int aec_decode_init(struct aec_stream *strm)
else
state->flush_output = flush_lsb_16;
} else {
state->byte_per_sample = 1;
state->bytes_per_sample = 1;
state->id_len = 3;
state->out_blklen = strm->block_size;
state->flush_output = flush_8;
}
if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1ULL << (strm->bit_per_sample - 1));
state->xmax = (1ULL << (strm->bit_per_sample - 1)) - 1;
state->xmin = -(1ULL << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
} else {
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->in_blklen = (strm->block_size * strm->bit_per_sample
state->in_blklen = (strm->block_size * strm->bits_per_sample
+ state->id_len) / 8 + 1;
modi = 1UL << state->id_len;
......
......@@ -39,7 +39,7 @@ struct internal_state {
int fs; /* last fundamental sequence in accumulator */
int ref; /* 1 if current block has reference sample */
int pp; /* 1 if postprocessor has to be used */
int byte_per_sample;
int bytes_per_sample;
int *se_table;
uint32_t *buf;
uint32_t buf_i;
......
......@@ -202,7 +202,7 @@ static void preprocess_signed(struct aec_stream *strm)
struct internal_state *state = strm->state;
uint32_t *d = state->data_pp;
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 xmin = state->xmin;
uint32_t rsi = strm->rsi * strm->block_size - 1;
......@@ -272,7 +272,7 @@ static int assess_splitting_option(struct aec_stream *strm)
Length of CDS encoded with splitting option and optimal k.
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
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
......@@ -438,7 +438,7 @@ static int m_encode_splitting(struct aec_stream *strm)
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);
if (k)
emitblock_1(strm, k);
......@@ -458,7 +458,7 @@ static int m_encode_uncomp(struct aec_stream *strm)
struct internal_state *state = strm->state;
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);
}
......@@ -471,7 +471,7 @@ static int m_encode_se(struct aec_stream *strm)
emit(state, 1, state->id_len + 1);
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) {
d = state->block[i] + state->block[i + 1];
......@@ -488,7 +488,7 @@ static int m_encode_zero(struct aec_stream *strm)
emit(state, 0, state->id_len + 1);
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)
emitfs(state, 4);
......@@ -513,7 +513,7 @@ static int m_select_code_option(struct aec_stream *strm)
struct internal_state *state = strm->state;
uncomp_len = (strm->block_size - state->ref)
* strm->bit_per_sample;
* strm->bits_per_sample;
split_len = assess_splitting_option(strm);
se_len = assess_se_option(split_len, strm);
......@@ -688,7 +688,7 @@ int aec_encode_init(struct aec_stream *strm)
{
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;
if (strm->block_size != 8
......@@ -707,11 +707,11 @@ int aec_encode_init(struct aec_stream *strm)
memset(state, 0, sizeof(struct internal_state));
strm->state = state;
if (strm->bit_per_sample > 16) {
if (strm->bits_per_sample > 16) {
/* 24/32 input bit settings */
state->id_len = 5;
if (strm->bit_per_sample <= 24
if (strm->bits_per_sample <= 24
&& strm->flags & AEC_DATA_3BYTE) {
state->block_len = 3 * strm->block_size;
if (strm->flags & AEC_DATA_MSB) {
......@@ -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 */
state->id_len = 4;
state->block_len = 2 * strm->block_size;
......@@ -754,12 +754,12 @@ int aec_encode_init(struct aec_stream *strm)
}
if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1ULL << (strm->bit_per_sample - 1));
state->xmax = (1ULL << (strm->bit_per_sample - 1)) - 1;
state->xmin = -(1ULL << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
state->preprocess = preprocess_signed;
} else {
state->xmin = 0;
state->xmax = (1ULL << strm->bit_per_sample) - 1;
state->xmax = (1ULL << strm->bits_per_sample) - 1;
state->preprocess = preprocess_unsigned;
}
......
......@@ -16,7 +16,7 @@ struct aec_stream {
unsigned char *next_out;
size_t avail_out; /* remaining free space at next_out */
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)
*/
int block_size; /* block size in samples */
......
......@@ -133,17 +133,17 @@ int SZ_BufftoBuffCompress(void *dest, size_t *destLen,
interleave = param->bits_per_pixel == 32 || param->bits_per_pixel == 64;
if (interleave) {
strm.bit_per_sample = 8;
strm.bits_per_sample = 8;
buf = malloc(sourceLen);
if (buf == NULL)
return SZ_MEM_ERROR;
interleave_buffer(buf, source, sourceLen, param->bits_per_pixel / 8);
} else {
strm.bit_per_sample = param->bits_per_pixel;
strm.bits_per_sample = param->bits_per_pixel;
buf = (void *)source;
}
pixel_size = bits_to_bytes(strm.bit_per_sample);
pixel_size = bits_to_bytes(strm.bits_per_sample);
if (pad_scanline) {
scanlines = (sourceLen / pixel_size + param->pixels_per_scanline - 1)
......@@ -213,11 +213,11 @@ int SZ_BufftoBuffDecompress(void *dest, size_t *destLen,
extra_buffer = pad_scanline || deinterleave;
if (deinterleave)
strm.bit_per_sample = 8;
strm.bits_per_sample = 8;
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 (pad_scanline) {
......
......@@ -25,21 +25,21 @@ int update_state(struct test_state *state)
{
struct aec_stream *strm = state->strm;
if (strm->bit_per_sample > 16) {
if (strm->bits_per_sample > 16) {
state->id_len = 5;
if (strm->bit_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) {
state->byte_per_sample = 3;
if (strm->bits_per_sample <= 24 && strm->flags & AEC_DATA_3BYTE) {
state->bytes_per_sample = 3;
} 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->byte_per_sample = 2;
state->bytes_per_sample = 2;
} else {
state->id_len = 3;
state->byte_per_sample = 1;
state->bytes_per_sample = 1;
}
if (strm->flags & AEC_DATA_MSB)
......@@ -48,11 +48,11 @@ int update_state(struct test_state *state)
state->out = out_lsb;
if (strm->flags & AEC_DATA_SIGNED) {
state->xmin = -(1ULL << (strm->bit_per_sample - 1));
state->xmax = (1ULL << (strm->bit_per_sample - 1)) - 1;
state->xmin = -(1ULL << (strm->bits_per_sample - 1));
state->xmax = (1ULL << (strm->bits_per_sample - 1)) - 1;
} else {
state->xmin = 0;
state->xmax = (1ULL << strm->bit_per_sample) - 1;
state->xmax = (1ULL << strm->bits_per_sample) - 1;
}
return 0;
......@@ -75,15 +75,15 @@ int encode_decode_small(struct test_state *state)
avail_out = 1;
total_out = 0;
strm->next_in = state->ubuf;
strm->avail_in = state->byte_per_sample;
strm->avail_in = state->bytes_per_sample;
strm->avail_out = 1;
strm->next_out = state->cbuf;
while ((avail_in || avail_out) && total_out < state->cbuf_len) {
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) {
strm->avail_in = state->byte_per_sample;
strm->avail_in = state->bytes_per_sample;
strm->next_in = state->ubuf + n_in;
} else {
avail_in = 0;
......@@ -120,7 +120,7 @@ int encode_decode_small(struct test_state *state)
strm->avail_in = 1;
strm->next_in = state->cbuf;
strm->avail_out = state->byte_per_sample;
strm->avail_out = state->bytes_per_sample;
strm->next_out = state->obuf;
status = aec_decode_init(strm);
......@@ -135,7 +135,7 @@ int encode_decode_small(struct test_state *state)
total_out = 0;
strm->next_in = state->cbuf;
strm->avail_in = 1;
strm->avail_out = state->byte_per_sample;
strm->avail_out = state->bytes_per_sample;
strm->next_out = state->obuf;
while ((avail_in || avail_out) && total_out < state->buf_len) {
......@@ -158,7 +158,7 @@ int encode_decode_small(struct test_state *state)
if (strm->total_out - total_out > 0
&& total_out < state->buf_len) {
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;
avail_out = 1;
} else {
......
......@@ -5,7 +5,7 @@
struct test_state {
int (* codec)(struct test_state *state);
int id_len;
int byte_per_sample;
int bytes_per_sample;
unsigned char *ubuf;
unsigned char *cbuf;
unsigned char *obuf;
......
......@@ -13,7 +13,7 @@ int check_block_sizes(struct test_state *state)
for (bs = 8; bs <= 64; bs *= 2) {
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);
if (status)
......@@ -30,7 +30,7 @@ int check_block_sizes_short(struct test_state *state)
tmp = state->ibuf_len;
for (bs = 8; bs <= 64; bs *= 2) {
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;
status = encode_decode_large(state);
if (status)
......@@ -51,11 +51,11 @@ int check_rsi(struct test_state *state)
int status, size;
unsigned char *tmp;
size = state->byte_per_sample;
size = state->bytes_per_sample;
for (tmp = state->ubuf;
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 + size, state->xmin, size);
}
......@@ -96,7 +96,7 @@ int main (void)
strm.flags = AEC_DATA_PREPROCESS;
state.strm = &strm;
strm.bit_per_sample = 32;
strm.bits_per_sample = 32;
update_state(&state);
status = check_rsi(&state);
......
......@@ -14,7 +14,7 @@ int check_block_sizes(struct test_state *state, int id, int id_len)
for (bs = 8; bs <= 64; bs *= 2) {
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)
max_rsi = 4096;
......@@ -54,11 +54,11 @@ int check_splitting(struct test_state *state, int k)
int status, size;
unsigned char *tmp;
size = state->byte_per_sample;
size = state->bytes_per_sample;
for (tmp = state->ubuf;
tmp < state->ubuf + state->buf_len;
tmp += 4 * state->byte_per_sample) {
tmp += 4 * state->bytes_per_sample) {
state->out(tmp, state->xmin + (1ULL << (k - 1)) - 1, size);
state->out(tmp + size, state->xmin, size);
state->out(tmp + 2 * size, state->xmin + (1ULL << (k + 1)) - 1, size);
......@@ -79,11 +79,11 @@ int check_uncompressed(struct test_state *state)
int status, size;
unsigned char *tmp;
size = state->byte_per_sample;
size = state->bytes_per_sample;
for (tmp = state->ubuf;
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 + size, state->xmin, size);
}
......@@ -104,11 +104,11 @@ int check_fs(struct test_state *state)
int status, size;
unsigned char *tmp;
size = state->byte_per_sample;
size = state->bytes_per_sample;
for (tmp = state->ubuf;
tmp < state->ubuf + state->buf_len;
tmp += 4 * state->byte_per_sample) {
tmp += 4 * state->bytes_per_sample) {
state->out(tmp, state->xmin + 2, size);
state->out(tmp + size, state->xmin, size);
state->out(tmp + 2 * size, state->xmin, size);
......@@ -129,7 +129,7 @@ int check_se(struct test_state *state)
int status, size;
unsigned char *tmp;
size = state->byte_per_sample;
size = state->bytes_per_sample;
for (tmp = state->ubuf;
tmp < state->ubuf + state->buf_len;
......@@ -158,7 +158,7 @@ int check_bps(struct test_state *state)
int k, status, bps;
for (bps = 8; bps <= 32; bps += 8) {
state->strm->bit_per_sample = bps;
state->strm->bits_per_sample = bps;
if (bps == 24)
state->strm->flags |= AEC_DATA_3BYTE;
else
......
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