Attached is a small program that computes all the possible ITU-R BT.656
and VESA VIP 2 SAV/EAV Raster reference/Protection (RP) codes and dumps
out a reference table.

And just to comment on the comment in ivtv-streams.c:

"Other code pairs that I found are: 0x250E6249/0x13545454 and 
0x25256262/0x38137F54.
 However, I have no idea what these values are for."

The first code set looks like attempts to pick off very specific VBI
lines at the end of the VBI:

0x25 [active raw VBI video in last line of vblank of the odd field         ] 
0x13
0x0E [active raw "VBI" video when in last vert active line in the odd field] 
0x54 (nonsense)
0x62 [active raw VBI video in last line of vblank of the even field        ] 
0x54
0x49 [active raw "VBI" video when in vert active line in the even field    ] 
0x54 (maybe OK)


The second code set actually makes much more sense:

0x25 [active raw VBI video in vblank of the odd field              ] 0x38
0x25 [active raw VBI video in last line of vblank of the odd field ] 0x13
0x62 [active raw VBI video in vblank of the even field             ] 0x7f
0x62 [active raw VBI video in last line of vblank of the even field] 0x54

For the CX25840 digitizer it may be better to use the codes
0x20206060/0x30107050 for raw VBI than the ones in use now.  Of course
I've wondered when the T bit would toggle since it has to toggle in the
EAV RP before the active video display which should also be the last
line of VBI.  In that case, maybe 0x20206060/0x309070A0 would be the
right codes.

-Andy
/*
 *  Program to compute and output a table of "Start Active Video" (SAV) and
 *  "End Active Video" (EAV) Raster/Protection (RP) code bytes.
 *
 *  References:
 *  ITU-R BT.656
 *  VESA VIP 2
 *
 *  Copyright (C) 2008 Andy Walls <[EMAIL PROTECTED]>
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
#include <stdio.h>

/* Raster position reference bits: only H is allowed to change in SAV RP */
#define T_MASK 0x80 /* Task: data for buffer 0/1 (VIP2); Raw VBI (0) (VIP1.1)*/
#define F_MASK 0x40 /* Field */
#define V_MASK 0x20 /* Vertical blanking */
#define H_MASK 0x10 /* Horizontal blanking */

#define T_SHIFT 7
#define F_SHIFT 6
#define V_SHIFT 5
#define H_SHIFT 4

#define R_MASK 0xf0 /* Raster position reference bits */
#define P_MASK 0x0f /* Protection bits.  Hamming (8,4)? */

#define R_SHIFT 4
#define P_SHIFT 0

int main(int argc, char *argv[])
{
	int r, p, rp;
	int t_, f, v, h;

	for(r = 0; r < 0x100; r += 0x20) {
		t_ = ((r & T_MASK) ^ T_MASK) >> T_SHIFT;
		f = (r & F_MASK) >> F_SHIFT;
		v = (r & V_MASK) >> V_SHIFT;
		h = (r & H_MASK) >> H_SHIFT;

		p = (t_^v^h) << 3;
		p |= (t_^f^h) << 2; 
		p |= (t_^f^v) << 1; 
		p |= (f^v^h); 

		rp = r | p;
		printf("RX: 0x%02x  RP: 0x%02x %s %s %s %s\n",
			r, rp, 
			t_ ? "    "           : "Task",
			f  ? "Field"          : "     ",
			v  ? "VertBlank"      : "         ",
			h  ? "HorizBlank EAV" : "           SAV");

		/* N.B. This mucks with the loop control variable */
		if (r == 0xe0)
			r = -0x10;
	}
	return 0;
}
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel

Reply via email to