[XviD-devel] possible vfw YV12 stride bug

Wei Dai weidai at weidai.com
Mon Jan 12 08:29:33 CET 2004


In compress(), codec.c, stride is being computed as:

	frame.input.stride[0] = (((icc->lpbiInput->biWidth * icc->lpbiInput->biBitCount) + 31) & ~31) >> 3;

	if ((frame.input.csp = get_colorspace(inhdr)) == XVID_CSP_NULL)		
		return ICERR_BADFORMAT;	

	if (frame.input.csp == XVID_CSP_I420 || frame.input.csp == XVID_CSP_YV12)		
		frame.input.stride[0] = (frame.input.stride[0]*2)/3;

For biWidth==716, this results in a stride of 717, which doesn't seem to
make sense. Can anyone either explain the logic behind this code, or
determine that it's a bug and fix it?

I encountered this problem while using avs2avi 1.31a with avisynth 2.53
and xvid beta 3. (xvid encodes the image as a slanted version of the
original.) The output from avisynth appears to have a stride of 716. I'm
not sure if that is correct either, but intuitively it seems more likely
to be correct than 717.


More information about the XviD-devel mailing list