[MPlayer-dev-eng] altivec_yuv2packedX (again. found the problem)

Andrea Palmatè andrea at amigasoft.net
Wed Jul 13 18:59:32 CEST 2005


Hi dear!

I have another problem with damned altivec. I have configured the 
output video driver to scale the image. Mplayer use an optimized 
altivec scale function. Now. when i use this function i receive a 
great GR in an altivec function with a "alignment" crash type. I'm 
not too expert of altivec and alignment but i have compiled mplayer 
with debug and i have found the line that crash. The function is:

void
altivec_yuv2packedX (SwsContext *c,
                        int16_t *lumFilter, int16_t **lumSrc, int 
lumFilterSize,
                        int16_t *chrFilter, int16_t **chrSrc, int 
chrFilterSize,
                        uint8_t *dest, int dstW, int dstY)
{
[...]snip[...]

     cvtyuvtoRGB (c, Y0,U0,V0,&R0,&G0,&B0);
     cvtyuvtoRGB (c, Y1,U1,V1,&R1,&G1,&B1);

     R  = vec_packclp (R0,R1);
     G  = vec_packclp (G0,G1);
     B  = vec_packclp (B0,B1);

     out_rgba (R,G,B,out);
     ^^^^^^^^^
and it crash here. Most probably for the wrong "out" parameter.
the dump is:

>R:804CC5C0 G:00004140 B:00000018 out:00004190
so it seems that R and out are swapped??

If you see, the out variable is:

   out = (vector unsigned char *)dest;

the dest function parameter is passed by draw_slice function in video 
output driver that is:

     if ( ! (lock_h = p96LockBitMap( BitmapTab[GET_RENDER],
                   (UBYTE *) &rinf,
                   sizeof( struct RenderInfo )) ) ) return -1; // 
Unable to lock the BitMap -> do nothing

      p96UnlockBitMap( BitmapTab[GET_RENDER], lock_h );

     MyBitmap_addr = (ULONG *)rinf.Memory;
     MyBitmap_stride = rinf.BytesPerRow;

         dstStride[0] = MyBitmap_stride;
         dstStride[1] = 0;
         dstStride[2] = 0;

         dst[0] = (uint8_t *) ( (LONG) MyBitmap_addr + 
(x+internal_offset_x)*image_bpp );
         dst[1] = NULL;
         dst[2] = NULL;

         sws_scale_ordered(swsContext,
                         image,
                         stride,
                         y + internal_offset_y,
                         h,
                         dst,
                         dstStride);

do you think it is possible found the problem? ave you some tips for me?
thank you

Andrea 




More information about the MPlayer-dev-eng mailing list