{
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 */
/**
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);
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);
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);
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;
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
#define CMP_CLIP(i) ((i&256)? (~(i>>10)) : i);
+static int initted = 0;
+
#endif
void
else
{
#ifdef BUILD_C
- static int initted = 0;
-
if (!initted) _evas_yuv_init();
initted = 1;
/* FIXME: diz may be faster sometimes */
/* 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 */
#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
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 */
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;
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);
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);
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;
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;
}
}
case EVAS_COLORSPACE_YCBCR422P709_PL:
case EVAS_COLORSPACE_YCBCR422P601_PL:
+ case EVAS_COLORSPACE_YCBCR422601_PL:
/* XXX untested */
*image_data = im->cs.data;
break;
break;
case EVAS_COLORSPACE_YCBCR422P601_PL:
case EVAS_COLORSPACE_YCBCR422P709_PL:
+ case EVAS_COLORSPACE_YCBCR422601_PL:
/* XXX untested */
if (image_data != im->cs.data)
{
break;
case EVAS_COLORSPACE_YCBCR422P601_PL:
case EVAS_COLORSPACE_YCBCR422P709_PL:
+ case EVAS_COLORSPACE_YCBCR422601_PL:
*image_data = im->cs.data;
break;
default:
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)
break;
case EVAS_COLORSPACE_YCBCR422P709_PL:
case EVAS_COLORSPACE_YCBCR422P601_PL:
+ case EVAS_COLORSPACE_YCBCR422601_PL:
*image_data = im->cs.data;
break;
default:
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)