int GetCoeffs(BitReader br, BandProbas[] prob, int ctx, int[] dq, int n, short[] out_ptr, int dst) { var p = prob[n].Probas[ctx]; for (; n < 16; ++n) { if (0 == br.GetBit (p[0])) return n; // previous coeff was last non-zero coeff while (0 == br.GetBit (p[1])) // sequence of zero coeffs { p = prob[++n].Probas[0]; if (16 == n) return 16; } // non zero coeff var p_ctx = prob[n + 1].Probas; int v; if (0 == br.GetBit (p[2])) { v = 1; p = p_ctx[1]; } else { v = br.GetLargeValue (p); p = p_ctx[2]; } out_ptr[dst+kZigzag[n]] = (short)(br.GetSigned (v) * dq[n > 0 ? 1 : 0]); } return 16; }