[XviD-devel] XVID_REDUCED question/bug

Marco "elcabesa" Belli xvid-devel@xvid.org
Fri, 31 Jan 2003 19:35:04 +0100


 i'm testing my adaptive quant code and it suddenly stop working when used 
with XVID_REDUCED
i think that this is a xvid bug becouse inside FRAMECODEI fuction i find

if ((pEnc->current->global_flags & XVID_REDUCED))
	{
		mb_width = (pEnc->mbParam.width + 31) / 32;
		mb_height = (pEnc->mbParam.height + 31) / 32;

		/* 16x16->8x8 downsample requires 1 additional edge pixel*/
		/* XXX: setedges is overkill */
		start_timer();
		image_setedges(&pEnc->current->image,
			pEnc->mbParam.edged_width, pEnc->mbParam.edged_height,
			pEnc->mbParam.width, pEnc->mbParam.height);
		stop_edges_timer();
	}

so if reduced size it calc a new number of mblock for image to be encoded

but then after few line i found 

for (y = 0; y < mb_height; y++)
		for (x = 0; x < mb_width; x++) {
			MACROBLOCK *pMB =
				&pEnc->current->mbs[x + y * pEnc->mbParam.mb_width];

			CodeIntraMB(pEnc, pMB);

			MBTransQuantIntra(&pEnc->mbParam, pEnc->current, pMB, x, y,
							  dct_codes, qcoeff);

			start_timer();
			MBPrediction(pEnc->current, x, y, pEnc->mbParam.mb_width, qcoeff);
			stop_prediction_timer();

			start_timer();
			if (pEnc->current->global_flags & XVID_GREYSCALE)
			{	pMB->cbp &= 0x3C;		/* keep only bits 5-2 */
				qcoeff[4*64+0]=0;		/* zero, because for INTRA MBs DC value is saved */
				qcoeff[5*64+0]=0;
			}
			MBCoding(pEnc->current, pMB, qcoeff, bs, &pEnc->current->sStat);
			stop_coding_timer();
		}

where 
MACROBLOCK *pMB =
				&pEnc->current->mbs[x + y * pEnc->mbParam.mb_width];  mblock data are the 
old one calc by NOT_REDUCED code
so quantizer that have benn calc were all woring, we sohuld take quant witha 
1/4 frequency  
i don0t know why but old lumi_mask work, or it change less the quant table or  
i'm totally  wrong and this mail  has only to be removed form your memory =)