Perhaps some have noticed that capturing 625/50/i with encoder 
firmware 2.06.039 or later shifts the capture window down by 2 lines.  

Here below is a quick kernel patch which works for the setup: 
Linux 2.6.29.6, 24xxx device, cx25840 decoder, cx23416 encoder.

This patch indeed changes the defaults.  This might be justifiable 
since, for vblank, 
1. the stream then follows itu-r bt.656 timing,
2. the firmware 2.06.039 expects this,
3. it is the decoder default for 625 line systems.

Additionally vblank656=vblank+4 holds for NTSC-M and PAL-60 so I 
moved this setting out of the if-then-else standard selection.  

The proposed hblank is the only value that always captures the whole 
frame.  It seems that the hsync detection is early.  The set color 
burst delay of 93 instead of the itu-r bt.470 delay of 91 hints to 
the same observation.

Some example captures with these defaults:
http://picaros.org/xorg/bbc.png         ri=15/11
http://picaros.org/xorg/cn.png
http://picaros.org/xorg/dvd.png
http://picaros.org/xorg/ned1.png
http://picaros.org/xorg/tmfc.png        ri=4/3

Test results:
http://picaros.org/xorg/v36-40.png        vblank=36
http://picaros.org/xorg/v34-38.png        vblank=34
http://picaros.org/xorg/ntsc26.png        vblank=26
http://picaros.org/xorg/ntsc656-26.png    vblank656=26

Synchronization details:
http://picaros.org/ftp/key/tvsync.html

Wed Jul 29 12:42:32 CEST 2009
--- linux-2.6.29.6/drivers/media/video/cx25840/cx25840-core-d.c 2009-07-03 
01:41:20.000000000 +0200
+++ linux-2.6.29.6/drivers/media/video/cx25840/cx25840-core.c   2009-07-28 
03:10:36.000000000 +0200
@@ -363,14 +363,13 @@ void cx25840_std_setup(struct i2c_client
        else
                cx25840_write(client, 0x49f, 0x14);
 
+       src_decimation = 543;
        if (std & V4L2_STD_625_50) {
-               hblank = 132;
+               hblank = 136; /* 132 */
                hactive = 720;
                burst = 93;
-               vblank = 36;
+               vblank = 34;
                vactive = 580;
-               vblank656 = 40;
-               src_decimation = 0x21f;
                luma_lpf = 2;
 
                if (std & V4L2_STD_SECAM) {
@@ -393,28 +392,25 @@ void cx25840_std_setup(struct i2c_client
                luma_lpf = 1;
                uv_lpf = 1;
 
-               src_decimation = 0x21f;
                if (std == V4L2_STD_PAL_60) {
                        vblank = 26;
-                       vblank656 = 26;
                        burst = 0x5b;
                        luma_lpf = 2;
                        comb = 0x20;
                        sc = 688739;
                } else if (std == V4L2_STD_PAL_M) {
                        vblank = 20;
-                       vblank656 = 24;
                        burst = 0x61;
                        comb = 0x20;
                        sc = 555452;
                } else {
                        vblank = 26;
-                       vblank656 = 26;
                        burst = 0x5b;
                        comb = 0x66;
                        sc = 556063;
                }
        }
+       vblank656 = vblank+4;
 
        /* DEBUG: Displays configured PLL frequency */
        pll_int = cx25840_read(client, 0x108);
@@ -446,8 +442,8 @@ void cx25840_std_setup(struct i2c_client
 
                v4l_dbg(1, cx25840_debug, client, "hblank %i, hactive %i, "
                        "vblank %i, vactive %i, vblank656 %i, src_dec %i, "
-                       "burst 0x%02x, luma_lpf %i, uv_lpf %i, comb 0x%02x, "
-                       "sc 0x%06x\n",
+                       "burst %i, luma_lpf %i, uv_lpf %i, comb 0x%02x, "
+                       "sc %i\n",
                        hblank, hactive, vblank, vactive, vblank656,
                        src_decimation, burst, luma_lpf, uv_lpf, comb, sc);
        }
@@ -491,6 +487,8 @@ void cx25840_std_setup(struct i2c_client
                cx25840_write(client, 0x47f, 0x00);
                state->vbi_line_offset = 8;
        }
+       /* Alignment test: force the use of vblank656 VIP_OPT_AL */
+       /* cx25840_write(client, 0x406, 0x17); */
 }
 
 /* ----------------------------------------------------------------------- */
_______________________________________________
pvrusb2 mailing list
[email protected]
http://www.isely.net/cgi-bin/mailman/listinfo/pvrusb2

Reply via email to