Log in

View Full Version : Question about the use of 6of9 in 1-pass const. quant


aabxx
3rd February 2007, 21:28
Would there be any benefit to using 6of9@q3 instead of mpeg@q2 or will they look basically the same? Do CQMs work directly on b-frames at all?

HeadBangeR77
3rd February 2007, 22:56
Would there be any benefit to using 6of9@q3 instead of mpeg@q2 or will they look basically the same? Do CQMs work directly on b-frames at all?
CQMs work directly on compression of every possible frame: in other words they cooperate with the codec, and decide together what details should be left out and which should be kept in an encode (tis maybe a bit simplistic, but still describes the encoding process pretty good, imo).

To tell you the truth: unless you have a favourite movie, which you can watch again and again, there are rarely visible differences between matrices, when you encode in 2 passes with the same target filesize/bitrate (yet in some cases the difference will be visible, like a comparison between H.263 and Didee's SixOfNine). However, in case of one pass constant quantizer mode the answer is yes, though it depends on experience and your personal expectations. Some would say: this one looks good, and the other one too, so what's the difference? The others would mark the difference by looking at details in low-motion scenes, or marking one matrice is more blocky on high-motion while the other isn't (btw. Didee's SixOfNine is rather blocky).

So, if you really want to dig into CQMs, you should pick up a favourite scene from one of your favourite movies and encode dozens of samples with different matrices, yet exactly the same settings. And then you will turn into a quality freak like me. :D

cheers,
HDBR77

henryho_hk
4th February 2007, 01:38
I would put it in this way: At the same constant quantizer level, I don't think 6of9 is more blocky than MPEG. It will simply consume higher bitrate. At the same (low) bitrate, 6of9 will be more blocky than MPEG.

HeadBangeR77
4th February 2007, 02:26
I would put it in this way: At the same constant quantizer level, I don't think 6of9 is more blocky than MPEG. It will simply consume higher bitrate. At the same (low) bitrate, 6of9 will be more blocky than MPEG.
True enough, I didn't express myself precisely though. Didee's SixOfNine is more blocky than a few other high bitrate matrices I've used so far, and this at the same bitrate and the same settings. The reason for that might be its rather even compression of high and low frequencies, both intra and inter, while the others follow the pattern to compress high frequencies more. Nevertheless, it's still one of my favourites. :)

Teegedeck
4th February 2007, 12:04
Would there be any benefit to using 6of9@q3 instead of mpeg@q2 or will they look basically the same?
The simple answer is: No. You MUST use the same quantization matrix for first and second pass!

MPEG lends itself to high or medium compression, SixOfNine to low compression.

Run a comp-check as described in the XviD presets thread for your specific use-case and you'll know whether to use SixOfNine or MPEG this time. On both passes.

Do CQMs work directly on b-frames at all?
Yes.

HeadBangeR77
4th February 2007, 14:50
@ Teegedeck:

He's got "1-pass constant quantizer" in the title of the opening post. ;)
Hmmm, according to some samples I encoded a few month ago (rather high motion) the MPEG matrice at Q2 and Didee's SixOfNine at Q3 tend to utilize similar bitrate. I would have to take a closer look at the samples to judge on the quality, but I'm busy atm, sorry.

Teegedeck
4th February 2007, 22:00
Hm, indeed. I could have sworn it was '1st pass'. :) Never answer posts in a hurry if you're me. ;)

Didée
5th February 2007, 00:49
Hmmm, according to some samples I encoded a few month ago (rather high motion) the MPEG matrice at Q2 and Didee's SixOfNine at Q3 tend to utilize similar bitrate.
That's the intended effect. In the sense of "strength of quantization":

>> 6of9 = mpeg-std * (6/9)

I.e. took the standard matrix, scaled all coefficients to 66%, then smoothed out the steps a little. Both matrices essentially have the same "shape". (exept for the bottom-right hi-freq area, but during encoding with "usual" bitrates, those coeffs are just zero most of all times, anyway.;):p)
The aim was to have a matrix with the same characteristics (-> same "shape") as the standard, but with finer granularity of quantizer steps. And hence, indeed, a q2 encode with mpeg-std is about equal to a q3 encode with 6of9.

That's why it seems strange that 6of9 should be "more blocky" than the standard matrix. "Seeing things", perhaps? Since the "shape" is the same, the characteristics at comparable fixed quantizers is the same. There's no reason why *the matrix* should produce more blocking ... for lower bitrates, there might arise differences because *the codec* uses different ME strategies, but that's another story.
As said, 6of9 offers better scalability for rather hi-Q 2-pass encodings (those with quant range q2-q3/4 with mpeg-std). And for those cases where the quality of standard's q2 isn't enough, using 6of9's q2 is more practical than using standard's q1.

aabxx
5th February 2007, 01:08
Ah, that explains a lot.

So basically the reason for using it at q3 instead of mpeg@q2 would be that the +1/2 quant jump in b-frames and AQ will not be as dramatic as with the mpeg matrix. Which also would mean that if I want to gain the compressibility amount I'm used to gaining from b-frames, using your "golden ratio" for b-frames would not be so wise with 6of9.

Which again means that the only reason I would want to use 6of9 at constant quant 1-pass encoding is if I want to use an "intermediate" quant (like 6of9@q2 which would be something like ~1,33 with mpeg right?) or if I want to use b-frames and/or AQ and I want the quantization steps to be more gentle / use more intermediate quant.

Didée
5th February 2007, 02:01
Bingo.

Perhaps except for
Which also would mean that if I want to gain the compressibility amount I'm used to gaining from b-frames, using your "golden ratio" for b-frames would not be so wise with 6of9.
which is a matter of how you look at it. From the point of gain-in-compressibility: yes. From the point of subjective qualitiy: not necessarily ... for my eyes, especially in those parts where quality degradations hurt the most (e.g. in dark scenes / with motion), the "gain" of B-frames sometimes is plain murder. For those parts I prefer more "careful" B-frame settings (small offset, and only one B-frame). But then again, that's less optimal for those much more forgiving high-contrast scenes ... not enough HVS modelling in Xvid, alas.

HeadBangeR77
5th February 2007, 02:08
That's the intended effect. In the sense of "strength of quantization":

>> 6of9 = mpeg-std * (6/9)

I.e. took the standard matrix, scaled all coefficients to 66%, then smoothed out the steps a little. Both matrices essentially have the same "shape". (exept for the bottom-right hi-freq area, but during encoding with "usual" bitrates, those coeffs are just zero most of all times, anyway.;):p)

The aim was to have a matrix with the same characteristics (-> same "shape") as the standard, but with finer granularity of quantizer steps. And hence, indeed, a q2 encode with mpeg-std is about equal to a q3 encode with 6of9.
Hi Didée! ;)
This corresponds well with what you explained once (olala, almost 3 years ago!):

http://forum.doom9.org/showthread.php?p=461740#post461740

When we put the linked post and the quoted one together it makes the whole story. As you see, I'm trying to be a good pupil. :D

That's why it seems strange that 6of9 should be "more blocky" than the standard matrix. "Seeing things", perhaps?
(...)
Seeing words, that are not there, perhaps? ;)

True enough, I didn't express myself precisely though. Didee's SixOfNine is more blocky than a few other high bitrate matrices I've used so far, and this at the same bitrate and the same settings. - a few posts above.

I've marked the above on some very nasty blocky source. I've compared yours to Heini's (heini_lr_6o9.xcm):
http://forum.doom9.org/showthread.php?p=854722#post854722
The bitrate was really high (see below, if you found sime time), the source was nasty, and your SixOfNine seemed to increase the blockiness slightly, while the other reduced the blocks by a small amount. After all, an encode with your one got better metrics, since it was probably more faithfull to the source, while an encode with Heini's got worse metrics, yet achieved a bit better visual quality, and that's what matters most for me.

Is Sagittaire always thinking in "either 0 or 1" terms?
http://forum.doom9.org/showthread.php?p=949290#post949290

I've stepped onto "enemy's territory". There is a battle ... errr ... a friendly competition going on. :D

all the best,
HDBR77

aabxx
5th February 2007, 02:14
didee:

I see. Thanks for the explanations. I'm going to try using 6of9 from now on, I like the concept behind it.

Didée
5th February 2007, 03:03
Seeing words, that are not there, perhaps? ;)
No. Just survey ... the words weren't yours:
I would put it in this way: At the same constant quantizer level, I don't think 6of9 is more blocky than MPEG. It will simply consume higher bitrate. At the same (low) bitrate, 6of9 will be more blocky than MPEG.
;)

HeadBangeR77
5th February 2007, 03:16
No. Just survey ... the words weren't yours:

;)
Ooops, Entschuldigung, you didn't specify to whom you were writing. :o
I'm working on your matrice and "grain retention" atm. :D

good night

Razorholt
5th February 2007, 06:28
Which also would mean that if I want to gain the compressibility amount I'm used to gaining from b-frames, using your "golden ratio" for b-frames would not be so wise with 6of9.

What would be wise then for B-VOPs using 6of9?


Thanks,
- Dan