[XviD-devel] Questions / Bug fixes / Patches how to do?

Michael Militzer michael at xvid.org
Wed Aug 18 10:57:09 CEST 2010


Hi,

you can send your patches to this list. Either paste the patch in your
mail body (note: the list strips attachments) or upload the patch somewhere
and simply post a link here.

With regard to the frame-drop issue: I think the clipping of the
frame_drop_ratio parameter to a minimum of zero is the intended behavior.
The frame_drop_ratio parameter should be set to a value between 0 and 100
(see xvid.h). -1 is used only internally.

When frame_drop_ratio is zero, no frame is dropped (in the sense that data
is ommitted to save bits). There can be N_VOPs produced however nonetheless
in case all macroblocks of a frame were encoded as skip MBs (e.g. when two
consecutive frames were identical already in the source).

Writing a N_VOP instead of a P_VOP with all MBs skipped is not wrong
(actually, it saves some bits) and imho doesn't make the stream variable
framerate. But I can't comment on what problems mp4box might have with
this - this should be verified.

Basically, it is possible to disable N_VOP creation completely. This will
just cost some bits here and there because coding a P_VOP with all skip
MBs is less efficient. To achieve this without changing the semantics of
the API I'd say it should be sufficient to change the "<=" to a "<" in the
if-clause around line 1891 in encoder.c:

if (current->sStat.kblks + current->sStat.mblks <
  		(pParam->frame_drop_ratio * mb_width * mb_height) / 100

With regard to adding additional simple profile presets to config.c in vfw
I see no problem in doing so.

Best regards,
Michael


Quoting Carl Eric Codere <cecodere at yahoo.ca>:

> Greetings,
>          Hello there, good and excellent codec you have there!! I   
> have been playing around with mencoder, which uses xvid and found a   
> few quirks in some of the code. I would like to help out where I can.
>
> - I have found the following quirks in the xvid codec:
>    According to some places in the code frame_drop_ratio, when set   
> to -1 indicates that no N-VOP will ever be added to the stream. The   
> problem is that somewhere else the value is reset to 0, therefore   
> the -1 option is unusable. Because of this mp4box cannot directly   
> import the mp4 stream as is and must convert it to a variable frame   
> rate if there are n-vops inserted,am i correct in assuming the above  
>  statement?
>
> In encoder.c:
> 	/* frame drop ratio */
> 	pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, 0);
> should be replaced by:
> 	/* frame drop ratio */
> 	pEnc->mbParam.frame_drop_ratio = MAX(create->frame_drop_ratio, -1);
>
> In encoder.c (around line 1891), the code should be replaced by as   
> follows (to validate by you if this is correct or not - I just check  
>  that the frame_drop_ratio >= 0 to continue in the frame dropping   
> algorithm, is that correct?
>
> 	if ((pParam->frame_drop_ratio >= 0) && (current->sStat.kblks +   
> current->sStat.mblks <=
> 		(pParam->frame_drop_ratio * mb_width * mb_height) / 100 &&
> 		( (pEnc->bframenum_head >= pEnc->bframenum_tail) ||   
> !(pEnc->mbParam.global_flags & XVID_GLOBAL_CLOSED_GOP)) ))
>
>   feature request: I would like to modify config.c of vfw to add the  
>  following pre-defined profile levels: SP at L4a SP at L5 (and maybe   
> SP at L6), as defined in ISO Amendments.
>
> Let me know how i can submit these patches to you and if they are acceptable!
> Thanks
> Best regards
> Carl Eric Codere
>
>
>
>
>
> _______________________________________________
> Xvid-devel mailing list
> Xvid-devel at xvid.org
> http://list.xvid.org/mailman/listinfo/xvid-devel
>
>




More information about the Xvid-devel mailing list