What is the width of an interleaved pixel returned by GstVideoFormatUnpack?

Tim Müller tim at centricular.com
Sun Sep 6 14:21:19 PDT 2015


On Sun, 2015-09-06 at 22:53 +0200, Graham Leggett wrote:

> I am using the GstVideoFormatUnpack function to return to me a full line of pixels from a given frame:
> 
> http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideo.html#GstVideoFormatUnpack
> 
> I am currently struggling to work out the resulting width of a single pixel returned. The docs are not sufficiently specific enough to work out the answer.
> 
> From reverse engineering the code it looks like it might be the following:
> 
>   uinfo = gst_video_format_get_info((&vframe)->info.finfo->unpack_format);
>   width_in_bits = uinfo->n_components * uinfo->bits;
> 
> Can anyone confirm?

The unpack format will be ARGB, AYUV, ARGB64, AYUV64, GRAY or GRAY16
depending on the original format.

The amount of space required to unpack pixels into the unpack_format is
of course dependent on the details of the unpack_format (I agree the
description is not very clear though).

Your formula should work. Alternatively,

 dest = g_malloc (width * GST_VIDEO_FORMAT_INFO_PSTRIDE(uinfo, 0));

should also work.

Cheers
 -Tim

-- 
Tim Müller, Centricular Ltd - http://www.centricular.com

Join us at the GStreamer Conference: 8-9 October 2015 in Dublin, Ireland




More information about the gstreamer-devel mailing list