public int decodeBin ( int m ) { int bin ; int qIdx = ( range >> 6 ) & 0x3 ; int rLPS = MConst . rangeLPS [ qIdx ] [ cm [ 0 ] [ m ] ] ; range -= rLPS ; int rs8 = range << 8 ; if ( code < rs8 ) { // MPS if ( cm [ 0 ] [ m ] < 62 ) cm [ 0 ] [ m ] ++ ; renormalize ( ) ; bin = cm [ 1 ] [ m ] ; } else { // LPS range = rLPS ; code -= rs8 ; renormalize ( ) ; bin = 1 - cm [ 1 ] [ m ] ; if ( cm [ 0 ] [ m ] == 0 ) cm [ 1 ] [ m ] = 1 - cm [ 1 ] [ m ] ; cm [ 0 ] [ m ] = MConst . transitLPS [ cm [ 0 ] [ m ] ] ; } // System.out.println("CABAC BIT [" + m + "]: " + bin); return bin ; }
Decodes one bin from arithmetice code word