Raptorq.StreamingDecoder (raptorq v0.2.0)

Copy Markdown View Source

A streaming stateful decoder that accumulates symbols as they arrive and attempts to decode once enough symbols are available.

Example

state = Raptorq.StreamingDecoder.new(10, 40)

{:ok, :incomplete, state} = Raptorq.StreamingDecoder.add_symbol(state, 0, sym0)
# ... accumulate more symbols ...
{:ok, {:decoded, data}, state} = Raptorq.StreamingDecoder.add_symbol(state, 12, sym12)

Summary

Functions

Add a symbol to the decoder state.

Initialize a new streaming decoder for a block of k source symbols. data_size is optional and used to truncate padding from the final output.

Functions

add_symbol(state, isi, symbol)

Add a symbol to the decoder state.

Returns {:ok, :incomplete, state} if more symbols are needed (or if the system remains singular). Returns {:ok, {:decoded, binary}, state} if the data was successfully recovered. Returns {:error, reason, state} if the symbol is invalid (e.g. inconsistent size).

new(k, data_size \\ nil)

Initialize a new streaming decoder for a block of k source symbols. data_size is optional and used to truncate padding from the final output.