[XviD-devel] about my B-frame decode code
Christoph Lampert
xvid-devel@xvid.org
Thu, 18 Jul 2002 10:24:37 +0200 (CEST)
On Thu, 18 Jul 2002, CM wrote:
> Hi:
>
> I found my B-frame decode code is wrong, because the Divx not
> write vol_control_param head, so I'm cann't get the low_delay flage
> at this time my code will broken bitstream, and program will error!
> I update my code at today (see decode.c), but I don't known
> where is the best way to fix that error and Divx how to?
I guess low_delay=0, if it is not specified.
However, this won't work with broken encoders (like old xvid and
DivX), so ffmpeg does is in the following way:
/* detect buggy encoders which dont set the low_delay flag
(divx4/xvid/opendivx)*/
// note we cannot detect divx5 without b-frames easyly (allthough its
buggy too)
if(s->vo_type==0 && s->vol_control_parameters==0 &&
s->divx_version==0 && s->picture_number==0){
printf("looks like this file was encoded with
(divx4/(old)xvid/opendivx) -> forcing low_delay flag\n");
s->low_delay=1;
}
So if no low_delay flag is present, it assumes that the decoder does not
know about low_delay and sets low_delay=1.
This may not always work, but what else should we do if the bytestream is
broken? We could add a "backwards compatability" field which sets
low_delay to 1 (if it is not present).
We should concentrate on producing and decoding _correct_ bytestreams.
gruel
--
Christoph H. Lampert chl@math.uni-bonn.de | Diese Signature wurde maschi-
Beringstr. 6, Raum 14 Tel. (0228) 73-2948 | nell erstellt und bedarf
Sprechstunden: keine, aber meistens da | keiner Unterschrift. AZ 27B-6