[XviD-devel] [In progress] devapi4 -- mpeg matrices
Edouard Gomez
ed.gomez at free.fr
Fri Nov 28 13:48:06 CET 2003
Edouard Gomez (ed.gomez at free.fr) wrote:
> skal (skal at planet-d.net) wrote:
> > i confirm: i simply forgot to add this usual poor man's
> > RD-opt. MPEG4's intra bias should be:
> > bias = (3*quant*intra_matrix[i]+2)>>2
> > Nice fishing! :) Thanks
>
> Ok i'll change the bias computation in the quantization context
> initializer (equivalent to your SKL_QUANTIZER type)
>
> Btw, i had left a serious bug, not copying the quant matrix in the
> context, so trellis was simply unoptimizing the coefficients.
Fixing that stupid bug, i got back to 38.8x dB :-)
Then i changed the bias value and got 39.11 dB w/o trellis (which is
0.01 dB better than old code)
Does this code looks right to you skal ?
void
quant_mpeg_init_context_c(quant_context_t *q,
const uint8_t *matrix,
const int32_t intra)
{
int qp;
for (qp=1; qp<32; qp++) {
int i;
for(i=0; i<64; i++) {
const int S = qp*matrix[i];
const int shift = mpeg_shifts[qp-1];
q[0][qp-1][0][i] = FIX(S<<1, shift, 1); /* quant */
q[0][qp-1][1][i] = intra ? ((3*S+2)>>2) : 0;
q[1][qp-1][0][i] = S<<1; /* dequant */
q[1][qp-1][1][i] = intra ? 0 : (S>>1);
}
}
}
--
Edouard Gomez
More information about the XviD-devel
mailing list