<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href='http://gres.uninova.pt/iopt-flow/show-pf.xsl' type='text/xsl' ?>
<net name="VideoScan" type="iopt-flow">
  <event id="Reset" x="65" y="58" mode="input"/>
  <operation id="o2" x="130" y="110" rot="0" shape="arrow" size="24">
    <name off_x="-10" off_y="5" text="CntX"/>
    <input off_x="-24" off_y="-8" name="Reset" id="o2.Reset" type="event"/>
    <input off_x="-24" off_y="8" name="X" id="o2.X" type="boolean" min="0" max="1"/>
    <output off_x="24" off_y="0" name="out" id="o2.out">
      <expression>
        <operand type="literal" value="0"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="Reset"/>
        </operand>
        <text>0 WHEN (Reset)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="X" delay="1"/>
        <operator type="add"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="X" delay="1"/>
        <operator type="less"/>
        <operand type="literal" value="1200"/>
        <text>X[-1] + 1 WHEN (X[-1] &lt; 1200)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="X" x="223" y="111" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a4" type="read" source="Reset" target="o2.Reset"/>
  <arc id="a5" type="read" source="X" target="o2.X" view="symbolic"/>
  <arc id="a6" type="read" source="o2.out" target="X"/>
  <operation id="o7" x="327" y="112" rot="0" shape="arrow" size="32">
    <name off_x="-10" off_y="5" text="CntY"/>
    <input off_x="-32" off_y="-16" name="Reset" id="o7.Reset" type="event"/>
    <input off_x="-32" off_y="0" name="X" id="o7.X" type="boolean" min="0" max="1"/>
    <input off_x="-32" off_y="16" name="Y" id="o7.Y" type="boolean" min="0" max="1"/>
    <output off_x="32" off_y="0" name="out" id="o7.out">
      <expression>
        <operand type="literal" value="0"/>
        <operator type="when"/>
        <operand type="signal" idRef="Reset"/>
        <text>0 WHEN (Reset)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Y" delay="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="X"/>
        <operator type="diff"/>
        <operand type="literal" value="0"/>
        <text>Y[-1] WHEN (X &lt;&gt; 0)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Y" delay="1"/>
        <operator type="add"/>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="Y" delay="1"/>
        <operator type="less"/>
        <operand type="literal" value="900"/>
        <text>Y[-1] + 1 WHEN (Y[-1] &lt; 900)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="Y" x="422" y="112" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a9" type="read" source="o7.out" target="Y"/>
  <arc id="a10" type="read" source="Reset" target="o7.Reset"/>
  <arc id="a11" type="read" source="Y" target="o7.Y" view="symbolic"/>
  <arc id="a12" type="read" source="X" target="o7.X"/>
  <operation id="o13" x="236" y="202" rot="0" shape="arrow" size="16">
    <name off_x="-10" off_y="5" text="sX"/>
    <input off_x="-16" off_y="0" name="X" id="o13.X" type="boolean" min="0" max="1"/>
    <output off_x="16" off_y="0" name="out" id="o13.out">
      <expression>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="X"/>
        <operator type="more"/>
        <operand type="literal" value="1080"/>
        <operator type="and"/>
        <operand type="signal" idRef="X"/>
        <operator type="less"/>
        <operand type="literal" value="1160"/>
        <text>1 WHEN (X &gt; 1080 AND X &lt; 1160)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="XSync" x="302" y="202" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a15" type="read" source="o13.out" target="XSync"/>
  <arc id="a16" type="read" source="X" target="o13.X"/>
  <operation id="o17" x="236" y="326" rot="0" shape="arrow" size="16">
    <name off_x="-10" off_y="5" text="sY"/>
    <input off_x="-16" off_y="0" name="Y" id="o17.Y" type="boolean" min="0" max="1"/>
    <output off_x="16" off_y="0" name="out" id="o17.out">
      <expression>
        <operand type="literal" value="1"/>
        <operator type="when"/>
        <operand type="signal" idRef="Y"/>
        <operator type="more"/>
        <operand type="literal" value="800"/>
        <operator type="and"/>
        <operand type="signal" idRef="Y"/>
        <operator type="less"/>
        <operand type="literal" value="820"/>
        <text>1 WHEN (Y &gt; 800 AND Y &lt; 820)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="YSync" x="306" y="325" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a19" type="read" source="Y" target="o17.Y"/>
  <arc id="a20" type="read" source="o17.out" target="YSync"/>
  <operation id="o21" x="681" y="132" rot="0" shape="arrow" size="56">
    <name off_x="-10" off_y="5" text="window1"/>
    <input off_x="-56" off_y="-40" name="X" id="o21.X" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="-24" name="Y" id="o21.Y" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="-8" name="Input1" id="o21.Input1" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="8" name="Input2" id="o21.Input2" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="24" name="Input3" id="o21.Input3" type="boolean" min="0" max="1"/>
    <input off_x="-56" off_y="40" name="Input4" id="o21.Input4" type="boolean" min="0" max="1"/>
    <output off_x="56" off_y="0" name="out" id="o21.out">
      <expression>
        <operand type="signal" idRef="Input1"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="80"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="120"/>
        </operand>
        <text>Input1 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 80 AND Y &lt; 120)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Input2"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="160"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="200"/>
        </operand>
        <text>Input2 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 160 AND Y &lt; 200)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Input3"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="240"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="280"/>
        </operand>
        <text>Input3 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 240 AND Y &lt; 280)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="Input4"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="300"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="320"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="360"/>
        </operand>
        <text>Input4 WHEN (X &gt; 100 AND X &lt; 300 AND Y &gt; 320 AND Y &lt; 360)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <signal id="Input1" x="561" y="124" mode="input" type="boolean" min="0" max="1"/>
  <signal id="Input2" x="532" y="140" mode="input" type="boolean" min="0" max="1"/>
  <signal id="Input3" x="504" y="158" mode="input" type="boolean" min="0" max="1"/>
  <signal id="Input4" x="477" y="177" mode="input" type="boolean" min="0" max="1"/>
  <arc id="a26" type="read" source="Input4" target="o21.Input4"/>
  <arc id="a27" type="read" source="Input3" target="o21.Input3"/>
  <arc id="a28" type="read" source="Input2" target="o21.Input2"/>
  <arc id="a29" type="read" source="Input1" target="o21.Input1"/>
  <arc id="a30" type="read" source="X" target="o21.X" view="symbolic"/>
  <arc id="a31" type="read" source="Y" target="o21.Y" view="symbolic"/>
  <operation id="o32" x="665" y="305" rot="0" shape="arrow" size="48">
    <name off_x="-10" off_y="5" text="window2"/>
    <input off_x="-48" off_y="-32" name="X" id="o32.X" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="-16" name="Y" id="o32.Y" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="0" name="InA" id="o32.InA" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="16" name="InB" id="o32.InB" type="boolean" min="0" max="1"/>
    <input off_x="-48" off_y="32" name="InC" id="o32.InC" type="boolean" min="0" max="1"/>
    <output off_x="48" off_y="0" name="out" id="o32.out">
      <expression>
        <operand type="signal" idRef="InA"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="600"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="100"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="200"/>
        </operand>
        <text>InA WHEN (X &gt; 400 AND X &lt; 600 AND Y &gt; 100 AND Y &lt; 200)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="InB"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="600"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="250"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="350"/>
        </operand>
        <text>InB WHEN (X &gt; 400 AND X &lt; 600 AND Y &gt; 250 AND Y &lt; 350)</text>
      </expression>
      <expression>
        <operand type="signal" idRef="InC"/>
        <operator type="when"/>
        <operand type="sub-expression">
          <operand type="signal" idRef="X"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="X"/>
          <operator type="less"/>
          <operand type="literal" value="600"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="more"/>
          <operand type="literal" value="400"/>
          <operator type="and"/>
          <operand type="signal" idRef="Y"/>
          <operator type="less"/>
          <operand type="literal" value="500"/>
        </operand>
        <text>InC WHEN (X &gt; 400 AND X &lt; 600 AND Y &gt; 400 AND Y &lt; 500)</text>
      </expression>
      <expression>
        <operand type="literal" value="0"/>
        <text>0 OTHERWISE</text>
      </expression>
    </output>
  </operation>
  <arc id="a33" type="read" source="Y" target="o32.Y" view="symbolic"/>
  <arc id="a34" type="read" source="X" target="o32.X" view="symbolic"/>
  <signal id="InA" x="564" y="303" mode="input" type="boolean" min="0" max="1"/>
  <signal id="InB" x="532" y="321" mode="input" type="boolean" min="0" max="1"/>
  <signal id="InC" x="560" y="335" mode="input" type="boolean" min="0" max="1"/>
  <arc id="a38" type="read" source="InC" target="o32.InC"/>
  <arc id="a39" type="read" source="InB" target="o32.InB"/>
  <arc id="a40" type="read" source="InA" target="o32.InA"/>
  <operation id="o41" x="872" y="221" rot="0" shape="arrow" size="25" locked="true">
    <name text="OR" off_x="-12" off_y="-5"/>
    <input id="o41.window1" name="window1" type="boolean" off_x="-25" off_y="-10"/>
    <input id="o41.window2" name="window2" type="boolean" off_x="-25" off_y="10"/>
    <output id="o41.out" name="out" type="boolean" off_x="25" off_y="0">
      <expression>
        <text>window1 OR window2</text>
        <operand type="signal" idRef="window1"/>
        <operator type="or"/>
        <operand type="signal" idRef="window2"/>
      </expression>
    </output>
  </operation>
  <arc id="a42" type="read" source="o32.out" target="o41.window2"/>
  <arc id="a43" type="read" source="o21.out" target="o41.window1"/>
  <signal id="RGB" x="945" y="220" mode="output" type="boolean" min="0" max="1"/>
  <arc id="a45" type="read" source="o41.out" target="RGB"/>
</net>
