[XviD-devel] vfw 2pass stats

peter ross xvid-devel@xvid.org
Mon, 14 Oct 2002 08:37:13 +1000


my thoughts on 2pass vbr.

the stats file should be stored in display order, because thats how
frames initially processed by encoder_encode_bframes().

performing bframes 2-pass _within_ the encoder is quite simple.
for 1st pass:
   * add length and texbits fields to the FRAMEINFO structure
   * write a frame_fprintf(FILE *, FRAMEINFO *) which dumps info
     about the given frame to the file.
   * call frame_fprintf(bframe) immediately after FrameCodeB calls
   * call frame_fprintf(ref_frame) at the  "pEnc->bframenum_head =
     pEnc->bframenum_tail = 0;" code.
   [there might be a couple of other cases where frame_fprintf should be 
called,
    for example the very first frame]


processing the 1pass data
   * ignore bframes initially, and utilitize the same algo for
     regular 2pass?


for 2nd-pass:
    * write a frame_fscanf(FILE *, FRAMEINFO *) function
    * call frame_fscanf() where we currently do
       frame->quant = RateControlGetQ(&pEnc->rate_control, 0);
       fscanf should set frame->quant and frame->mode.
    * patch the frame decision statement, so the desired frame->mode
      is forced.

the first/second pass filename (and other params) should be specified in
an XVID_ENC_RC structure. this structure can be passed to the encoder
via the second parameter. eg
	enc_rc.filename = "first.stats";
	xvid_encore(handle, XVID_ENC_CREATE, &enc_param, &enc_rc);

would someone like to implement the above?
iam happy to do it, but dont expect anything for atleast a couple of weeks.


-- pete


_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com