signalModeConsVal()函数解析

const int CodingStructure::signalModeCons( const PartSplit split, Partitioner &partitioner, const ModeType modeTypeParent ) const
{
  if (CS::isDualITree(*this) || modeTypeParent != MODE_TYPE_ALL || partitioner.currArea().chromaFormat == CHROMA_444 || partitioner.currArea().chromaFormat == CHROMA_400 )
  {
    return LDT_MODE_TYPE_INHERIT;
  }
  int minLumaArea = partitioner.currArea().lumaSize().area();
  if (split == CU_QUAD_SPLIT || split == CU_TRIH_SPLIT || split == CU_TRIV_SPLIT) // the area is split into 3 or 4 parts
  {
    minLumaArea = minLumaArea >> 2;
  }
  else if (split == CU_VERT_SPLIT || split == CU_HORZ_SPLIT) // the area is split into 2 parts
  {
    minLumaArea = minLumaArea >> 1;
  }
  int minChromaBlock = minLumaArea >> (getChannelTypeScaleX(CHANNEL_TYPE_CHROMA, partitioner.currArea().chromaFormat) + getChannelTypeScaleY(CHANNEL_TYPE_CHROMA, partitioner.currArea().chromaFormat));
  bool is2xNChroma = (partitioner.currArea().chromaSize().width == 4 && split == CU_VERT_SPLIT) || (partitioner.currArea().chromaSize().width == 8 && split == CU_TRIV_SPLIT);
  return minChromaBlock >= 16 && !is2xNChroma ? LDT_MODE_TYPE_INHERIT : ((minLumaArea < 32) || slice->isIntra()) ? LDT_MODE_TYPE_INFER : LDT_MODE_TYPE_SIGNAL;
}

参考H.266/VVC-VTM代码学习23-编码块RDO选择模式(Intra与Inter)initCULevel()_liaojq2020的博客-CSDN博客

第一个if语句:如果满足(1)当前为dual tree(2)当前父节点modetype不为MODE_TYPE_ALL(3)当前编码区域亮色度格式为444或400

则signalModeConsVal = LDT_MODE_TYPE_INHERIT(不需要signal mode_constraint_flag,并且该区域的modeType是从其父节点继承来的)

minLumaArea:这个变量表示最小亮度区域。创建变量时表示当前亮度区域的位置和大小

第二个if语句:若划分模式为 QT 或 TH 或 TV,则最小亮度区域为当前亮度区域/4.否则若划分模式为bv或bh时,最小亮度区域为当前亮度区域/2

minChromaBlock:最小色度块 >> scale,scale为getChannelTypeScaleX(),getChannelTypeScaleY()根据当前区域的通道类型和色度格式算出来的一个缩放值

is2xNChroma:(当前色度区域宽度为4 且 划分模式为 BV) 或 (当前色度区域宽度为8 且 划分模式为 TV)时,色度块尺寸为 2*N

返回值:若最小色度块 >= 16 且 色度块尺寸不是 2*N 时,LDT_MODE_TYPE_INHERIT模式。否则在最小亮度块<32 或 当前帧为 INTRA 时子块 RDO 模式为 Intra,否则当前模式由signal mode_constraint_flag 标志决定

static const int LDT_MODE_TYPE_INHERIT =                            0; ///< No need to signal mode_constraint_flag, and the modeType of the region is inherited from its parent node
static const int LDT_MODE_TYPE_INFER =                              1; ///< No need to signal mode_constraint_flag, and the modeType of the region is inferred as MODE_TYPE_INTRA
static const int LDT_MODE_TYPE_SIGNAL =                             2; ///< Need to signal mode_constraint_flag, and the modeType of the region is determined by the flag

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值