Thanks for your kind reply, Loren<br><br>" Given that B-frames' QP are locked to an offset from the adjacent <br> P-frames's QP (and that's optimal for compression), the way to modify the"<br>why is that optimal?
<br><br>Maybe I think I know how the vbv works. What confuses me is how to make good use of vbv? In the x264, qscale is adjusted according to<br>vbv buffer state, is the way to adjust qscale the best way? Just as you said in
ratecontrol.txt, this is empirical. Can you improve that? <br>If we want to improve it, what can we change? the way to adjust qscale? Ratecontrol equation?<br><br>Best Regards<br>Jogging <br><br><br><div><span class="gmail_quote">
On 4/29/07, <b class="gmail_sendername">Loren Merritt</b> <<a href="mailto:lorenm@u.washington.edu">lorenm@u.washington.edu</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Sun, 29 Apr 2007, jogging song wrote:<br><br>> Now I am reading the source code of rate control in x264. The function<br>> clip_qscale adjusts qscale according to vbv buffer state.<br>> I find some comments are not consistent with source codes.
<br>> Here is the codes:<br>><br>> /* Check B-frame complexity, and use up any bits that would<br>> * overflow before the next P-frame. */<br>> if( h->sh.i_type == SLICE_TYPE_P )<br>> {
<br>> int nb = rcc->bframes;<br>> double pbbits = bits;<br>> double bbits = predict_size( rcc->pred_b_from_p, q * h-><br>> param.rc.f_pb_factor, rcc->last_satd );<br>> double space;
<br>><br>> if( bbits > rcc->buffer_rate )<br>> nb = 0;<br>> pbbits += nb * bbits;<br>><br>> space = rcc->buffer_fill + (1+nb)*rcc->buffer_rate -<br>
> rcc->buffer_size;<br>> if( pbbits < space )<br>> {<br>> q *= X264_MAX( pbbits / space,<br>> bits / (0.5 * rcc->buffer_size) );<br>> }
<br>> q = X264_MAX( q0-5, q );<br>> }<br>><br>> The comments tell us that the following codes adjust qscale for B slices.<br>> But the codes are executed in the case the slice is P.<br><br>The comment is correct. It doesn't say it adjusts the QP of the B-frames,
<br>it says it adjusts the QP of the P-frames to compensate for B-frames.<br>Given that B-frames' QP are locked to an offset from the adjacent<br>P-frames's QP (and that's optimal for compression), the way to modify the
<br>qscale for B-frames is to modify the adjacent P-frames.<br><br>> I have one question. VBV buffer allows us to change the rate according the<br>> content of current frame. But how do we make good use of vbv buffer?
<br>> What is the objective pf vbv buffer in rate control? Try to make it<br>> full always?<br><br>Before asking what x264 does with VBV, do you know what VBV means in<br>general, as descibed in the MPEG-2 and H.264
standards and related docs?<br>I don't feel up to explaining that.<br><br>--Loren Merritt<br><br>--<br>This is the x264-devel mailing-list<br>To unsubscribe, go to: <a href="http://developers.videolan.org/lists.html">
http://developers.videolan.org/lists.html</a><br><br></blockquote></div><br>