gst_plugins_base/gst/videotestsrc/videotestsrc.c
branchRCL_3
changeset 30 7e817e7e631c
parent 29 567bb019e3e3
--- a/gst_plugins_base/gst/videotestsrc/videotestsrc.c	Tue Aug 31 15:30:33 2010 +0300
+++ b/gst_plugins_base/gst/videotestsrc/videotestsrc.c	Wed Sep 01 12:16:41 2010 +0100
@@ -25,11 +25,8 @@
 
 #include "gstvideotestsrc.h"
 #include "videotestsrc.h"
-#include <liboil/liboil.h>
+#include <gst/liboil.h>
 
-#ifdef __SYMBIAN32__
-#include <liboil/globals.h>
-#endif
 
 #include <string.h>
 #include <stdlib.h>
@@ -212,125 +209,49 @@
   COLOR_DARK_GREY
 };
 
-static const struct vts_color_struct_rgb vts_colors_rgb[] = {
-  {255, 255, 255},
-  {255, 255, 0},
-  {0, 255, 255},
-  {0, 255, 0},
-  {255, 0, 255},
-  {255, 0, 0},
-  {0, 0, 255},
-  {0, 0, 0},
-  {0, 0, 128},                  /* -I ? */
-  {0, 128, 255},                /* +Q ? */
-  {0, 0, 0},
-  {19, 19, 19},
-};
-
-static const struct vts_color_struct_rgb vts_colors_rgb_75[] = {
-  {191, 191, 191},
-  {191, 191, 0},
-  {0, 191, 191},
-  {0, 191, 0},
-  {191, 0, 191},
-  {191, 0, 0},
-  {0, 0, 191},
-  {0, 0, 0},
-  {0, 0, 128},                  /* -I ? */
-  {0, 128, 255},                /* +Q ? */
-  {0, 0, 0},
-  {19, 19, 19},
-};
-
-static const struct vts_color_struct_yuv vts_colors_bt709_ycbcr_100[] = {
-  {235, 128, 128},
-  {219, 16, 138},
-  {188, 154, 16},
-  {173, 42, 26},
-  {78, 214, 230},
-  {63, 102, 240},
-  {32, 240, 118},
-  {16, 128, 128},
-  {16, 198, 21},                /* -I ? */
-  {16, 235, 198},               /* +Q ? */
-  {0, 128, 128},
-  {32, 128, 128},
-};
-
-static const struct vts_color_struct_yuv vts_colors_bt709_ycbcr_75[] = {
-  {180, 128, 128},
-  {168, 44, 136},
-  {145, 147, 44},
-  {133, 63, 52},
-  {63, 193, 204},
-  {51, 109, 212},
-  {28, 212, 120},
-  {16, 128, 128},
-  {16, 198, 21},                /* -I ? */
-  {16, 235, 198},               /* +Q ? */
-  {0, 128, 128},
-  {32, 128, 128},
+static const struct vts_color_struct vts_colors[] = {
+  /* 100% white */
+  {255, 128, 128, 255, 255, 255, 255},
+  /* yellow */
+  {226, 0, 155, 255, 255, 0, 255},
+  /* cyan */
+  {179, 170, 0, 0, 255, 255, 255},
+  /* green */
+  {150, 46, 21, 0, 255, 0, 255},
+  /* magenta */
+  {105, 212, 235, 255, 0, 255, 255},
+  /* red */
+  {76, 85, 255, 255, 0, 0, 255},
+  /* blue */
+  {29, 255, 107, 0, 0, 255, 255},
+  /* black */
+  {16, 128, 128, 0, 0, 0, 255},
+  /* -I */
+  {16, 198, 21, 0, 0, 128, 255},
+  /* +Q */
+  {16, 235, 198, 0, 128, 255, 255},
+  /* superblack */
+  {0, 128, 128, 0, 0, 0, 255},
+  /* 5% grey */
+  {32, 128, 128, 32, 32, 32, 255},
 };
 
-static const struct vts_color_struct_yuv vts_colors_bt601_ycbcr_100[] = {
-  {235, 128, 128},
-  {210, 16, 146},
-  {170, 166, 16},
-  {145, 54, 34},
-  {106, 202, 222},
-  {81, 90, 240},
-  {41, 240, 110},
-  {16, 128, 128},
-  {16, 198, 21},                /* -I ? */
-  {16, 235, 198},               /* +Q ? */
-  {-0, 128, 128},
-  {32, 128, 128},
-};
 
-static const struct vts_color_struct_yuv vts_colors_bt601_ycbcr_75[] = {
-  {180, 128, 128},
-  {162, 44, 142},
-  {131, 156, 44},
-  {112, 72, 58},
-  {84, 184, 198},
-  {65, 100, 212},
-  {35, 212, 114},
-  {16, 128, 128},
-  {16, 198, 21},                /* -I ? */
-  {16, 235, 198},               /* +Q ? */
-  {-0, 128, 128},
-  {32, 128, 128},
-};
+#if 0
 
-static const struct vts_color_struct_gray vts_colors_gray_100[] = {
-  {235 << 8},
-  {210 << 8},
-  {170 << 8},
-  {145 << 8},
-  {106 << 8},
-  {81 << 8},
-  {41 << 8},
-  {16 << 8},
-  {16 << 8},
-  {16 << 8},
-  {-0 << 8},
-  {32 << 8},
-};
+/*                        wht  yel  cya  grn  mag  red  blu  blk   -I    Q, superblack, dark grey */
+static int y_colors[] = { 255, 226, 179, 150, 105, 76, 29, 16, 16, 16, 0, 32 };
+static int u_colors[] =
+    { 128, 0, 170, 46, 212, 85, 255, 128, 198, 235, 128, 128 };
+static int v_colors[] =
+    { 128, 155, 0, 21, 235, 255, 107, 128, 21, 198, 128, 128 };
 
-static const struct vts_color_struct_gray vts_colors_gray_75[] = {
-  {180 << 8},
-  {162 << 8},
-  {131 << 8},
-  {112 << 8},
-  {84 << 8},
-  {65 << 8},
-  {35 << 8},
-  {16 << 8},
-  {16 << 8},
-  {16 << 8},
-  {-0 << 8},
-  {32 << 8},
-};
+/*                        wht  yel  cya  grn  mag  red  blu  blk   -I    Q  superblack, dark grey */
+static int r_colors[] = { 255, 255, 0, 0, 255, 255, 0, 0, 0, 0, 0, 32 };
+static int g_colors[] = { 255, 255, 255, 255, 0, 0, 0, 0, 0, 128, 0, 32 };
+static int b_colors[] = { 255, 0, 255, 0, 255, 0, 255, 0, 128, 255, 0, 32 };
+#endif
+
 
 static void paint_setup_I420 (paintinfo * p, unsigned char *dest);
 static void paint_setup_YV12 (paintinfo * p, unsigned char *dest);
@@ -340,15 +261,8 @@
 static void paint_setup_IYU2 (paintinfo * p, unsigned char *dest);
 static void paint_setup_Y41B (paintinfo * p, unsigned char *dest);
 static void paint_setup_Y42B (paintinfo * p, unsigned char *dest);
-static void paint_setup_Y444 (paintinfo * p, unsigned char *dest);
 static void paint_setup_Y800 (paintinfo * p, unsigned char *dest);
 static void paint_setup_AYUV (paintinfo * p, unsigned char *dest);
-static void paint_setup_v308 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV12 (paintinfo * p, unsigned char *dest);
-static void paint_setup_NV21 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v410 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v216 (paintinfo * p, unsigned char *dest);
-static void paint_setup_v210 (paintinfo * p, unsigned char *dest);
 
 #if 0
 static void paint_setup_IMC1 (paintinfo * p, unsigned char *dest);
@@ -374,18 +288,12 @@
 static void paint_setup_bayer (paintinfo * p, unsigned char *dest);
 
 static void paint_hline_I420 (paintinfo * p, int x, int y, int w);
-static void paint_hline_NV12_NV21 (paintinfo * p, int x, int y, int w);
 static void paint_hline_YUY2 (paintinfo * p, int x, int y, int w);
 static void paint_hline_IYU2 (paintinfo * p, int x, int y, int w);
 static void paint_hline_Y41B (paintinfo * p, int x, int y, int w);
 static void paint_hline_Y42B (paintinfo * p, int x, int y, int w);
-static void paint_hline_Y444 (paintinfo * p, int x, int y, int w);
 static void paint_hline_Y800 (paintinfo * p, int x, int y, int w);
-static void paint_hline_v308 (paintinfo * p, int x, int y, int w);
 static void paint_hline_AYUV (paintinfo * p, int x, int y, int w);
-static void paint_hline_v410 (paintinfo * p, int x, int y, int w);
-static void paint_hline_v216 (paintinfo * p, int x, int y, int w);
-static void paint_hline_v210 (paintinfo * p, int x, int y, int w);
 
 #if 0
 static void paint_hline_IMC1 (paintinfo * p, int x, int y, int w);
@@ -398,11 +306,6 @@
 
 static void paint_hline_bayer (paintinfo * p, int x, int y, int w);
 
-static void paint_setup_GRAY8 (paintinfo * p, unsigned char *dest);
-static void paint_setup_GRAY16 (paintinfo * p, unsigned char *dest);
-static void paint_hline_GRAY8 (paintinfo * p, int x, int y, int w);
-static void paint_hline_GRAY16 (paintinfo * p, int x, int y, int w);
-
 struct fourcc_list_struct fourcc_list[] = {
 /* packed */
   {VTS_YUV, "YUY2", "YUY2", 16, paint_setup_YUY2, paint_hline_YUY2},
@@ -410,11 +313,7 @@
   {VTS_YUV, "Y422", "Y422", 16, paint_setup_UYVY, paint_hline_YUY2},
   {VTS_YUV, "UYNV", "UYNV", 16, paint_setup_UYVY, paint_hline_YUY2},    /* FIXME: UYNV? */
   {VTS_YUV, "YVYU", "YVYU", 16, paint_setup_YVYU, paint_hline_YUY2},
-  {VTS_YUV, "v308", "v308", 24, paint_setup_v308, paint_hline_v308},
   {VTS_YUV, "AYUV", "AYUV", 32, paint_setup_AYUV, paint_hline_AYUV},
-  {VTS_YUV, "v410", "v410", 32, paint_setup_v410, paint_hline_v410},
-  {VTS_YUV, "v210", "v210", 21, paint_setup_v210, paint_hline_v210},
-  {VTS_YUV, "v216", "v216", 32, paint_setup_v216, paint_hline_v216},
 
   /* interlaced */
   /*{ VTS_YUV,  "IUYV", "IUY2", 16, paint_setup_YVYU, paint_hline_YUY2 }, */
@@ -446,9 +345,7 @@
   /* I420 */
   {VTS_YUV, "I420", "I420", 12, paint_setup_I420, paint_hline_I420},
   /* NV12 */
-  {VTS_YUV, "NV12", "NV12", 12, paint_setup_NV12, paint_hline_NV12_NV21},
   /* NV21 */
-  {VTS_YUV, "NV21", "NV21", 12, paint_setup_NV21, paint_hline_NV12_NV21},
 #if 0
   /* IMC1 */
   {VTS_YUV, "IMC1", "IMC1", 16, paint_setup_IMC1, paint_hline_IMC1},
@@ -464,15 +361,9 @@
   {VTS_YUV, "Y41B", "Y41B", 12, paint_setup_Y41B, paint_hline_Y41B},
   /* Y42B */
   {VTS_YUV, "Y42B", "Y42B", 16, paint_setup_Y42B, paint_hline_Y42B},
-  /* Y444 */
-  {VTS_YUV, "Y444", "Y444", 24, paint_setup_Y444, paint_hline_Y444},
   /* Y800 grayscale */
   {VTS_YUV, "Y800", "Y800", 8, paint_setup_Y800, paint_hline_Y800},
 
-  /* Not exactly YUV but it's the same as above */
-  {VTS_GRAY, "GRAY8", "GRAY8", 8, paint_setup_GRAY8, paint_hline_GRAY8},
-  {VTS_GRAY, "GRAY16", "GRAY16", 16, paint_setup_GRAY16, paint_hline_GRAY16},
-
   {VTS_RGB, "RGB ", "xRGB8888", 32, paint_setup_xRGB8888, paint_hline_str4, 24,
       0x00ff0000, 0x0000ff00, 0x000000ff},
   {VTS_RGB, "RGB ", "xBGR8888", 32, paint_setup_xBGR8888, paint_hline_str4, 24,
@@ -501,7 +392,6 @@
 
   {VTS_BAYER, "BAY8", "Bayer", 8, paint_setup_bayer, paint_hline_bayer}
 };
-
 int n_fourccs = G_N_ELEMENTS (fourcc_list);
 
 struct fourcc_list_struct *
@@ -513,24 +403,7 @@
 
   g_return_val_if_fail (structure, NULL);
 
-  if (strcmp (media_type, "video/x-raw-gray") == 0) {
-    gint bpp, depth, endianness = 0;
-
-    ret = gst_structure_get_int (structure, "bpp", &bpp) &&
-        gst_structure_get_int (structure, "depth", &depth);
-    if (!ret || bpp != depth || (depth != 8 && depth != 16))
-      return NULL;
-
-    ret = gst_structure_get_int (structure, "endianness", &endianness);
-    if ((!ret || endianness != G_BYTE_ORDER) && bpp == 16)
-      return NULL;
-
-    for (i = 0; i < n_fourccs; i++) {
-      if (fourcc_list[i].type == VTS_GRAY && fourcc_list[i].bitspp == bpp) {
-        return fourcc_list + i;
-      }
-    }
-  } else if (strcmp (media_type, "video/x-raw-yuv") == 0) {
+  if (strcmp (media_type, "video/x-raw-yuv") == 0) {
     char *s;
     int fourcc;
     guint32 format;
@@ -666,14 +539,6 @@
             format->alpha_mask, NULL);
       }
       break;
-    case VTS_GRAY:
-      structure = gst_structure_new ("video/x-raw-gray",
-          "bpp", G_TYPE_INT, format->bitspp, "depth", G_TYPE_INT,
-          format->bitspp, NULL);
-      if (format->bitspp == 16)
-        gst_structure_set (structure, "endianness", G_TYPE_INT, G_BYTE_ORDER,
-            NULL);
-      break;
     case VTS_YUV:
       structure = gst_structure_new ("video/x-raw-yuv",
           "format", GST_TYPE_FOURCC, fourcc, NULL);
@@ -719,13 +584,6 @@
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -743,9 +601,7 @@
     int x1 = i * w / 7;
     int x2 = (i + 1) * w / 7;
 
-    p->yuv_color = p->yuv_colors + i;
-    p->rgb_color = p->rgb_colors + i;
-    p->gray_color = p->gray_colors + i;
+    p->color = vts_colors + i;
     for (j = 0; j < y1; j++) {
       p->paint_hline (p, x1, j, (x2 - x1));
     }
@@ -762,9 +618,7 @@
     } else {
       k = 6 - i;
     }
-    p->yuv_color = p->yuv_colors + k;
-    p->rgb_color = p->rgb_colors + k;
-    p->gray_color = p->gray_colors + k;
+    p->color = vts_colors + k;
     for (j = y1; j < y2; j++) {
       p->paint_hline (p, x1, j, (x2 - x1));
     }
@@ -783,9 +637,7 @@
     } else
       k = 9;
 
-    p->yuv_color = p->yuv_colors + k;
-    p->rgb_color = p->rgb_colors + k;
-    p->gray_color = p->gray_colors + k;
+    p->color = vts_colors + k;
     for (j = y2; j < h; j++) {
       p->paint_hline (p, x1, j, (x2 - x1));
     }
@@ -804,9 +656,7 @@
     } else
       k = COLOR_DARK_GREY;
 
-    p->yuv_color = p->yuv_colors + k;
-    p->rgb_color = p->rgb_colors + k;
-    p->gray_color = p->gray_colors + k;
+    p->color = vts_colors + k;
     for (j = y2; j < h; j++) {
       p->paint_hline (p, x1, j, (x2 - x1));
     }
@@ -814,26 +664,18 @@
 
   {
     int x1 = w * 3 / 4;
-    struct vts_color_struct_rgb rgb_color;
-    struct vts_color_struct_yuv yuv_color;
-    struct vts_color_struct_gray gray_color;
+    struct vts_color_struct color;
 
-    rgb_color = p->rgb_colors[COLOR_BLACK];
-    yuv_color = p->yuv_colors[COLOR_BLACK];
-    gray_color = p->gray_colors[COLOR_BLACK];
-    p->rgb_color = &rgb_color;
-    p->yuv_color = &yuv_color;
-    p->gray_color = &gray_color;
+    color = vts_colors[COLOR_BLACK];
+    p->color = &color;
 
     for (i = x1; i < w; i++) {
       for (j = y2; j < h; j++) {
         /* FIXME not strictly correct */
-        int y = random_char ();
-        yuv_color.Y = y;
-        rgb_color.R = y;
-        rgb_color.G = y;
-        rgb_color.B = y;
-        gray_color.G = (y << 8) | random_char ();
+        color.Y = random_char ();
+        color.R = color.Y;
+        color.G = color.Y;
+        color.B = color.Y;
         p->paint_hline (p, i, j, 1);
       }
     }
@@ -842,46 +684,6 @@
 }
 
 void
-gst_video_test_src_smpte75 (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h)
-{
-  int i;
-  int j;
-  paintinfo pi = { NULL, };
-  paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
-
-  p->rgb_colors = vts_colors_rgb_75;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_75;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_75;
-  }
-  p->gray_colors = vts_colors_gray_75;
-  p->width = w;
-  p->height = h;
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
-    return;
-
-  fourcc->paint_setup (p, dest);
-  p->paint_hline = fourcc->paint_hline;
-
-  /* color bars */
-  for (i = 0; i < 7; i++) {
-    int x1 = i * w / 7;
-    int x2 = (i + 1) * w / 7;
-
-    p->yuv_color = p->yuv_colors + i;
-    p->rgb_color = p->rgb_colors + i;
-    p->gray_color = p->gray_colors + i;
-    for (j = 0; j < h; j++) {
-      p->paint_hline (p, x1, j, (x2 - x1));
-    }
-  }
-}
-
-void
 gst_video_test_src_snow (GstVideoTestSrc * v, unsigned char *dest, int w, int h)
 {
   int i;
@@ -889,17 +691,8 @@
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
-  struct vts_color_struct_rgb rgb_color;
-  struct vts_color_struct_yuv yuv_color;
-  struct vts_color_struct_gray gray_color;
+  struct vts_color_struct color;
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -909,22 +702,16 @@
   fourcc->paint_setup (p, dest);
   p->paint_hline = fourcc->paint_hline;
 
-  rgb_color = p->rgb_colors[COLOR_BLACK];
-  yuv_color = p->yuv_colors[COLOR_BLACK];
-  gray_color = p->gray_colors[COLOR_BLACK];
-  p->rgb_color = &rgb_color;
-  p->yuv_color = &yuv_color;
-  p->gray_color = &gray_color;
+  color = vts_colors[COLOR_BLACK];
+  p->color = &color;
 
   for (i = 0; i < w; i++) {
     for (j = 0; j < h; j++) {
       /* FIXME not strictly correct */
-      int y = random_char ();
-      yuv_color.Y = y;
-      rgb_color.R = y;
-      rgb_color.G = y;
-      rgb_color.B = y;
-      gray_color.G = (y << 8) | random_char ();
+      color.Y = random_char ();
+      color.R = color.Y;
+      color.G = color.Y;
+      color.B = color.Y;
       p->paint_hline (p, i, j, 1);
     }
   }
@@ -932,20 +719,13 @@
 
 static void
 gst_video_test_src_unicolor (GstVideoTestSrc * v, unsigned char *dest, int w,
-    int h, int color_index)
+    int h, const struct vts_color_struct *color)
 {
   int i;
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -955,9 +735,7 @@
   fourcc->paint_setup (p, dest);
   p->paint_hline = fourcc->paint_hline;
 
-  p->rgb_color = p->rgb_colors + color_index;
-  p->yuv_color = p->yuv_colors + color_index;
-  p->gray_color = p->gray_colors + color_index;
+  p->color = color;
 
   for (i = 0; i < h; i++) {
     p->paint_hline (p, 0, i, w);
@@ -967,31 +745,31 @@
 void
 gst_video_test_src_black (GstVideoTestSrc * v, guchar * dest, int w, int h)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLACK);
+  gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_BLACK);
 }
 
 void
 gst_video_test_src_white (GstVideoTestSrc * v, guchar * dest, int w, int h)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_WHITE);
+  gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_WHITE);
 }
 
 void
 gst_video_test_src_red (GstVideoTestSrc * v, guchar * dest, int w, int h)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_RED);
+  gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_RED);
 }
 
 void
 gst_video_test_src_green (GstVideoTestSrc * v, guchar * dest, int w, int h)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_GREEN);
+  gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_GREEN);
 }
 
 void
 gst_video_test_src_blue (GstVideoTestSrc * v, guchar * dest, int w, int h)
 {
-  gst_video_test_src_unicolor (v, dest, w, h, COLOR_BLUE);
+  gst_video_test_src_unicolor (v, dest, w, h, vts_colors + COLOR_BLUE);
 }
 
 void
@@ -1002,13 +780,6 @@
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -1019,14 +790,10 @@
   p->paint_hline = fourcc->paint_hline;
 
   for (y = 0; y < h; y++) {
-    p->rgb_color = p->rgb_colors + COLOR_GREEN;
-    p->yuv_color = p->yuv_colors + COLOR_GREEN;
-    p->gray_color = p->gray_colors + COLOR_GREEN;
+    p->color = vts_colors + COLOR_GREEN;
     p->paint_hline (p, 0, y, w);
     for (x = (y % 2); x < w; x += 2) {
-      p->rgb_color = p->rgb_colors + COLOR_RED;
-      p->yuv_color = p->yuv_colors + COLOR_RED;
-      p->gray_color = p->gray_colors + COLOR_RED;
+      p->color = vts_colors + COLOR_RED;
       p->paint_hline (p, x, y, 1);
     }
   }
@@ -1040,13 +807,6 @@
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -1056,9 +816,7 @@
   fourcc->paint_setup (p, dest);
   p->paint_hline = fourcc->paint_hline;
 
-  p->rgb_color = p->rgb_colors + COLOR_GREEN;
-  p->yuv_color = p->yuv_colors + COLOR_GREEN;
-  p->gray_color = p->gray_colors + COLOR_GREEN;
+  p->color = vts_colors + COLOR_GREEN;
   for (y = 0; y < h; y++) {
     p->paint_hline (p, 0, y, w);
   }
@@ -1067,9 +825,7 @@
     for (x = ((y % 4) == 0) ? 0 : 2; x < w; x += 4) {
       guint len = (x < (w - 1)) ? 2 : (w - x);
 
-      p->rgb_color = p->rgb_colors + COLOR_RED;
-      p->yuv_color = p->yuv_colors + COLOR_RED;
-      p->gray_color = p->gray_colors + COLOR_RED;
+      p->color = vts_colors + COLOR_RED;
       p->paint_hline (p, x, y + 0, len);
       if (G_LIKELY ((y + 1) < h)) {
         p->paint_hline (p, x, y + 1, len);
@@ -1086,13 +842,6 @@
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -1102,9 +851,7 @@
   fourcc->paint_setup (p, dest);
   p->paint_hline = fourcc->paint_hline;
 
-  p->rgb_color = p->rgb_colors + COLOR_GREEN;
-  p->yuv_color = p->yuv_colors + COLOR_GREEN;
-  p->gray_color = p->gray_colors + COLOR_GREEN;
+  p->color = vts_colors + COLOR_GREEN;
   for (y = 0; y < h; y++) {
     p->paint_hline (p, 0, y, w);
   }
@@ -1113,9 +860,7 @@
     for (x = ((y % 8) == 0) ? 0 : 4; x < w; x += 8) {
       guint len = (x < (w - 3)) ? 4 : (w - x);
 
-      p->rgb_color = p->rgb_colors + COLOR_RED;
-      p->yuv_color = p->yuv_colors + COLOR_RED;
-      p->gray_color = p->gray_colors + COLOR_RED;
+      p->color = vts_colors + COLOR_RED;
       p->paint_hline (p, x, y + 0, len);
       if (G_LIKELY ((y + 1) < h)) {
         p->paint_hline (p, x, y + 1, len);
@@ -1138,13 +883,6 @@
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -1154,183 +892,40 @@
   fourcc->paint_setup (p, dest);
   p->paint_hline = fourcc->paint_hline;
 
-  p->rgb_color = p->rgb_colors + COLOR_GREEN;
-  p->yuv_color = p->yuv_colors + COLOR_GREEN;
-  p->gray_color = p->gray_colors + COLOR_GREEN;
+  p->color = vts_colors + COLOR_GREEN;
   for (y = 0; y < h; y++) {
-    for (x = 0; x < w; x += 8) {
-      int len = MIN (8, w - x);
-
-      if ((x ^ y) & (1 << 4)) {
-        p->rgb_color = p->rgb_colors + COLOR_GREEN;
-        p->yuv_color = p->yuv_colors + COLOR_GREEN;
-        p->gray_color = p->gray_colors + COLOR_GREEN;
-      } else {
-        p->rgb_color = p->rgb_colors + COLOR_RED;
-        p->yuv_color = p->yuv_colors + COLOR_RED;
-        p->gray_color = p->gray_colors + COLOR_RED;
-      }
-      p->paint_hline (p, x, y, len);
-    }
-  }
-}
-
-void
-gst_video_test_src_zoneplate (GstVideoTestSrc * v, unsigned char *dest,
-    int w, int h)
-{
-  int i;
-  int j;
-  paintinfo pi = { NULL, };
-  paintinfo *p = &pi;
-  struct fourcc_list_struct *fourcc;
-  struct vts_color_struct_rgb rgb_color;
-  struct vts_color_struct_yuv yuv_color;
-  struct vts_color_struct_gray gray_color;
-  static uint8_t sine_array[256];
-  static int sine_array_inited = FALSE;
-
-  static int t = 0;             /* time - increment phase vs time by 1 for each generated frame */
-  /* this may not fit with the correct gstreamer notion of time, so maybe FIXME? */
-
-  int xreset = -(w / 2) - v->xoffset;   /* starting values for x^2 and y^2, centering the ellipse */
-  int yreset = -(h / 2) - v->yoffset;
-
-  int x, y;
-  int accum_kx;
-  int accum_kxt;
-  int accum_ky;
-  int accum_kyt;
-  int accum_kxy;
-  int kt;
-  int kt2;
-  int ky2;
-  int delta_kxt = v->kxt * t;
-  int delta_kxy;
-  int scale_kxy = 0xffff / (w / 2);
-  int scale_kx2 = 0xffff / w;
-
-  if (!sine_array_inited) {
-    int black = 16;
-    int white = 235;
-    int range = white - black;
-    for (i = 0; i < 256; i++) {
-      sine_array[i] =
-          floor (range * (0.5 + 0.5 * sin (i * 2 * M_PI / 256)) + 0.5 + black);
-    }
-    sine_array_inited = TRUE;
+    p->paint_hline (p, 0, y, w);
   }
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
-  p->width = w;
-  p->height = h;
-  fourcc = v->fourcc;
-  if (fourcc == NULL)
-    return;
-
-  fourcc->paint_setup (p, dest);
-  p->paint_hline = fourcc->paint_hline;
-
-  rgb_color = p->rgb_colors[COLOR_BLACK];
-  yuv_color = p->yuv_colors[COLOR_BLACK];
-  gray_color = p->gray_colors[COLOR_BLACK];
-  p->rgb_color = &rgb_color;
-  p->yuv_color = &yuv_color;
-  p->gray_color = &gray_color;
+  for (y = 0; y < h; y += 8) {
+    for (x = ((GST_ROUND_UP_8 (y) % 16) == 0) ? 0 : 8; x < w; x += 16) {
+      guint len = (x < (w - 7)) ? 8 : (w - x);
 
-  /* Zoneplate equation:
-   *
-   * phase = k0 + kx*x + ky*y + kt*t
-   *       + kxt*x*t + kyt*y*t + kxy*x*y
-   *       + kx2*x*x + ky2*y*y + Kt2*t*t
-   */
-
-#if 0
-  for (j = 0, y = yreset; j < h; j++, y++) {
-    for (i = 0, x = xreset; i < w; i++, x++) {
-
-      //zero order
-      int phase = v->k0;
-
-      //first order
-      phase = phase + (v->kx * i) + (v->ky * j) + (v->kt * t);
-
-      //cross term
-      //phase = phase + (v->kxt * i * t) + (v->kyt * j * t);
-      //phase = phase + (v->kxy * x * y) / (w/2);
-
-      /*second order */
-      /*normalise x/y terms to rate of change of phase at the picture edge */
-      phase =
-          phase + ((v->kx2 * x * x) / w) + ((v->ky2 * y * y) / h) +
-          ((v->kt2 * t * t) >> 1);
-
-      color.Y = sine_array[phase & 0xff];
-
-      color.R = color.Y;
-      color.G = color.Y;
-      color.B = color.Y;
-      p->paint_hline (p, i, j, 1);
+      p->color = vts_colors + COLOR_RED;
+      p->paint_hline (p, x, y + 0, len);
+      if (G_LIKELY ((y + 1) < h)) {
+        p->paint_hline (p, x, y + 1, len);
+        if (G_LIKELY ((y + 2) < h)) {
+          p->paint_hline (p, x, y + 2, len);
+          if (G_LIKELY ((y + 3) < h)) {
+            p->paint_hline (p, x, y + 3, len);
+            if (G_LIKELY ((y + 4) < h)) {
+              p->paint_hline (p, x, y + 4, len);
+              if (G_LIKELY ((y + 5) < h)) {
+                p->paint_hline (p, x, y + 5, len);
+                if (G_LIKELY ((y + 6) < h)) {
+                  p->paint_hline (p, x, y + 6, len);
+                  if (G_LIKELY ((y + 7) < h)) {
+                    p->paint_hline (p, x, y + 7, len);
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
     }
   }
-#endif
-
-  /* optimised version, with original code shown in comments */
-  accum_ky = 0;
-  accum_kyt = 0;
-  kt = v->kt * t;
-  kt2 = v->kt2 * t * t;
-  for (j = 0, y = yreset; j < h; j++, y++) {
-    accum_kx = 0;
-    accum_kxt = 0;
-    accum_ky += v->ky;
-    accum_kyt += v->kyt * t;
-    delta_kxy = v->kxy * y * scale_kxy;
-    accum_kxy = delta_kxy * xreset;
-    ky2 = (v->ky2 * y * y) / h;
-    for (i = 0, x = xreset; i < w; i++, x++) {
-
-      //zero order
-      int phase = v->k0;
-
-      //first order
-      accum_kx += v->kx;
-      //phase = phase + (v->kx * i) + (v->ky * j) + (v->kt * t);
-      phase = phase + accum_kx + accum_ky + kt;
-
-      //cross term
-      accum_kxt += delta_kxt;
-      accum_kxy += delta_kxy;
-      //phase = phase + (v->kxt * i * t) + (v->kyt * j * t);
-      phase = phase + accum_kxt + accum_kyt;
-
-      //phase = phase + (v->kxy * x * y) / (w/2);
-      //phase = phase + accum_kxy / (w/2) ;
-      phase = phase + (accum_kxy >> 16);
-
-      /*second order */
-      /*normalise x/y terms to rate of change of phase at the picture edge */
-      //phase = phase + ((v->kx2 * x * x)/w) + ((v->ky2 * y * y)/h) + ((v->kt2 * t * t)>>1);
-      phase = phase + ((v->kx2 * x * x * scale_kx2) >> 16) + ky2 + (kt2 >> 1);
-
-      yuv_color.Y = sine_array[phase & 0xff];
-
-      rgb_color.R = yuv_color.Y;
-      rgb_color.G = yuv_color.Y;
-      rgb_color.B = yuv_color.Y;
-
-      gray_color.G = yuv_color.Y << 8;
-      p->paint_hline (p, i, j, 1);
-    }
-  }
-
-  t++;
 }
 
 #undef SCALE_AMPLITUDE
@@ -1343,9 +938,7 @@
   paintinfo pi = { NULL, };
   paintinfo *p = &pi;
   struct fourcc_list_struct *fourcc;
-  struct vts_color_struct_rgb rgb_color;
-  struct vts_color_struct_yuv yuv_color;
-  struct vts_color_struct_gray gray_color;
+  struct vts_color_struct color;
   static uint8_t sine_array[256];
   static int sine_array_inited = FALSE;
   double freq[8];
@@ -1363,13 +956,6 @@
     sine_array_inited = TRUE;
   }
 
-  p->rgb_colors = vts_colors_rgb;
-  if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
-    p->yuv_colors = vts_colors_bt601_ycbcr_100;
-  } else {
-    p->yuv_colors = vts_colors_bt709_ycbcr_100;
-  }
-  p->gray_colors = vts_colors_gray_100;
   p->width = w;
   p->height = h;
   fourcc = v->fourcc;
@@ -1379,12 +965,8 @@
   fourcc->paint_setup (p, dest);
   p->paint_hline = fourcc->paint_hline;
 
-  rgb_color = p->rgb_colors[COLOR_BLACK];
-  yuv_color = p->yuv_colors[COLOR_BLACK];
-  gray_color = p->gray_colors[COLOR_BLACK];
-  p->rgb_color = &rgb_color;
-  p->yuv_color = &yuv_color;
-  p->gray_color = &gray_color;
+  color = vts_colors[COLOR_BLACK];
+  p->color = &color;
 
   for (i = 1; i < 8; i++) {
     freq[i] = 200 * pow (2.0, -(i - 1) / 4.0);
@@ -1408,8 +990,7 @@
               h)) / (2 * w);
       seg = floor (dist * 16);
       if (seg == 0 || seg >= 8) {
-        yuv_color.Y = 255;
-        gray_color.G = 65535;
+        color.Y = 255;
       } else {
 #ifdef SCALE_AMPLITUDE
         double a;
@@ -1419,16 +1000,14 @@
         a = ampl[seg];
         if (a < 0)
           a = 0;
-        yuv_color.Y = 128 + a * (sine_array[d & 0xff] - 128);
-        gray_color.G = 128 + a * (sine_array[d & 0xff] - 128);
+        color.Y = 128 + a * (sine_array[d & 0xff] - 128);
 #else
-        yuv_color.Y = sine_array[d & 0xff];
-        gray_color.G = sine_array[d & 0xff];
+        color.Y = sine_array[d & 0xff];
 #endif
       }
-      rgb_color.R = yuv_color.Y;
-      rgb_color.G = yuv_color.Y;
-      rgb_color.B = yuv_color.Y;
+      color.R = color.Y;
+      color.G = color.Y;
+      color.B = color.Y;
       p->paint_hline (p, i, j, 1);
     }
   }
@@ -1447,30 +1026,6 @@
 }
 
 static void
-paint_setup_NV12 (paintinfo * p, unsigned char *dest)
-{
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
-  p->vp = p->up + 1;
-  p->ustride = p->ystride;
-  p->vstride = p->ystride;
-  p->endptr = p->up + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
-}
-
-static void
-paint_setup_NV21 (paintinfo * p, unsigned char *dest)
-{
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->vp = p->yp + p->ystride * GST_ROUND_UP_2 (p->height);
-  p->up = p->vp + 1;
-  p->ustride = p->ystride;
-  p->vstride = p->ystride;
-  p->endptr = p->vp + (p->ystride * GST_ROUND_UP_2 (p->height)) / 2;
-}
-
-static void
 paint_hline_I420 (paintinfo * p, int x, int y, int w)
 {
   int x1 = x / 2;
@@ -1478,25 +1033,9 @@
   int offset = y * p->ystride;
   int offset1 = (y / 2) * p->ustride;
 
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-  oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, x2 - x1);
-  oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, x2 - x1);
-}
-
-static void
-paint_hline_NV12_NV21 (paintinfo * p, int x, int y, int w)
-{
-  int x1 = x / 2;
-  int x2 = (x + w) / 2;
-  int offset = y * p->ystride;
-  int offsetuv = (y / 2) * p->ustride + (x & ~0x01);
-  int uvlength = x2 - x1 + 1;
-
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-  if (uvlength) {
-    oil_splat_u8 (p->up + offsetuv, 2, &p->yuv_color->U, uvlength);
-    oil_splat_u8 (p->vp + offsetuv, 2, &p->yuv_color->V, uvlength);
-  }
+  oil_splat_u8_ns (p->yp + offset + x, &p->color->Y, w);
+  oil_splat_u8_ns (p->up + offset1 + x1, &p->color->U, x2 - x1);
+  oil_splat_u8_ns (p->vp + offset1 + x1, &p->color->V, x2 - x1);
 }
 
 static void
@@ -1512,16 +1051,6 @@
 }
 
 static void
-paint_setup_v308 (paintinfo * p, unsigned char *dest)
-{
-  p->yp = dest;
-  p->up = dest + 1;
-  p->vp = dest + 2;
-  p->ystride = GST_ROUND_UP_4 (p->width * 3);
-  p->endptr = dest + p->ystride * p->height;
-}
-
-static void
 paint_setup_AYUV (paintinfo * p, unsigned char *dest)
 {
   p->ap = dest;
@@ -1533,38 +1062,6 @@
 }
 
 static void
-paint_setup_v410 (paintinfo * p, unsigned char *dest)
-{
-  p->yp = dest + 0;
-  p->up = dest + 0;
-  p->vp = dest + 0;
-  p->ystride = p->width * 4;
-  p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_v216 (paintinfo * p, unsigned char *dest)
-{
-  p->ap = dest;
-  p->yp = dest + 2;
-  p->up = dest + 0;
-  p->vp = dest + 4;
-  p->ystride = p->width * 4;
-  p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_setup_v210 (paintinfo * p, unsigned char *dest)
-{
-  p->ap = dest;
-  p->yp = dest + 0;
-  p->up = dest + 0;
-  p->vp = dest + 0;
-  p->ystride = ((p->width + 47) / 48) * 128;    /* no, really. */
-  p->endptr = dest + p->ystride * p->height;
-}
-
-static void
 paint_setup_YUY2 (paintinfo * p, unsigned char *dest)
 {
   p->yp = dest;
@@ -1595,96 +1092,15 @@
 }
 
 static void
-paint_hline_v308 (paintinfo * p, int x, int y, int w)
-{
-  int offset;
-
-  offset = (y * p->ystride) + (x * 3);
-  oil_splat_u8 (p->yp + offset, 3, &p->yuv_color->Y, w);
-  oil_splat_u8 (p->up + offset, 3, &p->yuv_color->U, w);
-  oil_splat_u8 (p->vp + offset, 3, &p->yuv_color->V, w);
-}
-
-static void
 paint_hline_AYUV (paintinfo * p, int x, int y, int w)
 {
   int offset;
-  guint8 alpha = 255;
 
   offset = (y * p->ystride) + (x * 4);
-  oil_splat_u8 (p->yp + offset, 4, &p->yuv_color->Y, w);
-  oil_splat_u8 (p->up + offset, 4, &p->yuv_color->U, w);
-  oil_splat_u8 (p->vp + offset, 4, &p->yuv_color->V, w);
-  oil_splat_u8 (p->ap + offset, 4, &alpha, w);
-}
-
-#define TO_16(x) (((x)<<8) | (x))
-#define TO_10(x) (((x)<<2) | ((x)>>6))
-
-static void
-paint_hline_v216 (paintinfo * p, int x, int y, int w)
-{
-  int x1 = x / 2;
-  int x2 = (x + w) / 2;
-  uint16_t Y, U, V;
-  int i;
-  int offset;
-
-  offset = y * p->ystride;
-  Y = TO_16 (p->yuv_color->Y);
-  U = TO_16 (p->yuv_color->U);
-  V = TO_16 (p->yuv_color->V);
-  for (i = x; i < x + w; i++) {
-    GST_WRITE_UINT16_LE (p->yp + offset + i * 4, Y);
-  }
-  for (i = x1; i < x2; i++) {
-    GST_WRITE_UINT16_LE (p->up + offset + i * 8, U);
-    GST_WRITE_UINT16_LE (p->vp + offset + i * 8, V);
-  }
-}
-
-static void
-paint_hline_v410 (paintinfo * p, int x, int y, int w)
-{
-  uint32_t a;
-  uint8_t *data;
-  int i;
-
-  a = (TO_10 (p->yuv_color->U) << 22) |
-      (TO_10 (p->yuv_color->Y) << 12) | (TO_10 (p->yuv_color->V) << 2);
-
-  data = p->yp + y * p->ystride + x * 4;
-  for (i = 0; i < w; i++) {
-    GST_WRITE_UINT32_LE (data, a);
-  }
-}
-
-static void
-paint_hline_v210 (paintinfo * p, int x, int y, int w)
-{
-  uint32_t a0, a1, a2, a3;
-  uint8_t *data;
-  int i;
-
-  /* FIXME this is kinda gross.  it only handles x values in
-     multiples of 6 */
-
-  a0 = TO_10 (p->yuv_color->U) | (TO_10 (p->yuv_color->Y) << 10)
-      | (TO_10 (p->yuv_color->V) << 20);
-  a1 = TO_10 (p->yuv_color->Y) | (TO_10 (p->yuv_color->U) << 10)
-      | (TO_10 (p->yuv_color->Y) << 20);
-  a2 = TO_10 (p->yuv_color->V) | (TO_10 (p->yuv_color->Y) << 10)
-      | (TO_10 (p->yuv_color->U) << 20);
-  a3 = TO_10 (p->yuv_color->Y) | (TO_10 (p->yuv_color->V) << 10)
-      | (TO_10 (p->yuv_color->Y) << 20);
-
-  data = p->yp + y * p->ystride;
-  for (i = x / 6; i < (x + w) / 6; i++) {
-    GST_WRITE_UINT32_LE (data + i * 16 + 0, a0);
-    GST_WRITE_UINT32_LE (data + i * 16 + 4, a1);
-    GST_WRITE_UINT32_LE (data + i * 16 + 8, a2);
-    GST_WRITE_UINT32_LE (data + i * 16 + 12, a3);
-  }
+  oil_splat_u8 (p->yp + offset, 4, &p->color->Y, w);
+  oil_splat_u8 (p->up + offset, 4, &p->color->U, w);
+  oil_splat_u8 (p->vp + offset, 4, &p->color->V, w);
+  oil_splat_u8 (p->ap + offset, 4, &p->color->A, w);
 }
 
 static void
@@ -1695,9 +1111,9 @@
   int offset;
 
   offset = y * p->ystride;
-  oil_splat_u8 (p->yp + offset + x * 2, 2, &p->yuv_color->Y, w);
-  oil_splat_u8 (p->up + offset + x1 * 4, 4, &p->yuv_color->U, x2 - x1);
-  oil_splat_u8 (p->vp + offset + x1 * 4, 4, &p->yuv_color->V, x2 - x1);
+  oil_splat_u8 (p->yp + offset + x * 2, 2, &p->color->Y, w);
+  oil_splat_u8 (p->up + offset + x1 * 4, 4, &p->color->U, x2 - x1);
+  oil_splat_u8 (p->vp + offset + x1 * 4, 4, &p->color->V, x2 - x1);
 }
 
 static void
@@ -1717,9 +1133,9 @@
   int offset;
 
   offset = y * p->ystride;
-  oil_splat_u8 (p->yp + offset + x * 3, 3, &p->yuv_color->Y, w);
-  oil_splat_u8 (p->up + offset + x * 3, 3, &p->yuv_color->U, w);
-  oil_splat_u8 (p->vp + offset + x * 3, 3, &p->yuv_color->V, w);
+  oil_splat_u8 (p->yp + offset + x * 3, 3, &p->color->Y, w);
+  oil_splat_u8 (p->up + offset + x * 3, 3, &p->color->U, w);
+  oil_splat_u8 (p->vp + offset + x * 3, 3, &p->color->V, w);
 }
 
 static void
@@ -1742,9 +1158,9 @@
   int offset = y * p->ystride;
   int offset1 = y * p->ustride;
 
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-  oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, x2 - x1);
-  oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, x2 - x1);
+  oil_splat_u8_ns (p->yp + offset + x, &p->color->Y, w);
+  oil_splat_u8_ns (p->up + offset1 + x1, &p->color->U, x2 - x1);
+  oil_splat_u8_ns (p->vp + offset1 + x1, &p->color->V, x2 - x1);
 }
 
 static void
@@ -1767,29 +1183,9 @@
   int offset = y * p->ystride;
   int offset1 = y * p->ustride;
 
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-  oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, x2 - x1);
-  oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, x2 - x1);
-}
-
-static void
-paint_setup_Y444 (paintinfo * p, unsigned char *dest)
-{
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->up = p->yp + p->ystride * p->height;
-  p->vp = p->up + p->ystride * p->height;
-  p->endptr = p->vp + p->ystride * p->height;
-}
-
-static void
-paint_hline_Y444 (paintinfo * p, int x, int y, int w)
-{
-  int offset = y * p->ystride;
-
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-  oil_splat_u8_ns (p->up + offset + x, &p->yuv_color->U, w);
-  oil_splat_u8_ns (p->vp + offset + x, &p->yuv_color->V, w);
+  oil_splat_u8_ns (p->yp + offset + x, &p->color->Y, w);
+  oil_splat_u8_ns (p->up + offset1 + x1, &p->color->U, x2 - x1);
+  oil_splat_u8_ns (p->vp + offset1 + x1, &p->color->V, x2 - x1);
 }
 
 static void
@@ -1806,7 +1202,7 @@
 {
   int offset = y * p->ystride;
 
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
+  oil_splat_u8_ns (p->yp + offset + x, &p->color->Y, w);
 }
 
 #if 0
@@ -1850,9 +1246,9 @@
   int offset = y * p->width;
   int offset1 = (y / 2) * p->width;
 
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-  oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, x2 - x1);
-  oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, x2 - x1);
+  oil_splat_u8_ns (p->yp + offset + x, &p->color->Y, w);
+  oil_splat_u8_ns (p->up + offset1 + x1, &p->color->U, x2 - x1);
+  oil_splat_u8_ns (p->vp + offset1 + x1, &p->color->V, x2 - x1);
 }
 #endif
 
@@ -1893,9 +1289,9 @@
   int offset = y * p->ystride;
   int offset1 = (y / 4) * p->ustride;
 
-  oil_splat_u8_ns (p->yp + offset + x, &p->yuv_color->Y, w);
-  oil_splat_u8_ns (p->up + offset1 + x1, &p->yuv_color->U, x2 - x1);
-  oil_splat_u8_ns (p->vp + offset1 + x1, &p->yuv_color->V, x2 - x1);
+  oil_splat_u8_ns (p->yp + offset + x, &p->color->Y, w);
+  oil_splat_u8_ns (p->up + offset1 + x1, &p->color->U, x2 - x1);
+  oil_splat_u8_ns (p->vp + offset1 + x1, &p->color->V, x2 - x1);
 }
 
 static void
@@ -1990,14 +1386,13 @@
 paint_hline_str4 (paintinfo * p, int x, int y, int w)
 {
   int offset = y * p->ystride;
-  guint8 alpha = 255;
 
-  oil_splat_u8 (p->yp + offset + x * 4, 4, &p->rgb_color->R, w);
-  oil_splat_u8 (p->up + offset + x * 4, 4, &p->rgb_color->G, w);
-  oil_splat_u8 (p->vp + offset + x * 4, 4, &p->rgb_color->B, w);
+  oil_splat_u8 (p->yp + offset + x * 4, 4, &p->color->R, w);
+  oil_splat_u8 (p->up + offset + x * 4, 4, &p->color->G, w);
+  oil_splat_u8 (p->vp + offset + x * 4, 4, &p->color->B, w);
 
   if (p->ap != NULL) {
-    oil_splat_u8 (p->ap + offset + (x * 4), 4, &alpha, w);
+    oil_splat_u8 (p->ap + offset + (x * 4), 4, &p->color->A, w);
   }
 }
 
@@ -2006,9 +1401,9 @@
 {
   int offset = y * p->ystride;
 
-  oil_splat_u8 (p->yp + offset + x * 3, 3, &p->rgb_color->R, w);
-  oil_splat_u8 (p->up + offset + x * 3, 3, &p->rgb_color->G, w);
-  oil_splat_u8 (p->vp + offset + x * 3, 3, &p->rgb_color->B, w);
+  oil_splat_u8 (p->yp + offset + x * 3, 3, &p->color->R, w);
+  oil_splat_u8 (p->up + offset + x * 3, 3, &p->color->G, w);
+  oil_splat_u8 (p->vp + offset + x * 3, 3, &p->color->B, w);
 }
 
 static void
@@ -2025,8 +1420,8 @@
   int offset = y * p->ystride;
   uint8_t a, b;
 
-  a = (p->rgb_color->R & 0xf8) | (p->rgb_color->G >> 5);
-  b = ((p->rgb_color->G << 3) & 0xe0) | (p->rgb_color->B >> 3);
+  a = (p->color->R & 0xf8) | (p->color->G >> 5);
+  b = ((p->color->G << 3) & 0xe0) | (p->color->B >> 3);
 
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
   oil_splat_u8 (p->yp + offset + x * 2 + 0, 2, &b, w);
@@ -2051,8 +1446,8 @@
   int offset = y * p->ystride;
   uint8_t a, b;
 
-  a = ((p->rgb_color->R >> 1) & 0x7c) | (p->rgb_color->G >> 6);
-  b = ((p->rgb_color->G << 2) & 0xe0) | (p->rgb_color->B >> 3);
+  a = ((p->color->R >> 1) & 0x7c) | (p->color->G >> 6);
+  b = ((p->color->G << 2) & 0xe0) | (p->color->B >> 3);
 
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
   oil_splat_u8 (p->yp + offset + x * 2 + 0, 2, &b, w);
@@ -2082,51 +1477,18 @@
   if (y & 1) {
     for (i = x; i < x + w; i++) {
       if (i & 1) {
-        dest[i] = p->rgb_color->G;
+        dest[i] = p->color->G;
       } else {
-        dest[i] = p->rgb_color->B;
+        dest[i] = p->color->B;
       }
     }
   } else {
     for (i = x; i < x + w; i++) {
       if (i & 1) {
-        dest[i] = p->rgb_color->R;
+        dest[i] = p->color->R;
       } else {
-        dest[i] = p->rgb_color->G;
+        dest[i] = p->color->G;
       }
     }
   }
 }
-
-static void
-paint_setup_GRAY8 (paintinfo * p, unsigned char *dest)
-{
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width);
-  p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_GRAY8 (paintinfo * p, int x, int y, int w)
-{
-  int offset = y * p->ystride;
-  guint8 color = p->gray_color->G >> 8;
-
-  oil_splat_u8_ns (p->yp + offset + x, &color, w);
-}
-
-static void
-paint_setup_GRAY16 (paintinfo * p, unsigned char *dest)
-{
-  p->yp = dest;
-  p->ystride = GST_ROUND_UP_4 (p->width * 2);
-  p->endptr = dest + p->ystride * p->height;
-}
-
-static void
-paint_hline_GRAY16 (paintinfo * p, int x, int y, int w)
-{
-  int offset = y * p->ystride;
-
-  oil_splat_u16_ns ((guint16 *) (p->yp + offset + 2 * x), &p->gray_color->G, w);
-}