calculate compression method