[XviD-devel] BUG: real n-vops with b-frames combination b0rks

bond b-o-n-d at gmx.net
Mon Feb 13 23:05:47 CET 2006


> >for a long time xvid didnt insert real n-vops into the video stream when
> >b-frames have been enabled (be it packed bitstream or not). since 1.1
this
> >has been changed
> >you can get xvid to insert real n-vops by increasing the framedropratio
> >option (maximum is a value of 100)
>
> <snip>
>
> >3) the third problem is that when getting xvid to insert real n-vops the
> >targeted bitrate isnt hit at all anymore in 2pass.
>
> Here's a patch that seems to fix this issue (maybe reason 4 as well, not
> sure):
>
> --- src/encoder.c 19 Jan 2006 22:25:18 -0000 1.123
> +++ src/encoder.c 12 Feb 2006 07:36:42 -0000
> @@ -1384,7 +1384,8 @@
>
> if ( FrameCodeP(pEnc, &bs) == 0 ) {
> /* N-VOP, we mustn't code b-frames yet */
> - call_plugins(pEnc, pEnc->current, &pEnc->sOriginal, XVID_PLG_AFTER,
> NULL, NULL, stats);
> + if ((pEnc->mbParam.global_flags & XVID_GLOBAL_PACKED) ||
> pEnc->mbParam.max_bframes == 0)
> + call_plugins(pEnc, pEnc->current, &pEnc->sOriginal, XVID_PLG_AFTER,
> NULL, NULL, stats);
> goto done;
> }
> }
> @@ -1797,7 +1798,7 @@
> (pParam->frame_drop_ratio * mb_width * mb_height) / 100 &&
> ( (pEnc->bframenum_head >= pEnc->bframenum_tail) ||
> !(pEnc->mbParam.global_flags & XVID_GLOBAL_CLOSED_GOP)) )
> {
> - current->sStat.kblks = current->sStat.mblks = 0;
> + current->sStat.kblks = current->sStat.mblks = current->sStat.iTextBits =
> 0;
> current->sStat.ublks = mb_width * mb_height;
>
> BitstreamReset(bs);



thx for this patch!
i now tested it again with your patch and it seems to fix all the problems:

> i made various tests with the framedropratio option and i noticed that in
> the case xvid inserts real n-vops together with b-frames things are not
> correct because of four reasons:
> 1) the amount of real n-vops is different whether i use packed bitstream
or
> whether i dont (counting of course only the real n-vops, not the fake ones
> caused by packed bitstream)

fixed, n-vop number is now exactly the same no matter if packed is used or
not

> 2) the second problem is that the frametypes should be exactly the same no
> matter if packed bitstream is used or not, but when getting xvid to insert
> real n-vops this isnt true anymore, as the frametypes differ between using
> packed and not using it, altough all other settings are the same

fixed, frametypes are exactly the same no matter if packed or not

> 3) the third problem is that when getting xvid to insert real n-vops the
> targeted bitrate isnt hit at all anymore in 2pass.
> 4) apart from that the final bitrate isnt hit it also differs clearly
> between the stream using packed bitstream and the stream not using (target
> bitrate was 700kbps, the packed stream had 800kbps, the not packed one had
> 850kbps)

fixed too
target: 700
packed: 695
not packed: 695

may i ask what the problem was causing the errors i reported?

anyways, i hope this patch can be committed to cvs :)

cheers
bond



More information about the XviD-devel mailing list