1 /******************************************************************************
5 ******************************************************************************/
8 * Copyright (C) 2010 R.M. Thomas <rmthomas@sciolus.org>
11 * This is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * The software is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this software; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 /*****************************************************************************/
30 /*****************************************************************************/
31 #define TESTCARD_BYTESPERLINE (2 * 720)
33 easycap_testcard(struct easycap
*peasycap
, int field
)
37 unsigned char uyvy
[4];
38 int i1
, line
, k
, m
, n
, more
, much
, barwidth
, barheight
;
39 unsigned char bfbar
[TESTCARD_BYTESPERLINE
/ 8], *p1
, *p2
;
40 struct data_buffer
*pfield_buffer
;
43 SAY("ERROR: peasycap is NULL\n");
46 JOM(8, "%i=field\n", field
);
47 switch (peasycap
->width
) {
50 barwidth
= (2 * 720) / 8;
55 barwidth
= (2 * 704) / 8;
60 barwidth
= (2 * 640) / 8;
64 SAM("ERROR: cannot set barwidth\n");
68 if (TESTCARD_BYTESPERLINE
< barwidth
) {
69 SAM("ERROR: barwidth is too large\n");
72 switch (peasycap
->height
) {
84 SAM("ERROR: cannot set barheight\n");
93 for (line
= 0; line
< (barheight
/ 2); line
++) {
94 for (i1
= 0; i1
< 8; i1
++) {
99 y
= 299*r
/1000 + 587*g
/1000 + 114*b
/1000 ;
100 u
= -147*r
/1000 - 289*g
/1000 + 436*b
/1000 ;
102 v
= 615*r
/1000 - 515*g
/1000 - 100*b
/1000 ;
111 while (p1
< &bfbar
[barwidth
]) {
123 if ((FIELD_BUFFER_SIZE
/PAGE_SIZE
) <= m
) {
124 SAM("ERROR: bad m reached\n");
128 SAM("ERROR: bad n reached\n");
133 SAM("ERROR: internal fault\n");
137 much
= PAGE_SIZE
- n
;
140 pfield_buffer
= &peasycap
->field_buffer
[k
][m
];
141 p2
= pfield_buffer
->pgo
+ n
;
142 memcpy(p2
, p1
, much
);
147 if (PAGE_SIZE
== n
) {