Dynamically calculate threshold to improve embedding capacity