Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > MPEG-4 AVC / H.264

Reply
 
Thread Tools Search this Thread Display Modes
Old 7th July 2014, 10:02   #1  |  Link
xkfz007
Registered User
 
Join Date: Sep 2013
Posts: 38
Why the two execution of X264 are different?

I am using the following commands to run the X264 under multithreads for MB-TREE algorithm:
./x264 -b 0 --threads 4 --lookahead-threads 1 --rc-lookahead 10 --aq-mode 1 -o test.264 ~/sequences/bus_352x288_25.yuv --fps 25 --frames -1 -I 30 -B 500 --b-adapt 0 --b-pyramid none --ref 5 --weightp 0 --no-scenecut -v --tune psnr --psnr --no-psy --no-asm >a.txt 2>&1

However, each time the result is different. How could that be possible?
xkfz007 is offline   Reply With Quote
Old 7th July 2014, 12:08   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,160
What exactly do you mean with "the result is different"?

File hashes don't match? Files come out at different size? Files actually look different?

Anyway, as far as I remember, x264 is supposed to be deterministic (i.e. always gives the same result for the same input), unless you either specify "--non-deterministic" or use VBV.

So if you think you found a case where x264 is not deterministic, you should probably file a bug report. But, first of all, track down the particular option that causes this!
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 7th July 2014 at 14:49.
LoRd_MuldeR is offline   Reply With Quote
Old 7th July 2014, 20:29   #3  |  Link
kabelbrand
Compression mode: Lousy
 
kabelbrand's Avatar
 
Join Date: Mar 2009
Location: Hamburg, Germany
Posts: 74
Quote:
Originally Posted by xkfz007 View Post
However, each time the result is different. How could that be possible?
You won't get bit identical results if you use more than one thread.
See here: http://forum.doom9.org/showthread.php?p=956564#post956564
kabelbrand is offline   Reply With Quote
Old 7th July 2014, 21:23   #4  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,160
Quote:
Originally Posted by kabelbrand View Post
You won't get bit identical results if you use more than one thread.
See here: http://forum.doom9.org/showthread.php?p=956564#post956564
I don't think that's quite correct. x264 synchronizes the threads in a way that guarantees deterministic results – unless the "--non-deterministic" switch is used.

At least that's how it's supposed to work
Quote:
--non-deterministic
Slightly improve quality of SMP, at the cost of repeatability
See also:
http://mewiki.project357.com/wiki/X2...-deterministic


The major exception here is VBV – which, according to the developers, is inherently non-determinsitc. But he didn't use VBV, so that can't be the reason.
__________________
There was of course no way of knowing whether you were being watched at any given moment.
How often, or on what system, the Thought Police plugged in on any individual wire was guesswork.



Last edited by LoRd_MuldeR; 7th July 2014 at 21:36.
LoRd_MuldeR is offline   Reply With Quote
Old 8th July 2014, 02:05   #5  |  Link
xkfz007
Registered User
 
Join Date: Sep 2013
Posts: 38
Quote:
Originally Posted by LoRd_MuldeR View Post
The major exception here is VBV – which, according to the developers, is inherently non-determinsitc. But he didn't use VBV, so that can't be the reason.
Yeah, I didn't use the VBV.
I have found the reason.
In my running of X264, multithreads and MB-TREE are enabled. When thread number is larger than 1, two more threads will be created, which are the IOThread and a LookaheadThread. When the IOThread and the MainThread run faster than LookaheadThread, much more frames will be put in the lookahead->ifbuf. So the frame number in lookahead->next will be larger than the number decided in the command line(--rc-lookahead) and this makes the MB-TREE analyse more frames and the QP offsets will be different.
BTW, the default value of b_determinstic in my codes is changed to 0, so the results are different. When the b_determinstic is set to 1, the results are the same.
The results, I mean, the final PSNR values and bitrate.
xkfz007 is offline   Reply With Quote
Old 8th July 2014, 09:29   #6  |  Link
MasterNobody
Registered User
 
Join Date: Jul 2007
Posts: 528
Quote:
Originally Posted by xkfz007 View Post
BTW, the default value of b_determinstic in my codes is changed to 0, so the results are different. When the b_determinstic is set to 1, the results are the same.
Then why are you asking? You specifically asked libx264 to not care about deterministic result (--non-deterministic).
MasterNobody is offline   Reply With Quote
Old 8th July 2014, 12:05   #7  |  Link
xkfz007
Registered User
 
Join Date: Sep 2013
Posts: 38
Quote:
Originally Posted by MasterNobody View Post
Then why are you asking? You specifically asked libx264 to not care about deterministic result (--non-deterministic).
At first, I didn't know it was changed. The x264 source I used is a project transplanted to Windows (a version in 2012) by others. Then through this Post, I realised the variable b_deterministic and found it was changed in the x264_param_default function.
xkfz007 is offline   Reply With Quote
Old 8th July 2014, 14:50   #8  |  Link
kabelbrand
Compression mode: Lousy
 
kabelbrand's Avatar
 
Join Date: Mar 2009
Location: Hamburg, Germany
Posts: 74
Quote:
Originally Posted by LoRd_MuldeR View Post
The major exception here is VBV which, according to the developers, is inherently non-determinsitc. But he didn't use VBV, so that can't be the reason.
You are right, I totally forgot this is VBV related.
kabelbrand is offline   Reply With Quote
Reply

Tags
x264

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:49.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.