MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / bits_peek

Function bits_peek

libhb/stream.c:2563–2591  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2561}
2562
2563static inline unsigned int bits_peek(bitbuf_t *bb, int bits)
2564{
2565 unsigned int val;
2566 int left = 32 - (bb->pos & 31);
2567
2568 if (bits < left)
2569 {
2570 val = (bb->val >> (left - bits)) & bitmask[bits];
2571 }
2572 else
2573 {
2574 val = (bb->val & bitmask[left]) << (bits - left);
2575 int bpos = bb->pos + left;
2576 bits -= left;
2577
2578
2579 if (bits > 0)
2580 {
2581 int pos = bpos >> 3;
2582 int bval = (bb->buf[pos] << 24) |
2583 (bb->buf[pos + 1] << 16) |
2584 (bb->buf[pos + 2] << 8) |
2585 bb->buf[pos + 3];
2586 val |= (bval >> (32 - bits)) & bitmask[bits];
2587 }
2588 }
2589
2590 return val;
2591}
2592
2593static inline unsigned int bits_get(bitbuf_t *bb, int bits)
2594{

Callers 1

parse_pes_headerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected