range coder on Z80
Do anyone understand %subj% ?
I tried very simple scheme which can be described by this pseudocode
it works reasonable well for highly skewed distribution (say P("0") ~ 0.75 , P("1") ~ 0.25) but fails for flat distributions (at worst case 16bits emits 12 bits only). could someone point where is a mistake ?
I tried very simple scheme which can be described by this pseudocode
@1 read new VALUE (16 bits) TRESHOLD = %TTTT 0000 0000 0000 @2 if (TRESHOLD < 16) goto @1 if (VALUE>treshold) emit "1" TRESHOLD = TRESHOLD +(TRESHOLD * TTTT)>>4 else emit "0" TRESHOLD = TRESHOLD - (TRESHOLD * (%1111 - TTTT))>>4 goto @2
it works reasonable well for highly skewed distribution (say P("0") ~ 0.75 , P("1") ~ 0.25) but fails for flat distributions (at worst case 16bits emits 12 bits only). could someone point where is a mistake ?