Changeset 826

Show
Ignore:
Timestamp:
03/12/08 11:41:26 (7 months ago)
Author:
gbooker
Message:

Perform color conversion on final line if the height is an odd number of pixels. Tested on intel, should work on others as well.
Fixes #307

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ColorConversions.c

    r825 r826  
    104104                 baseAddr += outRB * 2; 
    105105         } 
     106        if(height & 1) 
     107        { 
     108                int x; 
     109                for(x=0; x < halfWidth; x++) 
     110                { 
     111                        unsigned x4 = x*4, x2 = x*2; 
     112                        baseAddr[x4] = inU[x]; 
     113                        baseAddr[x4+1] = inY[x2]; 
     114                        baseAddr[x4+2] = inV[x]; 
     115                        baseAddr[x4+3] = inY[x2+1]; 
     116                } 
     117        }        
    106118 } 
    107119 
     
    154166                vc += rV; 
    155167        } 
     168        if(height & 1) 
     169        { 
     170                unsigned halfwidth = width / 2; 
     171                for(x=0; x < halfwidth; x++) 
     172                { 
     173                        unsigned x4 = x*4, x2 = x*2; 
     174                        o[x4] = uc[x]; 
     175                        o[x4+1] = yc[x2]; 
     176                        o[x4+2] = vc[x]; 
     177                        o[x4+3] = yc[x2+1]; 
     178                } 
     179        }        
    156180} 
    157181 
     
    189213                        unsigned x2 = x*2, x4 = x*4; 
    190214 
    191 #if 0 
     215#if 1 
    192216                        asm volatile( 
    193217                                "movdqu         %4,             %%xmm4  \n\t" 
     
    259283                vc += rV; 
    260284        } 
     285        if(height & 1) 
     286        { 
     287                for(x=0; x < halfwidth; x++) 
     288                { 
     289                        unsigned x4 = x*4, x2 = x*2; 
     290                        o[x4] = uc[x]; 
     291                        o[x4+1] = yc[x2]; 
     292                        o[x4+2] = vc[x]; 
     293                        o[x4+3] = yc[x2+1]; 
     294                } 
     295        } 
    261296} 
    262297 
     
    285320                u += rU; 
    286321                v += rV; 
     322        } 
     323        if(height & 1) 
     324        { 
     325                for(x=0; x < halfwidth; x++) 
     326                { 
     327                        unsigned x4 = x*4, x2 = x*2; 
     328                        o[x4] = u[x]; 
     329                        o[x4+1] = yc[x2]; 
     330                        o[x4+2] = v[x]; 
     331                        o[x4+3] = yc[x2+1]; 
     332                } 
    287333        } 
    288334}