summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2010-09-14 12:31:58 -0700
committerDavid Schleef <ds@schleef.org>2010-09-14 13:21:54 -0700
commitd71890156a33ea52b6e88b7c6222d150046f95f0 (patch)
tree0d102beb8f7e7a3e0b598cf872990bb4b98827d9
parent08be25ce62fef1e420039e87ad3deee98e5a5b7b (diff)
videotestsrc: Add UYVP
-rw-r--r--gst/videotestsrc/videotestsrc.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c
index 8a9ac7458..dcf00621a 100644
--- a/gst/videotestsrc/videotestsrc.c
+++ b/gst/videotestsrc/videotestsrc.c
@@ -149,6 +149,7 @@ static void paint_setup_v410 (paintinfo * p, unsigned char *dest);
#endif
static void paint_setup_v216 (paintinfo * p, unsigned char *dest);
static void paint_setup_v210 (paintinfo * p, unsigned char *dest);
+static void paint_setup_UYVP (paintinfo * p, unsigned char *dest);
static void paint_setup_YUV9 (paintinfo * p, unsigned char *dest);
static void paint_setup_YVU9 (paintinfo * p, unsigned char *dest);
@@ -188,6 +189,7 @@ static void convert_hline_v410 (paintinfo * p, int y);
#endif
static void convert_hline_v216 (paintinfo * p, int y);
static void convert_hline_v210 (paintinfo * p, int y);
+static void convert_hline_UYVP (paintinfo * p, int y);
static void convert_hline_YUV9 (paintinfo * p, int y);
static void convert_hline_astr4 (paintinfo * p, int y);
@@ -219,6 +221,7 @@ struct fourcc_list_struct fourcc_list[] = {
#endif
{VTS_YUV, "v210", "v210", 21, paint_setup_v210, convert_hline_v210},
{VTS_YUV, "v216", "v216", 32, paint_setup_v216, convert_hline_v216},
+ {VTS_YUV, "UYVP", "UYVP", 20, paint_setup_UYVP, convert_hline_UYVP},
#ifdef disabled
{VTS_YUV, "IYU2", "IYU2", 24, paint_setup_IYU2, convert_hline_IYU2},
@@ -1764,6 +1767,18 @@ paint_setup_v210 (paintinfo * p, unsigned char *dest)
}
static void
+paint_setup_UYVP (paintinfo * p, unsigned char *dest)
+{
+ p->ap = dest;
+ p->yp = dest + 0;
+ p->up = dest + 0;
+ p->vp = dest + 0;
+ p->ystride = GST_ROUND_UP_4 ((p->width * 2 * 5 + 3) / 4);
+ GST_ERROR ("stride %d", p->ystride);
+ p->endptr = dest + p->ystride * p->height;
+}
+
+static void
paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
{
p->yp = dest;
@@ -1924,6 +1939,31 @@ convert_hline_v210 (paintinfo * p, int y)
}
static void
+convert_hline_UYVP (paintinfo * p, int y)
+{
+ int i;
+ guint8 *Y = p->yp + y * p->ystride;
+ guint8 *ayuv = p->tmpline;
+
+ for (i = 0; i < p->width; i += 2) {
+ guint16 y0, y1;
+ guint16 u0;
+ guint16 v0;
+
+ y0 = ayuv[4 * (i + 0) + 1];
+ y1 = ayuv[4 * (i + 1) + 1];
+ u0 = (ayuv[4 * (i + 0) + 2] + ayuv[4 * (i + 1) + 2] + 1) >> 1;
+ v0 = (ayuv[4 * (i + 0) + 3] + ayuv[4 * (i + 1) + 3] + 1) >> 1;
+
+ Y[(i / 2) * 5 + 0] = u0;
+ Y[(i / 2) * 5 + 1] = y0 >> 2;
+ Y[(i / 2) * 5 + 2] = (y0 << 6) | (v0 >> 4);
+ Y[(i / 2) * 5 + 3] = (v0 << 4) | (y1 >> 2);
+ Y[(i / 2) * 5 + 4] = (y1 << 2);
+ }
+}
+
+static void
convert_hline_YUY2 (paintinfo * p, int y)
{
int i;