[XviD-devel] padding bytes in stream?

Michael Militzer michael at xvid.org
Tue Jul 3 22:56:39 CEST 2007


normally, the Xvid decoder should consume all the data in an AVI chunk
(without any left-overs). At least Xvid encoded AVIs are designed like that.
It could probably be different for AVIs created with a different encoder.

So it should be ok to drop the last byte of an AVI chunk if really just
this byte wasn't consumed by the decoder (then it might be indeed just a
padding byte). However, it doesn't hurt to feed this left-over byte to the
decoder together with the next AVI chunk - just it could mean a performance
penalty if buffer copy/merge operations are required for this...


Quoting Stephan Assmus <superstippi at gmx.de>:

> Hello all,
> First of all, thank you for a great software package! It is clean and well
> documented, it was easy to dive into it and be productive quickly. Thanks!
> I was wondering about the decode example with regards to MIN_USEFUL_BYTES
> (defined to 1). In the example, new data is fetched when there is less or
> equal to MIN_USEFUL_BYTES left in the source buffer. I used this code to
> write a BeOS decoder plugin. There is a function that the decoder can use,
> which will give it the "next chunk" of data from the extractor (ie AVI). I
> keep fetching chunk buffers and feeding them into xvid until I successfully
> decoded a frame. On the next request to decode a frame, I feed the left
> over bytes of the last chunk buffer into xvid and start fetching the next
> chunks and so on. My question is about MIN_USEFUL_BYTES. When xvid left
> just 1 byte in the buffer, should I prepend that byte to the next buffer or
> can it be safely discarded (like it is just some kind of padding). Right
> now, I just discard this byte and the codec seems to work fine, but someone
> looked over my code and spotted this and said I should probably not drop
> that byte... any insights?
> Thanks and best regards,
> -Stephan
> _______________________________________________
> 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