inline UnitArea clipArea(const UnitArea &area, const UnitArea &boundingBox)
{
UnitArea ret(area.chromaFormat);
for (uint32_t i = 0; i < area.blocks.size(); i++)
{
ret.blocks.push_back(clipArea(area.blocks[i], boundingBox.blocks[i]));
}
return ret;
}
boundingBox():分量的边界限制,如当前CTU
名称 | 值 | 类型 | |
---|---|---|---|
▶ | area | {x = 0, y = 0, width = 128, height = 128} | const UnitArea & |
而Y分量和CbCr分量的边界限制分别为
名称 | 值 | 类型 | |
---|---|---|---|
▶ | boundingBox.blocks[i] | {(Y) x = 0, y = 0, width = 832, height = 480} | CompArea |
名称 | 值 | 类型 | |
---|---|---|---|
▶ | boundingBox.blocks[i] | {(Cb) x = 0, y = 0, width = 416, height = 240} | CompArea |
这里将当前CTU的YCbCr分量的区域信息和边界限制信息传输到ret中并返回,调用ret即可得到这些信息
UnitArea CS::getArea( const CodingStructure &cs, const UnitArea &area, const ChannelType chType )
{
return isDualITree( cs ) || cs.treeType != TREE_D ? area.singleChan( chType ) : area;
}
如果当前bestCS结果为dual tree或不为joint tree,则返回singlechan()处理后的这块待处理的CTU,亮度Y和色度分量CbCr各自的位置,若为false,返回亮度色度分量共同的位置
const UnitArea UnitArea::singleChan(const ChannelType chType) const
{
UnitArea ret(chromaFormat);
for (const auto &blk : blocks)
{
if (toChannelType(blk.compID) == chType)
{
ret.blocks.push_back(blk);
}
else
{
ret.blocks.push_back(CompArea());
}
}
return ret;
}
chType:是当前CTU的通道类型
auto &blk : blocks :遍历当前bsetCS结构下的所有块,并用blk赋值
if (toChannelType(blk.compID) == chType):如果满足当前块的通道类型和CTU的相同,则将blk的参数赋值给block。不是的话则将当前blk的位置和长宽,色度采样格式,颜色分量类型的compArea()赋给当前block。
此处block的值:应该是代表YCbCr三个分量,所以值为3
这个函数推测应该是singlechannal的缩写为双树或非joint-tree划分结构下,YCbCr三个分量的区域信息,即位置信息和长宽信息,可看做CTB