Well, reading encoders with the parallel port is always going to be just a little bit sketchy. But it looks like your resolution is enough lower than your stepgen resolution that it should not be too much of a problem.
The order and location of how functions are added to the threads is important. It would be highly advisable to put all of your loadrt and addf lines of hal code in one place, at the beginning of your 1st hal file.
(not that this is necessarily causing your problem here.)
Other things to look at are electrical noise issues, causing lost or false steps in your encoder signals. Single ended TTL signals can be very susceptible to noise, especially if there are grounding or shielding issues.
Use hal scope to look at the A and B signals from the encoder. Do they look like they might have a noise issue? Does it look like there may be missed steps in the encoder signal? How about missed steps by the step motor?