summaryrefslogtreecommitdiff
path: root/gst/geometrictransform
diff options
context:
space:
mode:
authorAntonio Ospite <ospite@studenti.unina.it>2013-10-17 12:53:31 +0200
committerSebastian Dröge <sebastian@centricular.com>2013-10-31 15:03:30 +0100
commitae2231624c92953ea3dfb32a36a8ff2fb927da20 (patch)
tree0619a50d4a7946cabf5b03af723dc833475cff08 /gst/geometrictransform
parent7ec5f8527ae74462aa98b7badbfbcdbb3808e31e (diff)
geometrictransform: Fix setting black background for AYUV buffers
When the frame buffer is AYUV writing all zeros does not set it to black, in YUV colorspace 0x10 is the black level for luminance and 0x80 is the black level for chrominance. Fix setting the background to black when the out_frame format is AYUV; in all the other supported formats zeroing the data with memset is still the right thing to do. https://bugzilla.gnome.org/show_bug.cgi?id=710392
Diffstat (limited to 'gst/geometrictransform')
-rw-r--r--gst/geometrictransform/gstgeometrictransform.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gst/geometrictransform/gstgeometrictransform.c b/gst/geometrictransform/gstgeometrictransform.c
index 34ce49481..4c08b20ea 100644
--- a/gst/geometrictransform/gstgeometrictransform.c
+++ b/gst/geometrictransform/gstgeometrictransform.c
@@ -240,7 +240,16 @@ gst_geometric_transform_transform_frame (GstVideoFilter * vfilter,
in_data = GST_VIDEO_FRAME_PLANE_DATA (in_frame, 0);
out_data = GST_VIDEO_FRAME_PLANE_DATA (out_frame, 0);
- memset (out_data, 0, out_frame->map[0].size);
+
+ if (GST_VIDEO_FRAME_FORMAT (out_frame) == GST_VIDEO_FORMAT_AYUV) {
+ /* in AYUV black is not just all zeros:
+ * 0x10 is black for Y,
+ * 0x80 is black for Cr and Cb */
+ for (int i = 0; i < out_frame->map[0].size; i += 4)
+ GST_WRITE_UINT32_BE (out_data + i, 0xff108080);
+ } else {
+ memset (out_data, 0, out_frame->map[0].size);
+ }
GST_OBJECT_LOCK (gt);
if (gt->precalc_map) {