@@ -115,6 +115,7 @@ private:
unsigned int xShift_;
unsigned int stride_;
+ unsigned int sumShift_;
SharedMemObject<SwIspStats> sharedStats_;
SwIspStats stats_;
@@ -346,6 +346,11 @@ void SwStatsCpu::startFrame(uint32_t frame)
void SwStatsCpu::finishFrame(uint32_t frame, uint32_t bufferId)
{
stats_.valid = frame % kStatPerNumFrames == 0;
+ if (stats_.valid && sumShift_) {
+ stats_.sum_.r() >>= sumShift_;
+ stats_.sum_.g() >>= sumShift_;
+ stats_.sum_.b() >>= sumShift_;
+ }
*sharedStats_ = stats_;
statsReady.emit(frame, bufferId);
}
@@ -405,12 +410,15 @@ int SwStatsCpu::configure(const StreamConfiguration &inputCfg)
switch (bayerFormat.bitDepth) {
case 8:
stats0_ = &SwStatsCpu::statsBGGR8Line0;
+ sumShift_ = 0;
return 0;
case 10:
stats0_ = &SwStatsCpu::statsBGGR10Line0;
+ sumShift_ = 2;
return 0;
case 12:
stats0_ = &SwStatsCpu::statsBGGR12Line0;
+ sumShift_ = 4;
return 0;
}
}
@@ -422,6 +430,7 @@ int SwStatsCpu::configure(const StreamConfiguration &inputCfg)
/* Skip every 3th and 4th line, sample every other 2x2 block */
ySkipMask_ = 0x02;
xShift_ = 0;
+ sumShift_ = 0;
processFrame_ = &SwStatsCpu::processBayerFrame2;
switch (bayerFormat.order) {