PDA

View Full Version : Comments about the problem of frame loss


jackei
17th March 2005, 11:05
Nice to meet you. I am the author of original DVD2AVI.

Let me make a long story short.

Supposing that a MPEG2 sequence is DISPLAYED as
IBBPBBPBB IBBPBBPBB IBB...
123456789 012345678 901

The order of STORAGE is different from DISPLAY, it will be
IPBBPBB IBBPBBPBB IBB...
1423756 089312645 978

The real decoding process is proceeded as follows:

read I1 => decode I1 => display I1
read P4 => decode P4 from I1 => wait
read B2 => decode B2 from I1 & P4 => display B2
read B3 => decode B2 from I1 & P4 => display B3 & P4
read P7 => decode P7 from P4 => wait
read B5 => decode B5 from P4 & P7 => display B5
read B6 => decode B6 from P4 & P7 => display B6 & P7
read I0 => decode I0 => wait
read B8 => decode B8 from P7 & I0 => display B8
read B9 => decode B9 from P7 & I0 => display B9
display I0
......

DVD2AVI constructs D2V as follows:

read I1 => wait
read P4 => I1
read B2 => I1 B2
read B3 => I1 B2 B3
read P7 => I1 B2 B3 P4
read B5 => I1 B2 B3 P4 B5
read B6 => I1 B2 B3 P4 B5 B6
read I0 => I1 B2 B3 P4 B5 B6 P7

Supposing that we mark START as I1 and END as I0
We will loss B8 B9 because we cannot decode these two frames without I0.

It's a conservative tactic to cope with possible crash due to imcomplete MPEG2.
That's the reason of lossy B frames (B8 B9) at the end.

In addition, supposing that we mark START as I0.
DVD2AVI constructs D2V as follows:

read I0 => wait
read B8 => skip because we cannot decode without P7
read B9 => skip because we cannot decode without P7
read P3 => I0
read B1 => I0 B1
read B2 => I0 B1 B2
read P6 => I0 B1 B2 P3
read B4 => I0 B1 B2 P3 B4
......

That's the reason of lossy B frames (B8 B9) at the start.

However, the PTS (presentation time stamp) records the time of I-frame.
The delay time of AC3/WAV is computed by the PTS between I-frame and audio packets.

DVD2AVI's VFAPI plug-in is designed based on such kind of rules.
It's feasible to synchronize without orphan B frames through VFAPI.

The real problem is...
Do other applications follow this rule when they utilize D2V?

neuron2
17th March 2005, 15:38
Hello jackei. We all thought you had permanently vanished. Welcome back! It's an honor to speak with you. (I had emailed you when starting my derivative of your work.)

The problems you've mentioned have been solved in my derivative of your work (DGIndex), so that frames are not lost. Leading orphaned B frames are replaced by a copy of the first decodable frame (only needed for IBB... GOPS). The trailing frame problem is solved by flushing out the last frame entry when ThreadKill() occurs. Thus, DGIndex delivers all the coded pictures.

Of course, you need the matching Avisynth decoder DLL called DGDecode for serving into your encoding application. The revised VFAPI now just calls into DGDecode, thereby avoiding having to duplicate all the MPEG2 decoding code. The Save AVI functionality was removed, mainly because it didn't use OpenDML extensions.

The reported delay of the audio is now adjusted appropriately according to the GOP structure, so that retaining leading B frames does not result in an erroneous delay.

Trahald
17th March 2005, 19:57
@jackei
Welcome to the forum. As neuron2 stated it is an honor to have you here.

jackei
18th March 2005, 03:24
Dear all,

Thanks for your response. I just graduated from school and start to work. There are lots of things to learn and study. It's a pity that I still don't have much time to improve DVD2AVI. However, my job is highly related to SSE/SSE2 and Hyper-Threading optimization. I think I can also apply such skills to DVD2AVI in my spare time.

I am glad to see that lots of branch applications are developed based on DVD2AVI and lots of people makes them more useful. That's the spirit and merit of GPL license. My next step is aimed at speed improvements and most revised codes can be implanted to other projects based on DVD2AVI.

I am sorry that I didn't reply to emails for a long time. I have abandoned my email address since I received hundreds of virus and spamming letters everyday. Please post here if you have any comments or suggestions. Thank you very much.

Best regards, Jackei

neuron2
25th March 2005, 04:25
Hi jackei,

I just noticed your web site has vanished. I'd be willing to mirror it if you kept all the files. Please advise. Thank you.

If you don't have the files, I'll ask Fred if he kept a mirror.

jackei
25th March 2005, 14:30
It's a tragedy that I forgot to backup my website when transfering to http://arbor.ee.ntu.edu.tw/~jackeikuo (nothing now, still under construction) I lost all my files. I will be appreciate if someone kept the mirror then I can recover the site. Thank you very much.

neuron2
25th March 2005, 14:50
Hi jackei,

We're in luck! Our hero Fred Thompson has kept a mirror. He'll be sending it to me. I'll make sure you get a copy. Please advise if you'd like me to host a mirror, or if we should wait for you to bring it up again.

jackei
26th March 2005, 01:29
Thank you very much. I prefer maintaining the site by myself. However, I have heard about some people complained about the poor download speed before (Actually I can get 2MB/s on Taiwan's backbone network) Is it really too slow when connecting oversea?

neuron2
27th March 2005, 03:03
I've never thought your site was slow. I'll PM you with a link to a zip of your files.

neuron2
27th March 2005, 03:37
jackei, I uploaded it to my ftp server (see my sig). Please advise when you have downloaded it. Thank you.

jackei
27th March 2005, 11:43
:thanks: I have downloaded and recovered my website. Please refer to http://arbor.ee.ntu.edu.tw/~jackeikuo/dvd2avi/

Still one more request. Does anyone keep ONIMUSHA.M2V (http://arbor.ee.ntu.edu.tw/~jackeikuo/dvd2avi/idctref/)? I need this file to trace Reference iDCT's bug and I lost it too.

Nic
27th March 2005, 12:17
Hey Jackei,

Your work is legendary, had my own attempt once at recreating what you started, never had the time to do it right though ( http://nic.dnsalias.com/DVD2AVI_Nic.html )

Hope this is what you want:
http://nic.dnsalias.com/onimusha_op.mpeg

Cheers,
-Nic

jackei
27th March 2005, 13:07
:thanks: I have got the file. Wish everyone keep up with your great works. Cheers!

ppera2
27th March 2005, 15:54
Question to jackei:

Here, on this forum was couple time discussion about Menu point
"Force FILM" in your programm DVD2AVI. Some people said that it's little confusing, because it actually preserves original Mpeg2 video's frame flow (structure).
I'm curious about reasons for such solution. Is it because that 23.976 fps is non-standard?

Trahald
27th March 2005, 16:57
Its probably because when you have hybrid video (which 99% film movies end up being.. even if its just a logo at the beginning) and video is mixed with film, the video section is forced down to film.. At least thats been my take.. i'll allow jackei to answer ;)

jackei
27th March 2005, 17:27
Forced FILM does not completely preserve original MPEG2 video frame structure unless processing on 100% FILM source.

Original video frame number is counted as Coded # and display frame number calculated by Forced FILM algorithm is counted as Playback #. They are still different when watching on impure source.

Preserving original MPEG2 video frame structure on such kind of video results in A/V asynchronous playblack.

ppera2
27th March 2005, 17:39
Yes, it's true about mixed (impure) video. But I think that most NTSC movie (FILM) based DVD has clean 23.976 fps video.
I even like to 'sacrifice' 'artistic' 29.97 fps intros/logos :)
Better without it - no need for jerky and thousand times seen stuff.

By my view on things, by FILM pulldown is forced (by 'inflexible' TV-s). As we may see progressive scanning DVD players and TV-s are used more and more.

neuron2
27th March 2005, 18:52
jackei, is there any chance you could retain the previous URL? Changing it breaks the web site link in the About box of DGIndex. I can change that for future versions, but it would be great if you could keep it the same. I'm sure there are thousands of links to your previous site out there on the internet as well.

jackei
28th March 2005, 10:34
Hello neuron2. I have left school and I don't know whether I can retain the previous url. Anyway, I will try to ask the permission of my advisor.

neuron2
28th March 2005, 16:02
Originally posted by jackei
Hello neuron2. I have left school and I don't know whether I can retain the previous url. Anyway, I will try to ask the permission of my advisor. But the new URL you gave us is:

http://arbor.ee.ntu.edu.tw/~jackeikuo/dvd2avi/

while the old one is:

http://arbor.ee.ntu.edu.tw/~jackei/dvd2avi/

Aren't those both at the school?

jsoto
29th March 2005, 18:55
Just wanted to say thanks...
to jackei and also the to continuators of his work.

Most of DVD2AVI code is beyond my knowledge, but I've been able to integrate it (with some help of jeanl) in VobBlanker. (BTW, I've used DVD2AVIdg110).

Thanks again to all of you
jsoto