A source block decoder is retrieved from a {@link DataDecoder} object, which is associated to some source data.Source data is divided into source blocks and each source block is independently encoded by a RaptorQ encoder (as specified in RFC 6330). Each source block is further divided into source symbols, which together with repair symbols (extra encoded data) form the encoding symbols. The encoding symbols are transmitted inside encoding packets to specific source blocks of the data being decoded.
A source block can be decoded independently by an instance of {@code SourceBlockDecoder}, and the block is identified by a source block number, which is carried inside an encoding packet. The method {@link #sourceBlockNumber()}provides the source block number that identifies the source block being decoded. Additionally, the number of source symbols into which the source block is divided is given by the method {@link #numberOfSourceSymbols()}.
The method {@link #putEncodingPacket(EncodingPacket)} receives an encoding packet as argument and stores the encodingsymbols inside it for future decoding. If at the time the method is called, enough symbols are available for decoding the source block (see "symbol overhead" below), then a decoding operation takes place which either succeeds or not (a decoding failure).
Handling decoding failures is a task for the user. Typically, the user requests the sender for any missing source symbols or simply waits for more encoding symbols (source or repair) to be available. The method {@link #missingSourceSymbols()} returns a set with the identifiers of all missing source symbols, and the method{@link #availableRepairSymbols()} returns a set with the identifiers of all available repair symbols so far.
Imagine a source block being divided into {@code K} source symbols. Let {@code N} be the number of received encodingsymbols (source or repair) so far.
If all {@code K} source symbols are received then the decoding is immediate. When that is not the case, the decoderwill try to fill in the gaps of the missing source symbols with the received repair symbols. Whichever the case, the decoder requires at least {@code N = K} encoding symbols in order to try recovering the source data.
However, {@code K} encoding symbols may not be sufficient for a successful decoding when some of those are repairsymbols (RaptorQ is a probabilistic code). To increase the probability of successful decoding in this case, a source block decoder may be configured to start the decoding process only when it has received {@code N > K} encodingsymbols. The higher {@code N} is, the higher the probability. We call the {@code N - K} symbols the symboloverhead.
The method {@link #symbolOverhead()} returns the current symbol overhead value, and the method{@link #setSymbolOverhead(int)} changes that value.
Below are example symbol overhead values that allow a successful decoding with a specific probability given a number of encoding symbols (the probability values only apply if some of the encoding symbols are repair symbols):
Overhead Encoding symbols Probability 0
K
99% 1
K + 1
99.99% 2
K + 2
99.9999% (one in a million chance of failure)
|
|
|
|
|
|