gst/videotestsrc/videotestsrc.c: Fix Bayer pattern generation.

Original commit message from CVS:
Patch by: William M. Brack
* gst/videotestsrc/videotestsrc.c: Fix Bayer pattern generation.
This commit is contained in:
William M. Brack 2008-03-14 17:33:09 +00:00 committed by David Schleef
parent 4803dd99e5
commit bfdcf07674
2 changed files with 47 additions and 6 deletions

View file

@ -1,3 +1,9 @@
2008-03-14 David Schleef <ds@schleef.org>
Patch by: William M. Brack
* gst/videotestsrc/videotestsrc.c: Fix Bayer pattern generation.
2008-03-14 Wim Taymans <wim.taymans@collabora.co.uk> 2008-03-14 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/playback/gststreamselector.c: (gst_selector_pad_event), * gst/playback/gststreamselector.c: (gst_selector_pad_event),

View file

@ -304,7 +304,10 @@ static void paint_hline_str3 (paintinfo * p, int x, int y, int w);
static void paint_hline_RGB565 (paintinfo * p, int x, int y, int w); static void paint_hline_RGB565 (paintinfo * p, int x, int y, int w);
static void paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w); static void paint_hline_xRGB1555 (paintinfo * p, int x, int y, int w);
static void paint_hline_bayer (paintinfo * p, int x, int y, int w); #if 0
static void paint_hline_bayer_GRBG (paintinfo * p, int x, int y, int w);
#endif
static void paint_hline_bayer_BGGR (paintinfo * p, int x, int y, int w);
struct fourcc_list_struct fourcc_list[] = { struct fourcc_list_struct fourcc_list[] = {
/* packed */ /* packed */
@ -390,7 +393,11 @@ struct fourcc_list_struct fourcc_list[] = {
15, 15,
0x00007c00, 0x000003e0, 0x0000001f}, 0x00007c00, 0x000003e0, 0x0000001f},
{VTS_BAYER, "BAY8", "Bayer", 8, paint_setup_bayer, paint_hline_bayer} /* Need to know if this is correct */
#if 0
{VTS_BAYER, "BAY8", "BayerRGGB", 8, paint_setup_bayer, paint_hline_bayer_GRBG}
#endif
{VTS_BAYER, "BA81", "BayerBGGR", 8, paint_setup_bayer, paint_hline_bayer_BGGR}
}; };
int n_fourccs = G_N_ELEMENTS (fourcc_list); int n_fourccs = G_N_ELEMENTS (fourcc_list);
@ -1467,16 +1474,17 @@ paint_setup_bayer (paintinfo * p, unsigned char *dest)
p->endptr = p->dest + p->ystride * p->height; p->endptr = p->dest + p->ystride * p->height;
} }
#if 0
static void static void
paint_hline_bayer (paintinfo * p, int x, int y, int w) paint_hline_bayer_GRBG (paintinfo * p, int x, int y, int w)
{ {
int offset = y * p->ystride; int offset = y * p->ystride;
uint8_t *dest = p->yp + offset; uint8_t *dest = p->yp + offset;
int i; int i;
if (y & 1) { if ((y & 1) == 0) {
for (i = x; i < x + w; i++) { for (i = x; i < x + w; i++) {
if (i & 1) { if ((i & 1) == 0) {
dest[i] = p->color->G; dest[i] = p->color->G;
} else { } else {
dest[i] = p->color->B; dest[i] = p->color->B;
@ -1484,7 +1492,7 @@ paint_hline_bayer (paintinfo * p, int x, int y, int w)
} }
} else { } else {
for (i = x; i < x + w; i++) { for (i = x; i < x + w; i++) {
if (i & 1) { if ((i & 1) == 0) {
dest[i] = p->color->R; dest[i] = p->color->R;
} else { } else {
dest[i] = p->color->G; dest[i] = p->color->G;
@ -1492,3 +1500,30 @@ paint_hline_bayer (paintinfo * p, int x, int y, int w)
} }
} }
} }
#endif
static void
paint_hline_bayer_BGGR (paintinfo * p, int x, int y, int w)
{
int offset = y * p->ystride;
uint8_t *dest = p->yp + offset;
int i;
if ((y & 1) == 0) {
for (i = x; i < x + w; i++) {
if ((i & 1) == 0) {
dest[i] = p->color->B;
} else {
dest[i] = p->color->G;
}
}
} else {
for (i = x; i < x + w; i++) {
if ((i & 1) == 0) {
dest[i] = p->color->G;
} else {
dest[i] = p->color->R;
}
}
}
}