CodeBlocks

Saturday, 2 March 2013

X264 - Subme - Comparison

x264 Settings Comparison Part : 2 - Sub Pixel Motion Estimation

Subme define the subpixel estimation complexity. Higher values are better the question is by how much and what is the trade off.

Levels 1-5 control the subpixel refinement strength.
Level 6 enables RDO(Rate–distortion optimization) for mode decision, with level 8 enabling RDO for motion vectors and intra prediction modes. RDO levels are significantly slower than the rest.

Values available:
0 - Full pixel Only.
1 - Quater pixel(QPel) SAD 1 iteration
2 - Quater pixel SAD 2 iteration
3 - Half pixel(Hpel) on MB then QPel
4 - QPel Always
5 - Multi QPel + bi - directional motion estimation
6 - Rate Distortion(RD) on I/P
7 - RD on all frames(Default, Medium)
8 - RDO on I/P frames
9 - RDO on all frames
10 - QP-RD(Requires trellis=2, aq-mode(Adaptive Quantization Mode )>0 )*
11 - Full RD(No early termination)*

*Update found out that Subme10,11 requires other settings, as noted in post previously, will update post with new data.

Futurama SD

 Ok so lets take a look at the performance of sub pixel motion estimation
As you can see from the above graphs subme:0-3 shows significant performance improvement, with 0 and 1 have a noticeable adverse affect on compression, whilst 2-3 having better compression. However and this is important subme lower than 4 does have visible artefacts and I would not recommend any setting lower than 5.

We can also see no difference in subme 9,10,11 these values might require other additional settings for them to take effect. Safe settings are 5-8.

So lets take a look at the screenshots where you can decide for yourself.
Still Frame   

Subme=0
Subme=1


Subme=2

Subme=3

Subme=4

Subme=5

Subme=6


Subme=7(Medium)

 




















Subme=8
Subme=9










Most of the still frames have similar quality, looking closely higher subme retains more detail.

Smaller Motion Detail

Subme=7(Medium)
Subme=0


Subme=1

Subme=2

Subme=3

Subme=4

Subme=5

Subme=6

Subme=8

Subme=9



























 

 

 

It is difficult to see the difference between subme settings and animation type videos, however the higher settings do introduce less artfefacts and the image quality is consistently cleaner



Real Steel SD

 


As you can see the trend is similar to that of the previous one, with Subme 0-3 consitently faster at a loss of compression and 9,10,11 being identical.

 

Still Frame

subme=0
subme=1







subme=2
subme=3






subme=4
subme=5


subme=6


subme=8


subme=9

 

 

 

subme=7(Medium)

 

 

 

 

 

 

 

 

Looking at non animation type videos we can clearly see a visible difference between the subme settings with subme:0,1,2 retaining significantly less finer detail than the higher settings. From subme=7 is becomes a lot harder to notice the loss of fine detail.

Sunday, 17 February 2013


x264 Settings Comparison Part : 2 - Presets - Draft

In this post I want to look at the various built in x264 presets and its performance. Although
Handbrake doesn't allow native support for the x264 presets. To enable them you have to pass the parameters in the console window found at the bottom of the Advanced Tab. Here is a list of the presets and the parameters required, placebo preset omitted.

Make sure that only the values down below are inside the console window.

  1. Very Slow 
    • ref=16: bframes=8: b-adapt=2: direct=auto: me=umh: merange=24: subq=10: rc-lookahead=60: analyse=all: trellis=2 
  2. Slower 
    • ref=8: b-adapt=2: direct=auto: me=umh: subq=9: rc-lookahead=60: analyse=all: trellis=2 
  3. Slow 
    • ref=5: b-adapt=2: direct=auto: me=umh: subq=8: rc-lookahead=50 
  4. Medium
    • Default Settings of handbrake with no parameters in the console window
  5. Fast 
    • ref=2: weightp=1: subq=6: rc-lookahead=30 
  6. Faster 
    • ref=2: mixed-refs=0: weightp=1: subq=4: rc-lookahead=20
  7. Very Fast 
    • ref=1: mixed-refs=0: weightp=1: subq=2: rc-lookahead=10: trellis=0
  8. Super  Fast
    • ref=1: mixed-refs=0: weightp=1: subq=1: rc-lookahead=0: analyse=i8x8,i4x4: trellis=0: mbtree=0
  9. Ultra Fast  
    • ref=1: bframes=0: cabac=0: 8x8dct=0: weightp=0: me=dia: subq=0: rc-lookahead=0: analyse=none: trellis=0: aq-mode=0: no-deblock=1: scenecut=0: mbtree=0

Preset Performance

Compression - Lower is better
Performance - Higher is better  

Futurama SD
Cartoons and animation are some of the easier content to process and compress, the following graph shows how each preset affected the filesize(in Kilobytes) represented by the darker area and performance(average frames per second) shown by the lighter area of the graph.
Click to enlarge

 As you can see the compression does not scale the same as the performance, with the performance scaling at a rather stable rate. And the filesize rises towards the medium preset then down again  to the very fast preset, then spikes very sharply with super fast and ultra fast more than doubling the filesize.

the very slow, slower and slow offered the best compression.Very slow had 6.43% more compression but 57% slower than slower preset.  Of course the file size would not be completely represent the image quality and visual artefacts that can occur with using faster presets.

Percentage difference in speed and compression compared to medium
The above graph shows a comparison of how much speed one loses relative to the compression gained in relation to medium. Huge performance loss with very minimal compression gained when using the slower presets and significant performanced gained with little compression loss up to the very fast preset.

The next section will try and discover if any compression artefacts were introduced with the faster presents, and how closely the other presets represent the original footage.

Image Quality

Open each image in a new tab then using ctrl+mouse Scroll to stretch image bigger.

Still Images

Very Slow
Slower

Slow






Medium








Fast
Faster








Super Fast
Ultra Fast










The average image quality is very consistent which is what you would expect using CRF, only closer inspection one can see that that there are some if very few compression artefacts around benders left arm on the faster presets, but not much.

Smaller Motion Detail

Very Slow
Slower






Slow

Medium








Fast
Faster








Super Fast
Ultra Fast










Again some noticeable artefacts are introduced with the faster presets, with medium retaining enough detail to make it difficult to distinguish it from the slower presets.

Real Steel SD 
When we take a look at the compression and performance of a standard definition file, the trends are similar to that of Futurama. With the slower presets having smaller file sizes but significantly slower, with super fast and ultra fast significantly larger. 

Click to enlarge

Percentage difference in speed and compression compared to medium
Same trend with the comparison as seen with Futurama, with the exception that a lot more speed is gained at the faster settings.

Image Quality

Open each image in a new tab then using ctrl+mouse Scroll to stretch image bigger.

Still Images

Original
Very Slow







Slower
Slow






Medium
Fast







Faster
Very Fast







Super Fast
Ultra Fast







Telling the difference between the still images are difficult, with the slower presets retaining some of the finer details and the faster presets blending of detail, however not very noticable.

 Smaller Motion Detail

Original
Very Slow










Slower
Slow

Medium
Fast
Faster
Very Fast

Super Fast
Ultra Fast