changeset 1910:5c21b165abf6 libavcodec

ensure that the bitstream buffers for encoding partitioned frames are aligned
author michael
date Fri, 26 Mar 2004 21:58:55 +0000
parents 559e92baf533
children 5b379ba0a577
files h263.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/h263.c	Fri Mar 26 20:28:29 2004 +0000
+++ b/h263.c	Fri Mar 26 21:58:55 2004 +0000
@@ -2996,13 +2996,12 @@
     uint8_t *start= pbBufPtr(&s->pb);
     uint8_t *end= s->pb.buf_end;
     int size= end - start;
-    int pb_size = size/3;
-    int pb2_size= size/3;
-    int tex_size= size - pb_size - pb2_size;
+    int pb_size = (size/3)&(~1);
+    int tex_size= size - 2*pb_size;
     
     set_put_bits_buffer_size(&s->pb, pb_size);
     init_put_bits(&s->tex_pb, start + pb_size           , tex_size);
-    init_put_bits(&s->pb2   , start + pb_size + tex_size, pb2_size);
+    init_put_bits(&s->pb2   , start + pb_size + tex_size, pb_size);
 }
 
 void ff_mpeg4_merge_partitions(MpegEncContext *s)