@@ -554,7 +554,11 @@ int DebayerCpu::configure(const StreamConfiguration &inputCfg,
window_.width = outputCfg.size.width;
window_.height = outputCfg.size.height;
- /* Don't pass x,y since process() already adjusts src before passing it */
+ /*
+ * Set the stats window to the whole processed window. Its coordinates are
+ * relative to the debayered area since debayering passes only the part of
+ * data to be processed to the stats; see SwStatsCpu::setWindow.
+ */
stats_->setWindow(Rectangle(window_.size()));
/* pad with patternSize.Width on both left and right side */
@@ -416,6 +416,25 @@ int SwStatsCpu::configure(const StreamConfiguration &inputCfg)
/**
* \brief Specify window coordinates over which to gather statistics
* \param[in] window The window object.
+ *
+ * This method specifies the image area over which to gather the statistics.
+ * It must be called to set the area, otherwise the default zero-sized
+ * \a Rectangle is used and no statistics is gathered.
+ *
+ * The specified \a window is relative to what is passed to processLine*
+ * methods. Typically, this means processLine* methods get only data from the
+ * processed area and \a window is \a Rectangle with (0, 0) top-left point and
+ * of the same size as the processed area. But if statistics is gathered only
+ * from some part of the image, e.g. its centre, \a window should specify such a
+ * restriction accordingly.
+ *
+ * It is the responsibility of the callers to provide sensible \a window values,
+ * most notably not exceeding the original image boundaries.
+ *
+ * The method may adjust the window slightly if it is not aligned according to
+ * the bayer pattern determined in \a SwStatsCpu::configure(). If that happens,
+ * it is guaranteed that non-negative top-left point coordinates remain
+ * non-negative and that the window width and height don't get enlarged.
*/
void SwStatsCpu::setWindow(const Rectangle &window)
{