How i convert to Arduino Mega?
Yes, you will have to change the code to match the Mega pinout.

Because the program need to run quite fast, and the Arduino functions
digitalRead() and digitalWrite() are dead slow, the author of the
program used direct port access for performing the raw IO.
For example:

    //Wait for vsync it is on pin 3 (counting from 0) portD
    while(!(PIND&amp;8));//wait for high
    while((PIND&amp;8));//wait for low


This is testing pin PD3 (8 is 23), which on the Uno is
digital&nbsp;3, but on the Mega is digital&nbsp;18. The same code could
be written in a portable fashion:

    //Wait for vsync it is on pin 3 (counting from 0) portD
    while (digitalRead(3) == LOW);   //wait for high
    while (digitalRead(3) == HIGH);  //wait for low


but it would probably be too slow.

Note also that here:

    UDR0=(PINC&amp;15)|(PIND&amp;240);


the program takes advantage of the particular pin mapping of the Uno in
order to read 8&nbsp;inputs with only two port reads (4&nbsp;bits on
port C and 4&nbsp;bits on port D). You could do even better on the Mega
if you use pins A8 through A15 for the data bus, and then read the whole
8-bit word as PINK.

There may be some other differences between the Uno and the Mega that
need to be taken into account, but the pin mapping is the only one that
is obvious to me just by quickly going through the code.