View Full Version : use Alt. Curve!


Teegedeck
24th March 2002, 16:33
;)

Today, I thought it's time to befriend the alternative curve compression a little. And what do you know, it makes a wonderful friend, once you get to know it a little! :)

The thing I like best about it was that you can't (almost) entirely screw an encode, no matter what nonsense values you set! That is a big step forward to usability for newbies!

The 'hi distance, lo distance' values showed less effect than I had thought, I'll experiment more with it.

The 'aggressiveness'-levels work more or less like a smoother, did I get that right? [EDIT: nope, utterly WRONG, see posts below.]

Now, the 'minimum relative quality' is the thing I had been looking for; setting it lower will give a bias towards small frames, setting it higher will give a bias towards big frames. Correct?[EDIT: not quite, or not only. It mainly seems to restrict the range of quantizers - higher value, less fluctuation. I hope I'm right, this time.... See posts below.]

And the automatic mode with 'strength' will calculate meaningful values with regard to the movie's compressibility. Only that it's quite the other way round here; lower values will improve big frames and higher values improve small frames.

In all I am VERY happy with the alternative CC! Congratulations for your work, Foxer. The settings aren't very intuitive, but it's now possible to set the same defaults for high and low bitrate encodings alike. Good!

Teegedeck
25th March 2002, 13:28
OK, last time 'min. relative quality' protected me from getting _extreme_ results, but now I've set it to '1' and tried to utterly mess up my encoding. ;) The idea is, however to find out what setting triggers what tendency if not countered by the quality-setting.

I don't recommend any of the distance-settings I tried for an actual encoding session; min. quality and distances work together and it seems much more senseful to leave distances at reasonable values and fiddle with the quality-setting. And even better, to leave it at 'automatic' and use 'strength'.

I merely tried to find out what setting triggers what behaviour; lateron we could think about the merits of altering the 'distance' presets.

[EDIT: As I now know that I was mistaken to take the 'curve aggression' type as a simple smoother - it determines in fact the shape of the curve for bitrate distribution - I see that I should have used the 'medium' setting for meaningful testing. My results till now aren't worth anything, back to testing. :(]

Teegedeck
25th March 2002, 13:59
OK, finally saw the picture explaining the new CC and it helped me to understand some things. Although everybody with an up-to-date build has it on his PC, I still think it's apt to include it in this thread, too. These CC-things tend to get a bit insider-ish.

Graph by Foxer:

wing1
25th March 2002, 16:30
@teegedeck

I look here first, and saw what u have said. Still don't understand or at least understand completely. I saw your graph and sort of understand a little.

Let me paraphrase what I've understood from your explaination and graph.

If i set aggressiveness level to LOW: This means I am applying smoother at a low level which doesn't blur the detail much, right?

Then I'd set high distance from % average to 200, which is -100 from average framesize, correct? This is best quality for LOW, correct?
That also goes for Low distance from average % too right?

Now what about the strength for minimum relative quality? I am assuming if u are working with big frame size ( at what resolution that qualifies a frame size as big? 640x480, 512x384, 704x480 ) you lower the % to something like 25-40, right? and small frame size you would increase it to 55-95%?

This is about as much as I've understood it.

Just letting it loose at default settings, I do see a major quality boost already. Just like to know what all the knobs are there for and how to turn them( I am a knobs freak ) :D

Teegedeck
25th March 2002, 16:58
Hi,

frankly, I'm as lost as you, trying to hit something in the dark as I was never good at maths. :)

I'd like to have a little discussion here, so we all understand the alt. curve a bit better and also I want to promote it as I think it's clearly better than the old one.

So I try to make simple theses and see if I can falsify or prove them. I'm aware of the risk of writing bull, again (like mistaking aggressiveness for a smoother). Bear with me, new algos are exciting...

The best thing about it is by no doubt the minimum relative quality. I've set it to '1' for my tests to easily see the quantizers jumping. But if you use it as you should ('automatic' with strength around 50, seems pretty good), it will effectively constrain the range of quantizers you're getting. I.e. the higher min. quality is set, the lower is the maximum quantizers you'll receive in your encoding.

Given that you use medium aggression for the bitrate curve (linear curve), it seems the high and low distances should have effects like this:
[EDIT: had to remove some things that I could falsify. anyone else cares testing?]
-If you set both distances higher, you'll see not many jumps in quantizers (VBR-like)
-If you lower both of them, you'll see many (CBR-style)

Anyway, these should only get obvious with a very, very small min. rel. quality

Altering the distances with an aggression type different from 'medium' will lead to extreme results.

Oh, I'd welcome anyone to just step in and correct us here!

Teegedeck
25th March 2002, 17:34
Originally posted by wing1

If i set aggressiveness level to LOW: This means I am applying smoother at a low level which doesn't blur the detail much, right?
Actually I was talking about bitrate-curve smoothering, not about smoother filters, but I was wrong, anyway. Put simply, high aggressiveness should treat big frames favourably, low agressivenss small frames.
Then I'd set high distance from % average to 200, which is -100 from average framesize, correct? This is best quality for LOW, correct?
That also goes for Low distance from average % too right?eh? (sorry)

Now what about the strength for minimum relative quality? I am assuming if u are working with big frame size ( at what resolution that qualifies a frame size as big? 640x480, 512x384, 704x480 ) you lower the % to something like 25-40, right? and small frame size you would increase it to 55-95%?
The figures in min. rel. quality are relative (using the AVERAGE FRAMESIZE of the source) and calculated based upon compressibily of the source in automatic mode, so you shouldn't need to change them at all. I guess 'strength' 50% guarantees a very reasonable range of quantizers. But if you can live with higher quants you can set it _higher_. The effect will actually be quite mild, as long aus you use the automatic mode.
Manually setting the min. rel. quality lower should make the effect of the agressiveness-level more extreme because it allows for higher quantizers at the low-quality end.

BTW, the graph was made by Foxer, I should've made that clear.

wing1
25th March 2002, 19:15
Just for testing purposes, what i did was this

1st try
high aggression
High % = 300
Low % = 300
strength = 25%
(everything else is set to auto)

details slightly blur, no macroblocks.

2nd try
low aggression
high % = 500
low % = 300
strength = 90%
details getting better but still not as sharp (sorta like edge enhancement effect with temporal smoother applied) no macroblocks.

3rd try
low aggression
high % = 200
low % =200
strength = 90%
details are sharp, you can see some macroblocks on flat area (walls, sky, mono color area) but overall details are excellent.

will try to tweak some more knobs with this option :D

Teegedeck
25th March 2002, 19:20
'blurriness', 'sharpness' etc. are just effects of the quantizers used on frames. For testing it's better to watch the debugview-output, so you can exactly tell how big a frame was and what quantizer it received. ^_^

Foxer
25th March 2002, 19:52
Hmm.. I apologize for not being able to explain the alt. curve system in a simpler way. I'll give it another try but first I need to clear something up.

The +300% you see on the .gif there is 300% for high distance and -300% is 300% for low distance. The distance to the goals you see the aggression levels aiming for are defined by these distances so, the further the distances are from the average framesize, the more stretched out the curve will be and the less quality variation there will be and the opposite is true here too. The closer the distances are to the average framesize, the more squashed the curve will be and the more variation there will be.

Keep in mind that all of this variation is determined by min relative quality and bonus bias aswell as the distances.

The aggression level determines how quick it is to change the encoding quality and as you can see in graph, with high and low distances of 300%, high aggression will change the encoding quality very very quickly and low aggression will change the encoding quality very very slowly. Here, one can say that low aggression will virtually only take bytes from the higher high bitrate frames and give them to mid-high and lower bitrate frames and high aggression will take bytes from anything above average and give them to anything below average lol.

One can think of 'strength' in the min relative quality automatic mode as how much of the calculated variation is allowed. I posted how min relative quality is calculated in the Cvs 2002-03-23 thread.

Bonus bias specifies how much of the bonus is to be distributed in a bias manner and the rest in a proportional manner so, the higher this value, the more preference towards low bitrate frames.

Hmm.. Looking back over this post, it seems about as winded as the rest lol

Hopefully from the 3 or 4 explanations I've posted so far, one can get an idea of how it works :)

ps.
I'm glad you like it Teegedeck :)

I hope a lot people will test it out and post the sensible values they find most useful for various types of video content so we can change the defaults to the most common of those.

pandv
25th March 2002, 21:13
So, if I understand correctly, there are 3 equations. One for each agression type. Or, 3 relations between the original bitrate (or size) and the new.

Maybe, Foxer, can you post the equations?

Pandv.

Teegedeck
25th March 2002, 22:00
@Foxer:
...just think of us 'listeners' as children when you have difficulties explaining stuff - an old and reliable method. :)

Foxer
25th March 2002, 22:09
You want the equations for the different aggression levels? heh
Ok..

First, the high and low thresholds & differences are calculated.
quality midpoint is = (1.0 + min relative quality / 100.0) / 2.0
quality deviation is = 1.0 - quality midpoint
Then of course if low distance is > 100% (negative threshold and unreachable), the quality deviation is scaled and the midpoint is repositioned so that best produced quality to min relative quality is still attainable.

The calculations in the curve application code.. I can't really put into simple terms.

Go here http://www.xvid.org/cgi-bin/cvsweb.cgi/vfw/src/codec.c open the latest revision, search for "dbytes > twopass->average_frame", scroll down a little and there they'll be. Case 2 is high, 1 is medium and 0 is low aggressiveness. Scroll up a little to the beginning of the prepass and you can see the setup code which does what I've described in this post.

wing1
26th March 2002, 07:25
After reading Foxer's two write ups and studing the graph many times over, It sort of make some sense to me ( forgive me for being slow at this sort of things ). However, there are still a few questions that remain. If you don't mind that I am asking; The graph has three labeled that cross the -100% from Average Framesize, which are Best High Quality, Best Medium Quality, and Best Low Quality. It seems to suggest that at 100% from Average Framesize best quality from all aggression settings can be achieved.

Furthermore, From the write ups, I gathered that the aggression setting that distributes the bit from the bitbucket the best is medium setting. The high setting would favor high motion scenes and low setting would favor low motion scenes. The minimum relative quality is set based on the strength % and it is inversely porportional if automatic mode is involked.

Based on that, I encode a few tests using these settings :

clip used is a trailer Desperado (encoded with mpg4v3)

aggression/high dist/low dist/strength % ~ filesize
high/300/300/75 ~ 11Mb
high/300/300/50 ~ 11Mb
high/300/300/25 ~ 11Mb
med/300/300/75 ~ 11Mb
med/300/300/50 ~ 11Mb
med/300/300/25 ~ 11Mb
low/300/300/75 ~ 11Mb
low/300/300/50 ~ 11Mb
low/300/300/25 ~ 11Mb
and i repeated for 200/200 and 100/100. Filesize seems to remain the same for all compression settings. The only things that i've observed different are the sharpness and the macroblock in high motion scenes from the results. The best to my eyes is med/100/100/25 thus far.

also, what i have observed is that the high/low distant blur/sharpen the detail along with the strength %, and the strength % also increase the macroblock noise in the results. Furthermore, I also observed the data flow during the encoding with respect to the aggression settings: bitrate increase/decrease faster if high setting is used and slower if low setting is used. The flat out data flow of the steady motion scene seems to be lower for high aggression (bigger quant) and higher for the low aggression (lower quant).

Foxer
26th March 2002, 08:00
It seems to suggest that at 100% from Average Framesize best quality from all aggression settings can be achieved.

That is where the best quality is achieved if low distance is >= 100%, yes.

Furthermore, From the write ups, I gathered that the aggression setting that distributes the bit from the bitbucket the best is medium setting. The high setting would favor high motion scenes and low setting would favor low motion scenes.

Hmm.. What you say there is strange to me.. High aggressiveness will change the quality very quickly and taper off as the framesize approaches the threshold and thus will hurt high bitrate frames and improve low bitrate frames the quickest. Low aggressiveness will change the quality very slowly and then very quickly as the framesize approaches the threshold and thus will probably only noticably hurt the higher high bitrate frames and improve lower bitrate frames a little.

Teegedeck
26th March 2002, 13:03
Could you or -h perhaps consider changing some of the functions' names? Right now, I understand that the high aggression setting is aggressive 'at' the high bitrates (right?), but it took a while... Perhaps it could help the ease of use if the agression settings were named like 'small-frame-friendly (CBR-ish)', 'neutral', 'big-frame-friendly (VBR-ish)'. I know these are ugly and perhaps wrong, just wanted to give an idea of what I mean to say. Likewise, would it make sense to replace the 'high'-distance with a 'best quality reached at % from average'-distance (and calculate the 'high'-distance internally, based on that) - or alternatively leave it the way it is, but rename the 'high'-distance to something like 'strongest compression starting at % from average framesize'? Too long and ugly, I know, but while I love the way the alt. curve works (again, best of all, you can't hurt yourself with it), I guess it's good not to let it evolve into a secret science. ;)

[I have to edit all of my posts in this thread a lot - seems no easy topic for me...]

OUTPinged_
26th March 2002, 16:12
mmm.... i've tested it a bit(yay).

sample used was an anime opening, ~1:30:000 long.

i wanted to test aggressiveness, distances and relative quality.


all i cared was a drf distribution. ( no frame number in dbview output is evil)


first, does old CC interfere with new algo? i got two different files when changed it.


well the new algo atm produces drf distribution similar to nandub's if used with linear aggression and is definitely better than old plain assym CC. Good work here Foxer.

doh, i suck with these foxer's CC algos. 11 samples and all are ugly. guess it will require alot of messing with it to get it working for me as predictable as nandubs rate/CC settings do.

pandv
26th March 2002, 16:42
Thank's Foxer,

I am with the source code now.

Pandv.

Foxer
26th March 2002, 21:05
@OUTPinged_
first, does old CC interfere with new algo? i got two different files when changed it.
Nope. If the alt curve system is enabled, regular CC high & low are ignored, though everything else under the two pass tab will still take affect.
ATM, after an encode, the core occasionally produces slightly different output given the same input so the best way to test for same output is to close & reopen vdub between encodes or make sure the starting frame's actual size is the same between encodes.

@pandv
no problem :)

rui
26th March 2002, 22:34
Well, i have been messing a bit with the alternative curve, and for what i could see, i agree with wing1.
The best settings were low agression, with high/low 100%. With these settings the picture seemed a litle bit sharper than the others. I tried all agression levels (high, medium and low) each one with 100% and 300%.
The subject was the trailer from the movie The Replacements, using 6 motion search precision, and H.263 quantization, since i used a 800kb bitrate.

Foxer
27th March 2002, 00:21
Ah. low/100/100.. I'm a bit hesitant to set the min relative quality threshold to only 2x average framesize (high of 100%)..

Have you tried like low aggression with low/high distances of 125/200 with a 20-25% higher automatic strength?

Might wind up putting in the option to choose different aggression levels for high and low bitrate frames heh

ps.
I meant 20-25% higher as in 1.2 to 1.25 times what you had it set at for low/100/100.

wing1
27th March 2002, 07:42
Looked at the foxer's graph once again and in particular the high aggression: Starting at -100% below Average frame size and crossing over to the plus size. The curve bottoms out around +225% and after that it does not seemed to add any advantage. So I did a few tests using:

High/225/100/5 @ 900kbps and it is amazing :D

5? 95% relative quality?

Foxer
27th March 2002, 08:14
You specified a strength of just 5%? That would produce virtually uncurved output.

The strength specifies how much of the calculated variation is allowed and how large that variation is depends on how small your desired size is in relation to the first pass's (quant2) size.

ps.
The goals for the 3 aggression levels are not fixed at +- 300%. The distances specify how far from the average framesize their goals are and therefore their shape & affect.

Teegedeck
27th March 2002, 12:18
I would love it if some people could tell us about how their settings affect _quantizer-distribution_. It's nice and helpful to hear about perceived visual quality but it think combining it with some figures would help even more.

Apo
27th March 2002, 12:47
HI everyone
I'm doing a lot of testings at the moment with the settings but I have to do them again because I think the target filesize was much to big to see big differences so I can't post my conclusion now, maybe later today or tomorrow I can.

@Teegedeck
Can you explane me where I can get the information about which quantizer is used?

Apo

sierrafoxtrot
27th March 2002, 13:05
@apo

you can use debugview which is available from www.sysinternals.com. just run it during encoding and you will capture the debug output of xvid, which will tell you quantizer values for each frame. which leads on the next question for ...

@teegedeck

how do i get an idea of quantizer distribution? can i do that from debugview or do i need another proggie? i'll be more than happy to run some tests once i get home.

cheers all.

Teegedeck
27th March 2002, 13:18
Originally posted by sierrafoxtrot

@teegedeck

how do i get an idea of quantizer distribution? can i do that from debugview or do i need another proggie?

-_- AFAIK there's no tool to visualize a debugview-logfile. So there's nothing we can do apart from staring at the output.

Apo
27th March 2002, 13:24
Can I somehow tell the prog that it should save the results of every encode? I have a job queue of about 10files, can I separate the debug output? If i can't I think the output will be almost useless.

Apo

FuFo
27th March 2002, 16:06
..

Hi all
Great work, alt. compr.

Is 1 pass indipendent by the CC or alt.comp used?

Thanks a lot

FuFo

Teegedeck
27th March 2002, 19:36
1st pass is always the same - it's not linked to Curve Compression.

sierrafoxtrot
27th March 2002, 22:55
... this feels like trying to do fourier transforms using mental arithmetic :( any chance that someone will be able to compile some sort of FAQ about the new curve compression algos? foxer's explainations pretty comprehensive, but most of it's going straight over my head.

i'm off work tomorrow so i _might_ try some systematic tests with debugview so i can keep an eye on quantizer distribution but don't count on it though, it looks like death by scientific method ;)

Apo
27th March 2002, 23:14
Just a short conclusion after my tests:

Low aggression with a high distance of 400 and low of 200 gave me the best result.
I also tried 100/100 und 500/500 with both high and low aggression.
Second best is 100/100 with high aggression so maybe with a bit more sensitive values settings similar to this could give the best result.

Strength has a big influence on the quality but I would leave it at 50 because neither a higher nor a smaller value gave only good results over the whole movie.

Apo

primitive
28th March 2002, 07:26
I'm trying to work this through one setting at a time, so bear with me.

First, aggression, because this is the one I think I actually have down. First, draw a low-100-100 (agg-high-low) bitrate curve. Now, draw the tangents to the curve which make a 45 degree angle with the horizontal; they should both be sloping to the left. Now, at each of those points of intersection between the tangent lines you drew and the curve, draw a vertical line passing through that point. Shade the area between these two vertical lines.

The shaded area represents the algorithm's bias toward low motion and high motion frames. If aggression is low, as in our case above, the band will be wide. If aggression is high, the band will be narrow. The moderate aggression will fall somewhere in between these two other bands.

This suggests that the optimal choice of aggression is dependent on the source material. If the change in motion throughout the movie is relatively small, then high aggression is preferred because the narrow band more closely matches the lack of diversity of motion in the source. Sources of this type would include frenetic anime that's all high-motion, all the time, or dramas that are almost solely low-motion. If the change in motion throughout the movie is relatively large, then low aggression is preferred because the wide band more closely matches the great diversity of motion in the source. The particular source I'm working with is the first episode of Ah! My Mini-Goddess, which is this type of source. Of course, moderate aggression is somewhere in between.

primitive
28th March 2002, 08:20
Now, high% and low%.

If what I said in the previous post is correct, high% and low% will skew the bitrate curve to the left or to the right.

For example, let's take the frenetic anime series that's solid high-motion. If you want to make sure these high-bitrate action scenes get all the bits they need, increase high%, say to 200%. What this will do is stretch the curve on the right side of the critical point, shifting that vertical line on the right hand side we drew in the last post to the right. This move should impose a bias toward high-bitrate frames, the types of frames we see most in this particular source.

Conversely, let's take the low-motion drama. Since there's very little motion, none of the frames are going to be that large; therefore, shifting the low% to 200% will widen the band on the low side of the curve and give more bits to these low action scenes.

What I don't quite understand yet is how the width of the band will effect the output. For example, for the Ah! My Mini-Goddess I'm working with, I'm going to be doing two test encodes while I sleep: the first will be low-200-100-50% (band width 300, bias high 66%) and the second will be low-400-200-50% (band width 600, bias high 66%). Biases are high 66% for each case; however, what effect does the wider band have on the output?

Foxer
28th March 2002, 09:04
Conversely, let's take the low-motion drama. Since there's very little motion, none of the frames are going to be that large; therefore, shifting the low% to 200% will widen the band on the low side of the curve and give more bits to these low action scenes.

Actually, increasing the low distance beyond 100% will cause the low curve to be cut off earlier (anything beyond -100% is unreachable because that would be a negative framesize) so less preference would be given to low bitrate scenes.

however, what effect does the wider band have on the output?

Have you read my explanation of the alt curve system in the Cvs 2002-03-23 thread or earlier in this thread?

Lowering the low distance will move the preference some towards low bitrate frames and as you correctly stated, increasing the high distance will move the preference some towards high bitrate frames.

ps.
I'm glad that people are trying out, and some even preferring, the alt curve system instead of staying away from it :)

LotionBoy
28th March 2002, 09:27
Originally posted by Foxer

I'm glad that people are trying out, and some even preferring, the alt curve system instead of staying away from it :)

of course we are. we like playing with new toys. :-) It would be cool, though, if someone (probably you Foxer, since you understand this better than any of us) gathered a lot of the explanations in different threads and condensed them into a post on the Xvid Q&A. Just to have a quick reference. :-)

LotionBoy

sierrafoxtrot
28th March 2002, 14:03
done a couple of tests with foxer's new algo, and here's the results. you'll probably have to walk me through the interpretations, greater minds than mine lurk in this forum ... ;)

all tests were carried out using a 5032 frame clip from ghostbusters. the initial bit is low motion and last third is high framesize high motion.

1st pass size 48194
2nd pass target 23000

1st test is with Hi% 200 Lo% 150 and auto strength at 50%

Quant Low Med Hi
2 130 210 295
3 1752 1830 1856
4 2705 2375 2123
5 445 617 755
6 3
Av Q 3.68 3.67 3.66

2nd test Hi% 100 Lo% 300 auto str50%

2 175 281 368
3 2045 1993 1941
4 2059 1903 1753
5 714 837 957
6 39 18 13
Av Q 3.68 3.66 3.66

2rd test Hi%300 Lo%300 auto str50%

2 15 100 183
3 1612 1810 1854
4 3100 2646 2399
5 302 475 595
6 3 1 1
Av Q 3.73 3.69 3.67

BTW, the purple bars are low agg, and light blue are high

in the attached image you can see the changes in quant distribution with different aggression settings. seems to me that low aggression settings tend to give higher numbers of lower quants ie 2s,3s and 4s, and higher aggression tends to distribute more evenly over various quantizers. can't really tell differences in visual quality ATM, the nine clips are doing my head in. will post more abt that when i can be more objective.

in the last pic, H300 L300 (to give the cc as much leeway as possible), high aggression distributes almost according to frame size, and i was wondering if doing a 2nd-pass and analysing DRF distribution will allow you to see which settings would be ideal.

low aggression gives sharper peaks with fewer high quant frames. this DRF distribution is almost certainly movie-specific, and allow you to make an educated guess to final settings for a 3rd pass.

any thoughts?

EDIT: darn attachment didn't make it ... do i need a mod to validate it? actually how do i insert an image into the post itself (like the graph Teegedeck did in an earlier post)?

Apo
28th March 2002, 16:22
WOW thanks for your great work sierrafoxtrot I think this will make it a bit more clear which settings are the best.

So from the average quantizer useing the settings High 100% Low 300% with high aggression gives the best quality.

But now I'm a bit confused, I thought that greater high distance values would give the frames which need it a higher size so the quality should improve for these but then High 300% and Low 300% or High 200% and Low 150% would have to have more low quant frames than High 100% and Low 300%, but it doesn't.

Or does a higher distance mean that a higher quantizer can be used? From how I understand the alt. CC it shouldn't but the images seem to indicate this.
But I've been wrong many times before so why not again. ;-)

Apo

primitive
28th March 2002, 16:48
Originally posted by Foxer
Actually, increasing the low distance beyond 100% will cause the low curve to be cut off earlier (anything beyond -100% is unreachable because that would be a negative framesize) so less preference would be given to low bitrate scenes.

AH, it cuts off. Wow, I am a newbie making believe he knows what he is talking about.

So if I stretch the curve to say 200%, it will cutoff at -100% with a different bitrate than if I leave it at just 100%, I see. The more I stretch past 100%, the lower that bitrate.

*edit* So if I stretch the low to 200%, it will lower the average bitrate of the low frames and make the difference in size between the highest and the lowest low-bitrate frame smaller. I don't quite understand what it means to "raise its preference", though; please explain ^^

Have you read my explanation of the alt curve system in the Cvs 2002-03-23 thread or earlier in this thread?

Yea, I read them both. Widening the band would make the frame sizes "more average". However, I was wondering if that would translate into a tangible difference in quality in my encode. I tried looking at the results this morning to see if they did, but I have to run to class. From what I could see, any differences that exist are probably on the low end looking worse in some spots, with a negligible difference all around. (I assume the low looking worse would come from the maximum bitrate applied to low frames being lower because of the curve stretching beyond -100%)

ps.
I'm glad that people are trying out, and some even preferring, the alt curve system instead of staying away from it :)

low-200-100-50 at .143bpp is nigh-indistinguishable from no alt-cc .179bpp on this source material. I say it's a winner.

-p

Foxer
28th March 2002, 18:21
Wow! heheh :)
Now, that is how to analyze a new curve system lol
The only things missing are the size to quant info and more tests with different distances.
Much easier to have a graphical aid instead of trying to make sense of someone's words or the sourcecode. Thanks :)

Originally posted by Apo
But now I'm a bit confused, I thought that greater high distance values would give the frames which need it a higher size so the quality should improve for these but then High 300% and Low 300% or High 200% and Low 150% would have to have more low quant frames than High 100% and Low 300%, but it doesn't.

Ah but it does give the high bitrate frames more than it would with a low high distance. Relatively of course.
It has to take the extra bitrate given to those large frames from somewhere..

Originally posted by primitive
*edit* So if I stretch the low to 200%, it will lower the average bitrate of the low frames and make the difference in size between the highest and the lowest low-bitrate frame smaller. I don't quite understand what it means to "raise its preference", though; please explain ^^

Well.. Take low aggression for example. If you compare a 200% low distance to a 100% low distance, the low curve is cut off before it has a chance to improve low bitrate frames that much and this effect is increased since there would be less bonus to apply in a bias manner.

Apo
28th March 2002, 19:10
@Foxer

Sure it has to take it from somewhere but then shouldn't there be more low quant and more high (or at least more average) quant frames? But look at the 2nd and 3rd graph. With a high distance of 300 there are much less low quant frames (quant 2 and 3).

BTW: Sierrafoxtrot It looks like you didn't change the values for the 3rd image with a high aggression from the 2nd image.

Apo

Foxer
28th March 2002, 20:15
Originally posted by Apo
Sure it has to take it from somewhere but then shouldn't there be more low quant and more high (or at least more average) quant frames? But look at the 2nd and 3rd graph. With a high distance of 300 there are much less low quant frames (quant 2 and 3).

As I described in my explanations, increasing the distances will cause less variation and this is shown in sierrafoxtrot's graph.

sierrafoxtrot
28th March 2002, 22:00
@apo

well spotted, i've got the data and the graph, just waiting to finish some other tests before i edit that.

@primitive

any chance you could give us a pictorial representation of your curve stretching theory (i had enough trouble trying to understand foxer's graph, no offense foxer)? i get kinda lost reading text (sorry, i'm a bit thick that way ... ;) )

@foxer

yeah, i was thinking of doing something with the size to quant ratios but it looks ... painful to do. ATM i'm just doing word counts in m$ word and sticking them into excel, could i write a macro to do the dirty work for me? i've got all the logs so it shouldn't be a problem, i was just wondering if there was a way round all that hard work LoL. any help would be appreciated.

BTW in debug output, inter1 stats is the framesize at Q2, what's the difference between scaled and actual ie which value is the final frame with the indicated quant?

well, IMHO the last set of expts more or less covered the effects of low med hi aggression on quant distribution, now i'm doing some more encodes to try and determine how Hi% and Lo% values alter Q distribution wrt a fixed aggression (and inadvertantly doing all possible combinations of distances and aggression). i'll post pics once i'm done.

hope this helps :p

Foxer
28th March 2002, 23:52
@sierrafoxtrot
I'm in the process of writing a little program which will do that for you.
PM me your e-mail address and I'll e-mail it to you later tonight.
I need to get off here pretty soon.

sierrafoxtrot
28th March 2002, 23:56
@foxer

i've just PM you. thanks again. i've been trying to VB it, keep getting foiled because i'm not a coder :mad:

sierrafoxtrot
30th March 2002, 01:26
here are the quant threshold values (thanks foxer!) for Hi% and Lo% settings expressed as % of average scaled frame (all are medium aggression)

H100L100low med high
2 -88 -87 -86
3 -69 -66 -63
4 -9 -3 0
5 95 96 94

H100 L200
2 -90 -88 -87
3 -75 -69 -65
4 14 5 4
5 89 90 90

H100 L300
2 -92 -89 -87
3 -77 -71 -66
4 21 9 8
5 88 89 85

H200 L100
2 -90 -89 -88
3 -75 -72 -68
4 -27 -14 -8
5 158 147 121

H200 L200
2 -94 -91 -89
3 -85 -77 -71
4 -34 -12 -6
5 153 143 120

H200 L300
2 -96 -92 -90
3 -89 -79 -73
4 -40 -10 -2
5 152 141 118

H300 L100
2 -91 -90 -89
3 -76 -74 -71
4 -31 -19 -13
5 220 194 151

H300 L200
2 -95 -92 -90
3 -87 -80 -74
4 -43 -20 -13
5 219 192 152

H300 L300
2 -97 -93 -91
3 -92 -82 -77
4 -55 -21 -12
5 219 192 150

from what i can tell, the quant threshold is representing the quant that would be used after scaling (correct me if i'm wrong) and looking at debug output this seems to be the case. i didn't think of disabling bias payback so all i couldn't see a direct correlation but it sure looks like it's there.

for this particular clip, i'd say that the best value is H100 L100 (?) because in my previous post, H% 100 L%100 with high aggression gave the lowest average quantizer of 3.65 this is a bit unexpected but using these settings i had the highest number of quant 3 and 4 frames although i did get several quant 5 and 6 frames, since high aggression evens out the quant distribution.

from the graphs (sorry, they're all there for completeness) it seems that, yes, increasing Hi% decreases the number of high quant large frames ie favours larger frames by compressing them less. and that larger values of Lo% decreases the number of low quant small frames ie, higher quants for small frames (uglier) ie higher Lo% decreases the quality of small frames.

i guess from this little test; if a movie is high action, i'd go for Hi% 300 and Lo%200 with high aggression because i'd want to favour large frames by increasing Hi% therefore increasing the threshold frame size for larger quants, and i'd want all that extra bitrate to come from somewhere so sticking Lo%200 would allow some bitrate savings from the smaller frames.

depends what you want really, i tend to notice crap compression of small frames with little motion more easily than large frames with lots of motion. personally i think the odd of screwing up spectacularly are lower than with nandub. as long as you're messing about with the Hi% values and leaving the Lo% value at 100-200, you'd probably be safe.

BTW if you use Hi%100 and Lo%100 you will (of course) favour frames close to the average framesize.

... and i haven't even started to mess with payback and strength values yet. i suppose i could run more tests ... LoL

i hope some of this makes sense and doesn't muddy the waters any more than neccessary, two heavy drinking sessions and lying in the sun is murder to any form of rational thought :D

any feedback will be more than welcome, feel free to contribute, this is, after all, a forum :)

EDIT: could a mod pls validate the attachment? cheers!

soujir0u
30th March 2002, 07:43
Um, so does using the alt curve give better results?

primitive
30th March 2002, 07:53
Originally posted by sierrafoxtrot
@primitive

any chance you could give us a pictorial representation of your curve stretching theory (i had enough trouble trying to understand foxer's graph, no offense foxer)? i get kinda lost reading text (sorry, i'm a bit thick that way ... ;) )

It's not really a theory, just an observation.

Grab a piece of graph paper, we're going to be drawing some :)

First, draw a square. This is where we are going to be drawing the bitrate curve. Now, draw a vertical line down the center. This line represents the average frame size. Label the vertical line that makes up the left hand side of the square -100% and the vertical line that makes up the right hand side of the square +100%. Draw the diagonal from the upper left hand vertex of the square to the lower right hand vertex of the square. This is the curve for medium aggression, 100% high 100% low.

Now, let's say we set low to be 200% in the configuration. To simulate this on the drawing you just made, draw another square the same size as the first you drew and attach it to the left hand side of the first square you drew. Divide this square vertically like the first; now, you should have a drawing made up of four rectangles, side-by-side. Label the vertical line directly to the left of -100% "-200%". Draw a line from the vertex of the vertical line labeled "-200%" with the top of the rectangle to the lower right hand vertex of the rectangle. This is the curve for medium aggression, high 100% low 200%.

Now realize that low can't really go below -100% (because any lower and frames would have a negative size). Therefore, mark the spot on which this second line you drew intersects the vertical line marked "-100%". Realize that this point is lower down on the line than the point in which your first line intersected this vertical line. This is what it means for your bitrates to become "more average" as you stretch the curve: as you stretch the curve, the slope of that line you just drew goes down. If you need to verify this, repeat the process for -300% and notice that this new line intersects the -100% vertical line at a still-lower point.

@foxer:

You just confused me terribly. From an eariler post of yours, I was under the impression that increasing the high% improves high bitrate frames at the expense of low bitrate frames, and that increasing low% improves low bitrate frames at the expense of high bitrate frames. However, if what you've just said is true, having a low% > 100% actually screws your low bitrate frames because it cuts them off before they can be improved maximally. If this is the case, how exactly are we supposed to use the high% and the low%?

-p

Foxer
30th March 2002, 08:34
@primitive
Eh? What did I say that confused you or are you referring to sierrafoxtrot's post above?

Decreasing the low distance gives more preference to low bitrate frames.

Originally posted by primitive
However, if what you've just said is true, having a low% > 100% actually screws your low bitrate frames because it cuts them off before they can be improved maximally. If this is the case, how exactly are we supposed to use the high% and the low%?
How you are to use high% & low% depends upon the aggression level you're using.

Moving the low threshold below -100% for low aggression has a very large impact but not so much for medium and not much at all for high.

sierrafoxtrot
30th March 2002, 13:25
@primitive

thanks for the detailed instructions. phew. now ... to summarize, i think if you want to favour small frames, use small values (less negative) for Lo% then the quant thresholds for small frames will be set higher, and more small frames get lower quants. make sense?

as for Hi%, raising the % will raise the quant thresholds for larger frames resulting in the use of smaller quants for larger frames.

Hi% and Lo% should be adjusted according to the relative number of < average and > than average frames in the movie.

my impression of aggression is that it should be adjusted depending on whether you have lots of interspersed large and small frames (like cross cuts during action and non-action) or whether you have fairly long sequences of small and large frames. using a high aggression for the first case would allow for quick adjustment of the codec to each scene's individual demands and low aggression in the second case will allow for savings from smaller frames to be contributed to the larger ones (or vice versa, depending on where you're shaving the bits from, normally we steal from the rich to give to the poor :) )

however, the alt curve system is pretty configurable so different aggression settings for particular Hi and Lo% values will allow your curve to be made to deviate more from the medium setting (just like foxer said). i guess this will allow us to tailor the curve for particular movies.

i'm doing a rip of blade runner and trying Med Hi% 200 Lo% 50 but some of the smaller frames don't look too good. so i'm using High aggression High% 200 but Lo% 0 with strength at 70% (i _think_ this will allow the algo to exert a greater effect in enforcing minimum relative quality). i'll let you know what the frames look like once i'm done.

hope this makes sense :D

BTW, a lot of this is shown in the attachment, which doesn't seem to be visible. :(

sierrafoxtrot
30th March 2002, 19:22
@soujir0u

yes! it evens the quality out a _lot_. i've compared the old asymmetric cc with the new alt cc, and even if you screw up the settings you're getting much lower average quants and visual quality is immediately noticable.

i'm quite grateful for it :)

kagoru
30th March 2002, 23:49
Does the alternative CC affect the first pass? Do I have to do the 1st pass again when I want to use the alternative CC? Logically 1st pass stats should be the same since I create that curve when I do 1st pass. Am I right here?

sierrafoxtrot
31st March 2002, 02:13
@kagoru

no. the 1st pass stats is generated using const quant 2, and scaling (alt curve compression) on occurs on the 2nd pass. this means you can use the same stats file for several 2nd passes with different alt cc settings.

don't know why the fields in VfW are still active during 1st pass set-up tho, i guess that would be a tiny change to the interface to avoid confusion.

-h
31st March 2002, 02:22
don't know why the fields in VfW are still active during 1st pass set-up tho, i guess that would be a tiny change to the interface to avoid confusion.

Enabling/disabling controls is a pain, I'm looking at a better way of doing it.

But motion vector hint files are more fun to program :)

-h

trbarry
31st March 2002, 16:45
But motion vector hint files are more fun to program

I think you just dropped a motion vector hint hint. ;)

- Tom

Acaila
11th April 2002, 13:11
To better understand what Alt-CC is doing I ran some tests with various settings on the same movie (with the same 1st pass stats file).

I varied high % from 100 to 200 and 300, same for low %. For strength I used 25% and 50%. Always used Medium aggression. All target sizes were met dead on, only differing by several kbytes.
However the only effect I could find was some shifted quantizer distributions. A few more frames at quant 2 and thus also a few more at quant 4 over no Alt-CC (which will also happen when you blur btw). I checked a lot of individual frames and the noise and compression artifacts never lessened with Alt-CC, they only moved around to different places.

The only conclusion I could reach from my tests, was that NOT using Alt-CC was just as good as using Alt-CC with whatever setting I tested.

Maybe my 'normal' movie (i.e. without using Alt-CC) was already too high quality to see much difference?

Just looking at individual frames and checking total quantizer distribution is not enough to determine if one video is higher quality than another (apply a smoothing filter and you'll also see much lower quantizers, but the video is NOT higher quality).
Does anyone know what variable to check also to determine which is better?

Has anyone seen that using Alt-CC actually makes a movie better?

EDIT: The average quants varies between 2.85-2.88 for all Alt-CC settings I tested, whereas the average quant for the movie without Alt-CC is 2.79. So I fail to see the benefit of using Alt-CC...

sierrafoxtrot
11th April 2002, 13:53
yeah. tried encoding memento (special edition where all the B/W scenes are concatenated at the beginning) and it looked awful with the old cc, but using alt cc solved the problem some when i used high 100% lo 0% and medium aggression. it's a hit or miss thing, some movies probably don't require much tweaking.

foxer said something about the ratio of unscaled to scaled frames vs quants used. i guess that would give an idea of which frames got which quants. if you tie that in with the total number of each quant used, you might get a rough guide, but it's probably better to trust your eyes. :)

Teegedeck
11th April 2002, 18:14
Do you agree that we should give it some thought which alterations could be good/bad for what kinda movie? Though I still think you can't ruin your encoding if you leave the defaults alone.

But: Me thinks, for example, that cutting off the hi-distance early (say, at 100%) is a big no-no if your movie doesn't really have a lot of frames at the calculated 'average' bitrate but long sequences at a low bitrate (talking heads in not-so-well lit rooms) and long sequences with high bitrates (detailed shots of landscapes, cityscapes in bright daylight etc.). Because the dark scenes would profit a bit but the bright scenes would suffer _noticeably_ (not so noticeably if they were just hi-motion scenes). I guess low aggression and/or strength equal/lower 50% could work fine in such a case, also, if you don't want the hi-bitrate part looking much worse than the rest.

Second, if there's just few scenes that have a considerably higher than average bitrate (little dynamics in the (flat) bitrate curve, perhaps some nice and dull, depressing drama), lowering the hi-distance also isn't worth it; you don't gain much out of the few bits saved but you realize a sudden degradation in quality in that high-bitrate scene.

Finally if you have a good mixture, where framesizes change quickly (dynamic curve, an action flick, for example), you should be able to cut off a bit from the top because biggest frames don't last long and are probably full of motion, so there's a good chance that you won't notice it. Perhaps this could also be the best type of movie to get away with the medium type of aggression.

Setting lo-distance any lower doesn't seem so neccessary to me or did it really make such a big difference for you? Smallest frames always get quantized at 2 for me and the medium-small frames look good also - or so it seems to me? Perhaps my eyesight is worsening. :)

Just talking out of where the sun don't shine? You tell me.

OUTPinged_
12th April 2002, 00:05
4 hours of forum browsing, reading posts over and over again and messing with sources.

After figuring out, how all the options work and corellate, i respect Foxer much more. The way alt.cc works in extreme framesize conditions is really better than the one's existing in other codecs(too bad lowpass will screw it after a certain point :P ).

The only complaint i can post here that it was ass to learn it.


Foxer, you da man!

Alt.CC algo is now MooPolice approved! :-)

Dali Lama
12th April 2002, 03:20
Originally posted by OUTPinged_


After figuring out, how all the options work and corellate, i respect Foxer much more.



OUTPinged_, can you share your alt. cc guide with us? I am especially interested if it covers both movies and anime.

Thanks,

Dali

OUTPinged_
12th April 2002, 08:10
its written in russian. if you still want it, i can send you a .doc.

however, you are free to ask questions of course.


atm guide covers just mechanics of xvid, and i can only "guess" which alt.cc values will work _best_.



the range of values that has sense:
curve.agg: all, max.d: 50-200 (maybe more with low.agg), min.d:100-50, str.based automatic stuff: can be on(great idea here), mrq: 50-80, auto bonus: on.

when setting up, you have to know how far will extremely large frames go, basing on that you set mrq/agg/max.d.

ie, if you are aiming for 40% 1/2pass ratio and 50mrq, your average quant will be around 5 and your max quant will tend to be around 10 on large frames assuming you set max.d low enough.

Dali Lama
13th April 2002, 15:59
Ya if you could send it as an attachment to this forum it would be nice. (my friend understands Russian).

Also, if you were presented with a martial arts movie to encode (lots of slow scenes and lots of long action scenes) what cc settings would you use.

Finally, if you were presented with martial arts anime, like Rurouni Kenshin, what cc settings would you use.

Thanks,

Dali

Gazza
15th April 2002, 07:40
Suggestion for all - would it not be a good idea to provide a simple viewer that has the background functionality and buttons to try out the various settings so you can assess the impact without going through the whole encoding process. That is, trying one setting against another takes time and by the time you have done an encode with new settings you will have probably forgotten what the previous quality was like anyway.

This viewer could take say 250 frames from a segment in the video and put it through the encode, etc and output the results on screen. Then you could change a few settings and compare the results on screen at the same time? Maybe you can store a number of images or small film clips (of the same 250 frames)on screen so you can do comparisons.

I know that it could mean integrating a number of tools into one but it seems a pretty cool idea.

OUTPinged_
15th April 2002, 17:06
gazza, that tool will be useless for complete newbies (they will screw an encode anyway) and experienced rippers who know what they will get anyway.

dali lama, that guide will be uploaded to its place shortly and i will provide a link here.

Dali Lama
19th April 2002, 16:14
How's the guide coming along OUTPinged_?

Thanks,

Dali

OUTPinged_
19th April 2002, 18:50
bad. the guy who wanted to host it has read it and told me i am lame.

now he will point me out where he thinks i wrote wrong (hehe), we will flame for a week or so and the guide will be in :-)

Gazza
26th April 2002, 02:41
I'm still vague with the whole concept of Alt curve settings and their interactions and impact on final video. Therefore I am going to spend a little time on experimentation. Whilst pondering how to go about this and shorten the time to set this up for multiple encodes I had an idea.

At this time I can select a single vob, create the avs file, etc in order to create a small length of video to experiment with. But this takes time and you have to repeat the whole process when you are ready to do the whole video. Also the video motion could change through a movie therefore you may need to select different vob's.....

When setting up the codec parameters (including alt curve, etc) it would be very cool to be able encode just a small selected section of whole video to be able to see what would be the best series of settings for a particular movie. Imagine something similar to Nandub or Vdub where you can move sliders and select 'home' and 'end' to cut and clip video. Once you have selected a start frame and end frame the output can be processed according to the settings and you can quickly view the results. You might only need a few seconds of one particular scene.....

You could also use the same feature to find start/end of credits without coming out of the codec configuration process (which is very frustrating).

I would welcome other's thoughts and opinions on this

Gazza

manono
26th April 2002, 06:21
If you just want to encode a piece of the vob, then add:

Trim(start frame,end frame)

near the bottom of the .avs.

Gazza
26th April 2002, 06:55
@ manono

thanks - i'll give it a go

Gazza
26th April 2002, 07:37
Tried the trim setting and got some very weird results. The resulting output was awful with blocks all over the place, color was shot .... I tried a couple of videos but the same result. Also regardless of the codec settings I got the same crappy output.

Got any ideas?

Gazza
26th April 2002, 08:03
Figured out what was wrong - had to re-do the 1st pass before trying the 2nd pass....

rui
26th April 2002, 10:51
Ok, Teegedeck posted some thoughts about alt. cc in another thread, and he thought that it should be posted in this thread, so i brought it here, maybe could be usefull for anybody besides me :D

Originally posted by Teegedeck
In case you still wonder, just reduce the 'low distance' in the alt.CC-tab to a value around 90% to treat below-average frames VERY benignly (personally, I use 100%). It'll mean that (up to) at a framesize of 10% of the average framesize, the theoretical 'best' quality is used (the curve starts there). Make sure you've set the minimum i/p-frame quantizer to '2'! Of course, the actually used quantizers still depend on the kind of curve type you selected. (If you really want to boost small frames at the cost of big frames, choose 'medium aggression', but there is a building consensus on this forum that 'low aggression' is best - 'low aggression' means that 'compression schemes' won't change very much in the whole encoding...

Then i posted this:
Originally posted by Rui
If i got you right, you mean that we should NEVER use high agression, except in extreme cases like probably sports movies, which have both really fast action and slow action when the sports aren't being played? For example the movie The Replacements (american football), or that movie about Nascar with Tom Cruise, i think it's called Days of Thunder?

For all other types of movies, even action movies, we should only go till medium agression, simply playing with the high and low %'s to give more or less to big or small frames?

And then Teegdeck responded:

Originally posted by Teegedeck
No, no, who am I to tell you what you should use! I just got the impression that people were turning to low aggression and I myself prefer to compress small frames not too-little and to have a wide middle ground where quantizers don't vary too much. But I certainly will keep experimenting (like, for example, using medium aggression with more 'stretched' distances). High aggression seems a bit extreme to me, though - remember, it not only compresses high action strongly but simply big frames that can be anything from an action scene to a detailed picture. Perhaps this really belongs in the 'alt.cc'-thread.

Teegedeck
26th April 2002, 14:04
hey, that's very nice, Rui! Guess I can clear the other thread up, then.

Chibi Jasmin
26th April 2002, 18:54
I always like having some kinda standard setting that may not work perfectly on all movies, but close to perfect in most cases...for some quick encodings without encoding and tuning several times...from what I read here I would go for

Low Aggression
High Distance 200%
Low Distance 100%
Automatic minimum relative quality
Strength 50%
Automatic bonus bias calculation

What do you people think?

BTW: Can someone introduce me to the other 3 settings on the alt.cc page: max bitrate, max overflow improvement, max overflow degradation? Always left that at default: 10000/60/60...

rui
26th April 2002, 20:54
Well, if i am not to mistaken ;),when choosing Low agression, this will affect most the values we choose for the low %.
So, i believe that 100% is good, unless you really want the small frames to look very good, and then you should lower it a bit.
But, on the other hand, and again since you choose low agression, maybe you could up the high % to something more than 200%, that is if you have a movie with some action(and/or big frames, because like Teegedeck pointed, big frames can mean slow action scenes also). I say this because i think that with low agression, to have some effect with the high %, the values need to be a little higher.

Am i making any sense?? :D

In relation to the other values you mention, the only thing i can say is what appears when hovering the mouse above the options :)
Like you, i always leave them at default.

wing1
27th April 2002, 05:36
CVS dated 4-19-2002 and on from Umaniac's instant build has alt. curve feature disabled on all except 2-pass, why?

This feature does wonders for my capturing purpose, why is it disabled?

-h
27th April 2002, 06:45
CVS dated 4-19-2002 and on from Umaniac's instant build has alt. curve feature disabled on all except 2-pass, why?

The Alt. curve paramters only affect the 2nd pass modes. All that affects CBR encoding is the settings on the Global tab, the min/max quantizer, and the CBR controls on the Debug tab.

-h

Hanty
27th April 2002, 09:33
Well I'm the kind of guy that want no bias for either bigger/smaller frames. I want it all to look us good (that's the theory at least) So would just disabling alt. curve and putting 0/0 on "standard" curve make all the frames compete for bits on equal terms?

Evaldas
27th April 2002, 10:00
How to take bits from low motion scenes and give them to high motion areas. I did Swordfish with Low aggr, high dist 200, low dist 100, everything else default. Low scenes look very good (at least for me), but in very high motion areas (where the motion is really really high) theres seen a lot of blocks, so I want take some bits from low scenes and give them to higher motion scenes? What would you recommend?
I experimented with aggr/high/low dist: High/200/100, High/200/200, Low/200/200 and none of them did what I wanted.

Chibi Jasmin
27th April 2002, 10:12
Originally posted by Evaldas
How to take bits from low motion scenes and give them to high motion areas. I did Swordfish with Low aggr, high dist 200, low dist 100, everything else default. Low scenes look very good (at least for me), but in very high motion areas (where the motion is really really high) theres seen a lot of blocks, so I want take some bits from low scenes and give them to higher motion scenes? What would you recommend?
I experimented with aggr/high/low dist: High/200/100, High/200/200, Low/200/200 and none of them did what I wanted.

Maybe what rui suggested....low aggression, low 100, and higher value for high...maybe 300? Not sure, try it...

Chibi Jasmin
27th April 2002, 10:15
Originally posted by rui
Well, if i am not to mistaken ;),when choosing Low agression, this will affect most the values we choose for the low %.
So, i believe that 100% is good, unless you really want the small frames to look very good, and then you should lower it a bit.
But, on the other hand, and again since you choose low agression, maybe you could up the high % to something more than 200%, that is if you have a movie with some action(and/or big frames, because like Teegedeck pointed, big frames can mean slow action scenes also). I say this because i think that with low agression, to have some effect with the high %, the values need to be a little higher.

Am i making any sense?? :D

In relation to the other values you mention, the only thing i can say is what appears when hovering the mouse above the options :)
Like you, i always leave them at default.

Well, I don't know...I always used medium/low 100/high 200 and things came out pretty well...I just went to low aggression, because people here said, it might be better!? Remember, I was looking for some all-purpose setting...not for some for action movies only...but maybe it makes sense to got for a higher high distance value, if I know, the movie has much action...what I am mainly interested in is the curve to choose...medium or low? :-)

And about the other settings, latest uManiac build 26.04.02 0800 doesn't show anything, when hovering with the mouse...or am I too dumb again?

rui
27th April 2002, 11:02
Chibi Jasmin, the hovering thing works with me. I just go to the xvid Alt. Curve configuration tab, and then place the cursor over the option i want the info about.
After ~2 seconds a little text appears with a small explanation about that option.
But i will copy what appears to here:

Max bitrate : Constrains 2nd pass encodes to the specified maximum bitrate;

Max overflow improvement % :How much of the overflow the codec can eat into during underzised sections - larger values will bridge the gap faster;

Max overflow degradation % :How much of the overflow the codec can eat into during oversized sections - larger values will bridge the gap faster;

Chibi Jasmin
27th April 2002, 11:19
Originally posted by rui
Chibi Jasmin, the hovering thing works with me. I just go to the xvid Alt. Curve configuration tab, and then place the cursor over the option i want the info about.
After ~2 seconds a little text appears with a small explanation about that option.
But i will copy what appears to here:

Max bitrate : Constrains 2nd pass encodes to the specified maximum bitrate;

Max overflow improvement % :How much of the overflow the codec can eat into during underzised sections - larger values will bridge the gap faster;

Max overflow degradation % :How much of the overflow the codec can eat into during oversized sections - larger values will bridge the gap faster;

Now it works here, too...there were two things I missed:

1. Place mouse over the field, where value is entered, not above the field description.
2. Wait 2 seconds...

Thanx...can anyone tell us what the values really do?

ultimatebilly
30th April 2002, 11:27
Here another value for the quest for the "best" default settings:
"High/high:200/low:45/strength:50".
Tried to encode a piece of Universal Soldier 2 with several settings, "High/high:200/low:50/strength:50" was the one that gave the best over-all-rate of quantizers and displayed the message: "quantizer prevented from rising too steeply2nd-pass" not as often as other settings that looked good to me (used 550 as bitrate). I changed the value for low from originally 50 to 45 when I finally tried to encode a whole movie (don't know if it yielded any big difference) because the movie I encoded was Friday the 13th part 2, which has of course not as much high-motion scenes as Unisol 2 (Please no comments about my taste... :) ), therefore I wanted to favour low-bitrate-frames a little more...
The result looks very, very good to me...

morello12
1st May 2002, 18:36
I concur with the above post. Results using those settings look noticable nicer in a low motion piece i just tested than no alt. curve compression.

Teegedeck
2nd May 2002, 15:09
Originally posted by ultimatebilly
the movie I encoded was Friday the 13th part 2, which has of course not as much high-motion scenes as Unisol 2 (Please no comments about my taste... :) ), therefore I wanted to favour low-bitrate-frames a little more...

Hi :)

just wanted to comment on that bit. I doubt it works that easy. :( Have you ever asked yourself where the bits are taken from that you want to add to the 'low-motion' scenes (apart from the fact that low-motion frames can be just as big as hi-motion frames)? Yes, from the hi-motion scenes. If there are few of them, you theoretically don't gain much if you take a little away from them and distribute it onto the rest of the movie. Ack!

ultimatebilly
2nd May 2002, 23:00
Of course it is right, that in a movie with few high-motion scenes not much can be gained by taking bits from them. But as you said yourself, low-motion frames can be as big as high motion frames, thus you can take bits from these big frames (no matter if they are high or low motion). This is the way I understand alt-cc:
You can choose, to what extend you want to favour big or small frames, this can be achieved by changing the agression ("low good for big frames", "high good for low frames") and/or changing the threshholds. The two possibilities influence each other, so it should be possible (theoretically), to achieve the same with totally different settings. (In principle: high,250,80 may give similar results like, lets say, low,200,50, because in the upper setting you give higher priority to big frames, but in the same time youre shaving off more from them (high-aggr), the 2. setting doesn't shave off that much from big frames, but because the priority is set more to the small-frame-side, big frames arent getting this big; this is just an example of how I think the settings work :) )
It's not quite true, in any case, because the threshold of 50 forbids the small frames to drop under 50% average size, where in setting 1 they can drop down to 20%, therefore some frames will be uglier, but the overall-results could be similar in two different settings...
If you choose a setting which favours small frames like I did, you higher the over-all quality of small frames, by lowering the over-all quality of big frames, you just set the priority to small frames (maybe its better to speak of small and big frames and not of low- and high-mo-frames).

Hope there is some truth in it... :) dunno

Teegedeck
2nd May 2002, 23:45
Rightey-right, a very good explanation there! And right, it's all interdependend! I don't think it has ever been said so clearly :) Perhaps I should also mention that strength-setting has a much bigger influence on the encoding than all other settings. Thank god most people leave it alone. As far as I can tell, 50% is a very reasonable value that doesn't allow for too much quantizer-fluctuation, no matter what curve type you choose. I have to say, I'm very content with the alt-cc. because you can't do too much wrong - on the other side, there neither is much room for optimizations, judging from my tests. I don't quite agree on the explanation about distances though. The way you put it, it sounds like it was more of a minimum bitrate but it really only influences quantizer-distribution. Even if you set a low distance to 50% in one case and 20% in the other case, the quantizer threshhold for quant=3 might be at -80% (i.e. in fact 20%) of the average bitrate for both cases. The differences between the settings probably get visible if we look at the overall distribution of quantizer-thressholds, so if we wanted to compare consequences of different settings we'd have to compare the quantizer-thressholds and quantizer-distribution. I still wish I could simply set the quantizer-thressholds and the curve was calculated based on that (instead of distances).

unplugged
3rd May 2002, 14:57
Originally posted by ultimatebilly
...this can be achieved by changing the agression ("low good for big frames", "high good for low frames")...

"high" good for low frames???

Have you seen the alt-CC curve graph?

High-curve model falls early just a bit under the average frame size, so you are going to get easily little little frames...

However I m not a monster about interpreting this pain :) CC curve graph...

:confused: I have something to ask :(
Please, tell me, to which *exact* value does high-low percent refer?

It refers to average frame size or VBR curve detected peak?
(positive top peak... negative bottom peak...)

If it refers to average frame size how understand the exact inplication of the low value?
(default 300% low would mean average-size/3 ?)

Sorry...

Foxer
3rd May 2002, 18:49
@unplugged
"high" good for low frames???
Simply put, high aggression is the best for low bitrate frames and the worst for high bitrate frames because it changes the encoding quality the quickest.

However I m not a monster about interpreting this pain CC curve graph
lol That's understandable..
It seems a fair number of people don't understand it right away.


Please, tell me, to which *exact* value does high-low percent refer?

It refers to average frame size or VBR curve detected peak?
(positive top peak... negative bottom peak...)

If it refers to average frame size how understand the exact inplication of the low value?
(default 300% low would mean average-size/3 ?)
The high and low distances define the goals for the 3 aggression levels and this is shown in the graph I scratched up.
The percentages shown on that graph are relative to and proportional to the average framesize, so -100% = 0 and +300% = avg framesize * 4.
Negative percentages relate to the low distance and positive percentages relate to the high distance.
The low distance is allowed to go beyond 100% because this allows one to better shape the curve.

For further details, read through this and the Cvs 2002-03-23 threads.

unplugged
3rd May 2002, 19:48
OK!

Originally posted by Foxer

The low distance is allowed to go beyond 100% because this allows one to better shape the curve.

Ah... :D, now I feel ok.
Thank you for explanation, Foxer.

Is there a way to obtain the "lowest" and "highest" frame-size percentage automatically detected/applied by XviD normal VBR (no CC)? (by having 1st pass stats yet...)

Everyone could need these values to have a reference point to estimate optimal alt-CC high and low percentage...

Foxer
3rd May 2002, 21:03
No problem :)

One can use gordian knot to find the min and max framesizes though this info isn't exactly the best info to go on.

A better value to base your initial test aggression & distances off of would be the framesize standard deviation which gordian knot also provides.

OUTPinged_
3rd May 2002, 23:34
foxer, does 100% value in low distance mean that it will end at 2 times smaller than av. frames or at 0 size frames?

Foxer
3rd May 2002, 23:56
A low distance of >= 100% means that the low curve will end at 0 bytes.

I know that's a little erroneous but it's tolerable.

ookzDVD
6th May 2002, 11:33
This is a very long thread.....

@Foxer,
I know there is no best setting which
suitable for all movies, but at least
there is a "acceptable" setting which
may improve a little bit rather than
not using Alt-CC.

unplugged
6th May 2002, 14:48
I tried TheWef's Gordian Knot 0.23, this tool can give good useful infos from stats files.

On "Nandub files" tab, when I use the distribution button under frame-size column I obtain a strange graph, it grows smoothly and doesn't seem to be related with movie...
...Could be "distribution" graph only supported for real nandub stats files?

(not compatible with XviD stats)

OUTPinged_
6th May 2002, 15:37
ookz:

alt.cc has some value range capped and settings are quite fool-proof, so if you will keep mrq at 50-66 and ranges under 200, ypu wont screw it.

and if you want to make your encode look bad, use high.agg, 500% distance and 20mrq.

after all, quantizer based curve profiling isnt that difficult as long as all macroblocks have similar quantizers.

Teegedeck
8th May 2002, 16:16
...I've just moved the discussion that Gazza started about interlacing into a new thread called 'interlaced content'. Read it here. (http://forum.doom9.org/showthread.php?threadid=24796)

OUTPinged_
11th May 2002, 23:16
more questions:

does max.bitrate setting override quantizer restrictions?

Teegedeck
13th May 2002, 08:12
I don't know how the two settings could ever conflict? It should work the same way as in Nandub - you better not use it, it has only been included after a special request from a user that wanted to prevent 'stuttering' playback of his encodings on his VERY slow machine.

OUTPinged_
13th May 2002, 10:25
ie, the quantizer range specified is 2-5, but even at quant5 the frame is bigger than specified by max_bitrate and. will quantizer be increased in that case?

Teegedeck
13th May 2002, 11:59
Hm, that would indeed be interesting to see, go ahead and test it. :) I guess the bit-bucket will run empty so quickly that you'll think you could've spared yourself the 1st pass in the first place.

The maximum bitrate should work in the curve-calculation, i.e. _before_ quantizer decision, and just 'crop off' everything that is above maximum bitrate and distribute it back onto the rest of the curve. Not a very good idea if you don't have playback problems at high bitrates. Don't use it. The quantizer-limits should get in _after_ the curve has been recalculated and correct decisions about quantizers have been made. They just don't care about the curve, so they tend to screw everything up! :(

OUTPinged_
13th May 2002, 13:26
ok, that is exactly the way it works in nandub, thanks for confirming this.

OUTPinged_
15th May 2002, 00:49
those people who wanted to take a look at my xvid option guide, check

http://engel.otaku.ru/lab/d2div/xvid.html

beware, it's in russian \o/

kilg0r3
27th May 2002, 07:53
there isn't anybody outthere who would like to translate this page?:rolleyes:

soujir0u
27th May 2002, 08:36
I tried translating it with Altavista's translator but the results were horrendous. Perhaps Outpinged would like to write an English version? :)

OUTPinged_
27th May 2002, 15:07
That is a possibility, but not until i have my session over.

Defiler
3rd June 2002, 02:00
I'd just like to point out that this is the most confusing thread I have ever read. You think you understand something, and then it's revealed to be incorrect three posts later.
A "white paper" on this subject would be very handy. I'm personally far from understanding what the values in the quantizer matrices posted earlier ACTUALLY refer to. Shockingly hard to visualize.

That being said, carry on. :)

OUTPinged_
3rd June 2002, 22:30
The most funny thing is that people here have not posted a comprehensive description of all alt.cc options. So, if you didnt believe you have figured out what do these settings do from these posts, no wonder.

Defiler
6th June 2002, 01:07
Question: How can a something be -150% of the average size of a frame, much less -300%?

Teegedeck
6th June 2002, 09:37
It's the theoretical lower end of the graph, never to be reached. :)

Defiler
6th June 2002, 14:21
If the size of the average frame is, say, 20KB, and frame X is 5KB:
In my mind, that would be "-75%" on the graph.
If frame X was 10KB, it would be "-50%".. Is that correct?

Teegedeck
6th June 2002, 14:31
I should think it is. But remember that the curve isn't the only thing that goes into quantizer decision (otherwise I guess your 5K-frame should receive a non-existing quantizer '0' if you set low distance to 75%...). What would happen if it really was? Set minimum quality to '0', that should do the trick (still there's bias)...

What I want to point out is, it doesn't make sense to calculate actual framesizes in order to foretell results. One could try to work like this and not use min. quality or strength but that really wouldn't be good - strength calculates a very reasonable minimum quality based upon the first pass' .stats thus helping us to find a balance between big and small frames we would have a very hard time reaching ourselves.

Simply watch the quantizer-threshholds that the codec spits out at the begin of the 2nd pass in order to adjust your settings to your needs.

Defiler
6th June 2002, 18:27
Another of the various things I don't understand about this is what "distance" refers to..
Does "low distance" mean that it's "close" to the size of the average frame, and "high distance" mean it's "far?"

Is there a way to watch the quantizers from VirtualDub's "job control" mode? I tend to queue up the first and second passes, a la Doom9's guides.