Log in

View Full Version : Subme and psy


movmasty
14th January 2016, 12:53
If one is going to not use psy,

it is right to assume that subme 5 - Multi QPel + bi - directional motion estimation
is the same as 6 - Rate Distortion(RD) on I/P ?

foxyshadis
14th January 2016, 14:34
subme 6 is subme 5 + b8x8 + rd + psyrd + an extra qpel iteration.

bi-dir is already enabled at 5. There is no way to turn on rd without using at least subme 6; that's the minimum condition in the code.

movmasty
14th January 2016, 18:45
subme 6 is subme 5 + b8x8 + rd + psyrd + an extra qpel iteration..
Many thanks, but isnt b8x8 an independent option set in partitions?

I guess that the only function of RD, at this level at least, is to turn on psyrd.
But, since at 6 --psy=1 even if --psy_rd=0.00:0.00 is it right that --psy_rd=0.00:0.00 doesnt mean no psy,
but just the default level of psy?

And, what is the difference between RD and RDO?

LoRd_MuldeR
14th January 2016, 19:45
I think "RD" is just a shorthand for RDO (Rate-Distortion-Optimization) ;)

The idea of RDO is to not just pick the solution that gives the smallest "error" (distortion), but to pick the one that gives the best trade-off between "error" (distortion) vs. "bit cost" (rate). In other words, the encoder would pick a somewhat "worse" solution, if that saves a lot of bits - bits better used elsewhere. Clearly, RDO requies more computation, because for each possible decision you have to evaluate the resulting "error" and the number of bits required to code that decision.

Psy-RDO extends on that idea, by changing how "error" (distortion) is measured. Traditionally, the "error" has been measured as SAD (sum of absolute differences) or MSE (mean squared error). So, simply put, it just tries to keep each pixel as close to the original pixel as possible. Psy-RDO builds on the insight that a somewhat larger "error" (in terms of the traditional definition) is acceptable for the human eye, as long as we keep the "degree of detail" (complexity) close to the original. In other words, you rather want to see a "detailed" picture than a very "smooth" (blurry) one, even if that actually means a larger divergence from the original.

As implemented in x264, you can not have Psy-RDO without RDO, since Psy-RDO is more a tweak to how RDO operates. You can have RDO without "Psy" though.

movmasty
14th January 2016, 23:50
Thanks, but if i have RDO, and psy set to 0:00, this doesnt mean that i have no psy, but a default value of psy,, right?
since the report says: --psy=1 --psy_rd=0.00:0.00

LoRd_MuldeR
15th January 2016, 01:09
Thanks, but if i have RDO, and psy set to 0:00, this doesnt mean that i have no psy, but a default value of psy,, right?
since the report says: --psy=1 --psy_rd=0.00:0.00

If you set "--psy-rd 0:0" you disable both, Psy-RDO (first number) and Psy-Trellis (second number). You would still get "traditional" RDO though, as long as you have "subme ≥ 6". With "subme < 6" you don't get any RDO (also no Psy-RDO).

The "--no-psy" option disables "some internal psy optimizations that aren't settable via x264's command line arguments". There is no "--psy" option that I'm aware of ;)

movmasty
15th January 2016, 04:54
OK, i did wrong to modify the internal report, that said
psy=1 psy_rd=0.00:0.00
Mediainfo
/ psy=1 / psy_rd=0.00:0.00 /
no --, it isnt a command, but psy=1 should be enabled setting subme 6 and over i guess
and in these reports i have psy=1 psy_rd=0.00:0.00
there psy is on or off?

LoRd_MuldeR
15th January 2016, 17:14
OK, i did wrong to modify the internal report, that said
psy=1 psy_rd=0.00:0.00
Mediainfo
/ psy=1 / psy_rd=0.00:0.00 /
no --, it isnt a command, but psy=1 should be enabled setting subme 6 and over i guess
and in these reports i have psy=1 psy_rd=0.00:0.00
there psy is on or off?

Psy-RDO and Psy-Trellis are two "psy" features of x264. The option "--psy-rd x:y" is used to control the strength of Psy-RDO and Psy-Trellis, respectively. That's the "psy_rd=x:y" in your report. Default is "1.0:0.0", by the way.

Setting the strength to zero will effectively disable Psy-RDO and/or Psy-Trellis (but "normal" RDO and/or Trellis may still be enabled). Psy-Trellis is disabled by default.

Furthermore, there exist other "psy" hacks in x264. To really disable everything "psy"-related, you can use the "--no-psy" option. You do not want that though! And the "psy=1" in your report indicates that, indeed, "--no-psy" was not used.


See the original commit message (http://git.videolan.org/?p=x264.git;a=commit;h=835ccc3cec908b1febfd31613d3e6583628116b3) for details:

Add a new option, --no-psy, to disable all psy optimizations that don't improve PSNR or SSIM.
This disables psy-RD/trellis, but also other more subtle internal psy optimizations that can't be controlled directly via external parameters.

an3k
15th January 2016, 18:04
Where can I read about all these features and what they mean and actually do? Looks more difficult to me than actually writing the code for such an encoder :)

LoRd_MuldeR
15th January 2016, 18:47
Where can I read about all these features and what they mean and actually do?

http://git.videolan.org/?p=x264.git;a=blob;f=encoder/analyse.c
http://git.videolan.org/?p=x264.git;a=blob;f=encoder/encoder.c
http://git.videolan.org/?p=x264.git;a=blob;f=encoder/slicetype.c

Watch out for "param.analyse.b_psy" ;)

(I think it's more a couple of subtle tweaks/hacks than large-scale "features")

movmasty
15th January 2016, 21:11
OK, i did wrong to modify the internal report, that said
psy=1 psy_rd=0.00:0.00
Mediainfo
/ psy=1 / psy_rd=0.00:0.00 /
no --, it isnt a command, but psy=1 should be enabled setting subme 6 and over i guess
and in these reports i have psy=1 psy_rd=0.00:0.00
there psy is on or off?
Thanks