diff options
author | Thijs Vermeir <thijsvermeir@gmail.com> | 2008-05-22 18:30:15 +0000 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2008-05-22 18:30:15 +0000 |
commit | 88b1e8efcf776d5e1800e843b4251ab3520dbc70 (patch) | |
tree | 823a13555d7f7c636f30f89633af0a884457b95c /gst/videotestsrc/videotestsrc.c | |
parent | 1c424d9d931a72b3d4a46be9a1e5ed27303f7b7d (diff) |
gst/videotestsrc/videotestsrc.c: Fix generation of NV12/NV21 frames. Fixes bug #532454.
Original commit message from CVS:
Patch by: Thijs Vermeir <thijsvermeir@gmail.com>
* gst/videotestsrc/videotestsrc.c: (paint_hline_NV12_NV21):
Fix generation of NV12/NV21 frames. Fixes bug #532454.
Diffstat (limited to 'gst/videotestsrc/videotestsrc.c')
-rw-r--r-- | gst/videotestsrc/videotestsrc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c index 6e85b820f..32a2cced3 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 |