Log in

View Full Version : x264's quantizer decision based on rows?


Caroliano
28th January 2010, 05:05
I'm looking on ffdshow's visualizations, and the macroblock quantizers aways seems to be more or less organized by rows. Only something very drastic (http://img15.imageshack.us/img15/5597/diverse.png) makes the quantizer not be the same as the quantizer of neighbour macroblock, but it is not related at all with upper or lower macroblocks.

http://img687.imageshack.us/img687/8306/openingdor.jpg

In this other one, the macroblocks above the screen remain the same quantizer all the time, the lines at each side of the screen change independently at each frame, and the block below the screen changes each frame together:

http://img687.imageshack.us/img687/4686/smallscreen.jpg

Is this behavior normal and intended? An speed optmization? It just don't seems very clever... Or maybe ffdshow's visualization is buggy?

Megui's generated commandline:
--preset veryslow --tune animation --crf 18 --thread-input --bframes 8 --ref 16 --qcomp 0.75

Dark Shikari
28th January 2010, 05:15
The quantizer is only coded in the bitstream if there's coded coefficients in the block. This means that empty blocks (skip or otherwise) are displayed, when using the OSD, as using the quantizer of the previous block in raster-scan order.

So it may appear as if the quantizers are varying on a per-row basis, when in actuality it's just that none of that row even has coded coefficients, so it's displaying the most recent quantizer used.

Coincidentally, you are right, but not as you expected: x264 does actually vary the quantizer per-row, but only when VBV is on.

Caroliano
28th January 2010, 05:35
Oh, I understand. So, FFdshow's visualization is buggy, as it is showing as the block quantizer one that is not the quantizer of the block, but from a unrelated previous block in raster-scan order? The correct behaviour would be to say that it is a empty block, maybe with an "/" instead of the number, for example, right?

Coincidentally, you are right, but not as you expected: x264 does actually vary the quantizer per-row, but only when VBV is on.
When Periodic Intra Refresh is enabled? Or even not using it? And may I ask, why is that? (pure curiosity ^^)

Dark Shikari
28th January 2010, 05:37
Oh, I understand. So, FFdshow's visualization is buggy, as it is showing as the block quantizer one that is not the quantizer of the block, but from a unrelated previous block in raster-scan order? The correct behaviour would be to say that it is a empty block, maybe with an "/" instead of the number, for example, right?


When Periodic Intra Refresh is enabled? Or even not using it? And may I ask, why is that? (pure curiosity ^^)No, when VBV is on, because it varies the quantizer on a per-row basis in order to absolutely make sure that the frame isn't too much bigger than expected (and would thus underflow VBV).

Caroliano
28th January 2010, 05:47
My curiosity is satisfied (for now :devil:). :thanks: