[XviD-devel] Decoding B and P frames

reno reballos rreballos at yahoo.com
Thu Jul 3 03:56:59 CEST 2008


Hi Stephan,

I think you are 75 percent correct with what you said only that the difference in what you envision is that you are writing the encoded frames to disk and during the decoding: reading from disk. but right i did change the algorithm although the concept is still there which is the encoding, writing the compressed frame to disk, reading from disk and decode the compressed frame from disk. and another thing i am not dealing with container format anymore i use right away raw xvid stream to decode a compressed frame

now let me tell you a bit on my encoding and decoding:
1. encode a frame
2. store the encoded frame to buffer(statically allocated based on the raw video resolution e.i 352*288*3 = 304128 encoder output buffer size)
3. pass this encoded frame from buffer to array
4. then pass this entire array of a frame to decoder loop
5. display the decoded frame.
6. go to #1 to encode a new frame

is it really a must to write the encoded xvid frame to disk and read from disk when decoding? yes, i am aware of the discussion just recently that i have to feed the decoder with one complete frame for me to avoid the "fatal: invalid run or index"

and another thing that i notice with the xvid decoder is that, whenever there is 3 bytes left for decoding a frame decoder, does not decode, it keeps looping and looping and does not get out of the loop since there is still 3 bytes left to be decoded, what i do i make it 3 for the minimum left bytes to be decoded so that it will get out of the loop and solves the problem.

another thing why decoder keeps decoding a frame until it finishes, what i mean multiple execution of decoding is done for a single frame to be decoded. why not at one time calling the decoder and the frame is decoded? i just wanna compare this to the encoder where i feed a single frame to the encoder and after that i got a compressed stream of a frame.

thank you... looking forward to hear from you...


regards,
reno


Hi,

reno reballos wrote:
> another thing i want to ask if you know about this with regards to 
> decoding a compressed frame. why decoder could not decode them one time? 
> i mean decoder will have to execute again to decode the remaining 
> compressed frame... what is the reason behind...?

Ah, I think I may know what the problem is: This has been discussed here 
very recently: The decoder needs to be fed with complete frames, which is 
normally taken care of when the stream is embedded into an AVI container 
for example. So in your case, I assume you are dealing with the raw xvid 
stream and read fixed size buffers. I believe the frames inside the stream 
are arbitrarily broken up by the fixed buffer sizes and that is your 
problem. You need to embed "markers" into the stream. I mean, the stream 
already contains MPEG4 markers for frames, but it will be easier if you 
write some markers yourself. For example, you could write the size of the 
next chunk of encoded data. Right now, I assume you do the following:


      


More information about the XviD-devel mailing list