AVS Forum banner
Status
Not open for further replies.
1 - 4 of 4 Posts

·
Premium Member
Joined
·
134 Posts
Discussion Starter · #1 ·
Lester Jacobs originally asked a question about the ATI MPEG compressor. My response grew into a mini discourse on MPEG compression in general and I though it'd be better to post it as a new subject. Here goes:

Quote:
Originally posted by Lester Jacobs:
What does the motion estimation search range do? More specifically, in what direction does quality increase? Should I be trying to set the search range to the largest values possible or smallest?
MPEG is an interframe compression algorithm, which means it uses information from adjacent frames to compress the current one. The full spec has 3 different frame types:


I - Intraframe

These are compressed by themselves without needing info from surrounding frames. They're the biggest and can be decompressed without any information from other frames.


P - Predicted

These are compressed using info from previous frames. These are mid-sized. Decompression requires info from previous (temporally) frames.


B - Bi-directional

These are compressed using info from previous AND subsequent (temporally) frames. These are typically the smallest. Decompression requires info from previous and subsequent frames. They're also a lot tougher to do and I don't believe the ATI encoder does them.


Just in case you're wondering: How do you decode a frame that needs info from later frames? The answer is that the encoded frames are sent out of (temporal) sequence. A GOP (Group Of Pictures) always starts with an I frame, then some mix of P and B frames. B frames may only be inserted into the stream after all the P frames it requires are already in the stream.


P & B frames are compressed taking into account the motion of 8x8 blocks of pixels between frames. For each 8x8 block in the previous frame, the encoder looks 'around' it to see where it moved to in the current one. If it finds a good match, the compressor generates a motion vector, which is something like 'the football moved right 15 pixels and up 4 pixels between frame 12034 and 12035'. This is where the motion search range comes in. It's how 'far' the compressor looks to find a good match. As you can imaging, this is VERY compute intensive.


The motion search portion of MPEG compression completely swamps the rest of the algorithm for required compute cycles. I believe the ATI compressor only does pixel-aligned searches but professional hardware (and some real-time software compressors http://www.avsforum.com/ubb/smile.gif ) do sub-pixel aligned searches and the range can be quite large: +/-128 pixels in X and +/-64 pixels in Y, with a subpixel accuracy of 1/16. Then there are some gluttons for punishment that argue that the ENTIRE frame muse be searched. For a 720p frame, a complete 1/16 pixel accurate full frame search is (1280x720x2/64)^2 x 256, or 212 billion 8x8 block compares, or about 27 trillion 8-bit operations per P frame! Thankfully, there are algorithms that allow pairing that down by several orders of magnitude http://www.avsforum.com/ubb/biggrin.gif


Another setting in the ATI control is the GOP structure. Just doing I-frames is a lot less compute intensive than adding P frames since no motion search is performed. However, for the same data rate, the image will look worse.


Basically you can trade off the following with the ATI software. I'm doing this from memory since I don't have a Radeon AIW installed at work - hopefully I didn't forget one:


Resolution: Higher res = better IF you correspondingly increase the bit rate, worse if you don't


Bit Rate: More bits = better but more disk space and a little more CPU time


GOP structure: Adding P frames = better, but a lot more CPU time


Search Range: more is better, but requires a lot more CPU time


There's some options about deinterlacing but I'm not sure how they work under the ATI software. What I do know is you get significantly better compression (as much as 20%) if you compress temporally coherent frames rather than individual fields.


For each CPU, you just have to play around with the settings to get what works best for you. Hopefully the above will get you moving the sliders in the right direction http://www.avsforum.com/ubb/smile.gif



------------------

HTPC: 650MHz PIII All-In-Wonder Radeon & SB Live!

Systems Engineer - Graphics and Video
www.geocities.com/Racing_Talons
 

·
Registered
Joined
·
9,884 Posts
SThieret -


Excellent write up! I hadn't known that ATI didn't do B frames.


- Tom


------------------

Getting started:
HTPC Faq , dScaler , Xcel's Links .
 

·
Registered
Joined
·
435 Posts
SThieret


Thanks a lot! That clears up my questions. I am currently running the ATI MMC video capture on a P4 and seem to be having very good results with capture. Now that I know what the parameters mean I'll run some tests and then publish the results in this forum.


Cheers

Lester


------------------

Lester Jacobs

Website: http://www.digicasa.com

"The shortest answer is doing"

English Proverb. Collected in: George Herbert, Jacula Prudentum (1651).
 

·
Registered
Joined
·
33 Posts
SThieret


Wow excellent reply for all us that are new to this game.


Regards

Paul
 
1 - 4 of 4 Posts
Status
Not open for further replies.
Top