refine common moudle for part of intra prediction function