HACK: android: Fixes to build as part of AOSP
This commit is contained in:
@@ -235,7 +235,7 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const
|
||||
/* Clamp the gain to lastStageGain and regulate exposureTime. */
|
||||
if (stageExposureTime * lastStageGain >= exposure) {
|
||||
exposureTime = clampExposureTime(exposure / lastStageGain, &quantGain);
|
||||
gain = clampGain(exposure / exposureTime, &quantGain2);
|
||||
gain = clampGain(exposure.count() / exposureTime.count(), &quantGain2);
|
||||
quantGain *= quantGain2;
|
||||
|
||||
return { exposureTime, gain, quantGain,
|
||||
@@ -245,7 +245,7 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const
|
||||
/* Clamp the exposureTime to stageExposureTime and regulate gain. */
|
||||
if (stageExposureTime * stageGain >= exposure) {
|
||||
exposureTime = stageExposureTime;
|
||||
gain = clampGain(exposure / exposureTime, &quantGain2);
|
||||
gain = clampGain(exposure.count() / exposureTime.count(), &quantGain2);
|
||||
quantGain *= quantGain2;
|
||||
|
||||
return { exposureTime, gain, quantGain,
|
||||
@@ -263,7 +263,7 @@ ExposureModeHelper::splitExposure(utils::Duration exposure) const
|
||||
* exposure time is maxed before gain is touched at all.
|
||||
*/
|
||||
exposureTime = clampExposureTime(exposure / stageGain, &quantGain);
|
||||
gain = clampGain(exposure / exposureTime, &quantGain2);
|
||||
gain = clampGain(exposure.count() / exposureTime.count(), &quantGain2);
|
||||
quantGain *= quantGain2;
|
||||
|
||||
return { exposureTime, gain, quantGain,
|
||||
|
||||
@@ -71,7 +71,7 @@ void CamHelper::process([[maybe_unused]] StatisticsPtr &stats,
|
||||
|
||||
uint32_t CamHelper::exposureLines(const Duration exposure, const Duration lineLength) const
|
||||
{
|
||||
return exposure / lineLength;
|
||||
return exposure.count() / lineLength.count();
|
||||
}
|
||||
|
||||
Duration CamHelper::exposure(uint32_t exposureLines, const Duration lineLength) const
|
||||
@@ -93,8 +93,8 @@ std::pair<uint32_t, uint32_t> CamHelper::getBlanking(Duration &exposure,
|
||||
* frameLengthMax gets calculated on the smallest line length as we do
|
||||
* not want to extend that unless absolutely necessary.
|
||||
*/
|
||||
frameLengthMin = minFrameDuration / mode_.minLineLength;
|
||||
frameLengthMax = maxFrameDuration / mode_.minLineLength;
|
||||
frameLengthMin = minFrameDuration.count() / mode_.minLineLength.count();
|
||||
frameLengthMax = maxFrameDuration.count() / mode_.minLineLength.count();
|
||||
|
||||
/*
|
||||
* Watch out for (exposureLines + frameIntegrationDiff_) overflowing a
|
||||
|
||||
@@ -55,7 +55,7 @@ double CamHelperImx296::gain(uint32_t gainCode) const
|
||||
uint32_t CamHelperImx296::exposureLines(const Duration exposure,
|
||||
[[maybe_unused]] const Duration lineLength) const
|
||||
{
|
||||
return std::max<uint32_t>(minExposureLines, (exposure - 14.26us) / timePerLine);
|
||||
return std::max<uint32_t>(minExposureLines, (exposure - 14.26us).count() / timePerLine.count());
|
||||
}
|
||||
|
||||
Duration CamHelperImx296::exposure(uint32_t exposureLines,
|
||||
|
||||
@@ -910,7 +910,7 @@ void AgcChannel::divideUpExposure()
|
||||
}
|
||||
if (status_.fixedGain == 0.0) {
|
||||
if (exposureMode_->gain[stage] * exposureTime >= exposureValue) {
|
||||
gain = exposureValue / exposureTime;
|
||||
gain = exposureValue.count() / exposureTime.count();
|
||||
break;
|
||||
}
|
||||
gain = exposureMode_->gain[stage];
|
||||
@@ -928,7 +928,7 @@ void AgcChannel::divideUpExposure()
|
||||
int flickerPeriods = exposureTime / status_.flickerPeriod;
|
||||
if (flickerPeriods) {
|
||||
Duration newExposureTime = flickerPeriods * status_.flickerPeriod;
|
||||
gain *= exposureTime / newExposureTime;
|
||||
gain *= exposureTime.count() / newExposureTime.count();
|
||||
exposureTime = newExposureTime;
|
||||
}
|
||||
LOG(RPiAgc, Debug) << "After flicker avoidance, exposure time "
|
||||
|
||||
@@ -97,7 +97,7 @@ void Lux::process(StatisticsPtr &stats, Metadata *imageMetadata)
|
||||
double currentAperture = deviceStatus.aperture.value_or(currentAperture_);
|
||||
double gainRatio = referenceGain_ / currentGain;
|
||||
double exposureTimeRatio =
|
||||
referenceExposureTime_ / deviceStatus.exposureTime;
|
||||
referenceExposureTime_.count() / deviceStatus.exposureTime.count();
|
||||
double apertureRatio = referenceAperture_ / currentAperture;
|
||||
double yRatio = currentY / referenceY_;
|
||||
double estimatedLux = exposureTimeRatio * gainRatio *
|
||||
|
||||
@@ -776,7 +776,7 @@ void IpaPiSP::applyTdn(const TdnStatus *tdnStatus, const DeviceStatus *deviceSta
|
||||
utils::Duration exposure = deviceStatus->exposureTime * deviceStatus->analogueGain;
|
||||
pisp_be_tdn_config tdn = {};
|
||||
|
||||
double ratio = tdnReset_ ? 1.0 : exposure / lastExposure_;
|
||||
double ratio = tdnReset_ ? 1.0 : exposure.count() / lastExposure_.count();
|
||||
if (ratio >= 4.0) {
|
||||
/* If the exposure ratio goes above 4x, we need to reset TDN. */
|
||||
ratio = 1;
|
||||
@@ -934,7 +934,7 @@ bool IpaPiSP::applyStitch(const StitchStatus *stitchStatus, const DeviceStatus *
|
||||
|
||||
utils::Duration otherExposure = lastStitchExposures_[otherChannel];
|
||||
bool phaseLong = hdrStatus->channel == "long";
|
||||
double ratio = phaseLong ? otherExposure / exposure : exposure / otherExposure;
|
||||
double ratio = phaseLong ? otherExposure.count() / exposure.count() : exposure.count() / otherExposure.count();
|
||||
|
||||
pisp_be_stitch_config stitch = {};
|
||||
stitch.exposure_ratio = clampField(ratio, 15, 15);
|
||||
|
||||
@@ -4,9 +4,8 @@ libcamera_internal_sources += files([
|
||||
'pisp.cpp',
|
||||
])
|
||||
|
||||
librt = cc.find_library('rt', required : true)
|
||||
libpisp_dep = dependency('libpisp', fallback : ['libpisp', 'libpisp_dep'])
|
||||
|
||||
libcamera_deps += [libpisp_dep, librt]
|
||||
libcamera_deps += [libpisp_dep]
|
||||
|
||||
subdir('data')
|
||||
|
||||
Reference in New Issue
Block a user