/// <summary> /// Parse a vlc code. </summary> /// <param name="bits"> is the number of bits which will be read at once, must be /// identical to nb_bits in init_vlc() </param> /// <param name="maxDepth"> is the number of times bits bits must be read to completely /// read the longest vlc code /// = (max_vlc_length + bits - 1) / bits </param> public virtual int getVLC2(IBitReader br, int maxDepth) { int nbBits; int index = br.peek(bits); int code = table[index][0]; int n = table[index][1]; if (maxDepth > 1 && n < 0) { br.skip(bits); nbBits = -n; index = br.peek(nbBits) + code; code = table[index][0]; n = table[index][1]; if (maxDepth > 2 && n < 0) { br.skip(nbBits); nbBits = -n; index = br.peek(nbBits) + code; code = table[index][0]; n = table[index][1]; } } br.skip(n); return(code); }