MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / binkb_read_bundle

Function binkb_read_bundle

libavcodec/bink.c:584–616  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

582}
583
584static int binkb_read_bundle(BinkContext *c, GetBitContext *gb, int bundle_num)
585{
586 const int bits = binkb_bundle_sizes[bundle_num];
587 const int mask = 1 << (bits - 1);
588 const int issigned = binkb_bundle_signed[bundle_num];
589 Bundle *b = &c->bundle[bundle_num];
590 int i, len;
591
592 CHECK_READ_VAL(gb, b, len);
593 if (b->data_end - b->cur_dec < len * (1 + (bits > 8)))
594 return AVERROR_INVALIDDATA;
595 if (bits <= 8) {
596 if (!issigned) {
597 for (i = 0; i < len; i++)
598 *b->cur_dec++ = get_bits(gb, bits);
599 } else {
600 for (i = 0; i < len; i++)
601 *b->cur_dec++ = get_bits(gb, bits) - mask;
602 }
603 } else {
604 int16_t *dst = (int16_t*)b->cur_dec;
605
606 if (!issigned) {
607 for (i = 0; i < len; i++)
608 *dst++ = get_bits(gb, bits);
609 } else {
610 for (i = 0; i < len; i++)
611 *dst++ = get_bits(gb, bits) - mask;
612 }
613 b->cur_dec = (uint8_t*)dst;
614 }
615 return 0;
616}
617
618static inline int binkb_get_value(BinkContext *c, int bundle_num)
619{

Callers 1

binkb_decode_planeFunction · 0.85

Calls 1

get_bitsFunction · 0.70

Tested by

no test coverage detected