Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
19th October 2009, 17:18 | #1 | Link |
Beginner
Join Date: Jan 2009
Location: Europe
Posts: 125
|
How to: B frames
Hello all,
I know that B frames are the bi-directional frames. It means that the blocks in B-frames are calculated according to I and P frames. Are they just interpolated? If so, is there any feedback loop for wrongly calculated blocks? How? Thanks. |
19th October 2009, 21:42 | #2 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
A frame that was coded as a B-Frame is predicted from it's reference frames. That basically works the same way as a frame that was coded P-Frame is predicted from it's reference. Only that a B-Frame also references to a "future" frame in display order (see here). Anyway, no matter whether a frame was coded as P-Frame or as B-Frame, there will be a difference between the predicted frame and the original frame. That difference is called the "residual" and will be stored in the file. As B-Frames can predict the frame better, the residual will contain less information and thus take less space...
Example: 1) http://img21.imageshack.us/img21/855...predictedp.png 2) http://img42.imageshack.us/img42/639...meresidual.png 3) http://img21.imageshack.us/img21/3425/bframefinal.png
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 19th October 2009 at 23:01. |
20th October 2009, 07:44 | #3 | Link | |
Beginner
Join Date: Jan 2009
Location: Europe
Posts: 125
|
Quote:
Could you please correct me if I misunderstand you? When we go step by step for any B frame, let say our configuration is IBP, 1- B frame is predicted from I frame and the residual image is created, 2- It is predicted from P frame and the residual image is created, Then what happens these residual images? Are they kept in seperately? Or is there only one residual data after prediction? Thanks. |
|
20th October 2009, 15:16 | #4 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 20th October 2009 at 15:27. |
|
20th October 2009, 16:14 | #5 | Link | |
Beginner
Join Date: Jan 2009
Location: Europe
Posts: 125
|
Quote:
I understood everything except the Bold sentence. Did you mean encoder instead of decoder? Or did you mean encoder can create it? |
|
20th October 2009, 16:30 | #6 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
It means that the encoder won't store the "predicted" frame in the file, because the decoder can get the "predicted" frame without additional data ("for free") by prediction from the reference frames(s). This is possible because at the time when a P- or B-Frame is decoded, the decoder already has decoded all reference frames. Both, the encoder and the decoder, will calculate the "predicted" frame. The encoder will calculate the "residual" as the difference between the predicted frame and the original frame. The residual is stored in the file. The decoder, who doesn't know how the original frame looked, first calculates the "predicted" frame (from the reference frames it already knows) and then applies the "residual" to the "predicted" in order to get the "final" frame...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 20th October 2009 at 22:33. |
20th October 2009, 16:35 | #7 | Link | |
Beginner
Join Date: Jan 2009
Location: Europe
Posts: 125
|
Quote:
|
|
20th October 2009, 20:48 | #8 | Link | |
Registered User
Join Date: Feb 2002
Location: San Jose, California
Posts: 4,407
|
Quote:
So the B frame can use a mixture of blocks from the I and P frames but each block only uses the I or P frame for predicted and residual data. Last edited by Asmodian; 20th October 2009 at 20:51. |
|
20th October 2009, 21:19 | #9 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
Doesn't it mix data from several references to efficiently code fades and similar stuff?
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 20th October 2009 at 21:30. |
|
20th October 2009, 22:10 | #10 | Link | |
pencil artist
Join Date: Jan 2006
Location: Slovakia
Posts: 201
|
Quote:
__________________
fevh264 - open-source baseline h.264 encoder |
|
21st October 2009, 07:39 | #11 | Link |
Beginner
Join Date: Jan 2009
Location: Europe
Posts: 125
|
Another question. Let's think only an I and a P frame. Whole P image is divided to macroblocks and all macroblocks are one by one processed to look for maximum dependency from I frame, called motion vector. Let say the complexity of this process is O(n)=x.
For the B frame, all the macroblocks in the B frame are processed one by one. However, all these macroblocks are tried to match any macroblock from I frame or P frame. Therefore, the complexity is approximately 2x, isn't it? |
21st October 2009, 07:42 | #12 | Link | |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
Quote:
|
|
21st October 2009, 07:59 | #13 | Link | |
Beginner
Join Date: Jan 2009
Location: Europe
Posts: 125
|
Quote:
|
|
21st October 2009, 11:24 | #14 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
If you want the details, have a look at: http://git.videolan.org/?p=x264.git;...f18fbc;hb=HEAD
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 21st October 2009 at 11:31. |
|
26th October 2009, 01:03 | #16 | Link |
Registered User
Join Date: Feb 2009
Posts: 20
|
hey lord mulder i would be interested in understanding h264 at a similar level of comprehension to what you have, the problem with complex issues like this is finding the proper resources and finding them in the correct order, you know its important to understand the basic framework of the system in question before you try to start comprehending formulas for example, anyways i would be interested in any resources you recommend
|
|
|