fix bugs in active count; add shift,window mode in shifting window encoder