[XviD-devel] report: xvid_decraw bug

chchcomputer chchcomputer at 163.com
Mon Jul 9 11:51:25 CEST 2007


Hello,the authors of xvid1.1.2. Fisrt of all, I should say thanks very much for your devopling so useful code. Recently I'v read part of the code of xvid1.1.2. My main focus is to use the example xvid_decraw. But I found some thing wrong i.e. bugs with it, so I will describe what I've done and what I've seen, and point out the reason of the bugs.
My mission is only to point out the bugs, the work of fixing them is left to the authors, who are most familiar with the whole xvid code and most capable to make xvid perfect!My aim is to decode a raw mp4 video stream river.mp4v (this file is just a video stream complying 14496-2) use xvid_decraw. This file has headers like vol, 454 vops, and a visual_object_sequence_end_code. This file only consists of I_VOP and P_VOP, but low_delay bit doesn't appear in it, so low->delay will assumed to be 0 in decoding.Bug 1:
 I type: xvid_decraw -i river.mp4v -d -f tga -c rgb32 -m
 I got: volhdr.m4v,  frame00000.m4v---frame00453.m4v, dec00000.tga---dec00454.tga
 obviously, only the file name dec00000.tga---dec00453.tga are valid, dec00454.tga should not appear. I checked the files and found that dec00452.tga and dec00453.tga is same in content i.e. dec00453.tga should not exist while  dec00454.tga should be dec00453.tga.
 The reason of this odd phenomenon is: 1)the existence of visual_object_sequence_end_code;   2)dec->low_delay is 0 .
 Because dec->low_delay is 0, the I/P_VOP is taken by function decoder_output() not immediately after it has be decode. In fact, when decoding current frame, the program decoder_output() the ref[0] if exists, and when decoding the nextframe, current frame is decoder_output()ed. So when the last frame is decoded, the front 453 frames have all been decoder_output()ed correctly. But visual_object_sequence_end_code make xvid thinks that there is more frame to decode. When it try to decode a new frame, it fails of cource. But in the logic of the code, a frame should be decoder_output()ed, so the frame immediately before the last frame is decoder_output()ed as it is still in the output buffer. And then, when  "Flush decoder buffers", the last frame is decoder_output()ed.Bug 2:
 It seems frame00000.m4v---frame00453.m4v is good filenames, but when I open frame00453.m4v, I can only see 4 bytes of visual_object_sequence_end_code in it. The frame00000.m4v acturely corresponds to the second frame. The reason of this problem is also "dec->low_delay is 0". Because dec->low_delay is 0, only when a frame is put into the output buffer can the program to 1) put the first decoded frame stored in output buffer into dec00000.tga and 2) put part of input mpeg stream into frame00000.m4v. But as for the "/* Update buffer pointers */" code, the part of mpeg stream corresponding to the first frame isthrown away. ok, that is all.   


More information about the XviD-devel mailing list