[Ffmpeg-devel] PATCH: Blackfin Accelerated CSC (Color Space Converter)

Marc Hoffman mmh
Sat Apr 28 14:33:11 CEST 2007


Michael Niedermayer writes:
 > Hi
 > 
 > On Thu, Apr 26, 2007 at 08:52:16AM -0400, Marc Hoffman wrote:
 > Content-Description: message body text
 > > 
 > > Marc Hoffman writes:
 > >  > 
 > >  > Please review, and let me know how this is comming along?
 > > 
 > > Couple of small changes, fall back support for handling no more L1
 > > available.  internal local lables changed to start with L or .L.
 > > 
 > > Please review.
 > > 
 > > csctst.c:241: warning: passing argument 5 of 'ldframeYUV' from incompatible pointer type
 > > yoda:~/mp/libswscale mmh$ rsh -l root mad "cd /u/mp/libswscale; ./csctst" 
 > > [swscaler @ 0x25f5430]BlackFin Accelerated Color Space Converter rgb24
 > > [swscaler @ 0x25f5430]BlackFin Accelerated Color Space Converter rgb24
 > > [swscaler @ 0x25f5430]No accelerated colorspace conversion found
 > > 115397126 133545084 166542709
 > > 18147958 32997625
 > > improve 181.825553
 > > yoda:~/mp/libswscale mmh$ 
 > > 
 > > Which is a 182% of a performance boost if anyone is interested.
 > > 
 > 
 > [...]
 > > +static
 > > +int core_yuv420_rgb (SwsContext *c,
 > > +                     unsigned char **in, int *instrides,
 > > +                     int srcSliceY, int srcSliceH,
 > > +                     unsigned char **oplanes, int *outstrides, ltransform_t lcscf, int rgb)
 > > +{
 > > +    unsigned char *py,*pu,*pv,*op;
 > > +    int w  = instrides[0];
 > > +    int w2 = w/2;
 > > +    int h2 = srcSliceH>>1;
 > > +    int i;
 > > +
 > > +    py = in[0];
 > > +    pv = in[1+(0^rgb)];
 > > +    pu = in[1+(1^rgb)];
 > 
 > exchanging u and v is not equivalent to exchanging r anf b (i dont know if
 > theres any code which changes to coefficients to compensate the difference)


R=Y + V*CRV
G=Y + U*CGU + V*CGV
B=Y + U*CBU

You are correct excellent catch I guess we just need to exchange CGU
and CGV and then it would have the correct formulation. Do you agree
with this?


 > 
 > 
 > [...]
 > 
 > > +    c->cy  = c->yCoeff &0xffffffffU;
 > > +    c->crv = c->vrCoeff&0xffffffffU;
 > > +    c->cbu = c->ubCoeff&0xffffffffU;
 > > +    c->cgu = c->ugCoeff&0xffffffffU;
 > > +    c->cgv = c->vgCoeff&0xffffffffU;
 > 
 > why doesnt the asm code use *Coeff directly?

Those coeffients are 64bit quads and not 32bit pairs so the addressing
system wouldn't work.

 > 
 > [...]
 > > +SwsFunc ff_bfin_yuv2rgb_get_func_ptr (SwsContext *c)
 > > +{
 > > +    SwsFunc f = 0;
 > > +
 > > +    switch(c->dstFormat) {
 > > +    case PIX_FMT_RGB555: f = bfin_yuv420_rgb555; break;
 > > +    case PIX_FMT_BGR555: f = bfin_yuv420_bgr555; break;
 > > +    case PIX_FMT_RGB565: f = bfin_yuv420_rgb565; break;
 > > +    case PIX_FMT_BGR565: f = bfin_yuv420_bgr565; break;
 > > +    case PIX_FMT_RGB24:  f = bfin_yuv420_rgb24;  break;
 > > +    case PIX_FMT_BGR24:  f = bfin_yuv420_bgr24;  break;
 > > +    }
 > > +
 > > +    if (f)
 > > +      av_log(c, AV_LOG_INFO, "BlackFin Accelerated Color Space Converter %s\n", sws_format_name (c->dstFormat));
 > 
 > this could be a default: in the switch

I will make that change.

 > 
 > 
 > [...]
 > > Index: swscale_internal.h
 > > ===================================================================
 > > --- swscale_internal.h	(revision 22874)
 > > +++ swscale_internal.h	(working copy)
 > > @@ -162,6 +162,27 @@
 > >  
 > >  #endif
 > >  
 > > + 
 > > +#ifdef ARCH_BFIN
 > > +  int      scl;
 > > +  uint32_t oc;
 > > +  uint32_t oy;
 > > +  uint32_t cy;
 > > +  uint32_t ymin;
 > > +  uint32_t ymax;
 > > +  uint32_t crv;
 > > +  uint32_t rmask;
 > > +  uint32_t cgu;
 > > +  uint32_t cgv;
 > > +  uint32_t gmask;
 > > +  uint32_t cbu;
 > > +  uint32_t bmask;
 > > + 
 > > +  /* temporary memory buffers for translating between color spaces */
 > > +  short *tmpY, *tmpU, *tmpV;
 > > +#endif
 > > +
 > 
 > please indent them like the original c code

Sorry missed this.

 > 
 > [...]
 > -- 
 > Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
 > 
 > Those who are too smart to engage in politics are punished by being
 > governed by those who are dumber. -- Plato 
 > _______________________________________________
 > ffmpeg-devel mailing list
 > ffmpeg-devel at mplayerhq.hu
 > http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel




More information about the ffmpeg-devel mailing list