Commit 211fb21c authored by Mathis Rosenhauer's avatar Mathis Rosenhauer

RSI padding for encoding and decoding

parent fcf3a9e5
...@@ -202,8 +202,6 @@ static inline void check_rsi_end(struct aec_stream *strm) ...@@ -202,8 +202,6 @@ static inline void check_rsi_end(struct aec_stream *strm)
state->flush_output(strm); state->flush_output(strm);
state->flush_start = state->rsi_buffer; state->flush_start = state->rsi_buffer;
state->rsip = state->rsi_buffer; state->rsip = state->rsi_buffer;
if (strm->flags & AEC_PAD_RSI)
state->bitp -= state->bitp % 8;
} }
} }
...@@ -360,8 +358,11 @@ static int m_id(struct aec_stream *strm) ...@@ -360,8 +358,11 @@ static int m_id(struct aec_stream *strm)
{ {
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
if (state->pp && state->rsip == state->rsi_buffer) if (state->pp && state->rsip == state->rsi_buffer) {
state->ref = 1; state->ref = 1;
if (strm->flags & AEC_PAD_RSI)
state->bitp -= state->bitp % 8;
}
else else
state->ref = 0; state->ref = 0;
......
...@@ -511,6 +511,12 @@ static int m_flush_block(struct aec_stream *strm) ...@@ -511,6 +511,12 @@ static int m_flush_block(struct aec_stream *strm)
int n; int n;
struct internal_state *state = strm->state; struct internal_state *state = strm->state;
if (state->blocks_avail == 0
&& strm->flags & AEC_PAD_RSI
&& state->block_nonzero == 0
)
emit(state, 0, state->bits % 8);
if (state->direct_out) { if (state->direct_out) {
n = state->cds - strm->next_out; n = state->cds - strm->next_out;
strm->next_out += n; strm->next_out += 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