diff options
author | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 05:55:20 +0000 |
---|---|---|
committer | Oded Shimon <ods15@ods15.dyndns.org> | 2006-10-02 05:55:20 +0000 |
commit | 1f7e7464e9b8e00381830a4e4a61ac95137fd712 (patch) | |
tree | acf0d3ac12133d5a6207d82749ef34315222a92c /libavcodec/vorbis_enc.c | |
parent | 3112124154ebc773b1fddaa888cc9127e2ba24f2 (diff) | |
download | ffmpeg-1f7e7464e9b8e00381830a4e4a61ac95137fd712.tar.gz |
Original Commit: r6 | ods15 | 2006-09-16 20:36:31 +0300 (Sat, 16 Sep 2006) | 2 lines
add correct and working put_float ...
Originally committed as revision 6417 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/vorbis_enc.c')
-rw-r--r-- | libavcodec/vorbis_enc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libavcodec/vorbis_enc.c b/libavcodec/vorbis_enc.c index acb55b3073..8811e3b7fb 100644 --- a/libavcodec/vorbis_enc.c +++ b/libavcodec/vorbis_enc.c @@ -67,7 +67,13 @@ static inline int ilog(unsigned int a) { } static void put_float(PutBitContext * pb, float f) { - put_bits(pb, 32, *(uint32_t*)&f); + int exp, mant; + uint32_t res = 0; + mant = (int)ldexp(frexp(f, &exp), 20); + exp += 788 - 20; + if (mant < 0) { res |= (1 << 31); mant = -mant; } + res |= mant | (exp << 21); + put_bits(pb, 32, res); } static void put_codebook_header(PutBitContext * pb, codebook_t * cb) { |