[XviD-devel] dev-api-4 questions (decode)
suxen_drol
suxen_drol at hotmail.com
Wed Jun 11 18:37:04 CEST 2003
On 10 Jun 2003 20:36:25 +0200 Ravage <ravage at gmx.de> wrote:
> Hi out there,
>
> I checked out a fresh dev-api-4-cvs-version today - just to have a look
> at the new api since I only played around with the xvid-0.9.x api.
> I also had a look at the examples but there are some points within the
> decode-loop (for instance in xvid_decraw.c) which aren't clear for me:
>
> Let assume this pseudo-code:
>
> unsigned char* input_ptr;
> mp4_size = fread(...):
>
> used_bytes = dec_main(input_ptr, out_buffer, mp4_size, &xvid_dec_stats);
>
>
> So my quesition are:
> - What is used_bytes? My hint is, it's the size of the characters from
> input_ptr[] which were used. So used_bytes<=mp4_size is always correct,
> isn't it ?
correct.
when used_bytes is negative, it means an error occured.
when used_bytes is positive, or 0, it has the same meaning as the 0.9.x
"frame.length" field.
> For avi-cointainer it should be used_bytes == AVI_framesize.
yes, unless there is some junk at the end of the AVI frame chunk.
> - used_bytes <0 means error XVID_ERR_* and
> xvid_dec_stats.type <= 0 means we need more data ?
> or let's better say:
> - How would I notice errors (in stream for example) ?
> - How will I know the decoder needs more data ?
the logic for decoding is:
while(1) {
used_bytes = xvid_decore(... buffer ... &stats ...)
if used_bytes is less than zero, an error occured, break
increment our buffer position by used_bytes
if stats.type>0 then display the image buffer
}
stats.type tell you what was decoded.
> - Also I'm not sure what XVID_LOWDELAY means and when it must be set.
if XVID_LOWDELAY forces the decoder to operate in "low-delay" mode.
in low-delay mode, xvid will always write to the image buffer, which is
intended for Video-for-Windows decoding. VFW does not support the
decoding delay caused by bframes.
> Big thanks for reading my questions.
> I hope you'll have a few minutes to answer. Thank you.
glad to.
-- pete
More information about the XviD-devel
mailing list