From 7585e3b9fb0340624dc20379589bdd7df6c549b0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 5 Nov 2004 15:07:57 +0000 Subject: [PATCH] gst/videotestsrc/videotestsrc.c: Added two more colorspaces. Original commit message from CVS: * gst/videotestsrc/videotestsrc.c: (paint_setup_Y41B), (paint_hline_Y41B), (paint_setup_Y42B), (paint_hline_Y42B): Added two more colorspaces. --- ChangeLog | 6 +++++ gst/videotestsrc/videotestsrc.c | 56 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) diff --git a/ChangeLog b/ChangeLog index 92e1906..1a9d689 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2004-11-05 Wim Taymans + * gst/videotestsrc/videotestsrc.c: (paint_setup_Y41B), + (paint_hline_Y41B), (paint_setup_Y42B), (paint_hline_Y42B): + Added two more colorspaces. + +2004-11-05 Wim Taymans + * gst/ffmpegcolorspace/gstffmpegcodecmap.c: (gst_ffmpegcsp_avpicture_fill): * gst/ffmpegcolorspace/imgconvert.c: (avpicture_get_size), diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c index fba1ddd..0db5d22 100644 --- a/gst/videotestsrc/videotestsrc.c +++ b/gst/videotestsrc/videotestsrc.c @@ -255,6 +255,8 @@ static void paint_setup_YUY2 (paintinfo * p, char *dest); static void paint_setup_UYVY (paintinfo * p, char *dest); static void paint_setup_YVYU (paintinfo * p, char *dest); static void paint_setup_IYU2 (paintinfo * p, char *dest); +static void paint_setup_Y41B (paintinfo * p, char *dest); +static void paint_setup_Y42B (paintinfo * p, char *dest); static void paint_setup_Y800 (paintinfo * p, char *dest); #if 0 @@ -277,6 +279,8 @@ static void paint_setup_xRGB1555 (paintinfo * p, char *dest); static void paint_hline_I420 (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_Y800 (paintinfo * p, int x, int y, int w); #if 0 @@ -339,7 +343,9 @@ struct fourcc_list_struct fourcc_list[] = { #endif /* CLPL */ /* Y41B */ + {"Y41B", "Y41B", 12, paint_setup_Y41B, paint_hline_Y41B}, /* Y42B */ + {"Y42B", "Y42B", 16, paint_setup_Y42B, paint_hline_Y42B}, /* Y800 grayscale */ {"Y800", "Y800", 8, paint_setup_Y800, paint_hline_Y800}, @@ -794,6 +800,56 @@ paint_hline_IYU2 (paintinfo * p, int x, int y, int w) } static void +paint_setup_Y41B (paintinfo * p, char *dest) +{ + p->yp = dest; + p->ystride = ROUND_UP_4 (p->width); + p->up = p->yp + p->ystride * p->height; + p->ustride = ROUND_UP_8 (p->width) / 4; + p->vp = p->up + p->ustride * p->height; + p->vstride = ROUND_UP_8 (p->width) / 4; + p->endptr = p->vp + p->vstride * p->height; +} + +static void +paint_hline_Y41B (paintinfo * p, int x, int y, int w) +{ + int x1 = x / 4; + int x2 = (x + w) / 4; + int offset = y * p->ystride; + int offset1 = y * p->ustride; + + memset (p->yp + offset + x, p->color->Y, w); + memset (p->up + offset1 + x1, p->color->U, x2 - x1); + memset (p->vp + offset1 + x1, p->color->V, x2 - x1); +} + +static void +paint_setup_Y42B (paintinfo * p, char *dest) +{ + p->yp = dest; + p->ystride = ROUND_UP_4 (p->width); + p->up = p->yp + p->ystride * p->height; + p->ustride = ROUND_UP_8 (p->width) / 2; + p->vp = p->up + p->ustride * p->height; + p->vstride = ROUND_UP_8 (p->width) / 2; + p->endptr = p->vp + p->vstride * p->height; +} + +static void +paint_hline_Y42B (paintinfo * p, int x, int y, int w) +{ + int x1 = x / 2; + int x2 = (x + w) / 2; + int offset = y * p->ystride; + int offset1 = y * p->ustride; + + memset (p->yp + offset + x, p->color->Y, w); + memset (p->up + offset1 + x1, p->color->U, x2 - x1); + memset (p->vp + offset1 + x1, p->color->V, x2 - x1); +} + +static void paint_setup_Y800 (paintinfo * p, char *dest) { /* untested */ -- 2.7.4