V4L/DVB (11911): cx231xx: Use v4l bounding/alignment function
The v4l function has a better algorithm for aligning image size. Cc: Srinivasa Deevi <srinivasa.deevi@conexant.com> Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
653dc59b64
commit
9bd0e8d7d1
@@ -955,8 +955,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
|
|||||||
{
|
{
|
||||||
struct cx231xx_fh *fh = priv;
|
struct cx231xx_fh *fh = priv;
|
||||||
struct cx231xx *dev = fh->dev;
|
struct cx231xx *dev = fh->dev;
|
||||||
int width = f->fmt.pix.width;
|
unsigned int width = f->fmt.pix.width;
|
||||||
int height = f->fmt.pix.height;
|
unsigned int height = f->fmt.pix.height;
|
||||||
unsigned int maxw = norm_maxw(dev);
|
unsigned int maxw = norm_maxw(dev);
|
||||||
unsigned int maxh = norm_maxh(dev);
|
unsigned int maxh = norm_maxh(dev);
|
||||||
unsigned int hscale, vscale;
|
unsigned int hscale, vscale;
|
||||||
@@ -971,17 +971,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
|
|||||||
|
|
||||||
/* width must even because of the YUYV format
|
/* width must even because of the YUYV format
|
||||||
height must be even because of interlacing */
|
height must be even because of interlacing */
|
||||||
height &= 0xfffe;
|
v4l_bound_align_image(&width, 48, maxw, 1, &height, 32, maxh, 1, 0);
|
||||||
width &= 0xfffe;
|
|
||||||
|
|
||||||
if (unlikely(height < 32))
|
|
||||||
height = 32;
|
|
||||||
if (unlikely(height > maxh))
|
|
||||||
height = maxh;
|
|
||||||
if (unlikely(width < 48))
|
|
||||||
width = 48;
|
|
||||||
if (unlikely(width > maxw))
|
|
||||||
width = maxw;
|
|
||||||
|
|
||||||
get_scale(dev, width, height, &hscale, &vscale);
|
get_scale(dev, width, height, &hscale, &vscale);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user