Do palette definition after emitting header section
Minor fix
Improve the allocation method for creating histgram
Reduce sample pixels for creating histgram
Merge branch 'develop' into feature-fixed-palette