On Tue, May 31, 2016 at 09:02:01PM +0530, Umair Khan wrote: > Hi all, > > I replaced floats in my code with SoftFloat and the results weren't as > expected. > I also had some doubts the way it is written. > > 1. The biggest one is why is the mantissa part of FLOAT_1 defined as > 0x20000000 here - > https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/softfloat.h#L41. > If I'm right, the mantissa part of an IEEE 754 float should have all > mantissa bits unset, i.e., it should just be 0 if we talk in hex or > decimal format. Also, mantissa is supposed to be 23 bits long, whereas > the highest set bit of 0x20000000 is at 30th position.
SoftFloat makes no attempt to match 23 bit mantisse floats Its goals where more to use the available space in 32bits ints efficiently, be fast, accurate (in relation to the ideal infinite precission) and binary reproducable. It might be possible to extend it to work with 24bit mantissas if that is something someone wants, if thats practical to make it usable in a lossless integer coder i dont know. I didnt realize you intend to use this in ALS before > > 2. Why isn't there a variable for the sign bit ? How do I know if a > particular SoftFloat is positive or negative ? the mantisse is signed but really thats a implementation detail code that deals with the numbers at that low level should be in the softfloat code and not the app using it > > 3. After making the changes, the exp part was always one less than > what it should have been (I couldn't figure out why) and the mantissa > was totally different altogether. This is the commit which converts > float to SoftFloat - > https://github.com/omerjerk/FFmpeg/commit/d3f4cba1ebaa072bcb70cb8ae7bb4cef4765f1b7 > > P.S. The code is working perfectly fine with just float. > > Thanks, > Umair > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In fact, the RIAA has been known to suggest that students drop out of college or go to community college in order to be able to afford settlements. -- The RIAA
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel