[XviD-devel] [BUG] BFrame encoder doesn't force intra for 1st frame

peter ross xvid-devel@xvid.org
Wed, 07 Aug 2002 15:53:09 +1000


>From: "Michael Militzer" <michael@xvid.org>
>Reply-To: xvid-devel@xvid.org
>To: <xvid-devel@xvid.org>
>Subject: Re: [XviD-devel] [BUG] BFrame encoder doesn't force intra for 1st 
>frame
>Date: Mon, 5 Aug 2002 10:44:45 +0200
>
>
>----- Original Message -----
>From: "peter ross" <suxen_drol@hotmail.com>
>To: <xvid-devel@xvid.org>
>Sent: Monday, August 05, 2002 4:15 AM
>Subject: Re: [XviD-devel] [BUG] BFrame encoder doesn't force intra for 1st
>frame
>
>
> > >From: "Michael Militzer" <michael@xvid.org>
> > >Reply-To: xvid-devel@xvid.org
> > >To: <xvid-devel@xvid.org>
> > >Subject: Re: [XviD-devel] [BUG] BFrame encoder doesn't force intra for
>1st
> > >frame
> > >Date: Mon, 5 Aug 2002 01:37:05 +0200
> > >
> > >Hi,
> > >
> > > > > I get those results when using either divx5 bvop compatibility or
> > >plain
> > > > > "xvid style". I'm glad that someone finally confirmed that 
>problem.
> > > > > For me, the xvid decoder crashes on bframes (even if I #define
> > > > > #BFRAME_DEC), either the VFW in vdub and the DShow in WMP.
> > > > > Interesting is that gruel could see that the files produced in
>windows
> > > > > encoder are wrong (shows the same there), but if encoding in linux
> > > > > everything is fine.
> > > >
> > > > strange. Especially because for me here the encoded files seem not
> > >broken,
> > > > DivX5 and ffdshow can play them from the very beginning. So I'd 
>rather
> > > > suppose that something in the decoder part isn't perfect - but we'll
> > >see...
> > >
> > >I just commited a fix for the windows b-frame problems, at least for me
> > >everything works fine now.
> > >As supposed the unprocessed but queued frames caused the problem - I
>solved
> > >this problem by writing N_VOPs to the bitstream while the queue is 
>being
> > >filled. Sure this is not the best solution because a delay is 
>introduced
> > >even if we'd use .MP4 file format, but as long as the API doesn't 
>support
> > >returning a status for every frame like processed/queued, there's 
>nothing
> > >we
> > >can do about it.
> > >
> > >btw: before my changes there was a BitstreamPutBits(&bs, 0x7f, 8);
> > >(encoder.c, l. 826) while the queue was being filled. I have to admit
>that
> > >I
> > >don't really understand what this should do. Could the original author
> > >(pete?) explain it to me, please?
> > >
> >
> > when virtualdub sees a 1-byte frame containing 0x7f it will ignore the
> > output frame. (but only when the fourcc=DX50)
>
>Ah, I see. But that's not really a common solution, right? Is the current
>N_VOP solution ok for now?
>


correct; it's not a platform independant solution.
inserting N_VOPS is one way, although its not perfect. i think we should set 
ENC_FRAME->length to less-than-zero to indicate there is "no valid output" 
from the codec, AND, let the frontend handle the issue of "delay-build-up 
frames" ???


2pass bframes patch
-------------------
since i have been ill and unable to code/compute anything, ive been 
"thinking" about 2pass+bframes quite a bit lately.
here's my three-step plan.


1. rework the api (slightly) such that "bitstream" and "frame" statistics 
are seperate from each other.

bitstream stuff (XVID_ENC_FRAME)
- length
- "is this a keyframe"

actual frame stats (XVID_ENC_STATS)
- length of the frame
- frame type I/P/B?
- quantizer and quant_type
- k,m,u motion blocks


2. modify encoder.c such that XVID_ENC_STATS are spat out in correct order.
   i might have to include a flag in the XVID_ENC_FRAME to indicate whether 
or not the stats struct is valid


3. modify vfw/src/2pass.c:codec_2pass_update() such that it only deals with 
XVID_ENC_STATS

int codec_2pass_update(CODEC* codec, XVID_ENC_FRAME* frame, XVID_ENC_STATS* 
stats)


questions
---------
- is anyone working on vfw codec_2pass_update() this week/weekend? this 
patch will change a few things.
- do we want BFRAME mv-hinting??


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