For calculating compression ratio you should know the swept volume and clearance volume of the engine cylinder. Then you can use the relation, r= 1+(Vs/Vc). Where, r- compression ratio, Vs- Swept Volume and Vc- Clearance Volume.
Well Compression ratio is the basic engine specification , it is generally given by the ratio of maximum cylinder volume(Vc +Vs= total volume ) to minimum cylinder volume(Vc)
Vc= clearance volume and Vs= swept volume (pi/4 d2)*L where where d is cylinder bore and L is stroke length