finished first cut of encoder state persistence (untested). moved a couple of data structures into private header files to make them available to the encoder persistence code.