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]

 



Hello,

On Friday, November 04, 2011 2:08 PM Jonghun Han wrote:

> 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
> v4l2_pix_format.bytesperline	= bytesperline [in bytes]
> v4l2_pix_format.sizeimage	= bytesperline * buf height  -> Is this
> right ?

Yes, I would expect it to be calculated this way for formats where 
bytesperline can be defined (for macroblock format bytesperline is hard
to define).

> 
> v4l2_plane.length	= bytesperline * buf height  -> Is this right ?
> I don't which is right.
> 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 should indicate how many bytes have been modified from the 
beginning of the buffer, so memcpy(dst, buf->mem, byteused) will copy 
all the video data.

So probably the most appropriate value for bytesused is:
v4l2_plane.bytesused	= bytesperline * (top + height)

I hope my assumptions are correct, but I would also like Hans to comment 
on this.

> 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
-- 
Marek Szyprowski
Samsung Poland R&D Center


--
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