Message ID | 20250718144456.58625-2-mzamazal@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
Quoting Milan Zamazal (2025-07-18 15:44:56) > The statistics in software ISP is computed basically over the whole > image area, although only on part of the pixels. It is not necessary to > cover the whole image area, it's sufficient to compute the statistics > let's say over the central area of 2/3 of the image width and height, > which should be both sufficient and faster. The speedup is not that > important with the CPU implementation but it may save CPU work > more noticeably with GPU debayering implementation. > > Signed-off-by: Milan Zamazal <mzamazal@redhat.com> > --- > src/libcamera/software_isp/debayer_egl.cpp | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp > index 9ec966608..534e36050 100644 > --- a/src/libcamera/software_isp/debayer_egl.cpp > +++ b/src/libcamera/software_isp/debayer_egl.cpp > @@ -393,8 +393,11 @@ int DebayerEGL::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 */ > - stats_->setWindow(Rectangle(window_.size())); > + /* > + * Don't pass x,y since process() already adjusts src before passing it. > + * But reduce the width and height by 2/3 for speedup. > + */ > + stats_->setWindow(Rectangle(window_.size()).croppedBy(2, 3)); What does the comment about x,y mean now? what x,y adjustment is made? If croppedBy() is made to keep the initial x,y correctly - would this the nmake the correct final window? > > LOG(Debayer, Debug) << "Input width " << inputCfg.size.width << " height " << inputCfg.size.height; > LOG(Debayer, Debug) << "Output width " << outputCfg.size.width << " height " << outputCfg.size.height; > -- > 2.50.1 >
Hi Kieran, Kieran Bingham <kieran.bingham@ideasonboard.com> writes: > Quoting Milan Zamazal (2025-07-18 15:44:56) >> The statistics in software ISP is computed basically over the whole >> image area, although only on part of the pixels. It is not necessary to > >> cover the whole image area, it's sufficient to compute the statistics >> let's say over the central area of 2/3 of the image width and height, >> which should be both sufficient and faster. The speedup is not that >> important with the CPU implementation but it may save CPU work >> more noticeably with GPU debayering implementation. >> >> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> >> --- >> src/libcamera/software_isp/debayer_egl.cpp | 7 +++++-- >> 1 file changed, 5 insertions(+), 2 deletions(-) >> >> diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp >> index 9ec966608..534e36050 100644 >> --- a/src/libcamera/software_isp/debayer_egl.cpp >> +++ b/src/libcamera/software_isp/debayer_egl.cpp >> @@ -393,8 +393,11 @@ int DebayerEGL::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 */ >> - stats_->setWindow(Rectangle(window_.size())); >> + /* >> + * Don't pass x,y since process() already adjusts src before passing it. >> + * But reduce the width and height by 2/3 for speedup. >> + */ >> + stats_->setWindow(Rectangle(window_.size()).croppedBy(2, 3)); > > What does the comment about x,y mean now? what x,y adjustment is made? window_ can be a crop. Its top left corner is not passed to stats_->setWindow() because the window_ corner is handled in process(), for both the stats and debayering. I'll try to make it clearer in v2 (reminder to myself: the original comment should be improved in debayer_cpu.cpp as well). > If croppedBy() is made to keep the initial x,y correctly - would this > the nmake the correct final window? croppedBy() is applied here on a rectangle constructed from size only, which means the top left corner is (0, 0). > > >> >> LOG(Debayer, Debug) << "Input width " << inputCfg.size.width << " height " << >> inputCfg.size.height; >> LOG(Debayer, Debug) << "Output width " << outputCfg.size.width << " height " << >> outputCfg.size.height; >> -- >> 2.50.1 >>
diff --git a/src/libcamera/software_isp/debayer_egl.cpp b/src/libcamera/software_isp/debayer_egl.cpp index 9ec966608..534e36050 100644 --- a/src/libcamera/software_isp/debayer_egl.cpp +++ b/src/libcamera/software_isp/debayer_egl.cpp @@ -393,8 +393,11 @@ int DebayerEGL::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 */ - stats_->setWindow(Rectangle(window_.size())); + /* + * Don't pass x,y since process() already adjusts src before passing it. + * But reduce the width and height by 2/3 for speedup. + */ + stats_->setWindow(Rectangle(window_.size()).croppedBy(2, 3)); LOG(Debayer, Debug) << "Input width " << inputCfg.size.width << " height " << inputCfg.size.height; LOG(Debayer, Debug) << "Output width " << outputCfg.size.width << " height " << outputCfg.size.height;
The statistics in software ISP is computed basically over the whole image area, although only on part of the pixels. It is not necessary to cover the whole image area, it's sufficient to compute the statistics let's say over the central area of 2/3 of the image width and height, which should be both sufficient and faster. The speedup is not that important with the CPU implementation but it may save CPU work more noticeably with GPU debayering implementation. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> --- src/libcamera/software_isp/debayer_egl.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)