View Full Version : About XviD 1.0 and custom matrices
Chainmax
13th October 2003, 16:40
I wanted to know if some custom matrices could be hard-wired into XviD 1.0, H.263 and MPEG-style. HVS_Good and Andreas78 seem to be the most used ones, so maybe the devs could hard-wire them?
P.S: on a side note, where can I find some info on Gruel's 3-point GMC?
Chainmax
15th October 2003, 16:44
346 views and no replies? :eek: :( :eek:
Selur
15th October 2003, 17:03
Probably most of the readers (like me) think that the best way to handle the matrices is like it's done atm.
I think that it would be a mistake to include other matrices as 'standard' since it would only cause a lot of questions from newbies.
"on a side note, where can I find some info on Gruel's 3-point GMC?"
Did you browse the xvid dev-mailing list archive?
Cu Selur
Ps.: Personally I don't use the matrices you mentioned.
(Normally I use my own)
MfA
15th October 2003, 19:41
It would be nice if someone (not me) wrote a util to lift a couple dozen partial sequences (each weighing in at say a dozen frames) out of a movie and optimized intra/inter matrices accordingly.
Selur
15th October 2003, 20:30
some questions that pop into my mind thinking about that:
"How would one decide which matrice wouldbe the best?"
(SSIM? PSNR? both?)
"Is there a problem/way to change matices on a per frame basis?"
"How much overhead would a per frame matrix change produce?"
"Is it even possible (atm/in general) to produce an iso conform file with frequently changing matrices?"
Cu Selur
MfA
15th October 2003, 21:28
Originally posted by Selur
How would one decide which matrice wouldbe the best?
Most existing methods are designed for MSE (which is used to calculate PSNR) because of its desirable analytical properties. Of course the better the quality measure minimized the better the final quality will be, so SSIM is better.
Is there a problem/way to change matices on a per frame basis?
Latest xvid doesnt even have codepaths to do this anymore, it is not MPEG-4 compliant.
I was suggesting globally optimized matrices anyway, hence the spot checking of the movie.
How much overhead would a per frame matrix change produce?
About 1% for 1-CD encodes.
Selur
15th October 2003, 22:14
thx for the answers :D
Another problem might be the time it would take to find such a 'best suited' matrix ist it's not implemented in the codec. (suspecting that this might save a lot of time)
And if this would even only slowdown the whole encoding by a factor of 3, would it be worth the possible quality gain?
Cu Selur
MfA
15th October 2003, 23:00
Well it would probably be easiest to code it as a plugin in xvid.
As for how long it would take, that was why I suggested only operating on small parts of the total movie. This is even more important since changes in the quantizer matrices dont just impact coding efficiency of the DCT based coding, but also motion compensation efficiency... so you cant just look for optimal matrices in a single pass.
Selur
16th October 2003, 09:11
...why I suggested only operating on small parts of the total movie...
But how to be sure you didn't make the wrong choice unless you check the whole file? I know that if you raise the number of scenes you check the probability of choosing a 'wrong' matrix should sink,...
Never the less it's a nice idea in general and it would be nice if someone could prog such a plugin once dev-api-4 builds get public. ;)
Cu Selur
Chainmax
16th October 2003, 15:50
Originally posted by Selur:
Probably most of the readers (like me) think that the best way to handle the matrices is like it's done atm.
I think that it would be a mistake to include other matrices as 'standard' since it would only cause a lot of questions from newbies.
"on a side note, where can I find some info on Gruel's 3-point GMC?"
Did you browse the xvid dev-mailing list archive?
Cu Selur
Ps.: Personally I don't use the matrices you mentioned.
(Normally I use my own)
I never browsed a mailing list, so I wouldn't know where to start:o
Selur
17th October 2003, 08:30
The XviD-devel Archives:
http://list.xvid.org/pipermail/xvid-devel/
Cu Selur
jpl
17th October 2003, 12:37
It sounds to me like an ideal solution to this would be to run an initial pass (looking at each frame) to optimize the matrix and then run your 1 or 2 pass encode with the optimized matrix.
JPL
Selur
17th October 2003, 13:07
@jpl: Pls, correct me if I'm wrong.
The main problem might be that the only way to optimize the matrix I know of it to change the matrix check PSNR/SSSIM/.. anf then decide to keep the matrix or change something,...
AFAIK there's no 'easy'/fast way to do something like a 1 pass encode and then simply optimize the matrix.
(I suspect that if there would be a simple way to do this there won't be something like 'fixed' matrices at all ;) )
Cu Selur
jpl
17th October 2003, 13:47
@ Selur
I don't disagree with you, and I don't think it would be easy or fast to do. What I would envision is running an initial pass (pass-0) that calcualtes the quality for each frame with several matrices simultaneously. Quality would be evaluated based on PSNR, SSIM, some other metric or combination of metrics.
Then based on the result of the pass-0 run the decision can be made as to what is the optimal matrix with respect to quality. Based on that result you can proceed with a regular 1 or 2 pass encode as normal using the matrix determined from the 0-pass encode.
I'm primarily concerned with minimal size / optimal quality and would be willing to sacrifice time, probably much more than most other people, so I wouldn't have a problem with waiting for such a brute force method to finish.
Selur
17th October 2003, 18:39
Just wondering shouldn't your idea allways output a matrix with all 8s?
Since the real decision about bitrate distribution would be made later in the 'normal' following 2passes and a matrix with all 8s should be the most accurate,...
Cu Selur
MfA
17th October 2003, 19:00
You can use single pass RC, or you can do a first pass first and use the results to determine the desired size for the frames for which you optimize the quantizer matrices.
MfA
17th October 2003, 19:09
Originally posted by jpl
I'm primarily concerned with minimal size / optimal quality and would be willing to sacrifice time, probably much more than most other people, so I wouldn't have a problem with waiting for such a brute force method to finish.
Then this is not a good approach, if you optimize the inter matrices using p-frames from a movie coded with a different matrix then you arent really optimizing it very well. There is a significant interdependence between motion compensation and quantization.
It is not just important it quantizes the single frame well, it is also important it generates a frame which when motion compensated generates another nice frame.
jpl
17th October 2003, 19:15
@Sleur
If you open it to all possible matrices that would probably the case, but I was thinking along the lines of the original question about having a few extra matrices hard wired. If you had a selection of say 5-10 matrices (h263, mpeg, the HVS series, Andreas series) you could optimize on the best matrix for your particular clip.
However after some additional thought maybe you couldn't do it so simply and it would require you making a full set of passes for each matrix given that the quantizer decision is made in the 2nd pass and that will also affect the quality. I don't know enough to be sure if any quality improvement due to a specific matrix with quantizer of 2 would carry through into the final pass after the quantizer is changed to match the desired bitrate. I get the impression that it should but mathematically it might not work out that way once all the other program logic is thrown in.
JPL
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.