]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
V4L/DVB (11864): cx18: Complete support for Sliced and Raw VBI for 625 line systems
authorAndy Walls <awalls@radix.net>
Sun, 17 May 2009 00:06:57 +0000 (21:06 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Jun 2009 21:21:14 +0000 (18:21 -0300)
Finish changes for sliced and raw VBI for 625 line systems.  Tested with VPS
and WSS being emitted by a PVR-350 in field 1 lines 16 and 23.

Signed-off-by: Andy Walls <awalls@radix.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/cx18/cx18-av-core.c
drivers/media/video/cx18/cx18-av-vbi.c
drivers/media/video/cx18/cx18-streams.c

index d98010e0da9c91bf412d8b56c12916e82d5f8e20..33ec269a0f5e628372159b238ec3c88f3f5831a5 100644 (file)
@@ -299,13 +299,13 @@ void cx18_av_std_setup(struct cx18 *cx)
        if (std & V4L2_STD_625_50) {
                /*
                 * The following relationships of half line counts should hold:
-                * 625 = vblank656 + vactive + postvactive
+                * 625 = vblank656 + vactive
                 * 10 = vblank656 - vblank = vsync pulses + equalization pulses
                 *
                 * vblank656: half lines after line 625/mid-313 of blanked video
                 * vblank:    half lines, after line 5/317, of blanked video
-                * vactive:   half lines of active video
-                * postvactive: 5 half lines after the end of active video
+                * vactive:   half lines of active video +
+                *              5 half lines after the end of active video
                 *
                 * As far as I can tell:
                 * vblank656 starts counting from the falling edge of the first
@@ -316,10 +316,21 @@ void cx18_av_std_setup(struct cx18 *cx)
                 * For 625 line systems the driver will extract VBI information
                 * from lines 6-23 and lines 318-335 (but the slicer can only
                 * handle 17 lines, not the 18 in the vblank region).
+                * In addition, we need vblank656 and vblank to be one whole
+                * line longer, to cover line 24 and 336, so the SAV/EAV RP
+                * codes get generated such that the encoder can actually
+                * extract line 23 & 335 (WSS).  We'll lose 1 line in each field
+                * at the top of the screen.
+                *
+                * It appears the 5 half lines that happen after active
+                * video must be included in vactive (579 instead of 574),
+                * otherwise the colors get badly displayed in various regions
+                * of the screen.  I guess the chroma comb filter gets confused
+                * without them (at least when a PVR-350 is the PAL source).
                 */
-               vblank656 = 46; /* lines  1 -  23  &  313 - 335 */
-               vblank = 36;    /* lines  6 -  23  &  318 - 335 */
-               vactive = 574;  /* lines 24 - 310  &  336 - 622 */
+               vblank656 = 48; /* lines  1 -  24  &  313 - 336 */
+               vblank = 38;    /* lines  6 -  24  &  318 - 336 */
+               vactive = 579;  /* lines 24 - 313  &  337 - 626 */
 
                /*
                 * For a 13.5 Mpps clock and 15,625 Hz line rate, a line is
@@ -989,9 +1000,9 @@ static int cx18_av_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt)
                 * cx18_av_std_setup(), above standard values:
                 *
                 * 480 + 1 for 60 Hz systems
-                * 576 - 2 for 50 Hz systems
+                * 576 + 3 for 50 Hz systems
                 */
-               Vlines = pix->height + (is_50Hz ? -2 : 1);
+               Vlines = pix->height + (is_50Hz ? 3 : 1);
 
                /*
                 * Invalid height and width scaling requests are:
index 640121448eb92262e93bb09cb6eeb097660bc1e2..a51732bcca4b61343c09f4397c17f75f64243c97 100644 (file)
@@ -256,7 +256,7 @@ int cx18_av_vbi_s_fmt(struct cx18 *cx, struct v4l2_format *fmt)
 
        cx18_av_write(cx, 0x43c, 0x16);
        /* Should match vblank set in cx18_av_std_setup() */
-       cx18_av_write(cx, 0x474, is_pal ? 36 : 26);
+       cx18_av_write(cx, 0x474, is_pal ? 38 : 26);
        return 0;
 }
 
index a0800393316e419660b79139e4f8c0d937b9048a..54d248e16d85e882d0f1d757c8111389df10b73d 100644 (file)
@@ -374,12 +374,11 @@ static void cx18_vbi_setup(struct cx18_stream *s)
                 * For 625/50 systems, according to the VIP 2 & BT.656 std:
                 * The EAV RP code's Field bit toggles on line 1, a few lines
                 * after the Vertcal Blank bit has already toggled.
-                * Tell the encoder to capture 23-1+1=23 lines per field,
-                * since we want lines 6 through 23.
-                *
-                * FIXME - revisit for 625/50 systems
+                * (We've actually set the digitizer so that the Field bit
+                * toggles on line 2.) Tell the encoder to capture 23-2+1=22
+                * lines per field, since we want lines 6 through 23.
                 */
-               lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 1 + 1) * 2;
+               lines = cx->is_60hz ? (21 - 4 + 1) * 2 : (23 - 2 + 1) * 2;
        }
 
        data[0] = s->handle;