[FFmpeg-cvslog] r20103 - trunk/libavcodec/vorbis_enc.c

reimar subversion
Wed Sep 30 22:48:00 CEST 2009


Author: reimar
Date: Wed Sep 30 22:47:59 2009
New Revision: 20103

Log:
Do not needlessly add 7 to put_buts_count before dividing by 8,
flush_put_bits ensures it is divisible 8.

Modified:
   trunk/libavcodec/vorbis_enc.c

Modified: trunk/libavcodec/vorbis_enc.c
==============================================================================
--- trunk/libavcodec/vorbis_enc.c	Wed Sep 30 20:27:39 2009	(r20102)
+++ trunk/libavcodec/vorbis_enc.c	Wed Sep 30 22:47:59 2009	(r20103)
@@ -542,7 +542,7 @@ static int put_main_header(vorbis_enc_co
     put_bits(&pb,  1, 1); // framing
 
     flush_put_bits(&pb);
-    hlens[0] = (put_bits_count(&pb) + 7) / 8;
+    hlens[0] = put_bits_count(&pb) >> 3;
     buffer_len -= hlens[0];
     p += hlens[0];
 
@@ -555,7 +555,7 @@ static int put_main_header(vorbis_enc_co
     put_bits(&pb,  1, 1); // framing
 
     flush_put_bits(&pb);
-    hlens[1] = (put_bits_count(&pb) + 7) / 8;
+    hlens[1] = put_bits_count(&pb) >> 3;
     buffer_len -= hlens[1];
     p += hlens[1];
 
@@ -628,7 +628,7 @@ static int put_main_header(vorbis_enc_co
     put_bits(&pb, 1, 1); // framing
 
     flush_put_bits(&pb);
-    hlens[2] = (put_bits_count(&pb) + 7) / 8;
+    hlens[2] = put_bits_count(&pb) >> 3;
 
     len = hlens[0] + hlens[1] + hlens[2];
     p = *out = av_mallocz(64 + len + len/255);
@@ -1023,7 +1023,7 @@ static int vorbis_encode_frame(AVCodecCo
     avccontext->coded_frame->pts = venc->sample_count;
     venc->sample_count += avccontext->frame_size;
     flush_put_bits(&pb);
-    return (put_bits_count(&pb) + 7) / 8;
+    return put_bits_count(&pb) >> 3;
 }
 
 



More information about the ffmpeg-cvslog mailing list