| 353 | } |
| 354 | |
| 355 | static 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 | |
| 389 | static const uint8_t bink_rlelens[4] = { 4, 8, 12, 32 }; |
| 390 |
no test coverage detected