Thanks Marqs! I have tested the latest changes and I have some issues. Sampling phase works great.
-With horizontal scale for 256×240 smaller than 4 I get a doubled image to the right.
-256×240 and 320×240 optimized randomly show a light or striped vertical bar at the right side of the screen. It happens frequently with 320×240 optimized with settings for N64: H.samplerate 1546, H.synclen 22, H.backporch 36. sampling phase 0. Sometimes you have to turn the console on and off a few times to make it appear.
Btw, I found a typo in scanconverter.v with double G_pp1 and G_out at https://github.com/marqs85/ossc/blob/release/rtl/scanconverter.v#L342