70template <
typename CodeTag,
typename BackendPrefixCodeDecoder>
95 void setup(
bool fullDecode_,
bool fixDNGBug16_) {
101 for (
size_t i = 0; i <
Base::code.symbols.size(); i++) {
102 uint8_t code_l =
Base::code.symbols[i].code_len;
110 static_assert(Traits::MaxCodeValueLenghtBits <=
113 for (
uint16_t c = ll; c <= ul; c++) {
138 diff &= ((1 << diff_l) - 1);
151 template <
typename BIT_STREAM>
155 "This BitStreamer specialization is not marked as usable here");
160 template <
typename BIT_STREAM>
164 "This BitStreamer specialization is not marked as usable here");
173 template <
typename BIT_STREAM,
bool FULL_DECODE>
177 "This BitStreamer specialization is not marked as usable here");
184 bs.peekBitsNoFill(partial.code_len));
187 auto lutEntry =
static_cast<unsigned>(
decodeLookup[partial.code]);
188 int payload =
static_cast<int>(lutEntry) >>
PayloadShift;
192 bs.skipBitsNoFill(len);
199 typename Traits::CodeValueTy codeValue;
205 invariant(!FULL_DECODE || codeValue > 0);
210 bs.skipBitsNoFill(partial.code_len);
211 std::tie(partial, codeValue) =
assert(dim.area() >=area)
int processSymbol(BIT_STREAM &bs, CodeSymbol symbol, typename Traits::CodeValueTy codeValue) const
static int RAWSPEED_READNONE extend(uint32_t diff, uint32_t len)
typename Base::CodeSymbol CodeSymbol
bool RAWSPEED_READONLY isFullDecode() const
bool RAWSPEED_READONLY handleDNGBug16() const
PrefixCode< CodeTag > code
__attribute__((always_inline)) int decodeDifference(BIT_STREAM &bs) const
static constexpr unsigned PayloadShift
typename Base::Traits Traits
static constexpr unsigned FlagMask
std::make_unsigned_t< LUTEntryTy > LUTUnsignedEntryTy
PrefixCodeLookupDecoder< CodeTag > Base
__attribute__((always_inline)) int decodeCodeValue(BIT_STREAM &bs) const
void setup(bool fullDecode_, bool fixDNGBug16_)
std::vector< LUTEntryTy > decodeLookup
static constexpr unsigned LenMask
static constexpr unsigned LookupDepth
__attribute__((always_inline)) int decode(BIT_STREAM &bs) const
std::pair< typename Base::CodeSymbol, int > finishReadingPartialSymbol(BIT_STREAM &bs, typename Base::CodeSymbol partial) const
Traits::CodeValueTy decodeCodeValue(BIT_STREAM &bs) const
AbstractPrefixCodeDecoder< CodeTag > Base
typename Base::Traits Traits
int decode(BIT_STREAM &bs) const
int decodeDifference(BIT_STREAM &bs) const
void setup(bool fullDecode_, bool fixDNGBug16_)
constexpr RAWSPEED_READNONE Ttgt implicit_cast(Tsrc value)
constexpr unsigned RAWSPEED_READNONE bitwidth(T unused={})
constexpr RAWSPEED_READNONE T extractHighBits(T value, unsigned nBits, unsigned effectiveBitwidth=bitwidth< T >())