Personal View site logo
Could someone explain the scaling tables in Ptools v3.64d
  • Title says it all. I want to work with the new scaling tables, but haven't a clue how to do it. A guide would be most appreciated.

  • 7 Replies sorted by
  • Hi Ralph.

    First, I'm a little tired to finish this tonight so will spend some time tomorrow giving the basics.

    (more to come)

    I am working on a full guide in my AVCHD GH2/Gxx guide for dummies coming soon. It will have diagrams in and stuff which I can't really show here. The guide will appear next week. Here's a very quick subset of info... it probably won't help as Matrix design is a black art but here goes...

    (full details to come)

    Quantization Matrix

    (More to come)

    Quantization Scaling tables

    (More to come)

    Scaling tables?.... It's all quite complicated. Its a combi 48 entry table in scan order:

      Luma_Y
    
          Macroblock_entry [0-15]
    
              byte Intra
    
              byte Inter
    
    
      Chroma_Cr
    
          Macroblock_entry [0-15]
    
              byte Intra
    
              byte Inter
    
    
      Chroma_Cb
    
          Macroblock_entry [0-15]
    
              byte Intra
    
              byte Inter
    

    This means that each line in ptools for each scaling table is made up of 48 hex numbers.

    (more coming soon here)

    Quantization Scaling Tables Achieving the balance in Quantiser Matrix Design:

    Higher QM values will lead to bigger rounding errors, nullifying subtle luminance variations. Using high values for high frequencies in B/P-frame QM could improve compressability. However, the tradeoff for using too high values could cause ringing.

    Lowering the high frequency QM values in I-frames could be used to add bits to fine detail in keyframes, possibly creating better values for the B/P-frame process to work with.

    Using the same QM for both Inter and Intra frames is less efficient than using different QM's, because of the difference in method used.

    The standard Panasonic Lumix GXX matrices are already quite well made. The only reason I could see anyone using a custom QM is for increasing/decreasing the amount of detail/size of a video (since for higher compression you could just as well use a higher quant, no need for a custom matrix) or for making things look sharper, flatter or softer and less sharpe.

    What is colour space - YUV or YCbCr?

    In simplistic terms, component video's color space is also known as YUV or YCbCr, where Y encodes luminance, U or Cb (blue) the difference between the blue primary and luminance, and V or Cr (red) the difference between the red primary and luminance. The low chromatic acuity (clearness of vision) allows a percentage data reduction of the color difference signals. In digital video, this is achieved by chroma subsampling. In AVC colour space profiles the notation used is as follows: 4:4:4 = no chroma subsampling. 4:2:2 = chroma subsampling by a factor of 2 horizontally; this sampling format is used in the standard for studio-quality component digital video as defined by ITU-R Rec. BT.601-5 (1995), for example. 4:2:0 = chroma subsampling by a factor of 2 both horizontally and vertically; it is probably the closest approximation of human visual color acuity achievable by chroma subsampling alone. This sampling format is the most common in JPEG or MPEG and in the GH2's AVCHD implemntation.

    There are lots of CQM (Custom Quantiser Matrices) available on the internet. Most are very poor and totally irrelevant to the GH2 - designed for mpeg or DVD mastering. Some are good - in particular a guy called Shark Tooth made some decent matrices around 2005 onwards, and for AVC... try them...

    http://forum.doom9.org/showthread.php?t=96298

    A few months ago I was able to 'peruse' the official AVC Intra matrix and decided to scale the values myself (with good info and help from Chris Brandin @cbrandin) and employed the design in the first release of Orion.

    The official AVC standard flat matrix is made up of all 16s (48 x 16 converted to hex).

    The factory Panasonic GH2 1080p24 Scaling i tables are made up as seen in the first spreadsheet [graphic attached below] (and converted to hex as seen in ptools). Set out in Hex it looks in ptools as follows;- 0x605, 0x705, 0x705, 0x806, 0xA07, 0x806, 0xA08, 0xC0A, 0xC0A, 0xA08, 0xD0A, 0xE10, 0xD0A, 0x1010, 0x1010, 0x1414, 0x505, 0x606, 0x606, 0x808, 0x808, 0x808, 0xA0A, 0xE0E, 0xE0E, 0xA0A, 0xF0F, 0x1010, 0xF0F, 0x1210, 0x1210, 0x1A18, 0x505, 0x606, 0x606, 0x808, 0x808, 0x808, 0xA0A, 0xE0E, 0xE0E, 0xA0A, 0xF0F, 0x1010, 0xF0F, 0x1210, 0x1210, 0x1A18

    (more to come)

    There are various tools out there which enable you to analyse mts h264/AVCHD files Quantiser scaling tables; cbrandin's Streamparser (using Create Video Elelemtnary Stream File and then reanalysing it back in or externaly), Elecard Stream Analysis, etc... which shows you the contents of what is known as the Picture Parameter Set (or PPS) - listing the 6 scaling tables of what the GH2 outputs for each frame slice. However, not all tables are used... which I'll explain in the guide.!!!!

    (more to come)

    Stock Panasonic Scaling i Matrix.png
    1284 x 137 - 13K
  • Thanks, Nick. Looking forward to your guide. It will be of immense value to the community.

  • Driftwood, I couldn't have explained it any better :-)

  • A great read. Looking forward to it!

  • so much thanks nick for sharing your knowledge! appreciated ;)

  • Can't wait until @VK hacks Picture Profiles, then NO ONE will understand what is going on!

    Only joking, I get it...

    I think...

  • Did driftwood ever post the guide for dummies?