[Xvid-devel] bgr_to_yv12_mmx access violation for BGR 1280*1024 image. Is that just me?

Erwin Bellon erwin.bellon at uzleuven.be
Thu Apr 21 10:15:26 CEST 2011


Stephan,

You mention that for my RGB24 format the stride should be a multiple of 3. Isn't the stride the number of bytes between the start of one line in the image and the next line? I thought that on the Windows platform that figure should be a multiple of 4 for packed formats. In this specific case there are no padding bytes as 3840 is both a multiple of 3 and of 4. I calculate the stride using as (((imageWidth * nrBitsPerPixel) + 31) & ~31) >> 3, which I assumed to round up to the next 4-byte boundary.

Erwin

-----Original Message-----
From: xvid-devel-bounces at xvid.org [mailto:xvid-devel-bounces at xvid.org] On Behalf Of Stephan Aßmus
Sent: woensdag 20 april 2011 20:11
To: xvid-devel at xvid.org
Subject: Re: [Xvid-devel] bgr_to_yv12_mmx access violation for BGR 1280*1024 image. Is that just me?

Hi,

Am 20.04.2011 18:37, schrieb Erwin Bellon:
> I wrapped your fine encoder in a DirectShow filter and use that to capture real-time video. That filter works for most image resolutions but for
> 1280 * 1024 RGB 24bit output from a webcam I get a read access violation. Did I supply wrong values or might this conversion be suspect? Interestingly, the memory location that the code tries to read is just beyond the memory for the image frame.
>
> I include the code that calls the assembler routine below, with the parameter values included between ().
>
> case XVID_CSP_BGR:
> 	safe_packed_conv(
> 		src[0],   		(0x26ac0000, and when added 1280*1024*3
> 					 ->  address at which access violation occurs)
> 		src_stride[0],	(3840, is a multiple of 4)
> 		image->y,		(I assume that is an output buffer)
> 		image->u,
> 		image->v,
> 		edged_width,	(1408)
> 		edged_width2,	(704)
> 		width,		(1280)
> 		height,		(1024)
> 		(csp&  XVID_CSP_VFLIP),		(csp = 80000200
> 						 	 = XVID_CSP_BGR | XVID_CSP_VFLIP)
>
> 		interlacing?bgri_to_yv12  :bgr_to_yv12,	(interlacing = 0)
> 		interlacing?bgri_to_yv12_c:bgr_to_yv12_c, 3, interlacing);
>
> Any hint would be appreciated. I will in the mean time try to test some more.

It sounds wrong that src stride is a multiple of 4. It should be a 
multiple of 3.

Best regards,
-Stephan

_______________________________________________
Xvid-devel mailing list
Xvid-devel at xvid.org
http://list.xvid.org/mailman/listinfo/xvid-devel


More information about the Xvid-devel mailing list