libcamera: software_isp: Use RGB type to represent gains
Rather than using a custom struct to represent RGB values, let's use the corresponding type and its facilities. Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
committed by
Kieran Bingham
parent
84f82c6b3c
commit
94e849bcf7
@@ -103,16 +103,10 @@ void Lut::prepare(IPAContext &context,
|
||||
const double div = static_cast<double>(DebayerParams::kRGBLookupSize) /
|
||||
gammaTableSize;
|
||||
/* Apply gamma after gain! */
|
||||
unsigned int idx;
|
||||
idx = std::min({ static_cast<unsigned int>(i * gains.red / div),
|
||||
gammaTableSize - 1 });
|
||||
params->red[i] = gammaTable[idx];
|
||||
idx = std::min({ static_cast<unsigned int>(i * gains.green / div),
|
||||
gammaTableSize - 1 });
|
||||
params->green[i] = gammaTable[idx];
|
||||
idx = std::min({ static_cast<unsigned int>(i * gains.blue / div),
|
||||
gammaTableSize - 1 });
|
||||
params->blue[i] = gammaTable[idx];
|
||||
const RGB<double> lutGains = (gains * i / div).min(gammaTableSize - 1);
|
||||
params->red[i] = gammaTable[static_cast<unsigned int>(lutGains.r())];
|
||||
params->green[i] = gammaTable[static_cast<unsigned int>(lutGains.g())];
|
||||
params->blue[i] = gammaTable[static_cast<unsigned int>(lutGains.b())];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user