[XviD-devel] [In progress] devapi4 -- mpeg matrices

Edouard Gomez ed.gomez at free.fr
Fri Nov 28 11:20:39 CET 2003


Edouard Gomez (ed.gomez at free.fr) wrote:
> skal (skal at planet-d.net) wrote:
> > 	Sure, no pb. But beware:
> > 
> > 	a) i'm not sure it's bug-free (especially the h263 (de)quant)
> 
> Ok i  integrated the C  part of your  code to XviD  and i get  a strange
> result with  mpeg4 quantization  (using your C  code, not  the reference
> one).
> 
> ===============================================================================
> Test name: underworld-trailer
> Using cached first pass stats (hash - a1c5ab3ce4420b302dd41ee9886379ea)
>  
> Results:
> xvid:     Min PSNR y : 30,13 dB, u : 38,08 dB, v : 39,42 dB
> xvid: Average PSNR y : 38,72 dB, u : 42,98 dB, v : 45,27 dB
> xvid:     Max PSNR y : 99,99 dB, u : 99,99 dB, v : 99,99 dB
> ===============================================================================

The h263 part seems to be better than the old code i get a termendous
0.02 dB improvement ;-) I used to get 39.38 dB on this test now i get:

===============================================================================
Test name: underworld-trailer
Using cached first pass stats (hash - 14a607e0f274a4f3e8f65c5d15723d23)
 
Results:
xvid:     Min PSNR y : 32,77 dB, u : 39,38 dB, v : 41,81 dB
xvid: Average PSNR y : 39,40 dB, u : 43,03 dB, v : 45,25 dB
xvid:     Max PSNR y : 99,99 dB, u : 99,99 dB, v : 99,99 dB
===============================================================================

Concerning the MPEG quantization problem... dequant part are exactly the
same  between old  and your  sklmp4  code. But  I noticed  the old  mpeg
quant_intra function was using something like this for intra vops:

const uint32_t quantd = ((VM18P * quant) + (VM18Q / 2)) / VM18Q;
level = ((level << 4) + (intra_matrix[i] >> 1)) / intra_matrix[i];
level = ((level + quantd) * mult) >> SCALEBITS;

where:
mult = FIX(2*quant, SCALEBITS, 1);

In sklmp4 it's:
level = FDIV(level<<4, mult, bias, shift);

where:
mult = FIX(2*quant*intra_matrix[i], shift, 1);
bias = quant*intra_matrix[i];

It seems to me the +quantd bias from the old code is gone.

-- 
Edouard Gomez


More information about the XviD-devel mailing list