Mercurial > libavcodec.hg
comparison wavpack.c @ 10535:95f3daa991a2 libavcodec
Use get_bits_left() instead of size_in_bits - get_bits_count().
author | rbultje |
---|---|
date | Mon, 16 Nov 2009 17:42:43 +0000 |
parents | a514a601bf26 |
children | dfeaae916502 |
comparison
equal
deleted
inserted
replaced
10534:4cd2ef16fb63 | 10535:95f3daa991a2 |
---|---|
376 int sign; | 376 int sign; |
377 int exp = s->float_max_exp; | 377 int exp = s->float_max_exp; |
378 | 378 |
379 if(s->got_extra_bits){ | 379 if(s->got_extra_bits){ |
380 const int max_bits = 1 + 23 + 8 + 1; | 380 const int max_bits = 1 + 23 + 8 + 1; |
381 const int left_bits = s->gb_extra_bits.size_in_bits - get_bits_count(&s->gb_extra_bits); | 381 const int left_bits = get_bits_left(&s->gb_extra_bits); |
382 | 382 |
383 if(left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits) | 383 if(left_bits + 8 * FF_INPUT_BUFFER_PADDING_SIZE < max_bits) |
384 return 0.0; | 384 return 0.0; |
385 } | 385 } |
386 | 386 |
895 if(!got_float && avctx->sample_fmt == SAMPLE_FMT_FLT){ | 895 if(!got_float && avctx->sample_fmt == SAMPLE_FMT_FLT){ |
896 av_log(avctx, AV_LOG_ERROR, "Float information not found\n"); | 896 av_log(avctx, AV_LOG_ERROR, "Float information not found\n"); |
897 return -1; | 897 return -1; |
898 } | 898 } |
899 if(s->got_extra_bits && avctx->sample_fmt != SAMPLE_FMT_FLT){ | 899 if(s->got_extra_bits && avctx->sample_fmt != SAMPLE_FMT_FLT){ |
900 const int size = s->gb_extra_bits.size_in_bits - get_bits_count(&s->gb_extra_bits); | 900 const int size = get_bits_left(&s->gb_extra_bits); |
901 const int wanted = s->samples * s->extra_bits << s->stereo_in; | 901 const int wanted = s->samples * s->extra_bits << s->stereo_in; |
902 if(size < wanted){ | 902 if(size < wanted){ |
903 av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n"); | 903 av_log(avctx, AV_LOG_ERROR, "Too small EXTRABITS\n"); |
904 s->got_extra_bits = 0; | 904 s->got_extra_bits = 0; |
905 } | 905 } |