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

Function read_motion_values

libavcodec/bink.c:355–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355static int read_motion_values(AVCodecContext *avctx, GetBitContext *gb, Bundle *b)
356{
357 int t, sign, v;
358 const uint8_t *dec_end;
359
360 CHECK_READ_VAL(gb, b, t);
361 dec_end = b->cur_dec + t;
362 if (dec_end > b->data_end) {
363 av_log(avctx, AV_LOG_ERROR, "Too many motion values\n");
364 return AVERROR_INVALIDDATA;
365 }
366 if (get_bits_left(gb) < 1)
367 return AVERROR_INVALIDDATA;
368 if (get_bits1(gb)) {
369 v = get_bits(gb, 4);
370 if (v) {
371 sign = -get_bits1(gb);
372 v = (v ^ sign) - sign;
373 }
374 memset(b->cur_dec, v, t);
375 b->cur_dec += t;
376 } else {
377 while (b->cur_dec < dec_end) {
378 v = GET_HUFF(gb, b->tree);
379 if (v) {
380 sign = -get_bits1(gb);
381 v = (v ^ sign) - sign;
382 }
383 *b->cur_dec++ = v;
384 }
385 }
386 return 0;
387}
388
389static const uint8_t bink_rlelens[4] = { 4, 8, 12, 32 };
390

Callers 1

bink_decode_planeFunction · 0.85

Calls 4

av_logFunction · 0.85
get_bits_leftFunction · 0.85
get_bits1Function · 0.85
get_bitsFunction · 0.70

Tested by

no test coverage detected