2.1. Single-planar format structure¶
-
v4l2_pix_format
¶
__u32 | width |
Image width in pixels. |
__u32 | height |
Image height in pixels. If field is one of V4L2_FIELD_TOP ,
V4L2_FIELD_BOTTOM or V4L2_FIELD_ALTERNATE then height
refers to the number of lines in the field, otherwise it refers to
the number of lines in the frame (which is twice the field height
for interlaced formats). |
Applications set these fields to request an image
size, drivers return the closest possible values. In case of
planar formats the For compressed formats that contain the resolution information encoded inside the stream, when fed to a stateful mem2mem decoder, the fields may be zero to rely on the decoder to detect the right values. For more details see Memory-to-Memory Stateful Video Decoder Interface and format descriptions. For compressed formats on the CAPTURE side of a stateful mem2mem encoder, the fields must be zero, since the coded size is expected to be calculated internally by the encoder itself, based on the OUTPUT side. For more details see Memory-to-Memory Stateful Video Encoder Interface and format descriptions. |
||
__u32 | pixelformat |
The pixel format or type of compression, set by the application. This is a little endian four character code. V4L2 defines standard RGB formats in RGB Formats, YUV formats in YUV Formats, and reserved codes in Reserved Image Formats |
__u32 | field |
Field order, from enum v4l2_field .
Video images are typically interlaced. Applications can request to
capture or output only the top or bottom field, or both fields
interlaced or sequentially stored in one buffer or alternating in
separate buffers. Drivers return the actual field order selected.
For more details on fields see Field Order. |
__u32 | bytesperline |
Distance in bytes between the leftmost pixels in two adjacent lines. |
Both applications and drivers can set this field to request
padding bytes at the end of each line. Drivers however may ignore
the value requested by the application, returning Video hardware may access padding bytes, therefore they must reside in accessible memory. Consider cases where padding bytes after the last line of an image cross a system page boundary. Input devices may write padding bytes, the value is undefined. Output devices ignore the contents of padding bytes. When the image format is planar the For compressed formats the |
||
__u32 | sizeimage |
Size in bytes of the buffer to hold a complete image, set by the
driver. Usually this is The driver will set the value for uncompressed images. Clients are allowed to set the sizeimage field for variable length
compressed data flagged with |
__u32 | colorspace |
Image colorspace, from enum v4l2_colorspace .
This information supplements the pixelformat and must be set
by the driver for capture streams and by the application for
output streams, see Colorspaces. If the application sets the
flag V4L2_PIX_FMT_FLAG_SET_CSC then the application can set
this field for a capture stream to request a specific colorspace
for the captured image data. If the driver cannot handle requested
conversion, it will return another supported colorspace.
The driver indicates that colorspace conversion is supported by setting
the flag V4L2_FMT_FLAG_CSC_COLORSPACE in the corresponding struct
v4l2_fmtdesc during enumeration. See Image Format Description Flags. |
__u32 | priv |
This field indicates whether the remaining fields of the
struct Applications that wish to use the pixel format extended fields must first ensure that the feature is supported by querying the device for the V4L2_CAP_EXT_PIX_FORMAT capability. If the capability isn’t set the pixel format extended fields are not supported and using the extended fields will lead to undefined results. To use the extended fields, applications must set the When the |
__u32 | flags |
Flags set by the application or driver, see Format Flags. |
union { | (anonymous) | |
__u32 | ycbcr_enc |
Y’CbCr encoding, from enum v4l2_ycbcr_encoding .
This information supplements the colorspace and must be set by
the driver for capture streams and by the application for output
streams, see Colorspaces. If the application sets the
flag V4L2_PIX_FMT_FLAG_SET_CSC then the application can set
this field for a capture stream to request a specific Y’CbCr encoding
for the captured image data. If the driver cannot handle requested
conversion, it will return another supported encoding.
This field is ignored for HSV pixelformats. The driver indicates that
ycbcr_enc conversion is supported by setting the flag
V4L2_FMT_FLAG_CSC_YCBCR_ENC in the corresponding struct
v4l2_fmtdesc during enumeration. See Image Format Description Flags. |
__u32 | hsv_enc |
HSV encoding, from enum v4l2_hsv_encoding .
This information supplements the colorspace and must be set by
the driver for capture streams and by the application for output
streams, see Colorspaces. If the application sets the flag
V4L2_PIX_FMT_FLAG_SET_CSC then the application can set this
field for a capture stream to request a specific HSV encoding for the
captured image data. If the driver cannot handle requested
conversion, it will return another supported encoding.
This field is ignored for non-HSV pixelformats. The driver indicates
that hsv_enc conversion is supported by setting the flag
V4L2_FMT_FLAG_CSC_HSV_ENC in the corresponding struct
v4l2_fmtdesc during enumeration. See Image Format Description Flags. |
} | ||
__u32 | quantization |
Quantization range, from enum v4l2_quantization .
This information supplements the colorspace and must be set by
the driver for capture streams and by the application for output
streams, see Colorspaces. If the application sets the flag
V4L2_PIX_FMT_FLAG_SET_CSC then the application can set
this field for a capture stream to request a specific quantization
range for the captured image data. If the driver cannot handle requested
conversion, it will return another supported quantization.
The driver indicates that quantization conversion is supported by setting
the flag V4L2_FMT_FLAG_CSC_QUANTIZATION in the corresponding struct
v4l2_fmtdesc during enumeration. See Image Format Description Flags. |
__u32 | xfer_func |
Transfer function, from enum v4l2_xfer_func .
This information supplements the colorspace and must be set by
the driver for capture streams and by the application for output
streams, see Colorspaces. If the application sets the flag
V4L2_PIX_FMT_FLAG_SET_CSC then the application can set
this field for a capture stream to request a specific transfer function
for the captured image data. If the driver cannot handle requested
conversion, it will return another supported transfer function.
The driver indicates that xfer_func conversion is supported by setting
the flag V4L2_FMT_FLAG_CSC_XFER_FUNC in the corresponding struct
v4l2_fmtdesc during enumeration. See Image Format Description Flags. |
V4L2_PIX_FMT_FLAG_PREMUL_ALPHA |
0x00000001 | The color values are premultiplied by the alpha channel value. For example, if a light blue pixel with 50% transparency was described by RGBA values (128, 192, 255, 128), the same pixel described with premultiplied colors would be described by RGBA values (64, 96, 128, 128) |
V4L2_PIX_FMT_FLAG_SET_CSC |
0x00000002 | Set by the application. It is only used for capture and is
ignored for output streams. If set, then request the device to do
colorspace conversion from the received colorspace to the requested
colorspace values. If the colorimetry field ( To check which conversions are supported by the hardware for the current pixel format, see Image Format Description Flags. |