Complex XRD microstructural studies of hard coatings applied to PVD-deposited TiN films Part II. Transition from porous to compact films and microstructural inhomogeneity of the layers