From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
linux-media@vger.kernel.org
Subject: Re: [PATCH] uvc: Fix bytesperline calculation for planar YUV
Date: Wed, 13 Apr 2016 17:36:58 +0300 [thread overview]
Message-ID: <4325164.Ph5FqXt1zq@avalon> (raw)
In-Reply-To: <1452199428-3513-1-git-send-email-nicolas.dufresne@collabora.com>
Hi Nicolas,
Thank you for the patch.
On Thursday 07 Jan 2016 15:43:48 Nicolas Dufresne wrote:
> The formula used to calculate bytesperline only works for packed format.
> So far, all planar format we support have their bytesperline equal to
> the image width (stride of the Y plane or a line of Y for M420).
>
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> ---
> drivers/media/usb/uvc/uvc_v4l2.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_v4l2.c
> b/drivers/media/usb/uvc/uvc_v4l2.c index d7723ce..ceb1d1b 100644
> --- a/drivers/media/usb/uvc/uvc_v4l2.c
> +++ b/drivers/media/usb/uvc/uvc_v4l2.c
> @@ -142,6 +142,20 @@ static __u32 uvc_try_frame_interval(struct uvc_frame
> *frame, __u32 interval) return interval;
> }
>
> +static __u32 uvc_v4l2_get_bytesperline(struct uvc_format *format,
> + struct uvc_frame *frame)
I'd make the two parameters const.
> +{
> + switch (format->fcc) {
> + case V4L2_PIX_FMT_NV12:
> + case V4L2_PIX_FMT_YVU420:
> + case V4L2_PIX_FMT_YUV420:
> + case V4L2_PIX_FMT_M420:
> + return frame->wWidth;
> + default:
> + return format->bpp * frame->wWidth / 8;
> + }
> +}
> +
> static int uvc_v4l2_try_format(struct uvc_streaming *stream,
> struct v4l2_format *fmt, struct uvc_streaming_control *probe,
> struct uvc_format **uvc_format, struct uvc_frame **uvc_frame)
> @@ -245,7 +259,7 @@ static int uvc_v4l2_try_format(struct uvc_streaming
> *stream, fmt->fmt.pix.width = frame->wWidth;
> fmt->fmt.pix.height = frame->wHeight;
> fmt->fmt.pix.field = V4L2_FIELD_NONE;
> - fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
> + fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame);
> fmt->fmt.pix.sizeimage = probe->dwMaxVideoFrameSize;
> fmt->fmt.pix.colorspace = format->colorspace;
> fmt->fmt.pix.priv = 0;
> @@ -282,7 +296,7 @@ static int uvc_v4l2_get_format(struct uvc_streaming
> *stream, fmt->fmt.pix.width = frame->wWidth;
> fmt->fmt.pix.height = frame->wHeight;
> fmt->fmt.pix.field = V4L2_FIELD_NONE;
> - fmt->fmt.pix.bytesperline = format->bpp * frame->wWidth / 8;
> + fmt->fmt.pix.bytesperline = uvc_v4l2_get_bytesperline(format, frame);
> fmt->fmt.pix.sizeimage = stream->ctrl.dwMaxVideoFrameSize;
> fmt->fmt.pix.colorspace = format->colorspace;
> fmt->fmt.pix.priv = 0;
This looks good to me otherwise.
If it's fine with you I can fix the above issue while applying.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2016-04-13 14:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-07 20:43 [PATCH] uvc: Fix bytesperline calculation for planar YUV Nicolas Dufresne
2016-04-13 14:36 ` Laurent Pinchart [this message]
2016-04-13 15:57 ` Nicolas Dufresne
2016-04-14 16:32 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4325164.Ph5FqXt1zq@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@osg.samsung.com \
--cc=nicolas.dufresne@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox