本文整理汇总了C++中TComPicYuv::getNumberValidComponents方法的典型用法代码示例。如果您正苦于以下问题:C++ TComPicYuv::getNumberValidComponents方法的具体用法?C++ TComPicYuv::getNumberValidComponents怎么用?C++ TComPicYuv::getNumberValidComponents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TComPicYuv
的用法示例。
在下文中一共展示了TComPicYuv::getNumberValidComponents方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: xCalcACDCParamSlice
//! calculate AC and DC values for current original image
Void WeightPredAnalysis::xCalcACDCParamSlice(TComSlice *const slice)
{
//===== calculate AC/DC value =====
TComPicYuv* pPic = slice->getPic()->getPicYuvOrg();
WPACDCParam weightACDCParam[MAX_NUM_COMPONENT];
for(Int componentIndex = 0; componentIndex < pPic->getNumberValidComponents(); componentIndex++)
{
const ComponentID compID = ComponentID(componentIndex);
// calculate DC/AC value for channel
const Int iStride = pPic->getStride(compID);
const Int iWidth = pPic->getWidth(compID);
const Int iHeight = pPic->getHeight(compID);
const Int iSample = iWidth*iHeight;
Int64 iOrgDC = 0;
{
const Pel *pPel = pPic->getAddr(compID);
for(Int y = 0; y < iHeight; y++, pPel+=iStride )
{
for(Int x = 0; x < iWidth; x++ )
{
iOrgDC += (Int)( pPel[x] );
}
}
}
const Int64 iOrgNormDC = ((iOrgDC+(iSample>>1)) / iSample);
Int64 iOrgAC = 0;
{
const Pel *pPel = pPic->getAddr(compID);
for(Int y = 0; y < iHeight; y++, pPel += iStride )
{
for(Int x = 0; x < iWidth; x++ )
{
iOrgAC += abs( (Int)pPel[x] - (Int)iOrgNormDC );
}
}
}
const Int fixedBitShift = (slice->getSPS()->getSpsRangeExtension().getHighPrecisionOffsetsEnabledFlag())?RExt__PREDICTION_WEIGHTING_ANALYSIS_DC_PRECISION:0;
weightACDCParam[compID].iDC = (((iOrgDC<<fixedBitShift)+(iSample>>1)) / iSample);
weightACDCParam[compID].iAC = iOrgAC;
}
slice->setWpAcDcParam(weightACDCParam);
}
示例2: derivePGRPLT
Void derivePGRPLT(TComDataCU* pcCtu)
{
TComPic* pcPic = pcCtu->getPic();
TComPicYuv* pcOrgYuv = pcPic->getPicYuvOrg();
UInt uiNumValidComponents = pcOrgYuv->getNumberValidComponents();
UInt uiMaxCUWidth = pcCtu->getSlice()->getSPS()->getMaxCUWidth();
UInt uiMaxCUHeight = pcCtu->getSlice()->getSPS()->getMaxCUWidth();
for (UInt ch = 0; ch < uiNumValidComponents; ch++)
{
ComponentID cId = ComponentID(ch);
UInt uiPicWidth = pcOrgYuv->getWidth(cId);
UInt uiPicHeight = pcOrgYuv->getHeight(cId);
UInt uiStride = pcOrgYuv->getStride(cId);
UInt uiCUPelX = pcCtu->getCUPelX() >> (pcOrgYuv->getComponentScaleX(cId)); // x of upper left corner of the cu
UInt uiCUPelY = pcCtu->getCUPelY() >> (pcOrgYuv->getComponentScaleY(cId));; // y of upper left corner of the
UInt uiCBWidth = uiMaxCUWidth >> (pcOrgYuv->getComponentScaleX(cId));
UInt uiCBHeight = uiMaxCUHeight >> (pcOrgYuv->getComponentScaleY(cId));
uiCBWidth = Clip3((UInt)0, uiPicWidth - uiCUPelX, uiCBWidth);
uiCBHeight = Clip3((UInt)0, uiPicHeight - uiCUPelY, uiCBHeight);
// statistics
PelCount* pPixelCount[256];
for (int i = 0; i < 256; i++)
pPixelCount[i] = new PelCount(i);
Pel* pOrg = pcOrgYuv->getAddr(cId, pcCtu->getCtuRsAddr());
for (UInt uiY = 0; uiY < uiCBHeight; uiY++)
{
for (UInt uiX = 0; uiX < uiCBWidth; uiX++)
{
pPixelCount[pOrg[uiX]]->m_uiCount++;
}
pOrg += uiStride;
}
// sort
sort(pPixelCount, pPixelCount + 256, cmpPelCount);
g_ppCTUPalette[cId].m_uiSize = 0;
// insert entry
for (int i = 0, k = 0; k < 4; i++)
{
bool bDuplicate = false;
for (int j = 0; j < 4; j++)
{
// duplicate
if (g_ppCTUPalette[cId].m_pEntry[i] == g_ppPalette[cId].m_pEntry[j])
{
bDuplicate = true;
break;
}
}
if (!bDuplicate)
{
g_ppCTUPalette[cId].m_pEntry[k++] = pPixelCount[i]->m_uiVal;
g_ppCTUPalette[cId].m_uiSize++;
}
}
for (int i = 0; i < 256; i++)
delete pPixelCount[i];
}
}