openfimg: compiler: Implement depart/repeat counting

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>