Managing the codebook

Build a hierarchical codebook, merge and split codes, follow the operation history and lock the codebook.