Log in

View Full Version : x264 noise reduction - pixel range and proportionality to frame size.


benwaggoner
22nd February 2013, 18:55
So, the built-in x264 noise reduction is pretty darn good when it comes to good quality (edge preservation and static texture preservation while getting rid of random noise and grain) at low CPU overhead.

I'm trying to figure out how the strength of it should vary with different frame sizes. In initial tests, with the same source higher values are appropriate at higher output frame sizes.

At this point, strength linear to single-axis scaling looks around right (so 1920x1080 at 500 would give a similar result as 960x540 at 250).

Does anyone have a high-level description of the algorithm? Does it have a fixed pixel range, so higher values are just reducing the same noise more? Or is is a noise threshold, where lowering values exclude lighter noise from processing? Or do higher values actually increase the number of pixels included in the processing somehow?

Dark Shikari
22nd February 2013, 22:40
x264's noise reduction is way simpler than you figure it is -- it's just an adaptive deadzone applied after DCT (subtracting from DCT coefficients), before quantization, on inter blocks. It does no pixel-level filtering, doesn't cross DCT block boundaries, has no overlap, doesn't affect intra blocks, and really all-in-all doesn't have much going for it besides being incredibly fast.

benwaggoner
22nd February 2013, 23:12
x264's noise reduction is way simpler than you figure it is -- it's just an adaptive deadzone applied after DCT (subtracting from DCT coefficients), before quantization, on inter blocks. It does no pixel-level filtering, doesn't cross DCT block boundaries, has no overlap, doesn't affect intra blocks, and really all-in-all doesn't have much going for it besides being incredibly fast.

Yet it works so great anyway in impact in the encoded result! Implementing as ADZ probably tunes really nicely to help compression compared to a "blind" denoiser. Does it really only apply to intra blocks? It does a nice job with noise in moving parts of the video. Perhaps an interest interplay with MBTree?

Anyway, what does the strength parameter do? Just increase the minimum coefficients to be in the ADZ?

Based on this, it doesn't seem frame size should matter all that much. Maybe some if what I saw came from using Main on the SD streams and High on the HD streams?

Dark Shikari
22nd February 2013, 23:51
Strength is just a raw multiplier for the amount to subtract from each coefficient. See x264_noise_reduction_update in encoder/macroblock.c.

akupenguin
23rd February 2013, 20:52
Does it really only apply to intra blocks?
Inter only. The idea is to make each block more similar to the reference block that it's predicted from, thus attenuating temporally-varying texture. In intra we don't have a reference block, so it wouldn't make sense.

benwaggoner
25th February 2013, 18:45
Inter only. The idea is to make each block more similar to the reference block that it's predicted from, thus attenuating temporally-varying texture. In intra we don't have a reference block, so it wouldn't make sense.
Ah, that makes much more sense. And better matches what I'm seeing in practice.

Thanks for the clarification.

movmasty
6th March 2013, 20:54
So, the built-in x264 noise reduction is pretty darn good when it comes to good quality (edge preservation and static texture preservation while getting rid of random noise and grain) at low CPU overhead.

I'm trying to figure out how the strength of it should vary with different frame sizes. In initial tests, with the same source higher values are appropriate at higher output frame sizes.

At this point, strength linear to single-axis scaling looks around right (so 1920x1080 at 500 would give a similar result as 960x540 at 250).
This happens because, generally, the same levels of compression, for any parametre, is light with big pictures and harder with small,
and not because the range is set.
I would say that 300 at 640x is like 500 at 1920x
To not affect the quality at 640x dont go over 300
and to have not any visual impact not over 200.
another thing is that the impact is different for every movie
so for one you have to use 150-200,
and for another you could use 250-350.
Thus doing a test is mandatory.