====== Serialized envelope point counts ====== The point counts for the envelopes may be stored in four different modes, some of them different for the master and slave channel. ==== Encoding modes ==== === 0: Direct encoding === Plain encoding as 3-bit numbers. === 1: Variable length encoding === Each envelope point count is encoded independently using a variable-length encoding. === 2 (on master channel): Variable length delta encoding === The first point count is stored as in Mode 1, the later ones by encoding the difference to the previous point code using a variable length code. Delta application uses wrap-around after 7. === 2 (on slave channel): Variable length delta-to-master encoding === Each envelope point count is encoded as difference to the envelope point count of the corresponding envelope of the master channel (which is zero for non-existing envelopes). Delta application wraps around after 7. === 3 (on master channel): Base/delta encoding === The bit count for deltas is stored plain, as is the base value. Then for all stored envelope the delta to the base value is stored in a direct binary encoding. Delta application does not wrap around. Values > 7 are illegal, but possible. === 3 (on slave channel): Copy from master === The point counts are cloned from the master channel. If the slave channel has more enveloped bands than the master channel, point counts of zero would be added which is useless. ===== Encoding ===== ==== Serialized point counts ==== * Two bits: coding mode === Coding mode 0: direct encoding === * for each stored envelope: * 3 bits point count === Coding mode 1: variable length encoding === * for each stored envelope: * one symbol from the [[point count trees#point count encoding tree]] === Coding mode 2 on master channel: variable length delta to previous encoding === * one symbol from the [[point count trees#point count encoding tree]] for the first envelope * for all other stored envelopes * one symbol from the [[point count trees#delta point count encoding tree]] encoding the difference to the previous envelope === Coding mode 2 on slave channel: variable length delta to master encoding === * for all stored envelopes * one symbol from the the [[point count trees#delta point count encoding tree]] encoding the diffence to the master channel === Coding mode 3 on master channel: === * two bits: delta size //d// * three bits: base count //b// * for each stored envelope * //d// bits binary number giving the number of points more than //b// === Coding mode 3 on slave: === * //nothing//