//! 用于significant_coeff_flag的上下文推导过程的模式选择 draft 9.3.3.1.4
Int TComTrQuant::calcPatternSigCtx( const UInt* sigCoeffGroupFlag, UInt posXCG, UInt posYCG, Int width, Int height )
{
if( width == 4 && height == 4 ) return -1; //!< 不满足计算pattern的条件
UInt sigRight = 0;
UInt sigLower = 0;
/*
** x a
**
** b
*/
width >>= 2;
height >>= 2;
if( posXCG < width - 1 ) //!< draft (9-17)
{
sigRight = (sigCoeffGroupFlag[ posYCG * width + posXCG + 1 ] != 0); //!< coded_sub_block_flag[xS+1][yS]
}
if (posYCG < height - 1 ) //!< draft (9-18)
{
sigLower = (sigCoeffGroupFlag[ (posYCG + 1 ) * width + posXCG ] != 0); //!< (coded_sub_block_flag[xS][yS+1] << 1)
}
return sigRight + (sigLower<<1); //!< draft (9-17) (9-18)
}
//!