Commit d1f7331a authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

Fixed support for >64 bit FS for good, fixed init bug

parent 18458bd8
...@@ -329,6 +329,7 @@ int ae_decode_init(ae_streamp strm) ...@@ -329,6 +329,7 @@ int ae_decode_init(ae_streamp strm)
state->samples_out = 0; state->samples_out = 0;
state->bitp = 0; state->bitp = 0;
state->fs = 0;
state->pp = strm->flags & AE_DATA_PREPROCESS; state->pp = strm->flags & AE_DATA_PREPROCESS;
state->mode = M_ID; state->mode = M_ID;
return AE_OK; return AE_OK;
...@@ -363,21 +364,34 @@ int ae_decode_end(ae_streamp strm) ...@@ -363,21 +364,34 @@ int ae_decode_end(ae_streamp strm)
#define DROP(n) state->bitp -= (unsigned)(n) #define DROP(n) state->bitp -= (unsigned)(n)
#define ASKFS() \ #define ASKFS() \
do { \ do { \
ASK(1); \ ASK(1); \
while (GET(1) == 0) \ while ((state->acc & (1ULL << (state->bitp - 1))) == 0) \
{ \ { \
state->fs++; \ if (state->bitp == 1) \
DROP(1); \ { \
ASK(1); \ if (strm->avail_in == 0) goto req_buffer; \
} \ strm->avail_in--; \
DROP(1); \ strm->total_in++; \
} while(0) state->acc <<= 8; \
state->acc |= *strm->next_in++; \
state->bitp += 8; \
} \
state->fs++; \
state->bitp--; \
} \
} while (0)
#define GETFS() state->fs #define GETFS() state->fs
#define DROPFS() state->fs = 0; #define DROPFS() \
do { \
state->fs = 0; \
/* Needs to be here for \
ASK/GET/PUT/DROP interleaving. */ \
state->bitp--; \
} while (0)
#define PUT(sample) \ #define PUT(sample) \
do { \ do { \
......
...@@ -193,6 +193,7 @@ int ae_encode_init(ae_streamp strm) ...@@ -193,6 +193,7 @@ int ae_encode_init(ae_streamp strm)
return AE_MEM_ERROR; return AE_MEM_ERROR;
} }
state->bp_out = state->block_out; state->bp_out = state->block_out;
*state->bp_out = 0;
state->bitp = 8; state->bitp = 8;
strm->total_in = 0; strm->total_in = 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