The Definition of SAO:
Sample Adaptive Offset(SAO) is a kind of in-loop filter in HEVC codec. (there are also Deblocking Filter and Adaptive Loop Filter). HEVC codec use 4×4-32×32 block size for motion-compensated prediction, while AVC only use 4×4-16×16. HEVC can also use rectangle unit(e.g. 16×4) to process prediction. The bigger unit used in encoding, the smaller file size it will be. But it can also cause more artifacts(such as Ringing).
The key idea of SAO is to reduce sample distortion by first classifying reconstructed samples into different categories, obtaining an offset for each category, and then adding the offset to each sample of the category. The offset of each category is properly calculated at the encoder and explicitly signaled to the decoder for reducing sample distortion effectively, while the classification of each
sample is performed at both the encoder and the decoder for saving side information significantly.(Sample Adaptive Offset in the HEVC Standard IEEE)
a little demo:
the document of x265 says that, it can seeing 10% speed benefits at faster presets. It is not very important for me, but I want to use this parameter to solve the side effect of SAO.
The most typical side effect is the daubed texture:
On the right side of this picture, you can see the toy, staying on the top of the cabinet, becomes blur with SAO parameter.
I read the paper about SAO then I find: “From the statistical analyses –, the EO in HEVC disallows sharpening and sends absolute values of offsets, while signs of offsets are implicitly derived according to EO categories.” (Sample Adaptive Offset in the HEVC Standard), It means that nowadays, SAO can only cause blur, no longer become sharper.
“Fig.6. can be used to explain why BO works in a few circumstances. The horizontal axis and the vertical axis are not explicitly shown but are used to denote the sample position and the sample value, respectively. The dotted curve is the original samples, while the solid curve is the reconstructed samples, which might be corrupted by quantization errors of prediction residues and phase shifts due to coded motion vectors deviating from the true motions. In this example, the reconstructed samples are shifted to the left of the original samples, which systematically results in negative errors that can be corrected by BO for bands k, k + 1, k + 2, and k + 3.”(Sample Adaptive Offset in the HEVC Standard)So we can know that SAO don’t apply very accurate offset to the result, sometime it will cause another distortion.
We can find the Blur artifact reduced with limit-sao, and some other artifact comes back(ringing, noising).
From my point of view:
- limit-sao can limit the artifact causing by SAO in both P and B frame.
- SAO can improve visual effect. (reduce noise and ringing around edges)
- I think texture enhance will solve some of the problem, caused by SAO