| Message ID | 20260803131435.153927-39-barnabas.pocze@ideasonboard.com |
|---|---|
| State | Superseded |
| Headers | show |
| Series |
|
| Related | show |
Hi Barnabás, Barnabás Pőcze <barnabas.pocze@ideasonboard.com> writes: > Use `std::{min,max}()` just like it is done for the exposure. > > Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> > --- > src/ipa/simple/algorithms/agc.cpp | 10 ++-------- > 1 file changed, 2 insertions(+), 8 deletions(-) > > diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp > index f959abeba5..b25c303835 100644 > --- a/src/ipa/simple/algorithms/agc.cpp > +++ b/src/ipa/simple/algorithms/agc.cpp > @@ -130,19 +130,13 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou > exposure = std::max(next, exposure + 1); > } else { > double next = again * factor; > - if (next - again < context.configuration.agc.againMinStep) > - again += context.configuration.agc.againMinStep; > - else > - again = next; > + again = std::max(next, again + context.configuration.agc.againMinStep); > } > } else { > /* Scene too bright: decrease gain first, then exposure. */ > if (again > context.configuration.agc.again10) { > double next = again * factor; > - if (again - next < context.configuration.agc.againMinStep) > - again -= context.configuration.agc.againMinStep; > - else > - again = next; > + again = std::max(next, again - context.configuration.agc.againMinStep); Should be std::min, right? > } else { > uint32_t next = exposure * factor; > exposure = std::min(next, exposure - 1);
Hi 2026. 08. 04. 12:10 keltezéssel, Milan Zamazal írta: > Hi Barnabás, > > Barnabás Pőcze <barnabas.pocze@ideasonboard.com> writes: > >> Use `std::{min,max}()` just like it is done for the exposure. >> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> >> --- >> src/ipa/simple/algorithms/agc.cpp | 10 ++-------- >> 1 file changed, 2 insertions(+), 8 deletions(-) >> >> diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp >> index f959abeba5..b25c303835 100644 >> --- a/src/ipa/simple/algorithms/agc.cpp >> +++ b/src/ipa/simple/algorithms/agc.cpp >> @@ -130,19 +130,13 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou >> exposure = std::max(next, exposure + 1); >> } else { >> double next = again * factor; >> - if (next - again < context.configuration.agc.againMinStep) >> - again += context.configuration.agc.againMinStep; >> - else >> - again = next; >> + again = std::max(next, again + context.configuration.agc.againMinStep); >> } >> } else { >> /* Scene too bright: decrease gain first, then exposure. */ >> if (again > context.configuration.agc.again10) { >> double next = again * factor; >> - if (again - next < context.configuration.agc.againMinStep) >> - again -= context.configuration.agc.againMinStep; >> - else >> - again = next; >> + again = std::max(next, again - context.configuration.agc.againMinStep); > > Should be std::min, right? I could've sworn I had already fixed exactly this error... And as I turns out I did, only it was in "ipa: simple: agc: Move to libipa". Thanks, now it's fixed here as well. > >> } else { >> uint32_t next = exposure * factor; >> exposure = std::min(next, exposure - 1); >
diff --git a/src/ipa/simple/algorithms/agc.cpp b/src/ipa/simple/algorithms/agc.cpp index f959abeba5..b25c303835 100644 --- a/src/ipa/simple/algorithms/agc.cpp +++ b/src/ipa/simple/algorithms/agc.cpp @@ -130,19 +130,13 @@ void Agc::updateExposure(IPAContext &context, IPAFrameContext &frameContext, dou exposure = std::max(next, exposure + 1); } else { double next = again * factor; - if (next - again < context.configuration.agc.againMinStep) - again += context.configuration.agc.againMinStep; - else - again = next; + again = std::max(next, again + context.configuration.agc.againMinStep); } } else { /* Scene too bright: decrease gain first, then exposure. */ if (again > context.configuration.agc.again10) { double next = again * factor; - if (again - next < context.configuration.agc.againMinStep) - again -= context.configuration.agc.againMinStep; - else - again = next; + again = std::max(next, again - context.configuration.agc.againMinStep); } else { uint32_t next = exposure * factor; exposure = std::min(next, exposure - 1);
Use `std::{min,max}()` just like it is done for the exposure. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> --- src/ipa/simple/algorithms/agc.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)