[XviD-devel] How to encode the bitstream with const key-interval

skal skal at planet-d.net
Tue Oct 21 07:50:33 CEST 2003


	Hi Wang,

On Tue, 2003-10-21 at 04:31, yixian wang wrote:
> Dear Sir/Madam:
> 
>    I want to use xvid encoder to encode the bitstream with const key-interval and the decoder can access the bitstream randomly.
>   
>    I think it is important in broadcast system.In mpeg4 standard, the Group_of_VideoObjectPlane can do this work.
> 
	i'm not sure it's the real intend of the Group_of_VOP, anyway:

>   In XVID_ENC_PARAM structure, I only find the max_key_interval , which is  the  maximum   value  of   frames  between   two  keyframes.
> 
>  How can i encode the bitstream with const key-interval with the GOV head.
> 

	well, group of VOP needs timing informations that are hardly relevant for
	the encoder. It seems to me this function should be on the application
	side, rather than the encoder. Here's a code i think should work for
	adding a Group_of_VOP to the current bitstream when you feel appropriate.
	Please customise (and cross-check), given your knowledge about closed_gov
	and broken_link settings...

	hope it helps,
Skal



int
write_Group_of_VOP(xvid_enc_frame_t * xFrame, const int hours, const int mins, const int secs)
{
  Bitstream bs;

//  assert(hours>=0 && hours<24 && mins>=0 && mins<60 && secs>=0 && secs<60);
  BitstreamInit(&bs, xFrame->bitstream, 0);
  BitstreamPutBits(&bs, GRPOFVOP_START_CODE, 32);
  BitstreamPutBits(&bs, hours, 5);
  BitstreamPutBits(&bs, mins, 6);
  BitstreamPutBits(&bs, 1, 1);     // marker bits
  BitstreamPutBits(&bs, secs, 6);

  BitstreamPutBits(&bs, 1, 0);   // closed gov
  BitstreamPutBits(&bs, 0, 1);   // broken link

  BitstreamPadAlways(&bs);

  return BitstreamLength(&bs);
}




More information about the XviD-devel mailing list