2011/7/21 Enlightenment SVN <no-re...@enlightenment.org>:
> Log:
> evas: add software YUY2 colorspace converter.
>
>  NOTE: will shortly learn how to write the corresponding shader and add it 
> soon.
>
>

This is actually a 422? And not like our fake 422 that is actually 420?

> Author:       cedric
> Date:         2011-07-21 03:36:05 -0700 (Thu, 21 Jul 2011)
> New Revision: 61548
> Trac:         http://trac.enlightenment.org/e/changeset/61548
>
> Modified:
>  trunk/evas/src/lib/Evas.h trunk/evas/src/lib/cache/evas_cache_image.c 
> trunk/evas/src/lib/engines/common/evas_convert_yuv.c 
> trunk/evas/src/lib/engines/common/evas_convert_yuv.h 
> trunk/evas/src/lib/engines/common/evas_image_data.c 
> trunk/evas/src/lib/engines/common/evas_image_main.c 
> trunk/evas/src/modules/engines/directfb/evas_engine.c 
> trunk/evas/src/modules/engines/software_generic/evas_engine.c 
> trunk/evas/src/modules/engines/software_sdl/evas_engine.c
>
> Modified: trunk/evas/src/lib/Evas.h
> ===================================================================
> --- trunk/evas/src/lib/Evas.h   2011-07-21 08:17:13 UTC (rev 61547)
> +++ trunk/evas/src/lib/Evas.h   2011-07-21 10:36:05 UTC (rev 61548)
> @@ -457,10 +457,11 @@
>  {
>    EVAS_COLORSPACE_ARGB8888, /**< ARGB 32 bits per pixel, high-byte is Alpha, 
> accessed 1 32bit word at a time */
>      /* these are not currently supported - but planned for the future */
> -   EVAS_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 
> specifications. The data poitned to is just an array of row pointer, pointing 
> to the Y rows, then the Cb, then Cr rows */
> -   EVAS_COLORSPACE_YCBCR422P709_PL,/**< YCbCr 4:2:2 Planar, ITU.BT-709 
> specifications. The data poitned to is just an array of row pointer, pointing 
> to the Y rows, then the Cb, then Cr rows */
> +   EVAS_COLORSPACE_YCBCR422P601_PL, /**< YCbCr 4:2:2 Planar, ITU.BT-601 
> specifications. The data pointed to is just an array of row pointer, pointing 
> to the Y rows, then the Cb, then Cr rows */
> +   EVAS_COLORSPACE_YCBCR422P709_PL,/**< YCbCr 4:2:2 Planar, ITU.BT-709 
> specifications. The data pointed to is just an array of row pointer, pointing 
> to the Y rows, then the Cb, then Cr rows */
>    EVAS_COLORSPACE_RGB565_A5P, /**< 16bit rgb565 + Alpha plane at end - 5 
> bits of the 8 being used per alpha byte */
> -   EVAS_COLORSPACE_GRY8 /**< 8bit grayscale */
> +   EVAS_COLORSPACE_GRY8, /**< 8bit grayscale */
> +   EVAS_COLORSPACE_YCBCR422601_PL /**<  YCbCr 4:2:2, ITU.BT-601 
> specifications. The data poitned to is just an array of row pointer, pointing 
> to line of Y,Cb,Y,Cr bytes */
>  } Evas_Colorspace; /**< Colorspaces for pixel data supported by Evas */
>
>  /**
>
> Modified: trunk/evas/src/lib/cache/evas_cache_image.c
> ===================================================================
> --- trunk/evas/src/lib/cache/evas_cache_image.c 2011-07-21 08:17:13 UTC (rev 
> 61547)
> +++ trunk/evas/src/lib/cache/evas_cache_image.c 2011-07-21 10:36:05 UTC (rev 
> 61548)
> @@ -1048,7 +1048,8 @@
>    Image_Entry *im;
>
>    if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) ||
> -       (cspace == EVAS_COLORSPACE_YCBCR422P709_PL))
> +       (cspace == EVAS_COLORSPACE_YCBCR422P709_PL) ||
> +       (cspace == EVAS_COLORSPACE_YCBCR422601_PL))
>       w &= ~0x1;
>
>    im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, 
> NULL);
> @@ -1078,7 +1079,8 @@
>    Image_Entry *im;
>
>    if ((cspace == EVAS_COLORSPACE_YCBCR422P601_PL) ||
> -       (cspace == EVAS_COLORSPACE_YCBCR422P709_PL))
> +       (cspace == EVAS_COLORSPACE_YCBCR422P709_PL) ||
> +       (cspace == EVAS_COLORSPACE_YCBCR422601_PL))
>       w &= ~0x1;
>
>    im = _evas_cache_image_entry_new(cache, NULL, NULL, NULL, NULL, NULL, 
> NULL);
> @@ -1108,7 +1110,8 @@
>    Evas_Cache_Image *cache = im->cache;
>
>    if ((im->space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
> -       (im->space == EVAS_COLORSPACE_YCBCR422P709_PL))
> +       (im->space == EVAS_COLORSPACE_YCBCR422P709_PL) ||
> +       (im->space == EVAS_COLORSPACE_YCBCR422601_PL))
>      w &= ~0x1;
>
>    _evas_cache_image_entry_surface_alloc(cache, im, w, h);
> @@ -1123,7 +1126,8 @@
>    int error;
>
>    if ((im->space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
> -       (im->space == EVAS_COLORSPACE_YCBCR422P709_PL))
> +       (im->space == EVAS_COLORSPACE_YCBCR422P709_PL) ||
> +       (im->space == EVAS_COLORSPACE_YCBCR422601_PL))
>      w &= ~0x1;
>    if ((im->w == w) && (im->h == h)) return im;
>
>
> Modified: trunk/evas/src/lib/engines/common/evas_convert_yuv.c
> ===================================================================
> --- trunk/evas/src/lib/engines/common/evas_convert_yuv.c        2011-07-21 
> 08:17:13 UTC (rev 61547)
> +++ trunk/evas/src/lib/engines/common/evas_convert_yuv.c        2011-07-21 
> 10:36:05 UTC (rev 61548)
> @@ -25,6 +25,7 @@
>  static void _evas_yv12torgb_diz    (unsigned char **yuv, unsigned char *rgb, 
> int w, int h);
>  #endif
>  static void _evas_yv12torgb_raster (unsigned char **yuv, unsigned char *rgb, 
> int w, int h);
> +static void _evas_yuy2torgb_raster (unsigned char **yuv, unsigned char *rgb, 
> int w, int h);
>
>  #define CRV    104595
>  #define CBU    132251
> @@ -119,6 +120,8 @@
>
>  #define CMP_CLIP(i) ((i&256)? (~(i>>10)) : i);
>
> +static int initted = 0;
> +
>  #endif
>
>  void
> @@ -147,8 +150,6 @@
>    else
>      {
>  #ifdef BUILD_C
> -       static int initted = 0;
> -
>        if (!initted) _evas_yuv_init();
>        initted = 1;
>        /* FIXME: diz may be faster sometimes */
> @@ -877,7 +878,7 @@
>             /* yuv to rgb */
>             y = _v1164[*yp2++];
>             *((DATA32 *) dp2) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), 
> LUT_CLIP(y - vmu), LUT_CLIP(y + u));
> -
> +
>             dp2 += 4;
>          }
>        /* jump down one line since we are doing 2 at once */
> @@ -887,5 +888,70 @@
>  #endif
>  }
>
> +void
> +evas_common_convert_yuv_422_601_rgba(DATA8 **src, DATA8 *dst, int w, int h)
> +{
> +#ifdef BUILD_C
> +   if (!initted) _evas_yuv_init();
> +   initted = 1;
> +   _evas_yuy2torgb_raster(src, dst, w, h);
>  #endif
> +}
>
> +static void
> +_evas_yuy2torgb_raster(unsigned char **yuv, unsigned char *rgb, int w, int h)
> +{
> +#ifdef BUILD_C
> +   int xx, yy;
> +   int y, u, v;
> +   unsigned char *yp1, *yp2, *up, *vp;
> +   unsigned char *dp1;
> +
> +   dp1 = rgb;
> +
> +   /* destination pointers */
> +   for (yy = 0; yy < h; yy++)
> +     {
> +        /* plane pointers */
> +        unsigned char *line;
> +
> +        line = yuv[yy];
> +        yp1 = line + 0;
> +        up = line + 1;
> +        yp2 = line + 2;
> +        vp = line + 3;
> +
> +        for (xx = 0; xx < w; xx += 2)
> +          {
> +             int vmu;
> +
> +             /* collect u & v for 2 pixels block */
> +             u = *up;
> +             v = *vp;
> +
> +             /* save lookups */
> +             vmu = _v813[v] + _v391[u];
> +             u = _v2018[u];
> +             v = _v1596[v];
> +
> +             /* do the top 2 pixels of the 2x2 block which shared u & v */
> +            /* yuv to rgb */
> +            y = _v1164[*yp1];
> +            *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), 
> LUT_CLIP(y - vmu), LUT_CLIP(y + u));
> +
> +            dp1 += 4;
> +
> +            /* yuv to rgb */
> +            y = _v1164[*yp2];
> +            *((DATA32 *) dp1) = 0xff000000 + RGB_JOIN(LUT_CLIP(y + v), 
> LUT_CLIP(y - vmu), LUT_CLIP(y + u));
> +
> +             dp1 += 4;
> +
> +            yp1 += 4; yp2 += 4; up += 4; vp += 4;
> +         }
> +     }
> +#endif
> +}
> +
> +#endif
> +
>
> Modified: trunk/evas/src/lib/engines/common/evas_convert_yuv.h
> ===================================================================
> --- trunk/evas/src/lib/engines/common/evas_convert_yuv.h        2011-07-21 
> 08:17:13 UTC (rev 61547)
> +++ trunk/evas/src/lib/engines/common/evas_convert_yuv.h        2011-07-21 
> 10:36:05 UTC (rev 61548)
> @@ -3,6 +3,7 @@
>
>
>  EAPI void evas_common_convert_yuv_420p_601_rgba                     (DATA8 
> **src, DATA8 *dst, int w, int h);
> +EAPI void evas_common_convert_yuv_422_601_rgba(DATA8 **src, DATA8 *dst, int 
> w, int h);
>
>
>  #endif /* _EVAS_CONVERT_YUV_H */
>
> Modified: trunk/evas/src/lib/engines/common/evas_image_data.c
> ===================================================================
> --- trunk/evas/src/lib/engines/common/evas_image_data.c 2011-07-21 08:17:13 
> UTC (rev 61547)
> +++ trunk/evas/src/lib/engines/common/evas_image_data.c 2011-07-21 10:36:05 
> UTC (rev 61548)
> @@ -20,6 +20,7 @@
>        break;
>       case EVAS_COLORSPACE_YCBCR422P601_PL:
>       case EVAS_COLORSPACE_YCBCR422P709_PL:
> +      case EVAS_COLORSPACE_YCBCR422601_PL:
>        w &= ~0x1;
>        dst->cache_entry.w = w;
>        dst->cache_entry.h = h;
> @@ -51,6 +52,7 @@
>         break;
>      case EVAS_COLORSPACE_YCBCR422P601_PL:
>      case EVAS_COLORSPACE_YCBCR422P709_PL:
> +     case EVAS_COLORSPACE_YCBCR422601_PL:
>         dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char*) 
> * 2);
>         if (image_data && (dst->cs.data))
>           memcpy(dst->cs.data,  image_data, dst->cache_entry.h * 
> sizeof(unsigned char*) * 2);
> @@ -73,13 +75,15 @@
>    RGBA_Image   *im = (RGBA_Image *) ie_im;
>
>    if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
> -       (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL))
> +       (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL) ||
> +       (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422601_PL))
>      w &= ~0x1;
>
>    dst->flags = im->flags;
>    dst->cs.no_free = 0;
>    if ((im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P601_PL) ||
> -       (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL))
> +       (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422P709_PL) ||
> +       (im->cache_entry.space == EVAS_COLORSPACE_YCBCR422601_PL))
>      dst->cs.data = calloc(1, dst->cache_entry.h * sizeof(unsigned char *) * 
> 2);
>    evas_common_image_colorspace_dirty(dst);
>
> @@ -104,6 +108,7 @@
>        break;
>       case EVAS_COLORSPACE_YCBCR422P601_PL:
>       case EVAS_COLORSPACE_YCBCR422P709_PL:
> +      case EVAS_COLORSPACE_YCBCR422601_PL:
>        if (dst->image.no_free)
>          {
>              ie_dst->allocated.w = 0;
>
> Modified: trunk/evas/src/lib/engines/common/evas_image_main.c
> ===================================================================
> --- trunk/evas/src/lib/engines/common/evas_image_main.c 2011-07-21 08:17:13 
> UTC (rev 61547)
> +++ trunk/evas/src/lib/engines/common/evas_image_main.c 2011-07-21 10:36:05 
> UTC (rev 61548)
> @@ -588,6 +588,13 @@
>                                                im->cache_entry.w, 
> im->cache_entry.h);
>  #endif
>        break;
> +      case EVAS_COLORSPACE_YCBCR422601_PL:
> +#ifdef BUILD_CONVERT_YUV
> +        if ((im->image.data) && (*((unsigned char **)im->cs.data)))
> +          evas_common_convert_yuv_422_601_rgba(im->cs.data, (DATA8*) 
> im->image.data,
> +                                               im->cache_entry.w, 
> im->cache_entry.h);
> +#endif
> +        break;
>       default:
>        break;
>      }
>
> Modified: trunk/evas/src/modules/engines/directfb/evas_engine.c
> ===================================================================
> --- trunk/evas/src/modules/engines/directfb/evas_engine.c       2011-07-21 
> 08:17:13 UTC (rev 61547)
> +++ trunk/evas/src/modules/engines/directfb/evas_engine.c       2011-07-21 
> 10:36:05 UTC (rev 61548)
> @@ -1332,6 +1332,7 @@
>        }
>      case EVAS_COLORSPACE_YCBCR422P709_PL:
>      case EVAS_COLORSPACE_YCBCR422P601_PL:
> +     case EVAS_COLORSPACE_YCBCR422601_PL:
>        /* XXX untested */
>         *image_data = im->cs.data;
>         break;
> @@ -1383,6 +1384,7 @@
>         break;
>      case EVAS_COLORSPACE_YCBCR422P601_PL:
>      case EVAS_COLORSPACE_YCBCR422P709_PL:
> +     case EVAS_COLORSPACE_YCBCR422601_PL:
>        /* XXX untested */
>         if (image_data != im->cs.data)
>           {
>
> Modified: trunk/evas/src/modules/engines/software_generic/evas_engine.c
> ===================================================================
> --- trunk/evas/src/modules/engines/software_generic/evas_engine.c       
> 2011-07-21 08:17:13 UTC (rev 61547)
> +++ trunk/evas/src/modules/engines/software_generic/evas_engine.c       
> 2011-07-21 10:36:05 UTC (rev 61548)
> @@ -433,6 +433,7 @@
>        break;
>       case EVAS_COLORSPACE_YCBCR422P601_PL:
>       case EVAS_COLORSPACE_YCBCR422P709_PL:
> +      case EVAS_COLORSPACE_YCBCR422601_PL:
>        *image_data = im->cs.data;
>         break;
>       default:
> @@ -468,6 +469,7 @@
>        break;
>       case EVAS_COLORSPACE_YCBCR422P601_PL:
>       case EVAS_COLORSPACE_YCBCR422P709_PL:
> +      case EVAS_COLORSPACE_YCBCR422601_PL:
>        if (image_data != im->cs.data)
>          {
>             if (im->cs.data)
>
> Modified: trunk/evas/src/modules/engines/software_sdl/evas_engine.c
> ===================================================================
> --- trunk/evas/src/modules/engines/software_sdl/evas_engine.c   2011-07-21 
> 08:17:13 UTC (rev 61547)
> +++ trunk/evas/src/modules/engines/software_sdl/evas_engine.c   2011-07-21 
> 10:36:05 UTC (rev 61548)
> @@ -451,6 +451,7 @@
>         break;
>      case EVAS_COLORSPACE_YCBCR422P709_PL:
>      case EVAS_COLORSPACE_YCBCR422P601_PL:
> +     case EVAS_COLORSPACE_YCBCR422601_PL:
>         *image_data = im->cs.data;
>         break;
>      default:
> @@ -487,6 +488,7 @@
>         break;
>      case EVAS_COLORSPACE_YCBCR422P601_PL:
>      case EVAS_COLORSPACE_YCBCR422P709_PL:
> +     case EVAS_COLORSPACE_YCBCR422601_PL:
>         if (image_data != im->cs.data)
>           {
>              if (im->cs.data)
>
>
> ------------------------------------------------------------------------------
> 5 Ways to Improve & Secure Unified Communications
> Unified Communications promises greater efficiencies for business. UC can
> improve internal communications as well as offer faster, more efficient ways
> to interact with customers and streamline customer service. Learn more!
> http://www.accelacomm.com/jaw/sfnl/114/51426253/
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>

------------------------------------------------------------------------------
5 Ways to Improve & Secure Unified Communications
Unified Communications promises greater efficiencies for business. UC can 
improve internal communications as well as offer faster, more efficient ways
to interact with customers and streamline customer service. Learn more!
http://www.accelacomm.com/jaw/sfnl/114/51426253/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to