| 378 | } |
| 379 | |
| 380 | static float wv_get_value_float(WavpackContext *s, uint32_t *crc, int S) |
| 381 | { |
| 382 | union { |
| 383 | float f; |
| 384 | uint32_t u; |
| 385 | } value; |
| 386 | |
| 387 | int sign; |
| 388 | int exp = s->float_max_exp; |
| 389 | |
| 390 | if(s->got_extra_bits){ |
| 391 | const int max_bits = 1 + 23 + 8 + 1; |
| 392 | const int left_bits = get_bits_left(&s->gb_extra_bits); |
| 393 | |
| 394 | if(left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits) |
| 395 | return 0.0; |
| 396 | } |
| 397 | |
| 398 | if(S){ |
| 399 | S <<= s->float_shift; |
| 400 | sign = S < 0; |
| 401 | if(sign) |
| 402 | S = -S; |
| 403 | if(S >= 0x1000000){ |
| 404 | if(s->got_extra_bits && get_bits1(&s->gb_extra_bits)){ |
| 405 | S = get_bits(&s->gb_extra_bits, 23); |
| 406 | }else{ |
| 407 | S = 0; |
| 408 | } |
| 409 | exp = 255; |
| 410 | }else if(exp){ |
| 411 | int shift = 23 - av_log2(S); |
| 412 | exp = s->float_max_exp; |
| 413 | if(exp <= shift){ |
| 414 | shift = --exp; |
| 415 | } |
| 416 | exp -= shift; |
| 417 | |
| 418 | if(shift){ |
| 419 | S <<= shift; |
| 420 | if((s->float_flag & WV_FLT_SHIFT_ONES) || |
| 421 | (s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SAME) && get_bits1(&s->gb_extra_bits)) ){ |
| 422 | S |= (1 << shift) - 1; |
| 423 | } else if(s->got_extra_bits && (s->float_flag & WV_FLT_SHIFT_SENT)){ |
| 424 | S |= get_bits(&s->gb_extra_bits, shift); |
| 425 | } |
| 426 | } |
| 427 | }else{ |
| 428 | exp = s->float_max_exp; |
| 429 | } |
| 430 | S &= 0x7fffff; |
| 431 | }else{ |
| 432 | sign = 0; |
| 433 | exp = 0; |
| 434 | if(s->got_extra_bits && (s->float_flag & WV_FLT_ZERO_SENT)){ |
| 435 | if(get_bits1(&s->gb_extra_bits)){ |
| 436 | S = get_bits(&s->gb_extra_bits, 23); |
| 437 | if(s->float_max_exp >= 25) |
no test coverage detected