From 88b1e8efcf776d5e1800e843b4251ab3520dbc70 Mon Sep 17 00:00:00 2001 From: Thijs Vermeir Date: Thu, 22 May 2008 18:30:15 +0000 Subject: [PATCH] gst/videotestsrc/videotestsrc.c: Fix generation of NV12/NV21 frames. Fixes bug #532454. Original commit message from CVS: Patch by: Thijs Vermeir * gst/videotestsrc/videotestsrc.c: (paint_hline_NV12_NV21): Fix generation of NV12/NV21 frames. Fixes bug #532454. --- ChangeLog | 7 +++++++ gst/videotestsrc/videotestsrc.c | 13 ++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index a785bf5353..d3953bf2ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-05-22 Sebastian Dröge + + Patch by: Thijs Vermeir + + * gst/videotestsrc/videotestsrc.c: (paint_hline_NV12_NV21): + Fix generation of NV12/NV21 frames. Fixes bug #532454. + 2008-05-22 Wim Taymans Patch by: Sjoerd Simons diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c index 6e85b820f2..32a2cced3a 100644 --- a/gst/videotestsrc/videotestsrc.c +++ b/gst/videotestsrc/videotestsrc.c @@ -1070,14 +1070,17 @@ 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) { - int x1 = x / 2; - int x2 = (x + w) / 2; + int x1 = GST_ROUND_UP_2 (x) / 2; + int x2 = GST_ROUND_UP_2 (x + w) / 2; int offset = y * p->ystride; - int offsetuv = (y / 2) * p->ustride + x; + int offsetuv = GST_ROUND_UP_2 ((y / 2) * p->ustride + x); + int uvlength = x2 - x1; oil_splat_u8_ns (p->yp + offset + x, &p->color->Y, w); - oil_splat_u8 (p->up + offsetuv, 2, &p->color->U, x2 - x1); - oil_splat_u8 (p->vp + offsetuv, 2, &p->color->V, x2 - x1); + if (uvlength) { + oil_splat_u8 (p->up + offsetuv, 2, &p->color->U, x2 - x1); + oil_splat_u8 (p->vp + offsetuv, 2, &p->color->V, x2 - x1); + } } static void