PAQ8/PaqCtxMap.hpp
// Predict to mixer m from bit history state s, using sm to map s to
// a probability.
Predict to mixer m from bit history state s, using sm to map s to
a probability.
Predict to mixer m from bit history state s using sm to map s to a probability .
static inline int mix2(Mixer& m, int s, StateMap& sm) {
  int p1=sm.p(m.y, s);
  int n0=-!nex(s,2);
  int n1=-!nex(s,3);
  int st=Stretch::s(p1)>>2;
  m.add(st);
  p1>>=4;
  int p0=255-p1;
  m.add(p1-p0);
  m.add(st*(n1-n0));
  m.add((p1&n0)-(p0&n1));
  m.add((p1&n1)-(p0&n0));
  return s>0;
}
static inline int mix2 ( Mixer & m , int s , StateMap & sm ) { int p1 = sm . p ( m . y , s ) ; int n0 = - ! nex ( s , 2 ) ; int n1 = - ! nex ( s , 3 ) ; int st = Stretch :: s ( p1 ) >> 2 ; m . add ( st ) ; p1 >>= 4 ; int p0 = 255 - p1 ; m . add ( p1 - p0 ) ; m . add ( st * ( n1 - n0 ) ) ; m . add ( ( p1 & n0 ) - ( p0 & n1 ) ) ; m . add ( ( p1 & n1 ) - ( p0 & n0 ) ) ; return s > 0 ; }
Predict to mixer m from bit history state s, using sm to map s to
a probability.
Predict to mixer m from bit history state s using sm to map s to a probability .