Enum constriction::stream::queue::DecoderFrontendError
source · #[non_exhaustive]pub enum DecoderFrontendError {
InvalidData,
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidData
This can only happen if both of the following conditions apply:
- we are decoding invalid compressed data; and
- we use entropy models with varying
PRECISION
s.
Unless you change the PRECISION
mid-decoding this error cannot occur. However,
note that the encoder is not surjective, i.e., it cannot reach all possible values.
The reason why the decoder still doesn’t err (unless varying PRECISION
s are used)
is that it is not injective, i.e., it maps the bit strings that are unreachable by
the encoder to symbols that could have been encoded into a different bit string.
The lack of injectivity of the encoder makes the Range Coder implementation in this library unsuitable for bitsback coding. Even though you can encode an arbitrary bit string into a sequence of symbols using any entropy model, decoding the sequence of symbols with the same entropy models won’t always give you the same bit string. In other words,
range_decode(range_encode(sequence_of_symbols)) = sequence_of_symbols
for allsequence_of_symbols
; butrange_encode(range_encode(bit_string)) != bit_string
in general.
If you need equality in the second relation, use an AnsCoder
.