Add glcm tests, and revise glcm code.