Log in

View Full Version : x264 "Macroblock Tree Ratecontrol" testing (committed)


Pages : [1] 2 3 4 5 6 7 8 9 10

Dark Shikari
3rd August 2009, 01:17
http://i32.tinypic.com/2ev802e.jpg (http://i29.tinypic.com/34fiq9w.png)

Warning: (not really) Highly Experimental

It's done and committed! Grab the latest x264 from x264.nl!

Patch RC1 (http://pastebin.com/f87abd3f)
Download RC1 (Windows, old) (http://mirror05.x264.nl/Dark/x264_mbtree_rc1.exe)
Download RC1 (Windows debug build, old) (http://mirror05.x264.nl/Dark/x264_mbtree_rc1_debug.exe)
Patch v0.13 (http://pastebin.com/f6622f24d)
Download 0.13 (Windows) (http://mirror05.x264.nl/Dark/x264_mbtree13.exe)
Download 0.13 (Windows debug build) (http://mirror05.x264.nl/Dark/x264_mbtree13_debug.exe)
Patch v0.11 (http://pastebin.com/fe144569)
Download 0.11 (Windows, old) (http://mirror05.x264.nl/Dark/x264_mbtree11.exe)
Download 0.11 (Windows debug build, old) (http://mirror05.x264.nl/Dark/x264_mbtree11_debug.exe)
Patch v0.09 (old) (http://pastebin.com/f364aedf1)
Download 0.09 (Windows, old) (http://mirror05.x264.nl/Dark/x264_mbtree.exe)
Download 0.09 (Windows debug build, old) (http://mirror05.x264.nl/Dark/x264_mbtree_debug.exe)

Updates:

Changes in RC1:

1. Statsfile format changed; now takes only 2 bytes per macroblock. Varying-endianness now supported. Error handling improved.

2. More commandline validation fixes.

3. Clip propagation factors just in case they overflow.

4. Change default lookahead to 40 to save some memory.

5. It's now called --rc-lookahead, not --lookahead, at Akupenguin's request.

6. Various other things, just read the damn commit message in the patch.

Changes in 0.13:

1. Bugs fixed in the VBV patch. It's still separate, as per below.

2. B-adapt 1 now supported.

3. All B-adapt code is now merged into MB-tree code instead of duplicated. B-adapt 1 should be slightly better than it was before (even without MB-tree). In general, all three B-adapt modes now use the same basic framework.

4. MB-tree strength is now adjustable through qcomp. Raising qcomp lowers MB-tree strength; it works the same way that qcomp did before MB-tree, with qcomp 1 meaning constant frame quantizer. This lets you experiment a bit more; there's some possibility that the default qcomp 0.6 is not the psy-optimal value--it might be higher.

5. New --no-psy option, which disables all psy optimizations in x264 that don't improve PSNR or SSIM. This includes psy-RD/trellis, but also the recently-added chroma lambda offset and the magical "num_frames = j" line that causes MB-tree to pretend that non-scenecut I-frames don't exist.

6. "Fast" preset is now slower, "faster" preset added to cover the gap.

7. MB-tree is now default on presets "fast" and higher. Lookahead values are smaller for faster presets.

Changes in 0.11:

1. VBV now supported. Includes a separate VBV patch which fixes most VBV issues that MB-tree has; this will be committed separately, as it doesn't require MB-tree. It should also improve 1-pass VBV (especially CBR) performance on clips with lots of static content, e.g. anime, CGI.

Do note that CBR doesn't benefit much from MB-tree though, especially with small buffer sizes.

2. Lots of trivial parameter-handling fixes, e.g. lookahead automatically disabled on second pass.

FAQ:

How do I use it?

It's on by default. --no-mbtree turns it off.

What doesn't it work with yet?

--b-pyramid

How can I tweak it?

--lookahead; default is 50, higher takes more memory and is slower, but should give better results. It's probably overkill for most sources. If you get crashes immediately after the lookahead fills up, you probably ran out of memory (max is 2GB for x264 on 32-bit Windows).

--qcomp; works the same as it did before with actual qcomp, higher numbers lower MB-tree strength.

How much does it cost, speed-wise?

A bit. Not too much though. Speed cost is linearly proportional to --lookahead.

How can I help test it?

Use it.

Make sure you don't get any odd errors or warnings, such as asserts failing, crashes, etc. Try various combinations of the relevant settings (b-adapt, bframes, mbtree, lookahead, pass 1/2, crf, keyint, scenecut) that I might not have thought of.

Try it on various sources; see if you can find places where, with --tune ssim, at the same bitrate as without mbtree, it gives worse SSIM (or, equally, places where Global PSNR goes down with tune psnr).

Make sure it doesn't fall apart visually either.

Also, note that CRF is redefined again by this patch--I set it so that it kept the same bitrate on Blackpearl as before, but it may vary for different videos.

What does it actually do?

It tracks the propagation of information from future blocks to past blocks across motion vectors. It could be described as localizing qcomp to act on individual blocks instead of whole scenes. Thus instead of lowering quality in high-complexity scenes (like x264 currently does), it'll only lower quality on the complex part of the scene, while for example a static background will remain high-quality. It also has many other more subtle effects, some potentially negative, most probably not.

This helps at all bitrates, but can even help at phenomenally low bitrates where the video would otherwise fall apart completely, like in this 67kbps anime clip (http://mirror05.x264.nl/Dark/Flash/lowbitrateanime.html).

Should I go around distributing this patch and getting everyone I know to use it for their everyday encodes?

No. The commandline options here may change in the future, as may the statsfile format and various other aspects of the patch, so it's not a good idea to make this patch something that gets put in ordinary x264 builds. Furthermore, I might have broken something unrelated to mbtree.

Why does it give different output even without mbtree?

B-adapt (all modes) was slightly modified to work better with mbtree, so the frametype decisions may change somewhat.

What improvement does it give?

I've gotten up to a 70% SSIM increase.

You're joking, right?

No.

Seriously? How the hell can you get a 70% quality increase?

Magic.

OK, you're just making this u--wait a minute, what's this new statsfile, and why is it using up all my hard disk space?

Oh, that? (http://i26.tinypic.com/2s6odxt.jpg) Kyahahahahahaha. (http://mirror05.x264.nl/Dark/ahaha.wav)

Snowknight26
3rd August 2009, 01:56
You know you want to provide a 64-bit Windows binary. :D
Any reason why the exe is so tiny?

I have to say, clever picture..

Dark Shikari
3rd August 2009, 01:57
You know you want to provide a 64-bit Windows binary. :Dtry this (http://imk.cx/junk/x264_mbtree.7z)Any reason why the exe is so tiny?kkrunchy (http://www.farbrausch.de/~fg/kkrunchy/)I have to say, clever picture..Kuukunen made that.

Audionut
3rd August 2009, 01:59
Magic.

Black?

Snowknight26
3rd August 2009, 02:10
kkrunchy (http://www.farbrausch.de/~fg/kkrunchy/)
Farbrausch, should have known. I dare say I'm more impressed by that than the mbtree. :p

Funny how the QP for the mbtree version is twofold that of a normal build:


C:\temp\Encoding\test>cd ..

C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264_mbtree_x64 --crf 19 --mbt
ree --bframes 4 --b-adapt 2 --ref 4 --b-pyramid --direct auto --deblock -3:-3 -
-subme 10 --trellis 2 --analyse all --no-dct-decimate --me umh --ssim --fps 2400
0/1001 --output "test/test.mbtree.mkv" - 480x320
x264 [info]: 480x320 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 2.1
test/test.avs: 480x320, 10000000/417083 fps, 481 frames
x264 [info]: slice I:240 Avg QP:20.82 size: 79
x264 [info]: slice P:241 Avg QP:24.08 size: 79
x264 [info]: consecutive B-frames: 100.0% 0.0% 0.0% 0.0% 0.0%
x264 [info]: mb I I16..4: 100.0% 0.0% 0.0%
x264 [info]: mb P I16..4: 90.4% 0.0% 0.0% P16..4: 9.2% 0.0% 0.0% 0.0% 0
.0% skip: 0.4%
x264 [info]: 8x8 transform intra:0.0% inter:-1.$%
x264 [info]: coded y,uvDC,uvAC intra:0.0% 0.1% 0.0% inter:0.0% 0.0% 0.0%
x264 [info]: ref P L0 0.0% 100.0%
x264 [info]: SSIM Mean Y:1.0000000
x264 [info]: kb/s:15.2

encoded 481 frames, 151.83 fps, 16.87 kb/s

C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264.x64 --crf 19 --bframes 4
--b-adapt 2 --ref 4 --b-pyramid --direct auto --deblock -3:-3 --subme 10 --trel
lis 2 --analyse all --no-dct-decimate --me umh --ssim --fps 24000/1001 --output
"test/test.mkv" - 480x320
x264 [info]: 480x320 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 2.1
test/test.avs: 480x320, 10000000/417083 fps, 481 frames
x264 [info]: slice I:240 Avg QP:10.04 size: 83
x264 [info]: slice P:241 Avg QP:10.01 size: 91
x264 [info]: consecutive B-frames: 100.0% 0.0% 0.0% 0.0% 0.0%
x264 [info]: mb I I16..4: 100.0% 0.0% 0.0%
x264 [info]: mb P I16..4: 90.4% 0.0% 0.0% P16..4: 9.2% 0.0% 0.0% 0.0% 0
.0% skip: 0.4%
x264 [info]: 8x8 transform intra:0.0% inter:-1.$%
x264 [info]: coded y,uvDC,uvAC intra:0.0% 0.1% 0.0% inter:0.0% 0.0% 0.0%
x264 [info]: ref P L0 0.0% 100.0%
x264 [info]: SSIM Mean Y:1.0000000
x264 [info]: kb/s:16.7

encoded 481 frames, 162.39 fps, 18.08 kb/s

C:\temp\Encoding>pause
Press any key to continue . . .

And what did you mean by doesn't work with --b-pyramid? Different outputs seems to show that it does something differently.

Dark Shikari
3rd August 2009, 02:11
Black?Of course. (http://i31.tinypic.com/2qd4nif.jpg)

IgorC
3rd August 2009, 02:11
--lookahead; default is 50
Is lookahead measured in frames? 50 frames?

Great patch. Untill now I can say I get +4% of bitrate improvement for the same OPSNR and +20% for the same SSIM (foreman test sequence).

Dark Shikari
3rd August 2009, 02:12
Farbrausch, should have known. I dare say I'm more impressed by that than the mbtree. :p

Funny how the QP for the mbtree version is twofold that of a normal build:


C:\temp\Encoding\test>cd ..

C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264_mbtree_x64 --crf 19 --mbt
ree --bframes 4 --b-adapt 2 --ref 4 --b-pyramid --direct auto --deblock -3:-3 -
-subme 10 --trellis 2 --analyse all --no-dct-decimate --me umh --ssim --fps 2400
0/1001 --output "test/test.mbtree.mkv" - 480x320
x264 [info]: 480x320 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 2.1
test/test.avs: 480x320, 10000000/417083 fps, 481 frames
x264 [info]: slice I:240 Avg QP:20.82 size: 79
x264 [info]: slice P:241 Avg QP:24.08 size: 79
x264 [info]: consecutive B-frames: 100.0% 0.0% 0.0% 0.0% 0.0%
x264 [info]: mb I I16..4: 100.0% 0.0% 0.0%
x264 [info]: mb P I16..4: 90.4% 0.0% 0.0% P16..4: 9.2% 0.0% 0.0% 0.0% 0
.0% skip: 0.4%
x264 [info]: 8x8 transform intra:0.0% inter:-1.$%
x264 [info]: coded y,uvDC,uvAC intra:0.0% 0.1% 0.0% inter:0.0% 0.0% 0.0%
x264 [info]: ref P L0 0.0% 100.0%
x264 [info]: SSIM Mean Y:1.0000000
x264 [info]: kb/s:15.2

encoded 481 frames, 151.83 fps, 16.87 kb/s

C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264.x64 --crf 19 --bframes 4
--b-adapt 2 --ref 4 --b-pyramid --direct auto --deblock -3:-3 --subme 10 --trel
lis 2 --analyse all --no-dct-decimate --me umh --ssim --fps 24000/1001 --output
"test/test.mkv" - 480x320
x264 [info]: 480x320 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 2.1
test/test.avs: 480x320, 10000000/417083 fps, 481 frames
x264 [info]: slice I:240 Avg QP:10.04 size: 83
x264 [info]: slice P:241 Avg QP:10.01 size: 91
x264 [info]: consecutive B-frames: 100.0% 0.0% 0.0% 0.0% 0.0%
x264 [info]: mb I I16..4: 100.0% 0.0% 0.0%
x264 [info]: mb P I16..4: 90.4% 0.0% 0.0% P16..4: 9.2% 0.0% 0.0% 0.0% 0
.0% skip: 0.4%
x264 [info]: 8x8 transform intra:0.0% inter:-1.$%
x264 [info]: coded y,uvDC,uvAC intra:0.0% 0.1% 0.0% inter:0.0% 0.0% 0.0%
x264 [info]: ref P L0 0.0% 100.0%
x264 [info]: SSIM Mean Y:1.0000000
x264 [info]: kb/s:16.7

encoded 481 frames, 162.39 fps, 18.08 kb/s

C:\temp\Encoding>pause
Press any key to continue . . .It looks like your source failed, because your input was all black ;)

Is lookahead measured in frames? 50 frames?Yes.

Snowknight26
3rd August 2009, 02:14
It looks like your source failed, because your input was all black ;)

It's not actually. (http://stfcc.org/misc/test.mp4)

Crash after 100 frames:

C:\temp\Encoding\test>cd ..

C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264_mbtree_x64 --crf 19 --mbt
ree --lookahead 500 --bframes 16 --b-adapt 2 --ref 4 --b-pyramid --direct auto
--deblock -3:-3 --subme 10 --trellis 2 --analyse all --no-dct-decimate --me umh
--ssim --fps 24000/1001 --output "test/test.mbtree.mkv" - 1920x816
x264 [info]: 1920x816 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 4.0
test/test.avs: 1920x816, 10000000/417083 fps, 1378 frames
Output error: wrote only 1785423 of 2350080 bytes

C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264.x64 --crf 19 --bframes 16
--b-adapt 2 --ref 4 --b-pyramid --direct auto --deblock -3:-3 --subme 10 --tre
llis 2 --analyse all --no-dct-decimate --me umh --ssim --fps 24000/1001 --output
"test/test.mkv" - 1920x816
x264 [info]: 1920x816 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 4.0
test/test.avs: 1920x816, 10000000/417083 fps, 1378 frames
250 frames: 2.03 fps, 7743.86 kb/s
Other one is still going.. samples a bit big so hopefully someone can provide a debug build before I resort to uploading it.

Dark Shikari
3rd August 2009, 02:33
All crashes that I've seen so far that occurred with very large --lookahead values traced back perfectly to x264_malloc, so you should check with gdb before reporting such issues as bugs.

Snowknight26
3rd August 2009, 02:50
I have to say, the bitrate difference can be enormous sometimes:
C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264_mbtree_x64 --crf 19 --mbt
ree --bframes 0 --b-adapt 0 --ref 0 --direct spatial --deblock -3:-3 --subme 1 -
-trellis 0 --analyse all --me umh --ssim --fps 24000/1001 --output "test/test.mb
tree.mkv" - 1920x816
x264 [info]: 1920x816 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 4.0
test/test.avs: 1920x816, 10000000/417083 fps, 1378 frames
x264 [info]: slice I:20 Avg QP:14.02 size:131728
x264 [info]: slice P:1358 Avg QP:15.01 size: 37773
x264 [info]: mb I I16..4: 24.8% 47.2% 28.0%
x264 [info]: mb P I16..4: 22.4% 18.9% 1.6% P16..4: 35.4% 8.6% 1.8% 0.1% 0
.0% skip:11.2%
x264 [info]: 8x8 transform intra:44.2% inter:41.4%
x264 [info]: coded y,uvDC,uvAC intra:35.8% 87.5% 74.4% inter:13.7% 58.9% 19.6%
x264 [info]: SSIM Mean Y:0.9929551
x264 [info]: kb/s:7506.7

encoded 1378 frames, 30.29 fps, 7506.94 kb/s

C:\temp\Encoding>avs2yuv -raw test/test.avs - | x264.x64 --crf 19 --bframes 0
--b-adapt 0 --ref 0 --direct spatial --deblock -3:-3 --subme 1 --trellis 0 --ana
lyse all --me umh --ssim --fps 24000/1001 --output "test/test.mkv" - 1920x816
x264 [info]: 1920x816 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 4.0
test/test.avs: 1920x816, 10000000/417083 fps, 1378 frames
x264 [info]: slice I:21 Avg QP:10.66 size:187241
x264 [info]: slice P:1357 Avg QP:11.45 size: 73091
x264 [info]: mb I I16..4: 23.5% 37.2% 39.3%
x264 [info]: mb P I16..4: 20.8% 17.8% 5.0% P16..4: 32.7% 10.9% 4.0% 0.4% 0
.1% skip: 8.4%
x264 [info]: 8x8 transform intra:40.7% inter:31.8%
x264 [info]: coded y,uvDC,uvAC intra:51.6% 88.9% 81.5% inter:36.5% 73.8% 41.9%
x264 [info]: SSIM Mean Y:0.9953622
x264 [info]: kb/s:14353.1

encoded 1378 frames, 26.12 fps, 14353.34 kb/s

Audionut
3rd August 2009, 02:58
Well you're shooting for crf 19 and getting AVG QP's of 10.

Dark Shikari
3rd August 2009, 03:00
I have to say, the bitrate difference can be enormous sometimes:Or... maybe it's a bug?

Upload a sample of the output.

Snowknight26
3rd August 2009, 03:18
http://stfcc.org/misc/test.mbtree.10mb.mkv
http://stfcc.org/misc/test.10mb.mkv

Dark Shikari
3rd August 2009, 03:39
http://stfcc.org/misc/test.mbtree.10mb.mkv
http://stfcc.org/misc/test.10mb.mkvNope, it seems like MB-tree is in the right here; x264 was lowering the quantizers way too much before for its own good.

Snowknight26
3rd August 2009, 04:15
All crashes that I've seen so far that occurred with very large --lookahead values traced back perfectly to x264_malloc, so you should check with gdb before reporting such issues as bugs.

Couldn't get 64-bit x264+avs2yuv working with gdb but nevertheless, seems you were right:


C:\temp\Encoding\test>cd ..

C:\temp\Encoding>gdb --args x264_mbtree_debug --crf 19 --mbtree --lookahead 500
--bframes 16 --b-adapt 2 --ref 4 --b-pyramid --direct auto --deblock -3:-3 --su
bme 10 --trellis 2 --analyse all --no-dct-decimate --me umh --ssim --fps 24000/1
001 --output "test/test.mbtree.mkv" "test/test.avs"
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-pc-mingw32"...
(gdb) run
Starting program: C:\temp\Encoding/x264_mbtree_debug.exe --crf 19 --mbtree --loo
kahead 500 --bframes 16 --b-adapt 2 --ref 4 --b-pyramid --direct auto --deblock
-3:-3 --subme 10 --trellis 2 --analyse all --no-dct-decimate --me umh --ssim --f
ps 24000/1001 --output test/test.mbtree.mkv test/test.avs
[New thread 4380.0x10c0]
Error: dll starting at 0x76f10000 not found.
Error: dll starting at 0x768d0000 not found.
Error: dll starting at 0x76f10000 not found.
Error: dll starting at 0x76e10000 not found.
warning: DllMain: hModule=0x10000000, ulReason=1, lpReserved=0x00000000, gRefCnt
= 0

warning: DllGetClassObject() CLSID: CAVIFileSynth

warning: 00943450->CAVIFileSynth::CAVIFileSynth()

warning: 00943450->CAVIFileSynth::AddRef() gRefCnt=1, m_refs=1

warning: 00943450->CAVIFileSynth::QueryInterface() {00000001-0000-0000-c000-0000
00000046} (IClassFactory)

warning: 00943450->CAVIFileSynth::AddRef() gRefCnt=2, m_refs=2

warning: 00943450->CAVIFileSynth::Release() gRefCnt=1, m_refs=1

warning: DllGetClassObject() result=0x0, object=00943458

warning: 00943450->CAVIFileSynth::CreateInstance()

warning: 009434A8->CAVIFileSynth::CAVIFileSynth()

warning: 009434A8->CAVIFileSynth::AddRef() gRefCnt=2, m_refs=1

warning: 009434A8->CAVIFileSynth::QueryInterface() {00000000-0000-0000-c000-0000
00000046} (IUnknown)

warning: 009434A8->CAVIFileSynth::AddRef() gRefCnt=3, m_refs=2

warning: 009434A8->CAVIFileSynth::Release() gRefCnt=2, m_refs=1

warning: 00943450->CAVIFileSynth::CreateInstance() result=0x0, object=009434A8

warning: 009434A8->CAVIFileSynth::AddRef() gRefCnt=3, m_refs=2

warning: 009434A8->CAVIFileSynth::Release() gRefCnt=2, m_refs=1

warning: 00943450->CAVIFileSynth::Release() gRefCnt=1, m_refs=0

warning: 00943450->CAVIFileSynth::~CAVIFileSynth(), gRefCnt = 1

warning: 009434A8->CAVIFileSynth::QueryInterface() {00000000-0000-0000-c000-0000
00000046} (IUnknown)

warning: 009434A8->CAVIFileSynth::AddRef() gRefCnt=2, m_refs=2

warning: 009434A8->CAVIFileSynth::Release() gRefCnt=1, m_refs=1

warning: 009434A8->CAVIFileSynth::QueryInterface() {00020025-0000-0000-c000-0000
00000046} (unsupported!)

warning: 009434A8->CAVIFileSynth::QueryInterface() {0000010b-0000-0000-c000-0000
00000046} (IPersistFile)

warning: 009434A8->CAVIFileSynth::AddRef() gRefCnt=2, m_refs=2

warning: 009434A8->CAVIFileSynth::QueryInterface() {00020020-0000-0000-c000-0000
00000046} (IAVIFile)

warning: 009434A8->CAVIFileSynth::AddRef() gRefCnt=3, m_refs=3

warning: 009434A8->CAVIFileSynth::Load("test/test.avs", 0x0)

warning: 009434A8->CAVIFileSynth::Release() gRefCnt=2, m_refs=2

warning: 009434A8->CAVIFileSynth::Release() gRefCnt=1, m_refs=1

warning: 009434A8->CAVIFileSynth::GetStream(*, 73646976(vids), 0)

[New thread 4380.0xd1c]
warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

[New thread 4380.0x13c8]
[New thread 4380.0xb7c]
warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

[New thread 4380.0x13f8]
[New thread 4380.0x10bc]
[New thread 4380.0x8b4]
warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

[New thread 4380.0xb24]
[New thread 4380.0x80]
warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

[New thread 4380.0x644]
warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 1

[...]


warning: DllMain: hModule=0x10000000, ulReason=3, lpReserved=0x00000000, gRefCnt
= 2

[New thread 4380.0xfb8]35.18 fps, 0.00 kb/s, eta 0:00:36
warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 2

warning: DllMain: hModule=0x10000000, ulReason=3, lpReserved=0x00000000, gRefCnt
= 2

[New thread 4380.0xac8]35.08 fps, 0.00 kb/s, eta 0:00:36
warning: DllMain: hModule=0x10000000, ulReason=2, lpReserved=0x00000000, gRefCnt
= 2

warning: DllMain: hModule=0x10000000, ulReason=3, lpReserved=0x00000000, gRefCnt
= 2

[New thread 4380.0xed0]34.99 fps, 0.00 kb/s, eta 0:00:36

Program received signal SIGSEGV, Segmentation fault.
x264_malloc (i_size=6983680) at common/common.c:729
729 common/common.c: No such file or directory.
in common/common.c
(gdb) bt
#0 x264_malloc (i_size=6983680) at common/common.c:729
#1 0x00424229 in x264_frame_new (h=<incomplete type>) at common/frame.c:69
#2 0x00427bdb in x264_frame_pop_unused (h=<incomplete type>)
at common/frame.c:959
#3 0x0040de2c in x264_encoder_encode (h=<incomplete type>, pp_nal=0x28fa78,
pi_nal=0x28fa7c, pic_in=0x28fc60, pic_out=0x28fa80)
at encoder/encoder.c:1454
#4 0x00402fdd in Encode_frame (h=0x70cb2a0, hout=0x942e28, pic=0x28fc60)
at x264.c:1043
#5 0x00403335 in Encode (param=0x28fd00, opt=0x28fce0) at x264.c:1127
#6 0x004013c0 in main (argc=32, argv=0x9431a8) at x264.c:113
(gdb)

imk
3rd August 2009, 04:59
Here's my quick tests:

http://pastie.org/569295
http://imk.cx/temp/dead_space_mbtree0.mkv (13,94 MB)
http://imk.cx/temp/dead_space_mbtree1.mkv (13,95 MB)

SSIM
0.9728932 -> 0.9740763

Here's two comparison shots:

http://imk.cx/temppics/t_00000060_0.png.png (http://imk.cx/temppics/00000060_0.png) http://imk.cx/temppics/t_00000060_1.png.png (http://imk.cx/temppics/00000060_1.png)

Dark_Shikari let me know that single frame comparisons are useless for ratecontrol comparisons, but with the above shot, you can see that it brings out some more detail in the darker areas.

thewebchat
3rd August 2009, 05:48
Honestly, the only difference I see in that screenshot is that the position of the blocking artifacts shifted.

Audionut
3rd August 2009, 07:27
Pass 2 is slower with --b-adapt 2 :confused:

benwaggoner
3rd August 2009, 07:30
What does it actually do?[/b]

It tracks the propagation of information from future blocks to past blocks across motion vectors. It could be described as localizing qcomp to act on individual blocks instead of whole scenes. Thus instead of lowering quality in high-complexity scenes (like x264 currently does), it'll only lower quality on the complex part of the scene, while for example a static background will remain high-quality. It also has many other more subtle effects, some potentially negative, most probably not.
Cool. When you had me check out that Touhou clip a while ago, I figured something like this would be what was required. Have you tried it with this build?

The only decent looking encode of that I ever got was using PEP and ROI encoding, specifying a max QP for the static parts of the image so that the crazy motion parts wouldn't starve the background of bits and drive up their QP so high. Once encoded at a decent QP on the I-frame, they would be pretty much skip blocks the rest of the GOP and so didn't take up material bandwidth anyway.

Cool to see something that could achieve similar results without manual ROI and with moving images.

Dark Shikari
3rd August 2009, 07:32
Cool. When you had me check out that Touhou clip a while ago, I figured something like this would be what was required. Have you tried it with this build?That's what I got the 70% on. I got ~50% with some other clips though, like anime and Akiyo.
The only decent looking encode of that I ever got was using PEP and ROI encoding, specifying a max QP for the static parts of the image so that the crazy motion parts wouldn't starve the background of bits and drive up their QP so high. Once encoded at a decent QP on the I-frame, they would be pretty much skip blocks the rest of the GOP and so didn't take up material bandwidth anyway.

Cool to see something that could achieve similar results without manual ROI and with moving images.It does even better than that, because, for example, when a bullet passes a background area, it will instantly restore the quality of said background area once the bullet leaves.

It naturally does a whole lot of these sort of things in addition to the obvious effect of locally optimal qcomp.

Zachs
3rd August 2009, 07:51
Would this help in scenes with foreign dialogue subtitles on moving background too?

That's one area I can see macroblocking issues with the current version of x264 on my encodes.

TheImperial2004
3rd August 2009, 07:56
Sorry for my noobness :)

I use AviDemux so I need to compile libx264 DLL with this patch ... Can somebody point me to the right direction ?

Edit : Found It !

Dark Shikari
3rd August 2009, 07:57
Would this help in scenes with foreign dialogue subtitles on moving background too?

That's one area I can see macroblocking issues with the current version of x264 on my encodes.Your best bet there is to just lower AQ strength, but this might help there as well; I haven't tried it though.

Or do it right and use softsubs ;)

Zachs
3rd August 2009, 08:02
Or do it right and use softsubs

It's some foreign dialogue hardsubbed in the source (BDRip).

And, it's only for a few seconds of the movie.

Is this patch going to be incompatible with vbv-buf max / b-pyramid etc. or is it only temporarily as they get implemented?

Audionut
3rd August 2009, 08:09
Doesn't seem to increase ssim on this test.

source = ep 5 of band of brothers. Blu-ray source.

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune ssim --pass 1 -B 6000
--level 4.1 -m 10 --mbtree --lookahead 240 --keyint 240 --min-keyint 24 --ssim --psnr --fps 24000/1001 -o e:\mbtree_ssim.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile Main, level 4.1
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames

x264 [info]: slice I:147 Avg QP:24.78 size: 76029 PSNR Mean Y:39.09 U:50.35 V:50.53 Avg:40.68 Global:40.03
x264 [info]: slice P:2508 Avg QP:27.14 size: 41571 PSNR Mean Y:36.36 U:49.38 V:49.50 Avg:38.01 Global:37.59
x264 [info]: slice B:3071 Avg QP:29.23 size: 19866 PSNR Mean Y:35.66 U:49.43 V:49.60 Avg:37.32 Global:36.91
x264 [info]: consecutive B-frames: 10.4% 37.2% 33.9% 18.4%
x264 [info]: mb I I16..4: 45.1% 0.0% 54.9%
x264 [info]: mb P I16..4: 32.0% 0.0% 0.0% P16..4: 50.9% 0.0% 0.0% 0.0% 0.0% skip:17.1%
x264 [info]: mb B I16..4: 7.2% 0.0% 0.0% B16..8: 33.4% 0.0% 0.0% direct:19.3% skip:40.2% L0:28.4% L1:40.2% BI:31.4%
x264 [info]: final ratefactor: 22.88
x264 [info]: direct mvs spatial:99.9% temporal:0.1%
x264 [info]: coded y,uvDC,uvAC intra:62.8% 12.0% 0.5% inter:36.8% 2.1% 0.0%
x264 [info]: SSIM Mean Y:0.9443182
x264 [info]: PSNR Mean Y:36.054 U:49.430 V:49.581 Avg:37.709 Global:37.258 kb/s:
5910.50

encoded 5726 frames, 19.40 fps, 5910.66 kb/s

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune ssim --pass 2 -B 6000
--level 4.1 -m 10 --mbtree --lookahead 240 --keyint 240 --min-keyint 24 --ssim --psnr --fps 24000/1001 -o e:\mbtree_ssim.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames
x264 [info]: profile High, level 4.1

x264 [info]: slice I:147 Avg QP:25.90 size: 68481 PSNR Mean Y:39.34 U:50.24 V:50.31 Avg:40.92 Global:40.44
x264 [info]: slice P:2508 Avg QP:27.95 size: 42077 PSNR Mean Y:37.73 U:49.76 V:49.87 Avg:39.35 Global:39.09
x264 [info]: slice B:3071 Avg QP:29.86 size: 20635 PSNR Mean Y:36.61 U:49.74 V:49.88 Avg:38.26 Global:38.01
x264 [info]: consecutive B-frames: 10.4% 37.2% 33.9% 18.4%
x264 [info]: mb I I16..4: 27.3% 62.8% 9.9%
x264 [info]: mb P I16..4: 9.8% 24.8% 4.6% P16..4: 27.2% 11.8% 6.1% 0.6% 0.1% skip:15.0%
x264 [info]: mb B I16..4: 2.2% 6.0% 1.8% B16..8: 32.2% 3.4% 3.0% direct: 9.3% skip:42.1% L0:36.5% L1:39.4% BI:24.0%
x264 [info]: 8x8 transform intra:62.5% inter:66.9%
x264 [info]: direct mvs spatial:99.6% temporal:0.4%
x264 [info]: coded y,uvDC,uvAC intra:66.6% 15.2% 0.3% inter:33.7% 1.7% 0.0%
x264 [info]: ref P L0 76.7% 9.8% 5.5% 2.7% 2.0% 1.4% 1.1% 0.8%
x264 [info]: ref B L0 86.1% 6.2% 3.1% 1.7% 1.2% 0.9% 0.7%
x264 [info]: SSIM Mean Y:0.9542913
x264 [info]: PSNR Mean Y:37.169 U:49.757 V:49.887 Avg:38.804 Global:38.500 kb/s:
5994.88

encoded 5726 frames, 5.04 fps, 5995.05 kb/s

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune ssim --pass 1 -B 6000
--level 4.1 -m 10 --keyint 240 --min-keyint 24 --ssim --psnr --fps 24000/1001 -o e:\mbtree_ssim1.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile Main, level 4.1
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames

x264 [info]: slice I:147 Avg QP:24.65 size: 76321 PSNR Mean Y:39.08 U:50.49 V:50.66 Avg:40.68 Global:40.13
x264 [info]: slice P:2541 Avg QP:26.56 size: 42741 PSNR Mean Y:36.76 U:49.58 V:49.68 Avg:38.40 Global:37.69
x264 [info]: slice B:3038 Avg QP:29.29 size: 18494 PSNR Mean Y:35.55 U:49.47 V:49.60 Avg:37.22 Global:36.56
x264 [info]: consecutive B-frames: 10.9% 38.9% 31.3% 18.8%
x264 [info]: mb I I16..4: 42.4% 0.0% 57.6%
x264 [info]: mb P I16..4: 32.7% 0.0% 0.0% P16..4: 51.4% 0.0% 0.0% 0.0% 0.0% skip:15.9%
x264 [info]: mb B I16..4: 8.1% 0.0% 0.0% B16..8: 33.2% 0.0% 0.0% direct:19.3% skip:39.4% L0:28.1% L1:40.6% BI:31.3%
x264 [info]: final ratefactor: 21.04
x264 [info]: direct mvs spatial:99.9% temporal:0.1%
x264 [info]: coded y,uvDC,uvAC intra:65.6% 12.1% 0.4% inter:36.5% 2.0% 0.0%
x264 [info]: SSIM Mean Y:0.9453912
x264 [info]: PSNR Mean Y:36.180 U:49.546 V:49.663 Avg:37.833 Global:37.094 kb/s:
5895.91

encoded 5726 frames, 28.19 fps, 5896.07 kb/s

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune ssim --pass 2 -B 6000
--level 4.1 -m 10 --keyint 240 --min-keyint 24 --ssim --psnr --fps 24000/1001 -o e:\mbtree_ssim1.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile High, level 4.1
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames

x264 [info]: slice I:147 Avg QP:25.02 size: 71456 PSNR Mean Y:39.81 U:50.62 V:50.79 Avg:41.39 Global:40.54
x264 [info]: slice P:2541 Avg QP:27.02 size: 43147 PSNR Mean Y:38.30 U:50.13 V:50.28 Avg:39.91 Global:39.28
x264 [info]: slice B:3038 Avg QP:29.33 size: 19403 PSNR Mean Y:36.72 U:49.97 V:50.12 Avg:38.37 Global:37.80
x264 [info]: consecutive B-frames: 10.9% 38.9% 31.3% 18.8%
x264 [info]: mb I I16..4: 27.2% 62.0% 10.8%
x264 [info]: mb P I16..4: 9.6% 25.9% 5.2% P16..4: 27.3% 11.9% 6.1% 0.5% 0.1% skip:13.3%
x264 [info]: mb B I16..4: 2.9% 6.8% 1.8% B16..8: 32.1% 3.3% 3.1% direct: 9.7% skip:40.3% L0:35.7% L1:38.8% BI:25.6%
x264 [info]: 8x8 transform intra:62.5% inter:64.8%
x264 [info]: direct mvs spatial:99.7% temporal:0.3%
x264 [info]: coded y,uvDC,uvAC intra:69.8% 15.8% 0.3% inter:34.7% 1.5% 0.0%
x264 [info]: ref P L0 77.4% 9.4% 5.3% 2.6% 1.9% 1.4% 1.1% 0.8%
x264 [info]: ref B L0 86.2% 6.2% 3.1% 1.7% 1.2% 0.9% 0.7%
x264 [info]: SSIM Mean Y:0.9564886
x264 [info]: PSNR Mean Y:37.499 U:50.060 V:50.204 Avg:39.131 Global:38.457 kb/s:
5999.04

encoded 5726 frames, 4.99 fps, 5999.21 kb/s

Dark Shikari
3rd August 2009, 08:14
It's some foreign dialogue hardsubbed in the source (BDRip).

And, it's only for a few seconds of the movie.

Is this patch going to be incompatible with vbv-buf max / b-pyramid etc. or is it only temporarily as they get implemented?B-pyramid should not be too hard to add, but it won't really work ideally until we get MMCO. Which should be soon, Trahald's working on it.

VBV may be a trickier issue; it technically "works" but the row-based prediction completely falls apart with MB-tree despite the support code I wrote for it, causing serious quality loss, especially in 1-pass VBV. It'll take some investigation to figure out exactly what's wrong and whether it could be fixed or not.

tetsuo55
3rd August 2009, 08:35
This sounds like the best thing since sliced bread!

juGGaKNot
3rd August 2009, 09:09
Love sliced bread

Have to test this, will edit.

ocal5
3rd August 2009, 09:16
Seems wonderfull, perfect for stand-up shoots ;-) Thanks !

Audionut
3rd August 2009, 09:41
Same source as ssim test.

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune psnr --pass 1 -B 6000
--level 4.1 -m 10 --mbtree --lookahead 240 --keyint 240 --min-keyint 24 --ssim --psnr
--fps 24000/1001 -o e:\mbtree_psnr.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile Main, level 4.1
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames

x264 [info]: slice I:147 Avg QP:26.28 size: 74245 PSNR Mean Y:39.48 U:50.13 V:50.23 Avg:41.05 Global:40.11
x264 [info]: slice P:2508 Avg QP:28.16 size: 43247 PSNR Mean Y:37.05 U:49.27 V:49.30 Avg:38.67 Global:38.21
x264 [info]: slice B:3071 Avg QP:29.71 size: 19382 PSNR Mean Y:36.09 U:49.38 V:49.45 Avg:37.74 Global:37.31
x264 [info]: consecutive B-frames: 10.4% 37.2% 33.9% 18.4%
x264 [info]: mb I I16..4: 50.4% 0.0% 49.6%
x264 [info]: mb P I16..4: 29.1% 0.0% 0.0% P16..4: 47.6% 0.0% 0.0% 0.0% 0.0% skip:23.3%
x264 [info]: mb B I16..4: 6.1% 0.0% 0.0% B16..8: 31.0% 0.0% 0.0% direct:18.4% skip:44.6% L0:28.0% L1:38.6% BI:33.5%
x264 [info]: final ratefactor: 24.69
x264 [info]: direct mvs spatial:99.9% temporal:0.1%
x264 [info]: coded y,uvDC,uvAC intra:58.7% 10.4% 0.6% inter:35.0% 1.8% 0.0%
x264 [info]: SSIM Mean Y:0.9409480
x264 [info]: PSNR Mean Y:36.598 U:49.352 V:49.404 Avg:38.235 Global:37.740 kb/s:5992.75

encoded 5726 frames, 20.85 fps, 5992.92 kb/s

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune psnr --pass 2 -B 6000
--level 4.1 -m 10 --mbtree --lookahead 240 --keyint 240 --min-keyint 24 --ssim --psnr
--fps 24000/1001 -o e:\mbtree_psnr.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames

x264 [info]: profile High, level 4.1
x264 [info]: slice I:147 Avg QP:26.91 size: 66830 PSNR Mean Y:39.68 U:49.96 V:49.95 Avg:41.22 Global:40.37
x264 [info]: slice P:2508 Avg QP:28.31 size: 42914 PSNR Mean Y:38.39 U:49.49 V:49.43 Avg:39.97 Global:39.63
x264 [info]: slice B:3071 Avg QP:29.79 size: 20087 PSNR Mean Y:37.07 U:49.56 V:49.52 Avg:38.70 Global:38.41
x264 [info]: consecutive B-frames: 10.4% 37.2% 33.9% 18.4%
x264 [info]: mb I I16..4: 32.2% 58.9% 8.8%
x264 [info]: mb P I16..4: 12.1% 21.2% 4.2% P16..4: 24.4% 11.2% 6.0% 0.9% 0.2% skip:19.9%
x264 [info]: mb B I16..4: 2.3% 4.9% 1.7% B16..8: 28.4% 3.4% 3.0% direct: 9.7% skip:46.6% L0:35.2% L1:36.8% BI:28.0%
x264 [info]: 8x8 transform intra:56.5% inter:65.8%
x264 [info]: direct mvs spatial:99.4% temporal:0.6%
x264 [info]: coded y,uvDC,uvAC intra:60.0% 14.8% 0.4% inter:33.2% 1.7% 0.0%
x264 [info]: ref P L0 76.4% 9.9% 5.5% 2.8% 2.0% 1.4% 1.2% 0.8%
x264 [info]: ref B L0 86.3% 6.2% 3.1% 1.6% 1.1% 0.9% 0.7%
x264 [info]: SSIM Mean Y:0.9502261
x264 [info]: PSNR Mean Y:37.714 U:49.538 V:49.494 Avg:39.320 Global:38.947 kb/s:
6000.78

encoded 5726 frames, 5.80 fps, 6000.96 kb/s

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune psnr --pass 1 -B 6000
--level 4.1 -m 10 --keyint 240 --min-keyint 24 --ssim --psnr --fps 24000/1001 -o e:\mbtree_psnr1.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
x264 [info]: profile Main, level 4.1
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames

x264 [info]: slice I:147 Avg QP:26.08 size: 71885 PSNR Mean Y:39.27 U:50.16 V:50.24 Avg:40.85 Global:40.16
x264 [info]: slice P:2541 Avg QP:27.71 size: 42358 PSNR Mean Y:37.24 U:49.28 V:49.32 Avg:38.86 Global:38.07
x264 [info]: slice B:3038 Avg QP:29.44 size: 19722 PSNR Mean Y:36.14 U:49.25 V:49.29 Avg:37.79 Global:37.09
x264 [info]: consecutive B-frames: 10.9% 38.9% 31.3% 18.8%
x264 [info]: mb I I16..4: 47.7% 0.0% 52.3%
x264 [info]: mb P I16..4: 30.1% 0.0% 0.0% P16..4: 48.2% 0.0% 0.0% 0.0% 0.0% skip:21.6%
x264 [info]: mb B I16..4: 6.9% 0.0% 0.0% B16..8: 31.4% 0.0% 0.0% direct:19.1% skip:42.7% L0:27.3% L1:39.1% BI:33.7%
x264 [info]: final ratefactor: 22.74
x264 [info]: direct mvs spatial:99.9% temporal:0.1%
x264 [info]: coded y,uvDC,uvAC intra:62.1% 10.2% 0.5% inter:35.8% 1.8% 0.0%
x264 [info]: SSIM Mean Y:0.9418719
x264 [info]: PSNR Mean Y:36.712 U:49.286 V:49.328 Avg:38.343 Global:37.561 kb/s:
5966.45

encoded 5726 frames, 29.07 fps, 5966.62 kb/s

avs2yuv -raw e:\test.avs - | x264_mbtree_x64 --preset slower --tune psnr --pass 2 -B 6000
--level 4.1 -m 10 --keyint 240 --min-keyint 24 --ssim --psnr --fps 24000/1001 -o e:\mbtree_psnr1.mkv - 1280x720

x264 [info]: 1280x720 @ 23.98 fps
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
e:\test.avs: 1280x720, 24000/1001 fps, 5726 frames
x264 [info]: profile High, level 4.1

x264 [info]: slice I:147 Avg QP:25.33 size: 70603 PSNR Mean Y:40.20 U:50.64 V:50.73 Avg:41.75 Global:40.64
x264 [info]: slice P:2541 Avg QP:27.18 size: 42189 PSNR Mean Y:38.69 U:49.89 V:49.95 Avg:40.27 Global:39.57
x264 [info]: slice B:3038 Avg QP:28.90 size: 20269 PSNR Mean Y:37.24 U:49.87 V:49.92 Avg:38.87 Global:38.24
x264 [info]: consecutive B-frames: 10.9% 38.9% 31.3% 18.8%
x264 [info]: mb I I16..4: 33.0% 58.3% 8.7%
x264 [info]: mb P I16..4: 13.9% 21.5% 4.5% P16..4: 24.6% 11.0% 5.6% 0.6% 0.1% skip:18.2%
x264 [info]: mb B I16..4: 3.1% 5.6% 1.6% B16..8: 28.2% 3.4% 3.0% direct:11.2% skip:43.9% L0:34.4% L1:37.1% BI:28.5%
x264 [info]: 8x8 transform intra:54.3% inter:63.1%
x264 [info]: direct mvs spatial:99.6% temporal:0.4%
x264 [info]: coded y,uvDC,uvAC intra:63.7% 18.8% 0.5% inter:35.3% 2.0% 0.0%
x264 [info]: ref P L0 78.3% 9.1% 5.1% 2.5% 1.9% 1.3% 1.1% 0.7%
x264 [info]: ref B L0 86.4% 6.1% 3.0% 1.6% 1.1% 0.9% 0.8%
x264 [info]: SSIM Mean Y:0.9521406
x264 [info]: PSNR Mean Y:37.958 U:49.897 V:49.954 Avg:39.569 Global:38.837 kb/s:
6001.42

encoded 5726 frames, 6.12 fps, 6001.59 kb/s

juGGaKNot
3rd August 2009, 10:23
x264_x86_r1195_juGGaKNot (http://www.mediafire.com/download.php?dndzz0z0m4n)
GCC 4.4.0 generic, fprofiled, patched
Source: x264 GIT (git://git.videolan.org/x264.git)

Applied patches :

x264_win_zone_parse_fix_05.diff (http://www.mediafire.com/download.php?kqymujywhtw)
x264_Macroblock_Tree_Ratecontrol_01.diff (http://www.mediafire.com/download.php?zwezgdnhizy)

Please check Doom9.org patches thread (http://forum.doom9.org/showthread.php?t=130364), Doom9.org Macroblock tree Ratecontrol thread (http://forum.doom9.org/showthread.php?t=148686) and GIT shortlog (http://git.videolan.org/gitweb.cgi?p=x264.git;a=shortlog) for more info.

Compiled by juGGaKNot (http://forum.doom9.org/member.php?u=144865) on August 03-2009, 11:20:00 GMT with GCC 4.4.0 on Windows XP SP-2 32-bit.

Platform: X86
System: MINGW
asm: yes
avis input: yes
mp4 output: no
pthread: yes
debug: no
gprof: no
PIC: no
shared: no
visualize: no

Testing wise : ( a custom build not the generic one i uploaded )

--preset juggaknot (http://en.pastebin.ca/1516449)
vs
--preset juggaknot (http://en.pastebin.ca/1516451) --mbtree --lookahead 100.

no mbtree :
Writing library : x264 core 68 r1195 5d75a9b
Encoding settings : cabac=1 / ref=10 / deblock=1:1:1 / analyse=0x3:0x133 / me=tesa / subme=10 / psy_rd=1.0:0.0 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-2 / threads=3 / nr=0 / decimate=0 / mbaff=0 / bframes=4 / b_pyramid=0 / b_adapt=2 / b_bias=0 / direct=3 / wpredb=1 / keyint=250 / keyint_min=25 / scenecut=40 / lookahead=50 / rc=2pass / mbtree=0 / bitrate=4000 / ratetol=1.0 / qcomp=1.00 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=20000 / vbv_bufsize=20000 / ip_ratio=1.10 / pb_ratio=1.10 / aq=2:1.00

mbtree :
Writing library : x264 core 68 r1195 5d75a9b
Encoding settings : cabac=1 / ref=10 / deblock=1:1:1 / analyse=0x3:0x133 / me=tesa / subme=10 / psy_rd=1.0:0.0 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / chroma_qp_offset=-2 / threads=3 / nr=0 / decimate=0 / mbaff=0 / bframes=4 / b_pyramid=0 / b_adapt=2 / b_bias=0 / direct=3 / wpredb=1 / keyint=250 / keyint_min=25 / scenecut=40 / lookahead=100 / rc=2pass / mbtree=1 / bitrate=4000 / ratetol=1.0 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.10 / aq=2:1.00

No mbtree :
Encoding X264 1st Pass :

avis : 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:24.81 size: 12698
x264 [info]: slice P:103 Avg QP:21.88 size: 19737
x264 [info]: slice B:118 Avg QP:23.60 size: 9047
x264 [info]: consecutive B-frames: 14.0% 31.7% 40.7% 9.0% 4.5%
x264 [info]: mb I I16..4: 58.0% 37.5% 4.4%
x264 [info]: mb P I16..4: 9.7% 21.0% 1.4% P16..4: 43.0% 10.4% 8.1% 0.1% 0
.1% skip: 6.1%
x264 [info]: mb B I16..4: 1.3% 2.5% 0.3% B16..8: 40.9% 1.8% 2.3% direct:
6.7% skip:44.4% L0:49.1% L1:46.6% BI: 4.2%
[I]x264 [info]: final ratefactor: 21.43
x264 [info]: 8x8 transform intra:63.5% inter:82.5%
x264 [info]: direct mvs spatial:98.3% temporal:1.7%
x264 [info]: coded y,uvDC,uvAC intra:46.6% 40.1% 9.2% inter:24.7% 14.8% 2.1%
x264 [info]: ref P L0 63.9% 12.0% 9.0% 3.8% 2.5% 2.3% 2.5% 1.7% 1.2% 1.
1%
x264 [info]: ref B L0 71.9% 10.1% 7.6% 2.3% 2.1% 2.0% 1.4% 1.3% 1.4%
x264 [info]: kb/s:4485.6

encoded 223 frames, 0.26 fps, 4488.52 kb/s

Encoding X264 2nd Pass :

avis [info]: 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:23.30 size: 13949
x264 [info]: slice P:103 Avg QP:23.50 size: 16439
x264 [info]: slice B:118 Avg QP:25.47 size: 7667
x264 [info]: consecutive B-frames: 14.0% 31.7% 40.7% 9.0% 4.5%
x264 [info]: mb I I16..4: 53.0% 42.3% 4.7%
x264 [info]: mb P I16..4: 10.7% 19.1% 1.1% P16..4: 44.2% 7.5% 8.3% 0.1% 0
.1% skip: 9.0%
x264 [info]: mb B I16..4: 1.3% 2.3% 0.2% B16..8: 38.3% 1.5% 1.8% direct:
6.0% skip:48.6% L0:49.8% L1:46.5% BI: 3.7%
x264 [info]: 8x8 transform intra:60.7% inter:86.5%
x264 [info]: direct mvs spatial:98.3% temporal:1.7%
x264 [info]: coded y,uvDC,uvAC intra:41.5% 34.6% 6.7% inter:21.3% 12.0% 1.5%
x264 [info]: ref P L0 63.8% 12.1% 9.1% 3.9% 2.5% 2.2% 2.6% 1.8% 1.1% 1.
0%
x264 [info]: ref B L0 70.1% 11.2% 7.7% 2.3% 2.3% 2.1% 1.5% 1.4% 1.3%
x264 [info]: kb/s:3768.0

encoded 223 frames, 0.30 fps, 3770.96 kb/s

Muxing X264 :

AVC-H264 import - frame size 1184 x 666 at 40.000 FPS
Import results: 223 samples - Slices: 2 I 103 P 118 B - 1 SEI - 2 IDR
IsoMedia import - track ID 1 - Audio (SR 44100 - 2 channels)
Saving C:\x264\Movie_2D\Movie_X264_2D.mp4: 0.500 secs Interleaving

Encoding started at 11:20 AM and finished at 11:47 AM

mbtree :
Encoding X264 1st Pass :

avis [info]: 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:24.39 size: 13165
x264 [info]: slice P:103 Avg QP:21.71 size: 20739
x264 [info]: slice B:118 Avg QP:24.23 size: 8159
x264 [info]: consecutive B-frames: 14.0% 31.7% 40.7% 9.0% 4.5%
x264 [info]: mb I I16..4: 59.7% 35.2% 5.1%
x264 [info]: mb P I16..4: 10.6% 20.4% 1.3% P16..4: 42.2% 11.6% 8.2% 0.1% 0
.1% skip: 5.5%
x264 [info]: mb B I16..4: 1.3% 2.4% 0.3% B16..8: 39.8% 1.7% 2.0% direct:
6.0% skip:46.4% L0:51.9% L1:43.9% BI: 4.2%
x264 [info]: final ratefactor: 17.72
x264 [info]: 8x8 transform intra:61.3% inter:82.0%
x264 [info]: direct mvs spatial:98.3% temporal:1.7%
x264 [info]: coded y,uvDC,uvAC intra:44.3% 38.5% 9.0% inter:24.0% 14.8% 2.7%
x264 [info]: ref P L0 62.1% 12.8% 9.4% 4.0% 2.5% 2.4% 2.7% 1.9% 1.3% 1.
1%
x264 [info]: ref B L0 71.4% 9.9% 8.3% 2.2% 2.1% 2.0% 1.4% 1.3% 1.4%
x264 [info]: kb/s:4484.7

encoded 223 frames, 0.29 fps, 4487.58 kb/s

Encoding X264 2nd Pass :

avis [info]: 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:23.41 size: 14636
x264 [info]: slice P:103 Avg QP:22.56 size: 18846
x264 [info]: slice B:118 Avg QP:25.26 size: 7304
x264 [info]: consecutive B-frames: 14.0% 31.7% 40.7% 9.0% 4.5%
x264 [info]: mb I I16..4: 50.4% 44.5% 5.1%
x264 [info]: mb P I16..4: 11.3% 19.7% 1.1% P16..4: 43.2% 9.4% 8.3% 0.1% 0
.1% skip: 6.9%
x264 [info]: mb B I16..4: 1.3% 2.3% 0.2% B16..8: 37.4% 1.5% 1.8% direct:
5.7% skip:49.7% L0:52.3% L1:43.8% BI: 3.9%
x264 [info]: 8x8 transform intra:60.3% inter:85.3%
x264 [info]: direct mvs spatial:99.2% temporal:0.8%
x264 [info]: coded y,uvDC,uvAC intra:41.6% 35.3% 6.9% inter:22.1% 13.2% 2.3%
x264 [info]: ref P L0 61.9% 13.1% 9.3% 4.1% 2.6% 2.2% 2.7% 1.8% 1.2% 1.
0%
x264 [info]: ref B L0 70.1% 10.5% 8.5% 2.2% 2.3% 2.2% 1.5% 1.4% 1.3%
x264 [info]: kb/s:4064.2

encoded 223 frames, 0.30 fps, 4067.11 kb/s

Muxing X264 :

AVC-H264 import - frame size 1184 x 666 at 40.000 FPS
Import results: 223 samples - Slices: 2 I 103 P 118 B - 1 SEI - 2 IDR
IsoMedia import - track ID 1 - Audio (SR 44100 - 2 channels)
Saving C:\x264\Movie_2D\Movie_X264_2D.mp4: 0.500 secs Interleaving

Encoding started at 11:50 AM and finished at 12:15 PM

I guess the test is invalid, the non mbtree test has vbv and the mbtree one no ....

but

x264 [info]: slice I:2 Avg QP:24.81 size: 12698
x264 [info]: slice P:103 Avg QP:21.88 size: 19737
x264 [info]: slice B:118 Avg QP:23.60 size: 9047
x264 [info]: final ratefactor: 21.43

vs

x264 [info]: slice I:2 Avg QP:24.39 size: 13165
x264 [info]: slice P:103 Avg QP:21.71 size: 20739
x264 [info]: slice B:118 Avg QP:24.23 size: 8159
x264 [info]: final ratefactor: 17.72

Is normal ? final ratefactor smaller by 4 almost ?

Also the mbtree build seems to ignore

param->rc.f_qcompress = 1.0f;
param->rc.f_pb_factor = 1.1f;

Does not show up in the mediainfo window, ipratio does.

Dark Shikari
3rd August 2009, 10:29
Also the mbtree build seems to ignore

param->rc.f_qcompress = 1.0f;
param->rc.f_pb_factor = 1.1f;

Does not show up in the mediainfo window, ipratio does.Yes, because those parameters don't apply to mb-tree ratecontrol.

juGGaKNot
3rd August 2009, 10:35
what about the results ?

but

x264 [info]: slice I:2 Avg QP:24.81 size: 12698
x264 [info]: slice P:103 Avg QP:21.88 size: 19737
x264 [info]: slice B:118 Avg QP:23.60 size: 9047
x264 [info]: final ratefactor: 21.43

vs

x264 [info]: slice I:2 Avg QP:24.39 size: 13165
x264 [info]: slice P:103 Avg QP:21.71 size: 20739
x264 [info]: slice B:118 Avg QP:24.23 size: 8159
x264 [info]: final ratefactor: 17.72

Is normal ? final ratefactor smaller by 4 almost ?

Dark Shikari
3rd August 2009, 10:38
what about the results ?

but

x264 [info]: slice I:2 Avg QP:24.81 size: 12698
x264 [info]: slice P:103 Avg QP:21.88 size: 19737
x264 [info]: slice B:118 Avg QP:23.60 size: 9047
x264 [info]: final ratefactor: 21.43

vs

x264 [info]: slice I:2 Avg QP:24.39 size: 13165
x264 [info]: slice P:103 Avg QP:21.71 size: 20739
x264 [info]: slice B:118 Avg QP:24.23 size: 8159
x264 [info]: final ratefactor: 17.72

Is normal ? final ratefactor smaller by 4 almost ?Yes, read again what I said about CRF in the original post.

If you want to make a meaningful comparison, at a minimum compare SSIM or something like that?

tetsuo55
3rd August 2009, 10:57
Does any other h264 encoder have a feature like this?
Does this have any influence on the decode difficulty?

EDIT:

And that really low bitrate anime example is simply amazing...

Dark Shikari
3rd August 2009, 11:00
Does this have any influence on the decode difficulty?Almost surely not.

Audionut
3rd August 2009, 11:09
Here is a silly question!!

How fast does the motion have to be, to be affected by this patch?

juGGaKNot
3rd August 2009, 11:16
lookahead 100 only taked 335 mb on my xp
lookahead 200 crashed ( 236 frames source )

---pass 1 --slow-firstpass --preset slow --tune ssim --mbtree --lookahead 100 --ssim --bitrate 2000 :

avis [info]: 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:27.50 size: 8520
x264 [info]: slice P:101 Avg QP:25.02 size: 10155
x264 [info]: slice B:120 Avg QP:27.42 size: 4161
x264 [info]: consecutive B-frames: 12.2% 29.9% 48.9% 9.0%
x264 [info]: mb I I16..4: 63.8% 32.6% 3.6%
x264 [info]: mb P I16..4: 27.5% 19.0% 1.1% P16..4: 26.8% 3.2% 1.9% 0.0% 0
.0% skip:20.5%
x264 [info]: mb B I16..4: 6.0% 5.2% 0.3% B16..8: 23.9% 0.6% 0.5% direct:
1.9% skip:61.6% L0:47.9% L1:49.5% BI: 2.6%
x264 [info]: final ratefactor: 22.40
x264 [info]: 8x8 transform intra:40.8% inter:85.4%
x264 [info]: direct mvs spatial:98.3% temporal:1.7%
x264 [info]: coded y,uvDC,uvAC intra:25.6% 26.8% 2.6% inter:12.1% 5.1% 0.2%
x264 [info]: ref P L0 64.9% 12.5% 11.1% 4.9% 6.5%
x264 [info]: ref B L0 74.5% 11.0% 9.6% 4.9%
x264 [info]: SSIM Mean Y:0.9773563
x264 [info]: kb/s:2212.8

encoded 223 frames, 3.34 fps, 2213.70 kb/s

Encoding X264 2nd Pass :

avis [info]: 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:25.46 size: 9403
x264 [info]: slice P:101 Avg QP:25.84 size: 9277
x264 [info]: slice B:120 Avg QP:28.17 size: 3858
x264 [info]: consecutive B-frames: 12.2% 29.9% 48.9% 9.0%
x264 [info]: mb I I16..4: 73.3% 22.4% 4.2%
x264 [info]: mb P I16..4: 29.6% 16.7% 0.9% P16..4: 25.5% 2.9% 2.0% 0.0% 0
.0% skip:22.4%
x264 [info]: mb B I16..4: 6.7% 5.2% 0.2% B16..8: 22.6% 0.5% 0.4% direct:
1.8% skip:62.4% L0:49.0% L1:48.5% BI: 2.4%
x264 [info]: 8x8 transform intra:36.7% inter:85.5%
x264 [info]: direct mvs spatial:100.0% temporal:0.0%
x264 [info]: coded y,uvDC,uvAC intra:22.5% 25.2% 2.1% inter:11.2% 4.4% 0.2%
x264 [info]: ref P L0 64.7% 13.3% 10.7% 5.0% 6.3%
x264 [info]: ref B L0 74.5% 11.1% 8.9% 5.4%
x264 [info]: SSIM Mean Y:0.9766552
x264 [info]: kb/s:2035.7


--pass 1 --slow-firstpass --preset slow --tune ssim --lookahead 100 --ssim --bitrate 2000 :

avis [info]: 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:26.19 size: 8551
x264 [info]: slice P:104 Avg QP:24.79 size: 10073
x264 [info]: slice B:117 Avg QP:27.73 size: 3856
x264 [info]: consecutive B-frames: 13.6% 36.2% 33.9% 16.3%
x264 [info]: mb I I16..4: 62.4% 33.8% 3.7%
x264 [info]: mb P I16..4: 27.1% 20.2% 1.2% P16..4: 26.7% 3.0% 1.8% 0.0% 0
.0% skip:20.0%
x264 [info]: mb B I16..4: 5.7% 4.8% 0.2% B16..8: 24.6% 0.6% 0.5% direct:
1.6% skip:62.0% L0:45.7% L1:52.2% BI: 2.1%
x264 [info]: final ratefactor: 24.91
x264 [info]: 8x8 transform intra:42.1% inter:85.8%
x264 [info]: direct mvs spatial:98.3% temporal:1.7%
x264 [info]: coded y,uvDC,uvAC intra:26.8% 27.5% 2.7% inter:11.9% 4.7% 0.2%
x264 [info]: ref P L0 68.0% 11.7% 10.1% 4.7% 5.6%
x264 [info]: ref B L0 76.7% 10.4% 8.8% 4.1%
x264 [info]: SSIM Mean Y:0.9747903
x264 [info]: kb/s:2175.2

encoded 223 frames, 3.78 fps, 2176.15 kb/s

Encoding X264 2nd Pass :

avis [info]: 1184x666 @ 40.00 fps (223 frames)
x264 [warning]: width or height not divisible by 16 (1184x666), compression will
suffer.
x264 [info]: using cpu capabilities: MMX2 SSE2Slow
x264 [info]: profile High, level 4.0
x264 [info]: slice I:2 Avg QP:23.63 size: 10095
x264 [info]: slice P:104 Avg QP:25.44 size: 9294
x264 [info]: slice B:117 Avg QP:28.00 size: 3643
x264 [info]: consecutive B-frames: 13.6% 36.2% 33.9% 16.3%
x264 [info]: mb I I16..4: 66.0% 29.6% 4.4%
x264 [info]: mb P I16..4: 29.0% 18.0% 1.0% P16..4: 25.6% 2.8% 1.9% 0.0% 0
.0% skip:21.7%
x264 [info]: mb B I16..4: 6.1% 4.7% 0.2% B16..8: 23.5% 0.5% 0.4% direct:
1.6% skip:63.0% L0:47.0% L1:50.9% BI: 2.1%
x264 [info]: 8x8 transform intra:38.3% inter:85.9%
x264 [info]: direct mvs spatial:99.1% temporal:0.9%
x264 [info]: coded y,uvDC,uvAC intra:23.9% 26.2% 2.3% inter:11.2% 4.2% 0.2%
x264 [info]: ref P L0 66.6% 12.5% 10.2% 4.8% 5.9%
x264 [info]: ref B L0 74.3% 11.1% 9.9% 4.7%
x264 [info]: SSIM Mean Y:0.9751063
x264 [info]: kb/s:2027.6

encoded 223 frames, 4.72 fps, 2028.59 kb/s

tetsuo55
3rd August 2009, 11:19
Here is a silly question!!

How fast does the motion have to be, to be affected by this patch?i was wonder the same, image a scene like the killa sample (the one from BBC where the flock of birds fly over the moving and reflective sea), would this patch "kill" it or help it.

Audionut
3rd August 2009, 11:30
lookahead 200 crashed ( 236 frames source )

http://forum.doom9.org/showthread.php?p=1311000#post1311000

All crashes that I've seen so far that occurred with very large --lookahead values traced back perfectly to x264_malloc, so you should check with gdb before reporting such issues as bugs.

Couldn't get 64-bit x264+avs2yuv working with gdb but nevertheless, seems you were right:

Firebird
3rd August 2009, 15:08
First test. Source is anime (Suzumiya Haruhi-chan Op)
(Tested on AMD athlon XP 1700, lol)

"D:\Program Files\megui\tools\x264\x264.exe" --profile high --crf 18.0 --keyint 240 --min-keyint 24 --ref 8 --no-fast-pskip --bframes 5 --b-adapt 2 --no-weightb --direct auto --subme 9 --trellis 2 --psy-rd 0.3:0 --partitions p8x8,b8x8,i4x4,i8x8 --me umh --thread-input --aq-strength 0.5 --psnr --ssim --output "E:\haruhi\haruhi op.mkv" "E:\haruhi\haruhi op.avs"

avis [info]: 720x480 @ 23.98 fps (1476 frames)
x264 [info]: using cpu capabilities: MMX2
x264 [info]: profile High, level 3.1

x264 [info]: slice I:34 Avg QP:17.37 size: 25881 PSNR Mean Y:51.48 U:53.35 V:52.78 Avg:51.45 Global:48.29
x264 [info]: slice P:667 Avg QP:20.04 size: 11522 PSNR Mean Y:47.32 U:49.74 V:49.10 Avg:47.77 Global:45.49
x264 [info]: slice B:775 Avg QP:23.48 size: 5286 PSNR Mean Y:45.22 U:47.57 V:46.88 Avg:45.76 Global:43.84
x264 [info]: consecutive B-frames: 12.8% 43.0% 20.6% 10.3% 10.1% 3.3%
x264 [info]: mb I I16..4: 41.1% 29.0% 29.9%
x264 [info]: mb P I16..4: 6.9% 8.1% 5.2% P16..4: 30.2% 10.2% 6.9% 0.0% 0.0% skip:32.4%
x264 [info]: mb B I16..4: 1.3% 1.6% 0.7% B16..8: 27.2% 4.3% 4.5% direct: 4.5% skip:55.9% L0:41.5% L1:47.4% BI:11.1%
x264 [info]: 8x8 transform intra:38.5% inter:47.9%
x264 [info]: direct mvs spatial:99.4% temporal:0.6%
x264 [info]: coded y,uvDC,uvAC intra:47.5% 68.4% 47.8% inter:16.9% 22.8% 9.0%
x264 [info]: ref P L0 59.8% 13.8% 8.2% 4.9% 4.4% 3.6% 2.4% 2.9%
x264 [info]: ref B L0 68.3% 12.8% 7.1% 4.9% 2.9% 2.6% 1.5%
x264 [info]: SSIM Mean Y:0.9933523
x264 [info]: PSNR Mean Y:46.313 U:48.684 V:48.016 Avg:46.798 Global:44.586 kb/s:1645.44
encoded 1476 frames, 1.69 fps, 1645.67 kb/s

With mbtree:

avis [info]: 720x480 @ 23.98 fps (1476 frames)
x264 [info]: using cpu capabilities: MMX2
x264 [info]: profile High, level 3.1

x264 [info]: slice I:34 Avg QP:16.10 size: 31193 PSNR Mean Y:52.56 U:54.01 V:53.48 Avg:52.51 Global:50.16
x264 [info]: slice P:660 Avg QP:20.11 size: 12298 PSNR Mean Y:47.53 U:49.85 V:49.34 Avg:48.00 Global:46.47
x264 [info]: slice B:782 Avg QP:24.08 size: 6384 PSNR Mean Y:45.86 U:48.21 V:47.57 Avg:46.40 Global:45.32
x264 [info]: consecutive B-frames: 12.0% 43.6% 20.2% 10.8% 9.7% 3.7%
x264 [info]: mb I I16..4: 41.3% 28.6% 30.2%
x264 [info]: mb P I16..4: 6.4% 8.0% 5.5% P16..4: 28.7% 10.0% 6.8% 0.0% 0.0% skip:34.7%
x264 [info]: mb B I16..4: 1.3% 1.7% 0.9% B16..8: 25.4% 4.7% 4.7% direct: 4.3% skip:57.0% L0:43.6% L1:44.5% BI:11.9%
x264 [info]: 8x8 transform intra:38.6% inter:46.9%
x264 [info]: direct mvs spatial:98.1% temporal:1.9%
x264 [info]: coded y,uvDC,uvAC intra:48.5% 68.8% 48.7% inter:16.9% 22.0% 9.6%
x264 [info]: ref P L0 56.5% 15.0% 9.0% 5.3% 4.8% 4.1% 2.1% 3.3%
x264 [info]: ref B L0 68.1% 13.1% 7.1% 4.6% 3.5% 2.3% 1.3%
x264 [info]: SSIM Mean Y:0.9944401
x264 [info]: PSNR Mean Y:46.763 U:49.077 V:48.494 Avg:47.259 Global:45.874 kb/s:1841.39
encoded 1476 frames, 1.55 fps, 1841.62 kb/s

DarkZell666
3rd August 2009, 16:37
@Firebird : don't use CRF for doing such tests, go for two-pass (either bitrate or filesize, it doesn't matter), otherwise the results are meaningless x_x". Especially since Dark Shikari mentionned CRF was redefined. This means for any given CRF value, the expected bitrate will change for the same source. You won't know if the SSIM increase is due to the CRF redifinition or to the MB Tree Ratecontrol algo, and you won't know if the +0.0011 SSIM increase was worth the 204kbps increase.

Firebird
3rd August 2009, 17:18
Sorry, my fault.

The same source, with very low bitrate.

"D:\Program Files\megui\tools\x264\x264.exe" --profile high --pass 2 --bitrate 272 --stats "E:\haruhi\haruhi op.stats" --keyint 240 --min-keyint 24 --ref 8 --no-fast-pskip --bframes 5 --b-adapt 2 --no-weightb --direct auto --subme 9 --trellis 2 --psy-rd 0.0:0 --partitions p8x8,b8x8,i4x4,i8x8 --me umh --thread-input --aq-strength 0.5 --psnr --ssim --output "E:\haruhi\haruhi op.mkv" "E:\haruhi\haruhi op cl 264.avs"

First pass:

avis [info]: 720x480 @ 23.98 fps (1476 frames)
x264 [info]: using cpu capabilities: MMX2
x264 [info]: profile Main, level 3.0

x264 [info]: slice I:34 Avg QP:39.30 size: 4834 PSNR Mean Y:36.49 U:43.22 V:42.39 Avg:37.44 Global:32.02
x264 [info]: slice P:680 Avg QP:42.17 size: 1988 PSNR Mean Y:30.98 U:38.60 V:37.64 Avg:32.21 Global:29.17
x264 [info]: slice B:762 Avg QP:44.72 size: 726 PSNR Mean Y:29.43 U:37.02 V:35.92 Avg:30.67 Global:28.19
x264 [info]: consecutive B-frames: 13.9% 43.1% 19.6% 12.5% 7.6% 3.3%
x264 [info]: mb I I16..4: 84.9% 0.0% 15.1%
x264 [info]: mb P I16..4: 24.6% 0.0% 0.0% P16..4: 15.8% 0.0% 0.0% 0.0% 0.0% skip:59.6%
x264 [info]: mb B I16..4: 3.8% 0.0% 0.0% B16..8: 13.1% 0.0% 0.0% direct: 4.3% skip:78.9% L0:41.4% L1:56.8% BI: 1.7%
x264 [info]: final ratefactor: 39.49
x264 [info]: direct mvs spatial:96.6% temporal:3.4%
x264 [info]: coded y,uvDC,uvAC intra:12.0% 40.7% 17.8% inter:1.5% 7.3% 1.3%
x264 [info]: SSIM Mean Y:0.8703792
x264 [info]: PSNR Mean Y:30.307 U:37.893 V:36.858 Avg:31.533 Global:28.676 kb/s:268.94
encoded 1476 frames, 7.77 fps, 269.17 kb/s

Second pass:

avis [info]: 720x480 @ 23.98 fps (1476 frames)
x264 [info]: using cpu capabilities: MMX2
x264 [info]: profile High, level 3.1

x264 [info]: slice I:34 Avg QP:35.68 size: 5261 PSNR Mean Y:39.15 U:44.12 V:43.20 Avg:39.67 Global:35.20
x264 [info]: slice P:680 Avg QP:39.40 size: 2009 PSNR Mean Y:34.56 U:40.01 V:38.85 Avg:35.51 Global:33.56
x264 [info]: slice B:762 Avg QP:41.76 size: 726 PSNR Mean Y:33.13 U:38.31 V:36.86 Avg:34.08 Global:32.43
x264 [info]: consecutive B-frames: 13.9% 43.1% 19.6% 12.5% 7.6% 3.3%
x264 [info]: mb I I16..4: 41.5% 47.9% 10.6%
x264 [info]: mb P I16..4: 10.0% 9.1% 1.1% P16..4: 24.7% 3.3% 1.6% 0.0% 0.0% skip:50.2%
x264 [info]: mb B I16..4: 1.2% 0.8% 0.0% B16..8: 19.5% 0.5% 0.3% direct: 0.5% skip:77.1% L0:49.2% L1:49.8% BI: 1.1%
x264 [info]: 8x8 transform intra:45.0% inter:77.3%
x264 [info]: direct mvs spatial:75.7% temporal:24.3%
x264 [info]: coded y,uvDC,uvAC intra:14.6% 32.7% 12.8% inter:2.2% 5.2% 0.7%
x264 [info]: ref P L0 54.4% 16.7% 10.5% 5.6% 5.5% 2.9% 2.1% 2.4%
x264 [info]: ref B L0 66.4% 13.3% 7.4% 3.8% 4.4% 2.9% 1.7%
x264 [info]: SSIM Mean Y:0.9407777
x264 [info]: PSNR Mean Y:33.928 U:39.227 V:37.926 Avg:34.866 Global:32.970 kb/s:272.70
encoded 1476 frames, 3.02 fps, 272.93 kb/s

With mbtree:

First pass:

avis [info]: 720x480 @ 23.98 fps (1476 frames)
x264 [info]: using cpu capabilities: MMX2
x264 [info]: profile Main, level 3.0

x264 [info]: slice I:33 Avg QP:38.49 size: 5475 PSNR Mean Y:36.39 U:43.41 V:42.54 Avg:37.50 Global:33.86
x264 [info]: slice P:670 Avg QP:43.89 size: 1958 PSNR Mean Y:30.81 U:38.71 V:37.73 Avg:32.07 Global:29.60
x264 [info]: slice B:773 Avg QP:46.00 size: 752 PSNR Mean Y:29.75 U:37.36 V:36.18 Avg:31.01 Global:28.85
x264 [info]: consecutive B-frames: 13.7% 40.5% 21.2% 11.9% 9.4% 3.3%
x264 [info]: mb I I16..4: 81.6% 0.0% 18.4%
x264 [info]: mb P I16..4: 23.4% 0.0% 0.0% P16..4: 14.1% 0.0% 0.0% 0.0% 0.0% skip:62.5%
x264 [info]: mb B I16..4: 3.7% 0.0% 0.0% B16..8: 13.2% 0.0% 0.0% direct: 3.9% skip:79.1% L0:43.4% L1:54.6% BI: 2.1%
x264 [info]: final ratefactor: 40.39
x264 [info]: direct mvs spatial:95.2% temporal:4.8%
x264 [info]: coded y,uvDC,uvAC intra:12.3% 41.9% 18.5% inter:1.4% 6.8% 1.2%
x264 [info]: SSIM Mean Y:0.8832674
x264 [info]: PSNR Mean Y:30.382 U:38.107 V:37.027 Avg:31.632 Global:29.246 kb/s:269.44
encoded 1476 frames, 7.06 fps, 269.68 kb/s

Second pass:

avis [info]: 720x480 @ 23.98 fps (1476 frames)
x264 [info]: using cpu capabilities: MMX2
x264 [info]: profile High, level 3.1

x264 [info]: slice I:33 Avg QP:37.28 size: 5388 PSNR Mean Y:37.39 U:43.97 V:43.14 Avg:38.41 Global:35.35
x264 [info]: slice P:670 Avg QP:40.64 size: 2023 PSNR Mean Y:34.47 U:40.15 V:39.04 Avg:35.42 Global:33.84
x264 [info]: slice B:773 Avg QP:43.18 size: 745 PSNR Mean Y:33.24 U:38.47 V:37.01 Avg:34.20 Global:32.76
x264 [info]: consecutive B-frames: 13.7% 40.5% 21.2% 11.9% 9.4% 3.3%
x264 [info]: mb I I16..4: 35.9% 52.8% 11.3%
x264 [info]: mb P I16..4: 9.7% 9.1% 1.3% P16..4: 23.9% 3.2% 1.5% 0.0% 0.0% skip:51.2%
x264 [info]: mb B I16..4: 1.3% 0.9% 0.0% B16..8: 18.9% 0.6% 0.3% direct: 0.5% skip:77.5% L0:50.6% L1:48.4% BI: 1.0%
x264 [info]: 8x8 transform intra:46.3% inter:77.9%
x264 [info]: direct mvs spatial:76.3% temporal:23.7%
x264 [info]: coded y,uvDC,uvAC intra:14.0% 33.0% 13.1% inter:2.2% 5.2% 0.8%
x264 [info]: ref P L0 54.0% 16.4% 10.9% 6.1% 5.2% 2.7% 2.0% 2.6%
x264 [info]: ref B L0 65.6% 13.9% 7.7% 4.0% 4.2% 2.9% 1.8%
x264 [info]: SSIM Mean Y:0.9440372
x264 [info]: PSNR Mean Y:33.892 U:39.353 V:38.070 Avg:34.849 Global:33.264 kb/s:274.15
encoded 1476 frames, 2.96 fps, 274.39 kb/s

Chengbin
3rd August 2009, 19:02
Seems like a wonderful patch.

Can you explain "redefined" CRF? At the same CRF value, which build give the better quality?

Your links don't work (that directs to mirror05.x264.nl)

Dark Shikari
3rd August 2009, 19:04
Seems like a wonderful patch.

Can you explain "redefined" CRF? At the same CRF value, which build give the better quality?

Your links don't work (that directs to mirror05.x264.nl)mirror05 is down, blame jarod. There's an alternative download link a few posts down.

"Redefining CRF" means that CRF's measure of quality changes, so some videos may have higher or lower bitrates at the same CRF.

juGGaKNot
3rd August 2009, 19:15
x264_x86_r1195_juGGaKNot (http://www.mediafire.com/download.php?dndzz0z0m4n)
GCC 4.4.0 generic, fprofiled, patched
Source: x264 GIT (git://git.videolan.org/x264.git)

Applied patches :

x264_win_zone_parse_fix_05.diff (http://www.mediafire.com/download.php?kqymujywhtw)
x264_Macroblock_Tree_Ratecontrol_01.diff (http://www.mediafire.com/download.php?zwezgdnhizy)

Please check Doom9.org patches thread (http://forum.doom9.org/showthread.php?t=130364), Doom9.org Macroblock tree Ratecontrol thread (http://forum.doom9.org/showthread.php?t=148686) and GIT shortlog (http://git.videolan.org/gitweb.cgi?p=x264.git;a=shortlog) for more info.

Compiled by juGGaKNot (http://forum.doom9.org/member.php?u=144865) on August 03-2009, 11:20:00 GMT with GCC 4.4.0 on Windows XP SP-2 32-bit.

Platform: X86
System: MINGW
asm: yes
avis input: yes
mp4 output: no
pthread: yes
debug: no
gprof: no
PIC: no
shared: no
visualize: no

Your links don't work (that directs to mirror05.x264.nl)

You can try that ...

popper
4th August 2009, 00:31
just a random thought,when i looked at your tree picture in the OP i got to wondering if you have a way to visualise and track pattens in the algorithm(s) your using,
and that in turn reminded me of this old news post
http://www.physorg.com/news138893926.html
" Model helps computers sort data more like humans
August 25th, 2008
http://www.physorg.com/newman/gfx/news/modelhelpsco.jpg
MIT associate professor Josh Tenenbaum and his former student, Charles Kemp, have developed a computer algorithm that can select the best type of structure to fit a set of data. Such structures, shown here, include linear order, rings and clusters. Image courtesy / Charles Kemp

....
The model considers a range of possible data structures, such as trees, linear orders, rings, dominance hierarchies, clusters, etc. It finds the best-fitting structure of each type for a given data set and then picks the type of structure that best represents the data.

..."


i just wonder if anyone knows any more about the Tenenbaum/Kemp code algorithm since last year, and if any of its usable here in x264 POC code!

its good to see some experimentation in the algorithms used here and i wonder what drives the devs to try one algorithm against another, and if they measure and trial a given set of POC code just to see if its faster,better,more accurate than another set etc, and if so has there been any push/atemp to see visual pattens as per the above modelhelpsco.jpg appearing in any of these datasets/tests that may lead to even better ways to improve and add new code to the main codebase later...

Dark Shikari
4th August 2009, 07:17
Updated version in topic to 0.11. VBV now supported.

G_M_C
4th August 2009, 08:20
Updated version in topic to 0.11. VBV now supported.

That's faster than i hoped for. I make clips (AVCHD) for my STD, and i wanted to wait for VBV to added before i started testing. Lets see if it works on my STD :)