Skip to content

Commit

Permalink
[media] sh_veu: fix the buffer size calculation
Browse files Browse the repository at this point in the history
The 'bytesperline' value only indicates the stride of the Y plane
if the color format is planar, such as NV12. When calculating
the total plane size, the size of CbCr plane must also be considered.

Signed-off-by: Katsuya Matsubara <matsu@igel.co.jp>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Katsuya Matsubara authored and Mauro Carvalho Chehab committed Jun 9, 2013
1 parent 6abb3cf commit 697a6d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/media/platform/sh_veu.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,11 +905,11 @@ static int sh_veu_queue_setup(struct vb2_queue *vq,
if (ftmp.fmt.pix.width != pix->width ||
ftmp.fmt.pix.height != pix->height)
return -EINVAL;
size = pix->bytesperline ? pix->bytesperline * pix->height :
pix->width * pix->height * fmt->depth >> 3;
size = pix->bytesperline ? pix->bytesperline * pix->height * fmt->depth / fmt->ydepth :
pix->width * pix->height * fmt->depth / fmt->ydepth;
} else {
vfmt = sh_veu_get_vfmt(veu, vq->type);
size = vfmt->bytesperline * vfmt->frame.height;
size = vfmt->bytesperline * vfmt->frame.height * vfmt->fmt->depth / vfmt->fmt->ydepth;
}

if (count < 2)
Expand Down

0 comments on commit 697a6d2

Please sign in to comment.