[x264-devel] Encoder questions

Loren Merritt lorenm at u.washington.edu
Thu Nov 1 18:01:19 CET 2018


On Thu, 1 Nov 2018, vpstranger at tutanota.com wrote:

> The default deadzone size (21 for inter blocks,11 for intra) seems large to
> me. If the 21 interval is centered at zero, then all the frequency
> coefficients less than 10.5 will turn to zero with this deadzone. As I
> understand, there are quite many of them which are lower than this value and
> the compression literature that I read mentioned much less deadzone. So why
> is it so big?

The deadzone parameter is a fixed-point number, divide it by 64 to get the
logical value. Also, it applies to each side of zero, not split in half;
and is in addition to the amount of deadzone implied by "round to nearest".

So a deadzone parameter of "0" means that coefs up to 0.5 round down to 0.
A parameter of "21" means that coefs up to 0.83 round down to 0.
A parameter of "64" means that coefs up to 1.5 round down to 0.

> When I see the encode stats for each frame, I see that for all B frames there
> is the amount of P blocks listed and no B blocks. I assume it is a program
> error, isn't it?

The each-frame stats line just doesn't distinguish between P blocks and B
blocks, they're added to the same counter.

If the summary at the end of the encode says something like
"L0:39.7% L1:42.9% BI:17.4%", then it's working correctly.
If it hypothetically said "L0:100% L1:0% Bi:0%", that would indicate
P-blocks in B-frames.

> When I tried to calculate SSIM for each frame, I got a warning in the log
> that with adaptive quantization turned off SSIM calculation will be
> incorrect. I don't understand how these two are related. Adaptive
> quantization modifies quantization parameter values for different blocks in a
> frame, so why is it not possible to calculate the metric correctly if it is
> turned off?

The SSIM measured in that situation is still true, it's just not as useful.

Basically, the main reason you'd turn off AQ is if you want the encoder
to optimize for PSNR at the expense of every other metric. In which case
you probably want to measure PSNR too, rather than the other metrics you
told it to sacrifice. (There could be weird use-cases that justify
otherwise, of course.)

--Loren Merritt


More information about the x264-devel mailing list