I rhink the concept is: in the initial position you have three kings: in a1, e1 and h1. Once the left rook is moved, it will be encoded as rook and not as a king anymore. Same for the right one. If you move the king, both rooks will be encoded as rooks and not as king anymore.
Decoding is easy: if there's more than one king, one must be in e1: that's the real one, the others are actually rooks.