View Full Version : x264: Film Grain Optimization
This is not entirely true. The name of the game here is reducing file size so using crf in comparisons to judge how certain settings effect the need for bitrate has its place. So maybe crf's place isn't in this application. Note that I say maybe since it was clearly marked that the crf version took 30% more space and this is a clear concern.
But the version that takes more space could also have much higher visual quality. CRF doesn't measure quality in the same way as humans do, so you'll just need to use your own eyes for that. I'd listen to DS and akupenguin and use the same bitrate for quality comparisons :)
DarkZell666
30th May 2008, 10:21
This is not entirely true. The name of the game here is reducing file size so using crf in comparisons to judge how certain settings effect the need for bitrate has its place. So maybe crf's place isn't in this application. Note that I say maybe since it was clearly marked that the crf version took 30% more space and this is a clear concern. At a certain point we would be all but throwing away processing power by encoding if we only gained (for example) a 5% reduction in size .
The question that still needs answering : was the 30% bitrate increase worth it ? Was it well spent ? Would increasing the bitrate manually by 30% without enabling FGO produce the same benefit (or not, since FGO is supposed to do better, otherwise it would be useless, which I doubt :D) ? So now, you'd need to compare a 30% bigger FGO encode, and a 30% bigger non-FGO encode to compare, and here we go, comparing an FGO and non-FGO encode at the same bitrate. Back to start :rolleyes:
Inventive Software
31st May 2008, 02:25
I did a 2 pass encode at 2800 Kbps of the Open All Hours pilot (Ronnie Barker God rest his soul is hilarious), and noticed that the SSIM in the first pass was higher than the second pass, even though the first had something like this commandline:
--bitrate 2800 --pass 1 --subme 3 --partitions none --ref 1 --bframes 8 --me dia --interlaced --sar 16:15
Whereas the 2nd pass had this:
--bitrate 2800 --pass 3 --subme 7 --partitions all --ref 8 --bframes 8 --me tesa --interlaced --fgo 10 --bime --weightb --b-pyramid --b-rdo --mixed-refs --sar 16:15
The difference was 0.001 in pass 1's favour if I remember correctly.
Dark Shikari
31st May 2008, 02:46
I did a 2 pass encode at 2800 Kbps of the Open All Hours pilot (Ronnie Barker God rest his soul is hilarious), and noticed that the SSIM in the first pass was higher than the second pass, even though the first had something like this commandline:
--bitrate 2800 --pass 1 --subme 3 --partitions none --ref 1 --bframes 8 --me dia --interlaced --sar 16:15
Whereas the 2nd pass had this:
--bitrate 2800 --pass 3 --subme 7 --partitions all --ref 8 --bframes 8 --me tesa --interlaced --fgo 10 --bime --weightb --b-pyramid --b-rdo --mixed-refs --sar 16:15
The difference was 0.001 in pass 1's favour if I remember correctly.That's because FGO lowers SSIM.
By the way guys, I suspect that FGO is going to be obsoleted by my upcoming psy RDO metric, which will probably come out in a few days or weeks ;)
Heaud
31st May 2008, 06:29
I suspect that FGO is going to be obsoleted by my upcoming psy RDO metric, which will probably come out in a few days or weeks ;)
I can't wait for the release of that! I have been playing with FGO and I am amazed at how it works so well with noise that prevents banding.
Dark Shikari
31st May 2008, 06:37
I can't wait for the release of that! I have been playing with FGO and I am amazed at how it works so well with noise that prevents banding.Copypasta'd from another thread:
Here's a simple unthreaded build (http://mirror05.x264.nl/Dark/force.php?file=./x264_new_metric.exe); note its my dev build so it contains a few unrelated patches related to b8x8 and p4x4 (minor RD improvements).
How to use: The more RD, the better. Subme6? Good. B-rdo? Better. Subme7? Even better.
Use deadzones (trellis 0) with it; I'm not sure how well trellis 1 would perform. Trellis 2 should be fine I guess.
The purpose of the algorithm used here is to attempt to weight higher the importance of retaining complexity in the output video; this generally results in better-kept dither and sometimes results like this (http://i27.tinypic.com/a4ldtj.png) (without new algorithm, same bitrate (http://i29.tinypic.com/344fpd3.png)).
Note that this is a general-purpose psy optimization that, ideally, should improve any source, even very clean sources.
Sagittaire
31st May 2008, 18:49
By the way guys, I suspect that FGO is going to be obsoleted by my upcoming psy RDO metric, which will probably come out in a few days or weeks ;)
Good news because actual FGO outperform by far GrainOptimisation from MC/Elecard.
Mug Funky
2nd June 2008, 15:39
ooh, i missed this thread, but it's definitely relevant to my interests.
i'm gonna throw some 16mm at it and see how it stands up in HD (or should i go 2k? avisynth kinda hates 2k).
techouse
8th June 2008, 12:04
Since the FGO patch fails to patch r877 I made a cosmetic fix so it works ;)
x264_FGO_techouse_fix.diff (http://pastebin.com/f7dcb4e0f)
The problem was this:
patching file `common/pixel.c'
Hunk #4 succeeded at 581 (offset -1 lines).
Hunk #6 FAILED at 671.
1 out of 6 hunks FAILED -- saving rejects to common/pixel.c.rej
So I changed these problematic lines:
@@ -614,6 +671,7 @@ void x264_pixel_init( int cpu, x264_pixel_function_t *pixf )
if( cpu&X264_CPU_SSE2 )
{
INIT5( ssd, _sse2 );
+ INIT5( nssd, _sse2);
pixf->ssim_4x4x2_core = x264_pixel_ssim_4x4x2_core_sse2;
pixf->ssim_end4 = x264_pixel_ssim_end4_sse2;
pixf->sa8d[PIXEL_16x16] = x264_pixel_sa8d_16x16_sse2;
To these fixed lines:
@@ -605,6 +662,7 @@ void x264_pixel_init( int cpu, x264_pixel_function_t *pixf )
if( cpu&X264_CPU_SSE2 )
{
INIT5( ssd, _sse2 );
+ INIT5( nssd, _sse2);
INIT5( satd, _sse2 );
INIT5( satd_x3, _sse2 );
INIT5( satd_x4, _sse2 );
As you can see the fix is only cosmetic ;)
Enjoy :)
Sagittaire
9th June 2008, 15:16
Well, first this patch work incredibily well. The ability to keep grain at low/medium bitrate is really good now. Even better than Mainconcept/Elecard implementation.
+/* The weights chosen (5 for each) are arbitrary. They should probably be the same for SATD and SA8D but */
+/* the overall weight is chosen for no particularly good reason. */
Grain/noise is really hard to see on low luma level. Why not choose luma level for weight:
-> Low luma value imply classic RDO way with low grain/noise retention.
-> High luma value imply PSY RDO with high grain/noise retention.
Dark Shikari
9th June 2008, 15:22
Well, first this patch work incredibily well. The ability to keep grain at low/medium bitrate is really good now. Even better than Mainconcept/Elecard implementation.Know why? Mainconcept's "film grain optimization" is nothing but a bias in favor of inter blocks. Just a simple, one-line, non-adaptive numerical bias :pGrain/noise is really hard to see on low luma level. Why not choose luma level for weight:
-> Low luma value imply classic RDO way with low grain/noise retention.
-> High luma value imply PSY RDO with high grain/noise retention.This would completely eliminate the ability of psy RDO to keep fine detail on dark gradients and other places where x264 normally blurs out detail; IMO this is one of the places where it does best.
Sagittaire
9th June 2008, 15:46
This would completely eliminate the ability of psy RDO to keep fine detail on dark gradients and other places where x264 normally blurs out detail; IMO this is one of the places where it does best.
Grain/noise are high temporal complexity. Detail on dark area generaly not. The best HVS way for dark area is:
1) Eliminate noise/grain on dark area because it's hard to see fine gradiant here.
2) Eyes are really sensitive to global in dark area (banding and blocking artefact). Use lower quantisation (AQ) without grain/noise (after filtering ... or other way) is a really better HVS way at equivalent size.
VC1 from MS work like that for very high quality encoding. VC1 PEP use Dark Noise Filtering for eliminate grain in dark area and after use AQ with luma masking for better quality in dark area.
http://jfl1974.free.fr/upload/Sans%20titre.PNG
dimzon
12th June 2008, 00:51
fgo rocks!
C:\12>"C:\Program Files\megui\tools\x264\x264.exe" --pass 2 --fgo 10 --bitrate 1
791 --aq-strength 1.2 --stats "C:\12\ss12.stats" --ref 10 --mixed-refs --no-fast
-pskip --bframes 16 --b-pyramid --b-rdo --bime --weightb --direct auto --filter
-2,-1 --subme 7 --trellis 2 --partitions all --8x8dct --me umh --merange 24 --t
hreads auto --thread-input --sar 1:1 --progress --no-dct-decimate --output "C:\1
2\video12.mp4" "C:\12\12_video.avs"
avis [info]: 720x576 @ 25.00 fps (432825 frames)
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX MMX2 SSE SSE2 SSE3 3DNow
mp4 [info]: initial delay 2 (scale 25)
x264 [info]: slice I:2350 Avg QP:19.59 size: 34844 PSNR Mean Y:44.94 U:48.55
V:48.69 Avg:45.79 Global:45.23
x264 [info]: slice P:180307 Avg QP:21.74 size: 13950 PSNR Mean Y:42.54 U:46.94
V:47.05 Avg:43.55 Global:43.19
x264 [info]: slice B:250168 Avg QP:22.00 size: 5112 PSNR Mean Y:42.44 U:47.06
V:47.14 Avg:43.44 Global:42.89
x264 [info]: mb I I16..4: 10.9% 73.7% 15.4%
x264 [info]: mb P I16..4: 2.3% 7.9% 0.7% P16..4: 44.1% 20.6% 16.6% 0.3% 0
.1% skip: 7.4%
x264 [info]: mb B I16..4: 0.1% 1.4% 0.1% B16..8: 47.8% 1.5% 3.5% direct:
6.5% skip:39.1%
x264 [info]: 8x8 transform intra:75.0% inter:63.9%
x264 [info]: direct mvs spatial:98.2% temporal:1.8%
x264 [info]: ref P 60.0% 13.8% 8.0% 4.1% 3.4% 3.2% 2.7% 1.6% 1.5% 1.6%
x264 [info]: ref B 76.2% 11.3% 4.1% 2.2% 1.7% 1.5% 1.3% 0.9% 0.7%
x264 [info]: SSIM Mean Y:0.9843682
x264 [info]: PSNR Mean Y:42.494 U:47.019 V:47.114 Avg:43.500 Global:43.022 kb/s:
1791.03
encoded 432825 frames, 4.17 fps, 1791.08 kb/s
http://ipicture.ru/uploads/080612/thumbs/NSSTwit5Y1.png (http://ipicture.ru/Gallery/Viewfull/2470115.html) http://ipicture.ru/uploads/080612/thumbs/zs7eq412p2.png (http://ipicture.ru/Gallery/Viewfull/2470116.html) http://ipicture.ru/uploads/080612/thumbs/W3LH6wnS3i.png (http://ipicture.ru/Gallery/Viewfull/2470117.html) http://ipicture.ru/uploads/080612/thumbs/kdtepx6fWH.png (http://ipicture.ru/Gallery/Viewfull/2470118.html) http://ipicture.ru/uploads/080612/thumbs/kfLC263jWr.png (http://ipicture.ru/Gallery/Viewfull/2470119.html) http://ipicture.ru/uploads/080612/thumbs/AOx3pSIKbY.png (http://ipicture.ru/Gallery/Viewfull/2470210.html) http://ipicture.ru/uploads/080612/thumbs/106cUOCuep.png (http://ipicture.ru/Gallery/Viewfull/2470211.html) http://ipicture.ru/uploads/080612/thumbs/7C7v41Vieq.png (http://ipicture.ru/Gallery/Viewfull/2470212.html) http://ipicture.ru/uploads/080612/thumbs/0DYWgT7SFx.png (http://ipicture.ru/Gallery/Viewfull/2470213.html) http://ipicture.ru/uploads/080612/thumbs/2WXOHKUPd1.png (http://ipicture.ru/Gallery/Viewfull/2470214.html)http://ipicture.ru/uploads/080612/thumbs/3Bg1FpOGGN.png (http://ipicture.ru/Gallery/Viewfull/2470272.html) http://ipicture.ru/uploads/080612/thumbs/gW6ngH2sri.png (http://ipicture.ru/Gallery/Viewfull/2470273.html) http://ipicture.ru/uploads/080612/thumbs/zfZV6cR63s.png (http://ipicture.ru/Gallery/Viewfull/2470274.html) http://ipicture.ru/uploads/080612/thumbs/XBTvTs3mKU.png (http://ipicture.ru/Gallery/Viewfull/2470275.html) http://ipicture.ru/uploads/080612/thumbs/aYadBmJNVT.png (http://ipicture.ru/Gallery/Viewfull/2470276.html)
http://rapidshare.com/files/121784904/video12-007.mkv.html
Razorholt
12th June 2008, 04:37
Try psyRDO with trellis 2, it's even better ;)
e-Pawel
12th June 2008, 16:51
When will the FGO be adapted into the "official" release?
Dark Shikari
12th June 2008, 16:53
When will the FGO be adapted into the "official" release?If something is adopted, it will probably be psy-RDO, since its more general-purpose, but I may end up combining the concepts of the two; I'll have to do more investigation.
foxyshadis
13th June 2008, 00:42
Off topic discussion moved to Reverse Engineering Discussion (https://forum.doom9.org/showthread.php?t=138654). Keep it there.
TheCreamCrackerBoy
29th June 2008, 23:38
Is the psyRDO/FGO development interrupted somehow? I was hoping to see some news lately. :)
Shinigami-Sama
30th June 2008, 06:22
Is the psyRDO/FGO development interrupted somehow? I was hoping to see some news lately. :)
FGO is being replaced or merged with psyRO
and theres still some work on it, mostly in dark's head/testbuild at the moment it seems
TheCreamCrackerBoy
24th July 2008, 21:28
What are those "diff" files (x264_fgo.2.diff, x264_FGO_techouse_fix.diff)?
Should I download them to use in my MeGui? If affirmative, which one(s) should I get?
Thank you,
TheCreamCrackerBoy.
LoRd_MuldeR
24th July 2008, 21:30
The "diff" files are patches. You apply them to the source codes before you compile your x264.exe and then you can use that EXE with MeGUI ;)
BTW: FGO seems to be obsolete, now that Psy RDO has become popular...
Sharktooth
24th July 2008, 21:33
Psy-RDO is more general use.
FGO is still unbeaten on heavy grain however Psy-RDO is constantly improving and i hope it gets as near as possible or even better than FGO.
TheCreamCrackerBoy
24th July 2008, 21:52
Can I try (psy)RDO with this MeGui (latest version 0.3.0.1020, downlodaded at http://www.videohelp.com/tools/MeGUI" (http://www.videohelp.com/tools/MeGUI)) our should I use a different build?
Note: I´ve found another forum concerning PsyRDO at http://forum.handbrake.fr/viewtopic.php?f=4&p=37755. Is that another research for PsyRDO?
My best regards,
TheCreamCrackerBoy.
LoRd_MuldeR
24th July 2008, 21:59
I think the latest x264 build that comes with MeGUI per auto-update already has PsyRDO ...
Sharktooth
25th July 2008, 02:54
yes. it already has psy-rdo 0.5 and it is enabled by default.
TheCreamCrackerBoy
28th July 2008, 00:03
yes. it already has psy-rdo 0.5 and it is enabled by default.
Shouldn´t I use psy-RDO 10?
LoRd_MuldeR
28th July 2008, 00:17
Shouldn´t I use psy-RDO 10?
There no no Psy RDO "10" :confused:
The latest version of the Psy RDO patch available now is v0.5 and the default value for "--psy-rd" is 1.0000 ...
TheCreamCrackerBoy
28th July 2008, 00:32
There no no Psy RDO "10"
On the first page of this forum, I saw references to the setting "FGO 10"... is psy-RDO different then?
LoRd_MuldeR
28th July 2008, 00:34
On the first page of this forum, I saw references to the setting "FGO 10"... is psy-RDO different then?
"Psy RDO" and "FGO" are two a completely different patches! Also Psy RDO is a more general approach and it will most likely replace FGO...
Soichiro
28th July 2008, 04:32
PsyRDO defaults to on at a setting of 1.0, and it shouldn't be changed unless you have a good reason to. The 0.5 refers to the version number.
It might be interesting to see what would happen if you set Psy-RDO to strength 10 though. :p
Ranguvar
28th July 2008, 04:49
It might be interesting to see what would happen if you set Psy-RDO to strength 10 though. :p
It puts the psycho in psychovisual :p
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.