Update about packed and planar YUV formats
This commit is contained in:
@@ -196,7 +196,7 @@ func (d *Device) StreamOff() (err error) {
|
||||
return ioctl(d.fd, VIDIOC_REQBUFS, unsafe.Pointer(&rb))
|
||||
}
|
||||
|
||||
func (d *Device) Capture(cositedYUV bool) ([]byte, error) {
|
||||
func (d *Device) Capture(planarYUV bool) ([]byte, error) {
|
||||
dec := v4l2_buffer{
|
||||
typ: V4L2_BUF_TYPE_VIDEO_CAPTURE,
|
||||
memory: V4L2_MEMORY_MMAP,
|
||||
@@ -206,7 +206,7 @@ func (d *Device) Capture(cositedYUV bool) ([]byte, error) {
|
||||
}
|
||||
|
||||
buf := make([]byte, dec.bytesused)
|
||||
if cositedYUV {
|
||||
if planarYUV {
|
||||
YUYV2YUV(buf, d.bufs[dec.index][:dec.bytesused])
|
||||
} else {
|
||||
copy(buf, d.bufs[dec.index][:dec.bytesused])
|
||||
|
||||
@@ -16,7 +16,7 @@ var Formats = []Format{
|
||||
{V4L2_PIX_FMT_MJPEG, "Motion-JPEG", "mjpeg"},
|
||||
}
|
||||
|
||||
// YUYV2YUV convert [Y0 Cb Y1 Cr] to cosited [Y0Y1... Cb... Cr...]
|
||||
// YUYV2YUV convert packed YUV to planar YUV
|
||||
func YUYV2YUV(dst, src []byte) {
|
||||
n := len(src)
|
||||
i0 := 0
|
||||
|
||||
Reference in New Issue
Block a user