OSDN Git Service

[media] cx23885: fix size helper functions
authorHans Verkuil <hans.verkuil@cisco.com>
Sat, 20 Sep 2014 13:19:33 +0000 (10:19 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Sun, 21 Sep 2014 23:42:29 +0000 (20:42 -0300)
The norm_swidth function was unused and is dropped. It's not clear
what the purpose of that function was.

The norm_maxh function was changed so it tests for 60 Hz standards
rather than for 50 Hz standards. The is the preferred order.

The norm_maxw function was poorly written and used: it gives the maximum
allowed line width for the given standard. For 60 Hz that's 720, but
for 50 Hz that's 768 which allows for 768x576 which gives you square
pixels. For 60 Hz formats it is 640x480 that gives square pixels, so
there is no need to go beyond 720.

The initial width was set using norm_maxh(), which was wrong. Just set
to 720, that's what you normally use. Since the initial standard was
NTSC anyway the initial width was always 720 anyway.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/cx23885/cx23885-video.c
drivers/media/pci/cx23885/cx23885.h

index f0ea904..682a4f9 100644 (file)
@@ -1154,7 +1154,7 @@ int cx23885_video_register(struct cx23885_dev *dev)
        dev->tvnorm = V4L2_STD_NTSC_M;
        dev->fmt = format_by_fourcc(V4L2_PIX_FMT_YUYV);
        dev->field = V4L2_FIELD_INTERLACED;
-       dev->width = norm_maxw(dev->tvnorm);
+       dev->width = 720;
        dev->height = norm_maxh(dev->tvnorm);
 
        /* init video dma queues */
index 0e4f406..39a8985 100644 (file)
@@ -612,15 +612,10 @@ extern int cx23885_risc_databuffer(struct pci_dev *pci,
 
 static inline unsigned int norm_maxw(v4l2_std_id norm)
 {
-       return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 720 : 768;
+       return (norm & V4L2_STD_525_60) ? 720 : 768;
 }
 
 static inline unsigned int norm_maxh(v4l2_std_id norm)
 {
-       return (norm & V4L2_STD_625_50) ? 576 : 480;
-}
-
-static inline unsigned int norm_swidth(v4l2_std_id norm)
-{
-       return (norm & (V4L2_STD_MN & ~V4L2_STD_PAL_Nc)) ? 754 : 922;
+       return (norm & V4L2_STD_525_60) ? 480 : 576;
 }