add looprefine and loop estimation