{32, 128, 128},
};
+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},
+};
+
+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},
+};
static void paint_setup_I420 (paintinfo * p, unsigned char *dest);
static void paint_setup_YV12 (paintinfo * p, unsigned char *dest);
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},
{VTS_YUV, "Y800", "Y800", 8, paint_setup_Y800, paint_hline_Y800},
/* Not exactly YUV but it's the same as above */
- {VTS_YUV, "GRAY8", "GRAY8", 8, paint_setup_Y800, paint_hline_Y800},
+ {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},
g_return_val_if_fail (structure, NULL);
if (strcmp (media_type, "video/x-raw-gray") == 0) {
- gint bpp, depth;
+ gint bpp, depth, endianness = 0;
ret = gst_structure_get_int (structure, "bpp", &bpp) &&
gst_structure_get_int (structure, "depth", &depth);
- if (!ret || bpp != 8 || depth != 8)
+ 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_YUV
- && strcmp (fourcc_list[i].fourcc, "GRAY8") == 0) {
+ if (fourcc_list[i].type == VTS_GRAY && fourcc_list[i].bitspp == bpp) {
return fourcc_list + i;
}
}
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:
- if (strcmp (format->fourcc, "GRAY8") == 0) {
- structure = gst_structure_new ("video/x-raw-gray",
- "bpp", G_TYPE_INT, 8, "depth", G_TYPE_INT, 8, NULL);
- } else {
- structure = gst_structure_new ("video/x-raw-yuv",
- "format", GST_TYPE_FOURCC, fourcc, NULL);
- }
+ structure = gst_structure_new ("video/x-raw-yuv",
+ "format", GST_TYPE_FOURCC, fourcc, NULL);
break;
case VTS_BAYER:
structure = gst_structure_new ("video/x-raw-bayer", NULL);
} 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;
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 < y1; j++) {
p->paint_hline (p, x1, j, (x2 - x1));
}
}
p->yuv_color = p->yuv_colors + k;
p->rgb_color = p->rgb_colors + k;
+ p->gray_color = p->gray_colors + k;
for (j = y1; j < y2; j++) {
p->paint_hline (p, x1, j, (x2 - x1));
}
p->yuv_color = p->yuv_colors + k;
p->rgb_color = p->rgb_colors + k;
+ p->gray_color = p->gray_colors + k;
for (j = y2; j < h; j++) {
p->paint_hline (p, x1, j, (x2 - x1));
}
p->yuv_color = p->yuv_colors + k;
p->rgb_color = p->rgb_colors + k;
+ p->gray_color = p->gray_colors + k;
for (j = y2; j < h; j++) {
p->paint_hline (p, x1, j, (x2 - x1));
}
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;
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 (i = x1; i < w; i++) {
for (j = y2; j < h; j++) {
rgb_color.R = y;
rgb_color.G = y;
rgb_color.B = y;
+ gray_color.G = (y << 8) | random_char ();
p->paint_hline (p, i, j, 1);
}
}
} 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;
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));
}
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;
p->rgb_colors = vts_colors_rgb;
if (v->color_spec == GST_VIDEO_TEST_SRC_BT601) {
} 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;
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 (i = 0; i < w; i++) {
for (j = 0; j < h; j++) {
rgb_color.R = y;
rgb_color.G = y;
rgb_color.B = y;
+ gray_color.G = (y << 8) | random_char ();
p->paint_hline (p, i, j, 1);
}
}
} 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;
p->rgb_color = p->rgb_colors + color_index;
p->yuv_color = p->yuv_colors + color_index;
+ p->gray_color = p->gray_colors + color_index;
for (i = 0; i < h; i++) {
p->paint_hline (p, 0, i, w);
} 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;
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->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->paint_hline (p, x, y, 1);
}
}
} 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;
p->rgb_color = p->rgb_colors + COLOR_GREEN;
p->yuv_color = p->yuv_colors + COLOR_GREEN;
+ p->gray_color = p->gray_colors + COLOR_GREEN;
for (y = 0; y < h; y++) {
p->paint_hline (p, 0, y, w);
}
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 + 0, len);
if (G_LIKELY ((y + 1) < h)) {
p->paint_hline (p, x, y + 1, len);
} 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;
p->rgb_color = p->rgb_colors + COLOR_GREEN;
p->yuv_color = p->yuv_colors + COLOR_GREEN;
+ p->gray_color = p->gray_colors + COLOR_GREEN;
for (y = 0; y < h; y++) {
p->paint_hline (p, 0, y, w);
}
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 + 0, len);
if (G_LIKELY ((y + 1) < h)) {
p->paint_hline (p, x, y + 1, len);
} 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;
p->rgb_color = p->rgb_colors + COLOR_GREEN;
p->yuv_color = p->yuv_colors + COLOR_GREEN;
+ p->gray_color = p->gray_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);
}
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;
} 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;
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;
/* Zoneplate equation:
*
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);
}
}
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;
double freq[8];
} 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;
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 (i = 1; i < 8; i++) {
freq[i] = 200 * pow (2.0, -(i - 1) / 4.0);
seg = floor (dist * 16);
if (seg == 0 || seg >= 8) {
yuv_color.Y = 255;
+ gray_color.G = 65535;
} else {
#ifdef SCALE_AMPLITUDE
double a;
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);
#else
yuv_color.Y = sine_array[d & 0xff];
+ gray_color.G = sine_array[d & 0xff];
#endif
}
rgb_color.R = yuv_color.Y;
}
}
-
static void
paint_setup_I420 (paintinfo * p, unsigned char *dest)
{
}
}
}
+
+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);
+}