Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-08 19:19:10 +0300
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2015-11-08 23:06:40 +0300
commit9ac61e73d0843ec4b83f4e3d47eded73234e406e (patch)
tree52f40c2e062b62590a52fc829634b39e62b5af44 /libavutil/softfloat.h
parentf3866a14c3c2949fad16267e9f2977ba9d7b5504 (diff)
softfloat: handle INT_MIN correctly in av_int2sf
Otherwise v=INT_MIN doesn't get normalized and thus triggers av_assert2 in other functions. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavutil/softfloat.h')
-rw-r--r--libavutil/softfloat.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavutil/softfloat.h b/libavutil/softfloat.h
index 4cc3ceb646..5b285e3d9b 100644
--- a/libavutil/softfloat.h
+++ b/libavutil/softfloat.h
@@ -153,7 +153,12 @@ static inline av_const SoftFloat av_sub_sf(SoftFloat a, SoftFloat b){
* @returns a SoftFloat with value v * 2^frac_bits
*/
static inline av_const SoftFloat av_int2sf(int v, int frac_bits){
- return av_normalize_sf((SoftFloat){v, ONE_BITS + 1 - frac_bits});
+ int exp_offset = 0;
+ if(v == INT_MIN){
+ exp_offset = 1;
+ v>>=1;
+ }
+ return av_normalize_sf(av_normalize1_sf((SoftFloat){v, ONE_BITS + 1 - frac_bits + exp_offset}));
}
/**