<p class="MsoNormal"><span lang="EN-US">Loren, thanks for your reply.<br>
<br>
>A NAL unit is just the type and contents, not including the "00 00 00
01".<br>
>Startcode could be considered "data associated with an access
unit", but<br>
>it might not be present at all, depending on what container is used. And<br>
>libx264 can't possibly know what container you're putting the output<br>
>stream in.<br>
Yes, you are right. A NAL unit is only the type and contents. It doesn't
include the "start_code_prefix". </span></p>
<p class="MsoNormal"><span lang="EN-US">But I do not clearly know what you mean. Does
the different container correspond to different way? What does the container mean
here? Could you explain it in detail? Or give me some references please. <br>
<br>
Why I change them is because of some experience results. I use the x264 to
produce h264 es file by using 1pass, CBR mode. I use the software "Elecard
Buffer Analyzer" to analyze these files. I find that the vbv buffer will
underflow if the time is above 60 seconds. I think the accumulative errors for
input size result in the end. The buffer would not underflow if I change the
input size from encoded frame size to the all data size. So I believe that the vbv operation should be changed. <br></span></p>
<p class="MsoNormal"><span lang="EN-US">>Plus, you count bytes in a variable
called "bits", and you use a<br>
>complicated loop depending on nal type when it could just count up to<br>
>h->out.i_nal.</span></p>
<span style="font-size: 10.5pt; font-family: "Times New Roman";" lang="EN-US">Oh, yes. Your way is
simple. I will use this way. <br><br>Any advices will be welcome. Thanks in advance.<br></span><br><div><span class="gmail_quote">2007/3/28, Loren Merritt <<a href="mailto:lorenm@u.washington.edu">lorenm@u.washington.edu
</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On Wed, 28 Mar 2007, alexander tian wrote:<br><br>> I have some questions about vbv buffer update in x264. The specification
<br>> said that it is the data with the access units that flow into the CPB. The<br>> data include not only the coded frame size but also all the other NAL units<br>> flow into the CPB.<br>><br>> Bellows are from h264 specification:
<br>> "The HRD operates as follows. Data associated with access units that flow<br>> into the CPB according to a specified arrival schedule are delivered by the<br>> HSS. ¡¡"<br>> *"access unit*: A set of *NAL units *always containing exactly one *primary
<br>> coded picture*. In addition to the *primary coded picture*, an access unit<br>> may also contain one or more *redundant coded pictures *or other *NAL units<br>> *not containing *slices *or *slice data partitions *of a *coded picture*.
<br>> The decoding of an access unit always results in a *decoded picture*."<br>><br>> So I think the function "update_vbv" has some bugs. The parameter "bits"<br>> should be equal to the total bits in the "h->
out.nal[X264_NAL_MAX]". Such as<br>> bellows:<br>><br>> for(nNalLoop=0; nNalLoop<X264_NAL_MAX; nNalLoop++)<br>> {<br>> if(h->out.nal[nNalLoop].i_type > 0)<br>> nRealBits += h->
out.nal[nNalLoop].i_payload + 5;<br>> }<br>> rcc->buffer_fill += rcc->buffer_rate - nRealBits*8;<br>><br>> The number 5 is that 4 bytes "start_code_prefix" add 1 byte<br>> "nal_unit_start".
i.e. "00 00 00 01 65".<br>><br>> At the same time the "h->out.nal[nNalLoop].i_type" should be set as zero at<br>> the begin of the function "x264_encoder_encode" to avoid the influence of
<br>> last frame.<br><br>A NAL unit is just the type and contents, not including the "00 00 00 01".<br>Startcode could be considered "data associated with an access unit", but<br>it might not be present at all, depending on what container is used. And
<br>libx264 can't possibly know what container you're putting the output<br>stream in.<br><br>Plus, you count bytes in a variable called "bits", and you use a<br>complicated loop depending on nal type when it could just count up to
<br>h->out.i_nal.<br><br>--Loren Merritt</blockquote></div><br>