Commit b9f9312b authored by Mathis Rosenhauer's avatar Mathis Rosenhauer
Browse files

Formatting.

parent 1763545e
...@@ -61,86 +61,83 @@ ...@@ -61,86 +61,83 @@
#define ROS 5 #define ROS 5
#define BUFFERSPACE(strm) (strm->avail_in >= strm->state->in_blklen \ #define BUFFERSPACE(strm) (strm->avail_in >= strm->state->in_blklen \
&& strm->avail_out >= strm->state->out_blklen) && strm->avail_out >= strm->state->out_blklen)
#define FLUSH(KIND) \ #define FLUSH(KIND) \
static void flush_##KIND(struct aec_stream *strm) \ static void flush_##KIND(struct aec_stream *strm) \
{ \ { \
uint32_t *flush_end, *bp, half_d; \ uint32_t *flush_end, *bp, half_d; \
int32_t data, m; \ int32_t data, m; \
struct internal_state *state = strm->state; \ struct internal_state *state = strm->state; \
\ \
flush_end = state->rsip; \ flush_end = state->rsip; \
if (state->pp) { \ if (state->pp) { \
if (state->flush_start == state->rsi_buffer \ if (state->flush_start == state->rsi_buffer \
&& state->rsip > state->rsi_buffer) { \ && state->rsip > state->rsi_buffer) { \
state->last_out = *state->rsi_buffer; \ state->last_out = *state->rsi_buffer; \
\ \
if (strm->flags & AEC_DATA_SIGNED) { \ if (strm->flags & AEC_DATA_SIGNED) { \
m = UINT32_C(1) << (strm->bits_per_sample - 1); \ m = UINT32_C(1) << (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; \
} \ } \
put_##KIND(strm, (uint32_t)state->last_out); \ put_##KIND(strm, (uint32_t)state->last_out); \
state->flush_start++; \ state->flush_start++; \
} \ } \
\ \
data = state->last_out; \ data = state->last_out; \
\ \
if (state->xmin == 0) { \ if (state->xmin == 0) { \
\ uint32_t xmax, med, d; \
uint32_t xmax, med, d; \ med = state->xmax / 2 + 1; \
med = state->xmax / 2 + 1; \ xmax = state->xmax; \
xmax = state->xmax; \ \
\ for (bp = state->flush_start; bp < flush_end; bp++) { \
for (bp = state->flush_start; bp < flush_end; bp++) { \ d = *bp; \
d = *bp; \ half_d = (d >> 1) + (d & 1); \
half_d = (d >> 1) + (d & 1); \ /*in this case: data >= med == data & med */ \
/*in this case: data >= med == data & med */ \ uint32_t mask = (data & med)?xmax:0; \
uint32_t mask = (data & med)?xmax:0; \ \
\ /*in this case: xmax - data == xmax ^ data */ \
/*in this case: xmax - data == xmax ^ data */ \ if (half_d <= (mask ^ data)) { \
if (half_d <= (mask ^ data)) { \ data += (d >> 1)^(~((d & 1) - 1)); \
data += (d >> 1)^(~((d & 1) - 1)); \ } else { \
} else { \ data = mask ^ d; \
data = mask ^ d; \ } \
} \ put_##KIND(strm, (uint32_t)data); \
put_##KIND(strm, (uint32_t)data); \ } \
} \ state->last_out = data; \
state->last_out = data; \ } else { \
\ int32_t xmax, d; \
} else { \ xmax = state->xmax; \
\ \
int32_t xmax, d; \ for (bp = state->flush_start; bp < flush_end; bp++) { \
xmax = state->xmax; \ d = *bp; \
\ half_d = ((uint32_t)d >> 1) + (d & 1); \
for (bp = state->flush_start; bp < flush_end; bp++) { \ \
d = *bp; \ if (data < 0) { \
half_d = ((uint32_t)d >> 1) + (d & 1); \ if (half_d <= xmax + data + 1) { \
\ data += ((uint32_t)d >> 1)^(~((d & 1) - 1)); \
if (data < 0) { \ } else { \
if (half_d <= xmax + data + 1) { \ data = d - xmax - 1; \
data += ((uint32_t)d >> 1)^(~((d & 1) - 1)); \ } \
} else { \ } else { \
data = d - xmax - 1; \ if (half_d <= xmax - data) { \
} \ data += ((uint32_t)d >> 1)^(~((d & 1) - 1)); \
} else { \ } else { \
if (half_d <= xmax - data) { \ data = xmax - d; \
data += ((uint32_t)d >> 1)^(~((d & 1) - 1)); \ } \
} else { \ } \
data = xmax - d; \ put_##KIND(strm, (uint32_t)data); \
} \ } \
} \ state->last_out = data; \
put_##KIND(strm, (uint32_t)data); \ } \
} \ } else { \
state->last_out = data; \ for (bp = state->flush_start; bp < flush_end; bp++) \
} \ put_##KIND(strm, *bp); \
} else { \ } \
for (bp = state->flush_start; bp < flush_end; bp++) \ state->flush_start = state->rsip; \
put_##KIND(strm, *bp); \
} \
state->flush_start = state->rsip; \
} }
...@@ -245,7 +242,6 @@ static inline void fill_acc(struct aec_stream *strm) ...@@ -245,7 +242,6 @@ static inline void fill_acc(struct aec_stream *strm)
case (1): case (1):
strm->state->acc = (strm->state->acc << 8) | *strm->next_in++; strm->state->acc = (strm->state->acc << 8) | *strm->next_in++;
}; };
} }
static inline uint32_t direct_get(struct aec_stream *strm, int n) static inline uint32_t direct_get(struct aec_stream *strm, int n)
......
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