summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2010-08-24 09:51:46 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2010-08-24 09:51:46 +0200
commit613c44044a9811f90cbbaf3a5e3d4530abd6bd1d (patch)
tree72e5a5d87daaa349abc152a1ba968501578619a5
parent6bd90dc0cc742390c2f1e842e1f026a3503ded63 (diff)
videotestsrc: Fix NV21 rendering
Using the same as for NV12 will result in wrong colors and crashes.
-rw-r--r--gst/videotestsrc/videotestsrc.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/gst/videotestsrc/videotestsrc.c b/gst/videotestsrc/videotestsrc.c
index 8009e2b5c..c11ad686f 100644
--- a/gst/videotestsrc/videotestsrc.c
+++ b/gst/videotestsrc/videotestsrc.c
@@ -381,7 +381,8 @@ static void paint_setup_xRGB1555 (paintinfo * p, unsigned char *dest);
static void paint_setup_bayer (paintinfo * p, unsigned char *dest);
static void 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);
+static void paint_hline_NV12 (paintinfo * p, int x, int y, int w);
+static void paint_hline_NV21 (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);
@@ -453,9 +454,9 @@ struct fourcc_list_struct fourcc_list[] = {
/* I420 */
{VTS_YUV, "I420", "I420", 12, paint_setup_I420, paint_hline_I420},
/* NV12 */
- {VTS_YUV, "NV12", "NV12", 12, paint_setup_NV12, paint_hline_NV12_NV21},
+ {VTS_YUV, "NV12", "NV12", 12, paint_setup_NV12, paint_hline_NV12},
/* NV21 */
- {VTS_YUV, "NV21", "NV21", 12, paint_setup_NV21, paint_hline_NV12_NV21},
+ {VTS_YUV, "NV21", "NV21", 12, paint_setup_NV21, paint_hline_NV21},
#if 0
/* IMC1 */
{VTS_YUV, "IMC1", "IMC1", 16, paint_setup_IMC1, paint_hline_IMC1},
@@ -1844,7 +1845,7 @@ 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)
+paint_hline_NV12 (paintinfo * p, int x, int y, int w)
{
int x1 = x / 2;
int x2 = (x + w) / 2;
@@ -1866,6 +1867,28 @@ paint_hline_NV12_NV21 (paintinfo * p, int x, int y, int w)
}
static void
+paint_hline_NV21 (paintinfo * p, int x, int y, int w)
+{
+ int x1 = x / 2;
+ int x2 = (x + w) / 2;
+ int offset = y * p->ystride;
+ int offsetuv = (y / 2) * p->ustride + (x & ~0x01);
+ int uvlength = x2 - x1 + 1;
+ guint16 value;
+
+ gst_orc_splat_u8 (p->yp + offset + x, p->yuv_color->Y, w);
+#if G_BYTE_ORDER == G_LITTLE_ENDIAN
+ value = (p->yuv_color->U << 8) | (p->yuv_color->V << 0);
+#else
+ value = (p->yuv_color->U << 0) | (p->yuv_color->V << 8);
+#endif
+
+ if (uvlength) {
+ gst_orc_splat_u16 (p->vp + offsetuv, value, uvlength);
+ }
+}
+
+static void
paint_setup_YV12 (paintinfo * p, unsigned char *dest)
{
p->yp = dest;