[Ffmpeg-devel] question on cs_test testing semantics.

Michael Niedermayer michaelni
Thu Mar 29 19:11:58 CEST 2007


Hi

On Thu, Mar 29, 2007 at 11:16:31AM -0400, mmh wrote:
> Michael Niedermayer writes:
>  > Hi
>  > 
>  > On Thu, Mar 29, 2007 at 08:40:56AM -0400, Marc Hoffman wrote:
>  > > 
>  > > This function is called in a big loop running over src with an offset
>  > > which advances by 1 in each iteration.  This causes a misaligned
>  > > access violation on some non X86 architectures. I'm curious as to why
>  > > this test is written this way. Is the intent to start sampling the
>  > > input pixels at odd memory locations as the beginning of the first
>  > > sample?  
>  > 
>  > hmm i dont think the intent is to do missaligned accesses ...
>  > 
> 
> Well I'm not sure then because the cs_test loop does the following:
> 
> cs_test:
>     for(dstOffset=128; dstOffset<196; dstOffset++){
> 	    int srcOffset;
> 	    memset(dstBuffer, dstByte, SIZE);
> 
> 	    for(srcOffset=128; srcOffset<196; srcOffset++){
> 		    uint8_t *src= srcBuffer+srcOffset;
> 		    uint8_t *dst= dstBuffer+dstOffset;
> 		    char *name=NULL;
> 
> 		    if(failed) break; //don't fill the screen with shit ...
> 
> 		    switch(funcNum){
> 		    case 0:
> 			    srcBpp=2;
> 			    dstBpp=2;
> 			    name="rgb15to16";
> 			    rgb15to16(src, dst, width*srcBpp);
> 			    break;
> 
> It might not have been the intent but it is what is happening. I think
> X86's just handle this fine and considering the input pattern is fixed
> 55 one would never see this behavior.  On machines with strict
> alignment this code doesn't work because:
> 
>    register unsigned x= *((uint32_t *)s);
> 
> which is an odd pointer based on srcOffset++.
> 
> How about we increment by 4 it doesn't really matter based on what

i dont remember what the original intent of teh code was but its wrong
as its written so yes iam fine with +=4

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070329/520b4695/attachment.pgp>



More information about the ffmpeg-devel mailing list