FastLED 3.9.15
Loading...
Searching...
No Matches

◆ GetBits()

uint32_t fl::third_party::GetBits ( BitStreamInfo * bsi,
int32_t nBits )

Definition at line 134 of file bitstream.hpp.

135{
136 uint32_t data, lowBits;
137
138 nBits &= 0x1f; /* nBits mod 32 to avoid unpredictable results like >> by negative amount */
139 data = bsi->iCache >> (31 - nBits); /* unsigned >> so zero-extend */
140 data >>= 1; /* do as >> 31, >> 1 so that nBits = 0 works okay (returns 0) */
141 bsi->iCache <<= nBits; /* left-justify cache */
142 bsi->cachedBits -= nBits; /* how many bits have we drawn from the cache so far */
143
144 /* if we cross an int boundary, refill the cache */
145 if (bsi->cachedBits < 0) {
146 lowBits = -bsi->cachedBits;
148 data |= bsi->iCache >> (32 - lowBits); /* get the low-order bits */
149
150 bsi->cachedBits -= lowBits; /* how many bits have we drawn from the cache so far */
151 bsi->iCache <<= lowBits; /* left-justify cache */
152 }
153
154 return data;
155}
fl::u32 uint32_t
Definition coder.h:219
static __inline void RefillBitstreamCache(BitStreamInfo *bsi) FL_NOEXCEPT
Definition bitstream.hpp:92

References FL_NOEXCEPT, and RefillBitstreamCache().

Referenced by UnpackScaleFactors(), UnpackSFMPEG1(), UnpackSFMPEG2(), and UnpackSideInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: