[Ffmpeg-cvslog] r6417 - trunk/libavcodec/vorbis_enc.c

ods15 subversion
Mon Oct 2 07:55:20 CEST 2006


Author: ods15
Date: Mon Oct  2 07:55:20 2006
New Revision: 6417

Modified:
   trunk/libavcodec/vorbis_enc.c

Log:
Original Commit: r6 | ods15 | 2006-09-16 20:36:31 +0300 (Sat, 16 Sep 2006) | 2 lines

add correct and working put_float ...

Modified: trunk/libavcodec/vorbis_enc.c
==============================================================================
--- trunk/libavcodec/vorbis_enc.c	(original)
+++ trunk/libavcodec/vorbis_enc.c	Mon Oct  2 07:55:20 2006
@@ -67,7 +67,13 @@
 }
 
 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) {




More information about the ffmpeg-cvslog mailing list