Abend
Ich habe DE1-SoC board und Sony XC-E150CE CCD Kamera.
Zur zeit funktioniert alles recht gut. Das einzige Problem sind zwei
schwarze Balken am Rand das Bildes. (s. Bild)
Ein doppeltes Rand links, und ein schmales rechts.
Ich weiß nicht wo diese herkommen, denn ich nehme nur "active video"
auf.
Hier kurz wie es bei mir funktioniert.
Auf DE1-SoC sitzt ein ADV7180 und liefert die Daten an FPGA im 8-bit
ITU-R BT.656 YCrCb 4:2:2 Format.
Nun hat FPGA ein kleines Modul, der folgendes macht.
1. Warte auf Vsync von Frame 1
2. Warte auf StartActiveVideo (SAV)
3. Setze VideoEnabel=1 (Daten werden in SDRAM gespeichert) und warte auf
EndActiveVideo (EAV) oder Vsync (ende von Frame 1)
4. Nach EAV setze VideoEnable=0 warte auf SAV (nächste Zeile)
usw
D.h. Ich soll nur das tatsächliche Bild abspeichern. Doch ich sehe diese
Balken, als ob diese von "blanking" kommen. Ich habe versucht einiges in
meinem Design zu ändern, doch die Balken sind immer da, unverändert.
Anbei mein Code für das Oben genanntes Modul:
1 | library ieee;
|
2 |
|
3 | use ieee.std_logic_1164.all;
|
4 | use ieee.numeric_std.all;
|
5 |
|
6 | entity BT656 is
|
7 | port(
|
8 | clk: in std_logic;
|
9 | datain: in std_logic_vector(7 downto 0);
|
10 | dataout: out std_logic_vector(7 downto 0);
|
11 | done: buffer std_logic;
|
12 | capen: in std_logic;
|
13 | venable: buffer std_logic
|
14 | );
|
15 | end BT656;
|
16 |
|
17 | architecture main of BT656 is
|
18 | type fifo is array(3 downto 0) of std_logic_vector(7 downto 0);
|
19 | signal waitvs: std_logic:='1';
|
20 | signal waitav: std_logic:='0';
|
21 | signal field: std_logic:='0';
|
22 | signal flag: std_logic:='0';
|
23 | signal tv_buff:fifo;
|
24 | begin
|
25 |
|
26 | process(clk)
|
27 | begin
|
28 | if rising_edge(clk) then
|
29 | dataout<=datain;
|
30 |
|
31 | if(capen='1')then
|
32 |
|
33 | for i in 0 to 2 loop
|
34 | tv_buff(i+1)<=tv_buff(i);
|
35 | end loop;
|
36 | tv_buff(0)<=datain;
|
37 | if(waitvs='1')then---------waiting for vert sync blanking of the field 0
|
38 | if(field='0')then
|
39 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="10101011")then----vertical sync of field1
|
40 | waitvs<='0';
|
41 | waitav<='1';-----wait for active video signal
|
42 | end if;
|
43 | else
|
44 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="11101100")then----vertical sync of field2
|
45 | waitvs<='0';
|
46 | waitav<='1';-----wait for active video signal
|
47 | end if;
|
48 | end if;
|
49 | end if;
|
50 |
|
51 | if(waitav='1')then
|
52 | if(field='0')then
|
53 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="10000000")then--------field 1 active video signal
|
54 | venable<='1';
|
55 | waitav<='0';
|
56 | end if;
|
57 | else
|
58 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="11000111")then-------- field 2 active video signal
|
59 | venable<='1';
|
60 | waitav<='0';
|
61 | end if;
|
62 | end if;
|
63 | end if;
|
64 | if(venable='1')then
|
65 | if(field='0')then
|
66 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="10011101")then--------end active video, wait next line
|
67 | venable<='0';
|
68 | waitav<='1';
|
69 | end if;
|
70 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="10110110")then--------end field 1, next field2
|
71 | venable<='0';
|
72 | waitvs<='1';
|
73 | field<='1';
|
74 | end if;
|
75 | else
|
76 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="11011010")then--------end active video, wait next line
|
77 | venable<='0';
|
78 | waitav<='1';
|
79 | end if;
|
80 | if(tv_buff(3)="11111111" and tv_buff(2)="00000000" and tv_buff(1)="00000000" and tv_buff(0)="11110001")then--------end field 2, capture done
|
81 | venable<='0';
|
82 | waitvs<='1';
|
83 | field<='0';
|
84 | done<='1';
|
85 | end if;
|
86 | end if;
|
87 | end if;
|
88 | else
|
89 | tv_buff(0)<=(others=>'0');
|
90 | tv_buff(1)<=(others=>'0');
|
91 | tv_buff(2)<=(others=>'0');
|
92 | tv_buff(3)<=(others=>'0');
|
93 |
|
94 | waitav<='0';
|
95 | if (done='1')then
|
96 | done<='0';
|
97 | end if;
|
98 | end if;
|
99 | end if;
|
100 | end process;
|
101 | end main;
|
PS
Komische streifen unter dem Bild sind erst unwichtig.