80 for (
UInt y = 0; y < iHeight; y += uiAQPartHeight )
82 const UInt uiCurrAQPartHeight = min(uiAQPartHeight, iHeight-y);
83 for (
UInt x = 0; x < iWidth; x += uiAQPartWidth, pcAQU++ )
85 const UInt uiCurrAQPartWidth = min(uiAQPartWidth, iWidth-x);
86 const Pel* pBlkY = &pLineY[x];
87 UInt64 uiSum[4] = {0, 0, 0, 0};
88 UInt64 uiSumSq[4] = {0, 0, 0, 0};
90 for ( ; by < uiCurrAQPartHeight>>1; by++ )
93 for ( ; bx < uiCurrAQPartWidth>>1; bx++ )
95 uiSum [0] += pBlkY[bx];
96 uiSumSq[0] += pBlkY[bx] * pBlkY[bx];
98 for ( ; bx < uiCurrAQPartWidth; bx++ )
100 uiSum [1] += pBlkY[bx];
101 uiSumSq[1] += pBlkY[bx] * pBlkY[bx];
105 for ( ; by < uiCurrAQPartHeight; by++ )
108 for ( ; bx < uiCurrAQPartWidth>>1; bx++ )
110 uiSum [2] += pBlkY[bx];
111 uiSumSq[2] += pBlkY[bx] * pBlkY[bx];
113 for ( ; bx < uiCurrAQPartWidth; bx++ )
115 uiSum [3] += pBlkY[bx];
116 uiSumSq[3] += pBlkY[bx] * pBlkY[bx];
121 assert ((uiCurrAQPartWidth&1)==0);
122 assert ((uiCurrAQPartHeight&1)==0);
123 const UInt pixelWidthOfQuadrants = uiCurrAQPartWidth >>1;
124 const UInt pixelHeightOfQuadrants = uiCurrAQPartHeight>>1;
125 const UInt numPixInAQPart = pixelWidthOfQuadrants * pixelHeightOfQuadrants;
128 if (numPixInAQPart!=0)
130 for (
Int i=0; i<4; i++)
132 const Double dAverage =
Double(uiSum[i]) / numPixInAQPart;
133 const Double dVariance =
Double(uiSumSq[i]) / numPixInAQPart - dAverage * dAverage;
134 dMinVar = min(dMinVar, dVariance);
141 const Double dActivity = 1.0 + dMinVar;
143 dSumAct += dActivity;
145 pLineY += iStride * uiCurrAQPartHeight;
virtual ~TEncPreanalyzer()
Void xPreanalyze(TEncPic *pcPic)
Int getStride(const ComponentID id) const
Int getHeight(const ComponentID id) const
Void setAvgActivity(Double d)
Picture class including local image characteristics information for QP adaptation.
Int getWidth(const ComponentID id) const
Void setActivity(Double d)
UInt getNumAQPartInHeight()
TComPicYuv * getPicYuvOrg()
Local image characteristics for CUs on a specific depth.
unsigned long long UInt64
UInt getNumAQPartInWidth()
TEncPicQPAdaptationLayer * getAQLayer(UInt uiDepth)
Pel * getAddr(const ComponentID ch)
Unit block for storing image characteristics.
source picture analyzer class (header)
TEncQPAdaptationUnit * getQPAdaptationUnit()