Commit b8374138 authored by Frank Schaefer's avatar Frank Schaefer Committed by Mauro Carvalho Chehab

[media] em28xx: add function scale_to_size()

Signed-off-by: default avatarFrank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6b09a21c
...@@ -815,6 +815,17 @@ static void size_to_scale(struct em28xx *dev, ...@@ -815,6 +815,17 @@ static void size_to_scale(struct em28xx *dev,
*vscale = EM28XX_HVSCALE_MAX; *vscale = EM28XX_HVSCALE_MAX;
} }
static void scale_to_size(struct em28xx *dev,
unsigned int hscale, unsigned int vscale,
unsigned int *width, unsigned int *height)
{
unsigned int maxw = norm_maxw(dev);
unsigned int maxh = norm_maxh(dev);
*width = (((unsigned long)maxw) << 12) / (hscale + 4096L);
*height = (((unsigned long)maxh) << 12) / (vscale + 4096L);
}
/* ------------------------------------------------------------------ /* ------------------------------------------------------------------
IOCTL vidioc handling IOCTL vidioc handling
------------------------------------------------------------------*/ ------------------------------------------------------------------*/
...@@ -890,9 +901,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, ...@@ -890,9 +901,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
} }
size_to_scale(dev, width, height, &hscale, &vscale); size_to_scale(dev, width, height, &hscale, &vscale);
scale_to_size(dev, hscale, hscale, &width, &height);
width = (((unsigned long)maxw) << 12) / (hscale + 4096L);
height = (((unsigned long)maxh) << 12) / (vscale + 4096L);
f->fmt.pix.width = width; f->fmt.pix.width = width;
f->fmt.pix.height = height; f->fmt.pix.height = height;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment