idf pre-calculate