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. |
16th June 2008, 16:04 | #1 | Link |
Registered User
Join Date: Apr 2008
Posts: 4
|
How to build quantization matrix
Hi,
I've read quite a lot of papers about the job of the intra quantization matrix in mpeg4 codec, about the Human Visual System and Contrast Sensitivity Function saying that they must be taken into account to build a correct quantization matrix, but still i don't get how these matrix are build. (JPEG, Jawor, HVS best picture, H263, H264) How people use the Weber's law, the luminance masking and contrast masking, ... to build these matrix ? If anyone has links or ideas, feel free to share them
__________________
pierre Last edited by ticapix; 16th June 2008 at 16:34. |
16th June 2008, 16:08 | #2 | Link |
x264 developer
Join Date: Sep 2005
Posts: 8,666
|
1. Pick a random number between 30 and 255. Call this number B.
2. Pick a random number between 6 and 14. Call this number A. 3. Create a logarithmic distribution of values between A and B. For example, if A is 10 and B is 32: 10 12 15 18 22 26 32 4. Arrange these into a matrix: 10 12 15 18 12 15 18 22 15 18 22 26 18 22 26 32 5. Repeat the process for the 8x8 matrix. 6. You're done! You have yourself a CQM... /runs with mp4guy in hot pursuit
__________________
Follow x264 development progress | akupenguin quotes | x264 git status ffmpeg and x264-related consulting/coding contracts | Doom10 Last edited by Dark Shikari; 16th June 2008 at 16:13. |
16th June 2008, 17:04 | #3 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
/me prepares and loads the shotty aiming at D_S legs
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! |
16th June 2008, 18:14 | #4 | Link |
Testeur de codecs
Join Date: May 2003
Location: France
Posts: 2,484
|
HVS matrix for exemple use really serious IEEE paper based on HVS luminance study.
http://forum.doom9.org/showthread.ph...=referencedivx There are simple rule for CQM: Human eyes are more sensible to global (low frequencies aka gradiant) than detail (high frequencies). For HVS it's better to use higher coefficient for HF and lower coefficient for LF. You obtain intra HVS matrix for MPEG4 ASP like that: 16 16 16 16 17 18 21 24 16 16 16 16 17 19 22 25 16 16 17 18 20 22 25 29 16 16 18 21 24 27 31 36 17 17 20 24 30 35 41 47 18 19 22 27 35 44 54 65 21 22 25 31 41 54 71 88 24 25 29 36 47 65 88 115 Anyway for MPEG4 AVC you have a more complex architecture. High quantisation values for Global (LF) mean blocking and it's a better HVS way to use lower relative coef in CQM in this case. But H264 can use another way against blocking: inloop deblocking. Inloop is really good against blocking but inloop is aggressive with detail level (HF). In conclusion with inloop you change this simple HVS rule. In fact in practice and IMO for H264, flat16 matrix is really good for "low bitrate" because inloop is really agressive in this case. Have same coef for HF and LF is certainely the best HVS way here. For "high bitrate" inloop is less aggressive. HVS matrix (low coef for LF and high coef for HF) is certainely a better HVS way in this case. Moreover with implementation like x264 use a matrix radically different than the flat16 can change the codec functioning in bad way. If you want really use CQM with x264 you must IMO use really "soft" HVS matrix like that: INTRA4X4_LUMA = 12,12,14,16, 12,14,16,20, 14,16,20,25, 16,20,25,32 INTRA4X4_CHROMAU = 12,12,14,16, 12,14,16,20, 14,16,20,25, 16,20,25,32 INTRA4X4_CHROMAV = 12,12,14,16, 12,14,16,20, 14,16,20,25, 16,20,25,32 INTER4X4_LUMA = 14,14,15,16, 14,15,16,17, 15,16,17,18, 16,17,18,19 INTER4X4_CHROMAU = 14,14,15,16, 14,15,16,17, 15,16,17,18, 16,17,18,19 INTER4X4_CHROMAV = 14,14,15,16, 14,15,16,17, 15,16,17,18, 16,17,18,19 INTRA8X8_LUMA = 12,12,12,12,13,14,15,16, 12,12,12,13,14,15,16,17, 12,12,13,14,15,16,17,19, 12,13,14,15,16,18,20,22, 13,14,15,16,18,21,23,27, 14,15,16,18,21,24,28,37, 15,16,17,20,23,28,39,48, 16,17,19,22,27,37,48,68 INTER8X8_LUMA = 14,14,14,14,15,15,15,16, 14,14,14,14,15,15,16,17, 14,14,14,15,15,16,17,18, 14,14,15,15,16,17,18,19, 15,15,15,16,17,18,19,21, 15,15,16,17,18,20,22,26, 15,16,17,18,19,22,27,32, 16,17,18,19,21,26,32,44
__________________
Le Sagittaire ... ;-) 1- Ateme AVC or x264 2- VP7 or RV10 only for anime 3- XviD, DivX or WMV9 Last edited by Sagittaire; 16th June 2008 at 21:42. |
5th April 2009, 10:23 | #5 | Link | |
Registered User
Join Date: Jan 2009
Posts: 25
|
Quote:
|
|
5th April 2009, 14:12 | #6 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
they are NOT deduced.
you cant understand or build a (useful) CQM if you do not understand how the quantization works, what are the DCT coefficients, etc... however, basically for AVC, what Dark_Shikari said is correct or at least, it works... but dont expect good results...
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! Last edited by Sharktooth; 6th April 2009 at 20:53. |
Tags |
matrix, quantification |
Thread Tools | Search this Thread |
Display Modes | |
|
|