How to encode a frame twice without change reference frame?

I want to encode a frame with different QPs to observe how different QPs influent the output size. But after encoding once, the reference frame changed automatic. Is there a method to control reference frame unchanged? Thank you!