Re: Query the meaning of variable in v4l2_pix_format and v4l2_plane

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/04/2011 02:07 PM, Jonghun Han wrote:

Hi,

Hi Mr. Han,


I'm not sure the meaning of variables in v4l2_pix_format and v4l2_plane.
Especially bytesperline, sizeimage, length and bytesused.

v4l2_pix_format.width		= width
v4l2_pix_format.height		= height

The fields width and height are undefined for some formats, like compressed JPEG and video streams.

v4l2_pix_format.bytesperline	= bytesperline [in bytes]

The spec says "Distance in bytes between the leftmost pixels in two adjacent lines" for the largest plane. For YUV 4:2:0 the largest plane is luminance, where one pixel is one byte.

v4l2_pix_format.sizeimage	= bytesperline * buf height  ->  Is this
right ?

It is the upper limit for size of image of desired size. This value is needed if images are passed in compressed formats.


v4l2_plane.length	= bytesperline * buf height  ->  Is this right ?
I don't which is right.

This is the upper limit for a size of a given plane. For simple formats use:
v4l2_plane.length = plane_height * plane.bytesperline
The plane_height may be smaller the buf_height. For example for YUV420, the height of the chrominance plane, should be the half of buf_height.

For compressed formats it specify upper limit for plane size.

v4l2_plane.bytesused	= bytesperline * (top + height)
v4l2_plane.bytesused	= bytesperline * height
v4l2_plane.bytesused	= width * height * bytesperpixel
v4l2_plane.bytesused	= bytesperline * (top + height) - (pixelperline -
(left + width)) * bytesperpixel

bytesused specify how much valid data is present in the buffer.
For simple formates you should use:
v4l2_plane.bytesused	= v4l2_plane.length
while queuing buffer into OUTPUT queue.

The inner rectangle refers to cropping rectangle for mem2mem devices. This rectangle should not be used in any computations of the buffer parameters.

Best regards,
Tomasz Stanislawski

I assumed the following buffer.

|                                                          |
|<--------------------- bytesperline --------------------->|
|                                                          |
+----------------------------------------------------------+-----
|          ^                                               |  ^
|          |                                               |  |
|                                                          |  |
|          t                                               |  |
|          o                                               |  |
|          p                                               |  |
|                                                          |  |
|          |                                               |  |
|          V |<--------- width ---------->|                |  |
|<-- left -->+----------------------------+ -              |  |
|            |                            | ^              |
|            |                            | |              |  b
|            |                            | |              |  u
|            |                            |                |  f
|            |                            | h              |
|            |                            | e              |  h
|            |                            | i              |  e
|            |                            | g              |  i
|            |                            | h              |  g
|            |                            | t              |  h
|            |                            |                |  t
|            |                            | |              |
|            |                            | |              |  |
|            |                            | v              |  |
|            +----------------------------+ -              |  |
|                                                          |  |
|                                                          |  |
|                                                          |  v
+----------------------------------------------------------+-----


Best regards,



--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux