Log in

View Full Version : In HEVC, only QP=4 is truly lossless quantization... what about 0~3?


iAvoe
2nd August 2018, 10:48
This is definitly very hard to answer, the document source: x265.readthedocs.io/en/default/lossless.html

Updated - Aug.16:
Quantization is the process of dividing the DCT coefficients by another matrix that is sorted by quantizer, when specifed QP=0, x265 skips dividing and gives output. When QP=4, x265 gives a lossless output that is same as x264's QP=0.

Since value 0~3 are available, and 0 disables quantization, it appears the --qp option has 4 states:
0 disable, 1~3 unknown, 4 lossless and 5~51 x264Setting+4

I thought this could be an error in the doc, but they also says the highest RDO optmization is --qp 4, which it's lossless.
Since 4 is --qp 0 in x264, it looks like we need to give a +-4 to switch encoders, but it won't make sense when the maximum of --qp is 51.

iAvoe
2nd August 2018, 11:09
I'm trying to understand this means, the original URL is: x265.readthedocs.io/en/default/lossless.html

I think they're saying about when parameter --qp is set to 4, and it will do the same as --qp 0 in x264... and this makes confusion to me:confused:

In x264 screen recording, I prefer using --qp 0 instead of CRF mode to save processing power and make the output as sharp as possible to make editing easy (and other encoding elements doesn't affect the video much to me), if one day x265 screen record is available, then this setting is became weird you know

iAvoe
2nd August 2018, 12:31
and with further study, I feel it is more like for instructing DCT transformation better, because in very low CRF mode, you want the output to be as sharp as possible, so they have increased the "--qp 0" gap where if the decision lands among 0~3, the DCT transformation is disabled because it's worth to output that detail untouched, but when it's 4, the divisor for DCT matrix became 1, so this is equivalent as "--qp 1" in x264, am I right?

benwaggoner
2nd August 2018, 19:32
It's worth noting that HEVC can do both transform skip (--tskip) which is lossy encoding but without the initial frequency domain transform for a CU and Lossless CU (--cu-lossless) which is true lossless encoding of a CU. Both can be used on a per CU basis, and both can be used in the same frame.

iAvoe
3rd August 2018, 00:23
Thanks for reply! Actually that's why this is confusing to me, if we are already able to skip DCT transform then what are they thinking about it, and it seems that DCT transform it what I only know about quantization, is there some thing that I'm missing?

Asmodian
3rd August 2018, 09:16
Quantization (https://en.wikipedia.org/wiki/Quantization_(image_processing)) is dividing the coefficients from the DCT transform, not the transform itself.

Note the use of both a quantizer scale code and a quantization matrix, you can vary the strength of the quantization by varying the scale code. I believe this is what we usually think of as the quantizer (qp) but the quantization matrix can still do something even if it is one. You can also simply keep the DCT coefficient matrix untouched, do the DCT transform but not use the quantization matrix at all.