PAQ8/orig/paq8o10t.cpp
// Model order 1-2 contexts with gaps.
Model order 1-2 contexts with gaps.
Model order 1 - 2 contexts with gaps .
void sparseModel(Mixer& m, int seenbefore, int howmany) {
  static ContextMap cm(MEM*2, 48+2+2+1);
  static int mask = 0;
  if (bpos==0) {
    cm.set( c4&0x00f0f0f0);
    cm.set((c4&0xf0f0f0f0)+1);
    cm.set((c4&0x00f8f8f8)+2);
    cm.set((c4&0xf8f8f8f8)+3);
    cm.set((c4&0x00e0e0e0)+4);
    cm.set((c4&0xe0e0e0e0)+5);
    cm.set((c4&0x00f0f0ff)+6);
     cm.set((c4&0xC3CCC38C)+7);
    cm.set((c4&0x0081CC81)+8);
    cm.set(seenbefore);
    cm.set(howmany);
    cm.set(c4&0x00ff00ff);
    cm.set(c4&0xff0000ff);
        cm.set(c4&0x00c10081);
    cm.set(c4&0x810000c1);
    cm.set(buf(1)|buf(5)<<8);
    cm.set(buf(1)|buf(6)<<8);
    cm.set(buf(3)|buf(6)<<8);
    cm.set(buf(4)|buf(8)<<8);
    for (int i=1; i<8; ++i) {
      cm.set((buf(i+1)<<8)|buf(i+2));
      cm.set((buf(i+1)<<8)|buf(i+3));
      cm.set(seenbefore|buf(i)<<8);
    }
    int fl = 0;
    if( c4&0xff != 0 ){
           if( isalpha( c4&0xff ) ) fl = 1;
      else if( ispunct( c4&0xff ) ) fl = 2;
      else if( isspace( c4&0xff ) ) fl = 3;
      else if( c4&0xff == 0xff ) fl = 4;
      else if( c4&0xff < 16 ) fl = 5;
      else if( c4&0xff < 64 ) fl = 6;
      else fl = 7;
    }
    mask = (mask<<3)|fl;
    cm.set(mask);
    cm.set(mask<<8|buf(1));
    cm.set(mask<<17|buf(2)<<8|buf(3));
    cm.set(mask&0x1ff|((c4&0xf0f0f0f0)<<9));
  }
  cm.mix(m);
}
void sparseModel ( Mixer & m , int seenbefore , int howmany ) { static ContextMap cm ( MEM * 2 , 48 + 2 + 2 + 1 ) ; static int mask = 0 ; if ( bpos == 0 ) { cm . set ( c4 & 0x00f0f0f0 ) ; cm . set ( ( c4 & 0xf0f0f0f0 ) + 1 ) ; cm . set ( ( c4 & 0x00f8f8f8 ) + 2 ) ; cm . set ( ( c4 & 0xf8f8f8f8 ) + 3 ) ; cm . set ( ( c4 & 0x00e0e0e0 ) + 4 ) ; cm . set ( ( c4 & 0xe0e0e0e0 ) + 5 ) ; cm . set ( ( c4 & 0x00f0f0ff ) + 6 ) ; cm . set ( ( c4 & 0xC3CCC38C ) + 7 ) ; cm . set ( ( c4 & 0x0081CC81 ) + 8 ) ; cm . set ( seenbefore ) ; cm . set ( howmany ) ; cm . set ( c4 & 0x00ff00ff ) ; cm . set ( c4 & 0xff0000ff ) ; cm . set ( c4 & 0x00c10081 ) ; cm . set ( c4 & 0x810000c1 ) ; cm . set ( buf ( 1 ) | buf ( 5 ) << 8 ) ; cm . set ( buf ( 1 ) | buf ( 6 ) << 8 ) ; cm . set ( buf ( 3 ) | buf ( 6 ) << 8 ) ; cm . set ( buf ( 4 ) | buf ( 8 ) << 8 ) ; for ( int i = 1 ; i < 8 ; ++ i ) { cm . set ( ( buf ( i + 1 ) << 8 ) | buf ( i + 2 ) ) ; cm . set ( ( buf ( i + 1 ) << 8 ) | buf ( i + 3 ) ) ; cm . set ( seenbefore | buf ( i ) << 8 ) ; } int fl = 0 ; if ( c4 & 0xff != 0 ) { if ( isalpha ( c4 & 0xff ) ) fl = 1 ; else if ( ispunct ( c4 & 0xff ) ) fl = 2 ; else if ( isspace ( c4 & 0xff ) ) fl = 3 ; else if ( c4 & 0xff == 0xff ) fl = 4 ; else if ( c4 & 0xff < 16 ) fl = 5 ; else if ( c4 & 0xff < 64 ) fl = 6 ; else fl = 7 ; } mask = ( mask << 3 ) | fl ; cm . set ( mask ) ; cm . set ( mask << 8 | buf ( 1 ) ) ; cm . set ( mask << 17 | buf ( 2 ) << 8 | buf ( 3 ) ) ; cm . set ( mask & 0x1ff | ( ( c4 & 0xf0f0f0f0 ) << 9 ) ) ; } cm . mix ( m ) ; }
Model order 1-2 contexts with gaps.
Model order 1 - 2 contexts with gaps .