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

◆ get_bits()

static uint32 fl::third_party::vorbis::get_bits ( vorb * f,
int32_t n )
static

Definition at line 1327 of file stb_vorbis.cpp.hpp.

1328{
1329 uint32 z;
1330
1331 if (f->valid_bits < 0) return 0;
1332 if (f->valid_bits < n) {
1333 if (n > 24) {
1334 // the accumulator technique below would not work correctly in this case
1335 z = get_bits(f, 24);
1336 z += get_bits(f, n-24) << 24;
1337 return z;
1338 }
1339 if (f->valid_bits == 0) f->acc = 0;
1340 while (f->valid_bits < n) {
1342 if (z == EOP) {
1344 return 0;
1345 }
1346 f->acc += z << f->valid_bits;
1347 f->valid_bits += 8;
1348 }
1349 }
1350
1351 FL_ASSERT(f->valid_bits >= n, "valid_bits must be >= n");
1352 z = f->acc & ((1 << n)-1);
1353 f->acc >>= n;
1354 f->valid_bits -= n;
1355 return z;
1356}
uint32_t z[NUM_LAYERS]
Definition Fire2023.h:93
#define FL_ASSERT(x, MSG)
Definition assert.h:6
static constexpr int32_t INVALID_BITS
static constexpr int32_t EOP
static int32_t get8_packet_raw(vorb *f) FL_NOEXCEPT
static uint32 get_bits(vorb *f, int32_t n) FL_NOEXCEPT
fl::i32 int32_t
Definition coder.h:220

References EOP, FL_ASSERT, FL_NOEXCEPT, get8_packet_raw(), get_bits(), INVALID_BITS, and z.

Referenced by get_bits(), start_decoder(), vorbis_decode_initial(), and vorbis_decode_packet_rest().

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