Re: [PATCH v4 10/16] media: coda: fix sizeimage setting in try_fmt

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

 



On 10 September 2012 17:29, Philipp Zabel <p.zabel@xxxxxxxxxxxxxx> wrote:
> VIDIOC_TRY_FMT would incorrectly return bytesperline * height,
> instead of width * height * 3 / 2.
>
> Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> ---
>  drivers/media/platform/coda.c |   10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c
> index fe8a397..e8ed427 100644
> --- a/drivers/media/platform/coda.c
> +++ b/drivers/media/platform/coda.c
> @@ -407,8 +407,8 @@ static int vidioc_try_fmt(struct coda_dev *dev, struct v4l2_format *f)
>                                       W_ALIGN, &f->fmt.pix.height,
>                                       MIN_H, MAX_H, H_ALIGN, S_ALIGN);
>                 f->fmt.pix.bytesperline = round_up(f->fmt.pix.width, 2);
> -               f->fmt.pix.sizeimage = f->fmt.pix.height *
> -                                       f->fmt.pix.bytesperline;
> +               f->fmt.pix.sizeimage = f->fmt.pix.width *
> +                                       f->fmt.pix.height * 3 / 2;
>         } else { /*encoded formats h.264/mpeg4 */
>                 f->fmt.pix.bytesperline = 0;
>                 f->fmt.pix.sizeimage = CODA_MAX_FRAME_SIZE;
> @@ -492,11 +492,7 @@ static int vidioc_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f)
>         q_data->fmt = find_format(ctx->dev, f);
>         q_data->width = f->fmt.pix.width;
>         q_data->height = f->fmt.pix.height;
> -       if (q_data->fmt->fourcc == V4L2_PIX_FMT_YUV420) {
> -               q_data->sizeimage = q_data->width * q_data->height * 3 / 2;
> -       } else { /* encoded format h.264/mpeg-4 */
> -               q_data->sizeimage = CODA_MAX_FRAME_SIZE;
> -       }
> +       q_data->sizeimage = f->fmt.pix.sizeimage;
>
>         v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev,
>                 "Setting format for type %d, wxh: %dx%d, fmt: %d\n",
> --
> 1.7.10.4
>

Tested-by: Javier Martin <javier.martin@xxxxxxxxxxxxxxxxx

-- 
Javier Martin
Vista Silicon S.L.
CDTUC - FASE C - Oficina S-345
Avda de los Castros s/n
39005- Santander. Cantabria. Spain
+34 942 25 32 60
www.vista-silicon.com
--
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