Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 Doom9's Forum Matrix or Matrices for encoding Mpeg-2 - Please explain, help or link
 Register FAQ Calendar Search Today's Posts Mark Forums Read

 12th February 2005, 18:04 #1  |  Link video_magic Registered User   Join Date: Jan 2005 Posts: 368 Matrix or Matrices for encoding Mpeg-2 - Please explain, help or link I have noticed Matrices, which are a lot of numbers that I understand help improve the encoding quality in some way I would like to know the basic information about them (preferably explained simply ) - i.e. what do the numbers mean and what do Matrices do - what's the basic idea of how they work? if anyone knows a good link and could give a little tutorial if it's worth me making my own if that's an option, even better. I am interested in Matrices for Mpeg-2 and Mpeg-1. If it's complicated please explain simply if possible, thanks. Here are a couple of questions too: Do Matrices alter the picture for percieved qulity or enhancements - I mean like you could have a 'sharpen' effect which might fool the viewer into thinking it's a better quality encoding but it has actually altered the picture further from the original. Or do Matrices really improve the quality by keeping the picture closer to the original than if it was not used. Is the use of a Matrix permissible if I wanted to encode 'Spec-compliant' Mpeg? I mean, does the decoder have to know about Matrices that were used to encode, or is this not an issue. __________________ Thankyou!, I am grateful for any help
 13th February 2005, 14:47 #2  |  Link Amnon82 Paldo-GNU/LinuxMaintainer     Join Date: Oct 2003 Location: Germany Posts: 1,580 What is a Quantization Matrix? To quote the explanation here: The quantization matrix is the 8 by 8 matrix of step sizes (sometimes called quantums) - one element for each DCT coefficient. It is usually symmetric. Step sizes will be small in the upper left (low frequencies), and large in the upper right (high frequencies); a step size of 1 is the most precise. The quantizer divides the DCT coefficient by its corresponding quantum, then rounds to the nearest integer. Large quantums drive small coefficients down to zero. The result: many high frequency coefficients become zero, and therefore easier to code." To put it short: It's the lossy filter by which you achieve higher compressibility by losing detail. The amount of detail lost is determined by the values of each individual quantum. More theory about the technical process behind it: http://www.ece.purdue.edu/~ace/jpeg-tut/jpegtut1.html http://www.mpeg.org/MPEG/MSSG/tm5/Ch7/Ch7.html http://www.cmlab.csie.ntu.edu.tw/cml...eg/encoder.htm http://www.acm.org/crossroads/xrds6-...imgcoding.html Note: Most of these links are about Jpeg but the process is nearly the same for MPEG-2 Some matrices of mine: AutoQ#1 Matrix: Code: ```8,16,19,22,26,27,29,34 16,16,22,24,27,29,34,35 19,22,26,27,29,34,35,38 22,22,26,27,29,34,35,40 22,26,27,29,32,35,40,48 26,27,29,32,35,40,48,50 26,27,29,35,40,48,50,60 27,29,35,40,48,50,60,62 16,20,24,28,32,36,40,44 20,24,28,32,36,40,44,48 24,28,32,36,40,44,48,52 28,32,36,40,44,48,52,56 32,36,40,44,48,52,56,58 36,40,44,48,52,56,58,60 40,44,48,52,56,58,60,62 44,48,52,56,58,60,62,62``` (C) 2005 by Amnon82 - You will find it in Auto(C)Q, DRPEncEasy, DRPEncME, DRPEncXP, EasySVCD/DVD. AutoQ#2 Matrix: Code: ```8,16,19,22,26,28,32,38 16,16,22,24,28,32,38,44 19,22,26,28,32,38,44,48 22,22,26,32,38,44,48,54 22,26,32,38,44,48,54,64 26,32,38,44,48,54,64,74 32,38,44,48,54,64,74,84 38,44,48,54,64,74,84,94 16,20,24,28,36,42,46,52 20,24,28,36,42,46,52,58 24,28,36,42,46,52,58,62 28,36,42,46,52,58,62,68 36,42,46,52,58,62,68,78 42,46,52,58,62,68,78,88 46,52,58,62,68,78,88,99 52,58,62,68,78,88,99,99``` (C) 2005 by Amnon82 - You will find it in Auto(C)Q and HCEncoder Last edited by Amnon82; 13th February 2005 at 14:55.
 13th February 2005, 16:02 #3  |  Link Guest Guest   Join Date: Jan 2002 Posts: 21,923 Suppose you have a number in 8 bits. It has 256 levels. You want to save some bits when sending the value. So you divide it by 2 and send that. It is only 7 bits now. Then when you receive that you multiply it back by 2. You've saved bits but you now only get the even values of the number. That's just to give you an intuitive idea of what quantizing is for and the effect it has.
14th February 2005, 00:26   #5  |  Link
hank315
HCenc author

Join Date: Nov 2003
Location: Netherlands
Posts: 570
Quote:
 Is it pointless to put them all to '1' to try and get the best quality encode , I suppose that would be too easy! and it doesn't work in that way.
Too easy indeed
Don't use values < 8 for intra and < 16 for non-intra and also don't use values > 255 (better not use values > 127, some encoders/decoders can't handle it)
There's no perfect matrix, every matrix used is a compromise.
The upper left part (lower frequencies) take care off the general picture, the lower right (high frequencies) take care of the detail.
So if you want to preserve all detail just use all 8 (intra) and 16 (non-intra) but the result will be bad, the lower frequencies will not have enough bits.
The used quantiser (Q-value) can be seen as a factor applied to the matrices.

Hope this helps, but if you really want to know more about it, just Google on DCT or FFT, you will get *alot* more information