From: Loren Merritt Date: Mon, 23 Apr 2007 07:09:30 +0000 (+0000) Subject: fix the computation of bits used for vbv. (regression in r651) X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=08b4f6956135d54693b4e618f58fd7f68e654473;p=x264.git fix the computation of bits used for vbv. (regression in r651) git-svn-id: svn://svn.videolan.org/x264/trunk@653 df754926-b1dd-0310-bc7b-ec298dee348c --- diff --git a/encoder/encoder.c b/encoder/encoder.c index 1c4ea839..a05f963b 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -770,19 +770,13 @@ static void x264_nal_start( x264_t *h, int i_type, int i_ref_idc ) nal->i_ref_idc = i_ref_idc; nal->i_type = i_type; - bs_align_0( &h->out.bs ); /* not needed */ - nal->i_payload= 0; - nal->p_payload= &h->out.p_bitstream[bs_pos( &h->out.bs) / 8]; + nal->p_payload= &h->out.p_bitstream[bs_pos( &h->out.bs ) / 8]; } static void x264_nal_end( x264_t *h ) { x264_nal_t *nal = &h->out.nal[h->out.i_nal]; - - bs_align_0( &h->out.bs ); /* not needed */ - - nal->i_payload = &h->out.p_bitstream[bs_pos( &h->out.bs)/8] - nal->p_payload; - + nal->i_payload = &h->out.p_bitstream[bs_pos( &h->out.bs ) / 8] - nal->p_payload; h->out.i_nal++; } @@ -1052,7 +1046,7 @@ static void x264_slice_write( x264_t *h ) { const int i_mb_y = mb_xy / h->sps->i_mb_width; const int i_mb_x = mb_xy % h->sps->i_mb_width; - int mb_spos = bs_pos(&h->out.bs); + int mb_spos = bs_pos(&h->out.bs) + x264_cabac_pos(&h->cabac); if( i_mb_x == 0 ) x264_fdec_filter_row( h, i_mb_y ); @@ -1138,7 +1132,7 @@ static void x264_slice_write( x264_t *h ) } if( h->mb.b_variable_qp ) - x264_ratecontrol_mb(h, bs_pos(&h->out.bs) - mb_spos); + x264_ratecontrol_mb(h, bs_pos(&h->out.bs) + x264_cabac_pos(&h->cabac) - mb_spos); if( h->sh.b_mbaff ) {