refactor: remove RAW metering center weight
This commit is contained in:
1 parent
7ff18f902a
commit
8eee59654e
11 files changed
+3
-114
No files matched your search
@@ -59,7 +59,6 @@ data class UserPreferences(
|
||||
val rawNlmNoiseFactor: Float = 0f,
|
||||
val rawExposureCompensation: Float = 0f,
|
||||
val rawAutoExposure: Boolean = true,
|
||||
val rawMeteringCenterWeight: Float = 0f,
|
||||
val rawBlackPointCorrection: Float = 0f,
|
||||
val rawWhitePointCorrection: Float = 0f,
|
||||
val rawAutoWhiteBalanceEstimate: Boolean = false,
|
||||
@@ -153,7 +152,6 @@ class UserPreferencesRepository(private val context: Context) {
|
||||
private val RAW_NLM_NOISE_FACTOR_KEY = floatPreferencesKey("raw_nlm_noise_factor")
|
||||
private val RAW_EXPOSURE_COMPENSATION_KEY = floatPreferencesKey("raw_exposure_compensation")
|
||||
private val RAW_AUTO_EXPOSURE_KEY = booleanPreferencesKey("raw_auto_exposure")
|
||||
private val RAW_METERING_CENTER_WEIGHT_KEY = floatPreferencesKey("raw_metering_center_weight")
|
||||
private val RAW_BLACK_POINT_CORRECTION_KEY = floatPreferencesKey("raw_black_point_correction")
|
||||
private val RAW_WHITE_POINT_CORRECTION_KEY = floatPreferencesKey("raw_white_point_correction")
|
||||
private val RAW_AUTO_WHITE_BALANCE_ESTIMATE_KEY = booleanPreferencesKey("raw_auto_white_balance_estimate")
|
||||
@@ -256,7 +254,6 @@ class UserPreferencesRepository(private val context: Context) {
|
||||
rawNlmNoiseFactor = preferences[RAW_NLM_NOISE_FACTOR_KEY] ?: 0f,
|
||||
rawExposureCompensation = preferences[RAW_EXPOSURE_COMPENSATION_KEY] ?: 0f,
|
||||
rawAutoExposure = preferences[RAW_AUTO_EXPOSURE_KEY] ?: true,
|
||||
rawMeteringCenterWeight = preferences[RAW_METERING_CENTER_WEIGHT_KEY]?.coerceIn(0f, 1f) ?: 0f,
|
||||
rawBlackPointCorrection = preferences[RAW_BLACK_POINT_CORRECTION_KEY] ?: 0f,
|
||||
rawWhitePointCorrection = preferences[RAW_WHITE_POINT_CORRECTION_KEY] ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = preferences[RAW_AUTO_WHITE_BALANCE_ESTIMATE_KEY] ?: false,
|
||||
@@ -535,12 +532,6 @@ class UserPreferencesRepository(private val context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun saveRawMeteringCenterWeight(value: Float) {
|
||||
context.dataStore.edit { preferences ->
|
||||
preferences[RAW_METERING_CENTER_WEIGHT_KEY] = value.coerceIn(0f, 1f)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun saveRawBlackPointCorrection(value: Float) {
|
||||
context.dataStore.edit { preferences ->
|
||||
preferences[RAW_BLACK_POINT_CORRECTION_KEY] = value
|
||||
|
||||
@@ -132,15 +132,6 @@ object GalleryManager {
|
||||
?: (ContentRepository.getInstance(context).userPreferencesRepository.userPreferences.firstOrNull()
|
||||
?.rawAutoExposure ?: true)
|
||||
}
|
||||
|
||||
private suspend fun resolveRawMeteringCenterWeight(
|
||||
context: Context,
|
||||
metadata: MediaMetadata?
|
||||
): Float {
|
||||
return metadata?.rawMeteringCenterWeight
|
||||
?: (ContentRepository.getInstance(context).userPreferencesRepository.userPreferences.firstOrNull()
|
||||
?.rawMeteringCenterWeight ?: 0f)
|
||||
}
|
||||
private val _photoLibraryChangedEvents = MutableSharedFlow<Unit>(extraBufferCapacity = 16)
|
||||
val photoLibraryChangedEvents: SharedFlow<Unit> = _photoLibraryChangedEvents.asSharedFlow()
|
||||
private val hdrWorkLock = Any()
|
||||
@@ -1178,7 +1169,6 @@ object GalleryManager {
|
||||
exposureBias = exposureBias ?: 0f,
|
||||
rawExposureCompensation = metadata.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = resolveRawAutoExposure(context, metadata),
|
||||
rawMeteringCenterWeight = resolveRawMeteringCenterWeight(context, metadata),
|
||||
rawBlackPointCorrection = metadata.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = metadata.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = resolveRawAutoWhiteBalanceEstimate(context, metadata),
|
||||
@@ -1744,7 +1734,6 @@ object GalleryManager {
|
||||
exposureBias = exposureBias ?: 0f,
|
||||
rawExposureCompensation = metadata.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = resolveRawAutoExposure(context, metadata),
|
||||
rawMeteringCenterWeight = resolveRawMeteringCenterWeight(context, metadata),
|
||||
rawBlackPointCorrection = metadata.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = metadata.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = resolveRawAutoWhiteBalanceEstimate(context, metadata),
|
||||
@@ -2636,7 +2625,6 @@ object GalleryManager {
|
||||
dngFile.absolutePath, null, null, 0,
|
||||
rawExposureCompensation = updatedMetadata.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = resolveRawAutoExposure(context, updatedMetadata),
|
||||
rawMeteringCenterWeight = resolveRawMeteringCenterWeight(context, updatedMetadata),
|
||||
rawBlackPointCorrection = updatedMetadata.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = updatedMetadata.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = resolveRawAutoWhiteBalanceEstimate(context, updatedMetadata),
|
||||
@@ -2753,7 +2741,6 @@ object GalleryManager {
|
||||
dngFile.absolutePath, metadata?.ratio, metadata?.cropRegion, 0,
|
||||
rawExposureCompensation = updatedMetadata?.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = resolveRawAutoExposure(context, updatedMetadata),
|
||||
rawMeteringCenterWeight = resolveRawMeteringCenterWeight(context, updatedMetadata),
|
||||
rawBlackPointCorrection = updatedMetadata?.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = updatedMetadata?.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = resolveRawAutoWhiteBalanceEstimate(context, updatedMetadata),
|
||||
|
||||
@@ -39,7 +39,6 @@ data class MediaMetadata(
|
||||
val rawDenoiseValue: Float? = null,
|
||||
val rawExposureCompensation: Float? = null,
|
||||
val rawAutoExposure: Boolean? = null,
|
||||
val rawMeteringCenterWeight: Float? = null,
|
||||
val rawBlackPointCorrection: Float? = null,
|
||||
val rawWhitePointCorrection: Float? = null,
|
||||
val rawAutoWhiteBalanceEstimate: Boolean? = null,
|
||||
@@ -185,7 +184,6 @@ data class MediaMetadata(
|
||||
put("denoiseValue", rawDenoiseValue?.toDouble() ?: JSONObject.NULL)
|
||||
put("rawExposureCompensation", rawExposureCompensation?.toDouble() ?: JSONObject.NULL)
|
||||
put("rawAutoExposure", rawAutoExposure ?: JSONObject.NULL)
|
||||
put("rawMeteringCenterWeight", rawMeteringCenterWeight?.toDouble() ?: JSONObject.NULL)
|
||||
put("rawBlackPointCorrection", rawBlackPointCorrection?.toDouble() ?: JSONObject.NULL)
|
||||
put("rawWhitePointCorrection", rawWhitePointCorrection?.toDouble() ?: JSONObject.NULL)
|
||||
put("rawAutoWhiteBalanceEstimate", rawAutoWhiteBalanceEstimate ?: JSONObject.NULL)
|
||||
@@ -362,7 +360,6 @@ data class MediaMetadata(
|
||||
rawDenoiseValue = if (obj.isNull("denoiseValue")) null else obj.optDouble("denoiseValue").toFloat(),
|
||||
rawExposureCompensation = if (obj.isNull("rawExposureCompensation")) null else obj.optDouble("rawExposureCompensation").toFloat(),
|
||||
rawAutoExposure = if (obj.isNull("rawAutoExposure")) null else obj.optBoolean("rawAutoExposure"),
|
||||
rawMeteringCenterWeight = if (obj.isNull("rawMeteringCenterWeight")) null else obj.optDouble("rawMeteringCenterWeight").toFloat(),
|
||||
rawBlackPointCorrection = if (obj.isNull("rawBlackPointCorrection")) null else obj.optDouble("rawBlackPointCorrection").toFloat(),
|
||||
rawWhitePointCorrection = if (obj.isNull("rawWhitePointCorrection")) null else obj.optDouble("rawWhitePointCorrection").toFloat(),
|
||||
rawAutoWhiteBalanceEstimate = if (obj.isNull("rawAutoWhiteBalanceEstimate")) null else obj.optBoolean("rawAutoWhiteBalanceEstimate"),
|
||||
|
||||
@@ -63,11 +63,6 @@ class PhotoProcessor(
|
||||
?: (userPreferencesRepository.userPreferences.firstOrNull()?.rawAutoExposure ?: true)
|
||||
}
|
||||
|
||||
private suspend fun resolveRawMeteringCenterWeight(metadata: MediaMetadata): Float {
|
||||
return metadata.rawMeteringCenterWeight
|
||||
?: (userPreferencesRepository.userPreferences.firstOrNull()?.rawMeteringCenterWeight ?: 0f)
|
||||
}
|
||||
|
||||
suspend fun prepareUltraHdrSource(
|
||||
context: Context,
|
||||
photoId: String,
|
||||
@@ -430,7 +425,6 @@ class PhotoProcessor(
|
||||
exposureBias = metadata.exposureBias ?: 0f,
|
||||
rawExposureCompensation = metadata.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = resolveRawAutoExposure(metadata),
|
||||
rawMeteringCenterWeight = resolveRawMeteringCenterWeight(metadata),
|
||||
rawBlackPointCorrection = metadata.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = metadata.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = resolveRawAutoWhiteBalanceEstimate(metadata),
|
||||
@@ -492,7 +486,6 @@ class PhotoProcessor(
|
||||
metadata.exposureBias ?: 0f,
|
||||
rawExposureCompensation = metadata.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = resolveRawAutoExposure(metadata),
|
||||
rawMeteringCenterWeight = resolveRawMeteringCenterWeight(metadata),
|
||||
rawBlackPointCorrection = metadata.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = metadata.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = resolveRawAutoWhiteBalanceEstimate(metadata),
|
||||
|
||||
@@ -103,7 +103,7 @@ object MeteringSystem {
|
||||
|
||||
val normalizedCenterWeight = centerWeight.coerceIn(0f, 1f).toDouble()
|
||||
val centerInfluence = normalizedCenterWeight * normalizedCenterWeight
|
||||
var weight = calculateSpatialMeteringWeight(distSqC.toDouble(), centerInfluence)
|
||||
var weight = 1.0
|
||||
|
||||
// 2. 肤色密度补偿
|
||||
val skinDensity = zoneSkinCount[i].toDouble() / zonePixCount[i]
|
||||
@@ -151,7 +151,6 @@ object MeteringSystem {
|
||||
byteBuffer: ByteBuffer,
|
||||
width: Int,
|
||||
height: Int,
|
||||
centerWeight: Float = 0f
|
||||
): Float {
|
||||
val pixelCount = width * height
|
||||
if (pixelCount == 0) return 0f
|
||||
@@ -159,15 +158,10 @@ object MeteringSystem {
|
||||
val lumas = FloatArray(pixelCount)
|
||||
var totalWeightedLuma = 0.0
|
||||
var totalWeight = 0.0
|
||||
|
||||
val normalizedCenterWeight = centerWeight.coerceIn(0f, 1f).toDouble()
|
||||
val centerInfluence = normalizedCenterWeight * normalizedCenterWeight
|
||||
|
||||
byteBuffer.position(0)
|
||||
for (y in 0 until height) {
|
||||
val py = (y + 0.5f) / height
|
||||
for (x in 0 until width) {
|
||||
val px = (x + 0.5f) / width
|
||||
|
||||
val r = (byteBuffer.get().toInt() and 0xFF) / 255f
|
||||
val g = (byteBuffer.get().toInt() and 0xFF) / 255f
|
||||
@@ -178,9 +172,7 @@ object MeteringSystem {
|
||||
val idx = y * width + x
|
||||
lumas[idx] = luma
|
||||
|
||||
// Calculate spatial weight for the average (subject reference)
|
||||
val distSqC = (px - 0.5f).let { it * it } + (py - 0.5f).let { it * it }
|
||||
val weight = calculateSpatialMeteringWeight(distSqC.toDouble(), centerInfluence)
|
||||
val weight = 1.0
|
||||
totalWeightedLuma += luma * weight
|
||||
totalWeight += weight
|
||||
}
|
||||
@@ -228,17 +220,6 @@ object MeteringSystem {
|
||||
return (ln(value.toDouble()) / ln(2.0)).toFloat()
|
||||
}
|
||||
|
||||
private fun calculateSpatialMeteringWeight(distSqC: Double, centerInfluence: Double): Double {
|
||||
if (centerInfluence <= 0.0) {
|
||||
return 1.0
|
||||
}
|
||||
|
||||
val centerSigma = 0.24 - 0.17 * centerInfluence
|
||||
val centerBoost = 1.0 + 3.0 * centerInfluence
|
||||
val centerWeightedWeight = exp(-distSqC / centerSigma) * centerBoost
|
||||
return 1.0 * (1.0 - centerInfluence) + centerWeightedWeight * centerInfluence
|
||||
}
|
||||
|
||||
private fun calculateHighlightSuppression(zoneAvg: Double, centerInfluence: Double): Double {
|
||||
val highlightThreshold = 0.75 - 0.25 * centerInfluence
|
||||
if (zoneAvg <= highlightThreshold) {
|
||||
|
||||
@@ -5,7 +5,6 @@ import android.graphics.Bitmap
|
||||
import android.graphics.Rect
|
||||
import android.media.Image
|
||||
import android.opengl.*
|
||||
import android.util.Log
|
||||
import com.hinnka.mycamera.data.ContentRepository
|
||||
import com.hinnka.mycamera.camera.AspectRatio
|
||||
import com.hinnka.mycamera.utils.BitmapUtils
|
||||
@@ -254,7 +253,6 @@ class RawDemosaicProcessor {
|
||||
exposureBias: Float = 0f,
|
||||
rawExposureCompensation: Float = 0f,
|
||||
rawAutoExposure: Boolean = true,
|
||||
rawMeteringCenterWeight: Float = 0f,
|
||||
rawBlackPointCorrection: Float = 0f,
|
||||
rawWhitePointCorrection: Float = 0f,
|
||||
rawAutoWhiteBalanceEstimate: Boolean = false,
|
||||
@@ -279,7 +277,6 @@ class RawDemosaicProcessor {
|
||||
exposureBias = exposureBias,
|
||||
rawExposureCompensation = rawExposureCompensation,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawMeteringCenterWeight = rawMeteringCenterWeight,
|
||||
rawBlackPointCorrection = rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = rawWhitePointCorrection,
|
||||
rawAutoWhiteBalanceEstimate = rawAutoWhiteBalanceEstimate,
|
||||
@@ -341,7 +338,6 @@ class RawDemosaicProcessor {
|
||||
rotation = rotation,
|
||||
rawExposureCompensation = rawExposureCompensation,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawMeteringCenterWeight = rawMeteringCenterWeight,
|
||||
rawBlackPointCorrection = rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = rawWhitePointCorrection,
|
||||
rawAutoWhiteBalanceEstimate = rawAutoWhiteBalanceEstimate,
|
||||
@@ -366,7 +362,6 @@ class RawDemosaicProcessor {
|
||||
exposureBias: Float = 0f,
|
||||
rawExposureCompensation: Float = 0f,
|
||||
rawAutoExposure: Boolean = true,
|
||||
rawMeteringCenterWeight: Float = 0f,
|
||||
rawBlackPointCorrection: Float = 0f,
|
||||
rawWhitePointCorrection: Float = 0f,
|
||||
rawAutoWhiteBalanceEstimate: Boolean = false,
|
||||
@@ -391,7 +386,6 @@ class RawDemosaicProcessor {
|
||||
exposureBias = exposureBias,
|
||||
rawExposureCompensation = rawExposureCompensation,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawMeteringCenterWeight = rawMeteringCenterWeight,
|
||||
rawBlackPointCorrection = rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = rawWhitePointCorrection,
|
||||
rawAutoWhiteBalanceEstimate = rawAutoWhiteBalanceEstimate,
|
||||
@@ -425,7 +419,6 @@ class RawDemosaicProcessor {
|
||||
exposureBias: Float = 0f,
|
||||
rawExposureCompensation: Float = 0f,
|
||||
rawAutoExposure: Boolean = true,
|
||||
rawMeteringCenterWeight: Float = 0f,
|
||||
rawBlackPointCorrection: Float = 0f,
|
||||
rawWhitePointCorrection: Float = 0f,
|
||||
rawAutoWhiteBalanceEstimate: Boolean = false,
|
||||
@@ -588,7 +581,6 @@ class RawDemosaicProcessor {
|
||||
val autoExposureEv = if (rawAutoExposure) {
|
||||
resolveRawAutoExposureEv(
|
||||
metadata = actualMetadata,
|
||||
rawMeteringCenterWeight = rawMeteringCenterWeight,
|
||||
sourceTextureId = demosaicTextureId,
|
||||
dcpRenderPlan = resolvedDcpRenderPlan
|
||||
)
|
||||
@@ -2118,7 +2110,6 @@ class RawDemosaicProcessor {
|
||||
|
||||
private fun resolveRawAutoExposureEv(
|
||||
metadata: RawMetadata,
|
||||
rawMeteringCenterWeight: Float,
|
||||
sourceTextureId: Int,
|
||||
dcpRenderPlan: DcpRenderPlan?
|
||||
): Float {
|
||||
@@ -2152,11 +2143,10 @@ class RawDemosaicProcessor {
|
||||
byteBuffer = buffer,
|
||||
width = meteringWidth,
|
||||
height = meteringHeight,
|
||||
centerWeight = rawMeteringCenterWeight
|
||||
)
|
||||
PLog.d(
|
||||
TAG,
|
||||
"RAW auto exposure: renderedEv=$ev centerWeight=${rawMeteringCenterWeight.coerceIn(0f, 1f)}"
|
||||
"RAW auto exposure: renderedEv=$ev"
|
||||
)
|
||||
ev
|
||||
} catch (e: Exception) {
|
||||
|
||||
@@ -30,7 +30,6 @@ fun RawEditPanel(
|
||||
rawNlmNoiseFactor: Float,
|
||||
rawExposureCompensation: Float,
|
||||
rawAutoExposure: Boolean,
|
||||
rawMeteringCenterWeight: Float,
|
||||
rawBlackPointCorrection: Float,
|
||||
rawWhitePointCorrection: Float,
|
||||
onSelectDcp: (String?) -> Unit,
|
||||
@@ -39,7 +38,6 @@ fun RawEditPanel(
|
||||
onRawNlmNoiseFactorChange: (Float) -> Unit,
|
||||
onRawExposureCompensationChange: (Float) -> Unit,
|
||||
onRawAutoExposureChange: (Boolean) -> Unit,
|
||||
onRawMeteringCenterWeightChange: (Float) -> Unit,
|
||||
onRawBlackPointCorrectionChange: (Float) -> Unit,
|
||||
onRawWhitePointCorrectionChange: (Float) -> Unit,
|
||||
onAdjustmentStart: () -> Unit,
|
||||
@@ -66,19 +64,6 @@ fun RawEditPanel(
|
||||
checked = rawAutoExposure,
|
||||
onCheckedChange = onRawAutoExposureChange
|
||||
)
|
||||
SliderSettingItem(
|
||||
title = stringResource(R.string.settings_raw_metering_center_weight),
|
||||
description = stringResource(R.string.settings_raw_metering_center_weight_description),
|
||||
value = rawMeteringCenterWeight,
|
||||
valueRange = 0f..1f,
|
||||
resetValue = 0f,
|
||||
enabled = rawAutoExposure,
|
||||
onValueChange = {
|
||||
onAdjustmentStart()
|
||||
onRawMeteringCenterWeightChange(it)
|
||||
},
|
||||
onValueChangeFinished = onAdjustmentEnd
|
||||
)
|
||||
SliderSettingItem(
|
||||
title = stringResource(R.string.settings_raw_exposure_compensation),
|
||||
value = rawExposureCompensation,
|
||||
|
||||
@@ -88,7 +88,6 @@ private data class PreviewRenderSignature(
|
||||
val editRawDenoise: Float,
|
||||
val editRawExposureCompensation: Float,
|
||||
val editRawAutoExposure: Boolean,
|
||||
val editRawMeteringCenterWeight: Float,
|
||||
val editRawBlackPointCorrection: Float,
|
||||
val editRawWhitePointCorrection: Float,
|
||||
val editRawDcpId: String?,
|
||||
@@ -150,7 +149,6 @@ fun PhotoEditScreen(
|
||||
val editRawNlmNoiseFactor by viewModel.editRawDenoise.collectAsState()
|
||||
val editRawExposureCompensation by viewModel.editRawExposureCompensation.collectAsState()
|
||||
val editRawAutoExposure by viewModel.editRawAutoExposure.collectAsState()
|
||||
val editRawMeteringCenterWeight by viewModel.editRawMeteringCenterWeight.collectAsState()
|
||||
val editRawBlackPointCorrection by viewModel.editRawBlackPointCorrection.collectAsState()
|
||||
val editRawWhitePointCorrection by viewModel.editRawWhitePointCorrection.collectAsState()
|
||||
val editRawDcpId by viewModel.editRawDcpId.collectAsState()
|
||||
@@ -199,7 +197,6 @@ fun PhotoEditScreen(
|
||||
editRawDenoise = editRawNlmNoiseFactor,
|
||||
editRawExposureCompensation = editRawExposureCompensation,
|
||||
editRawAutoExposure = editRawAutoExposure,
|
||||
editRawMeteringCenterWeight = editRawMeteringCenterWeight,
|
||||
editRawBlackPointCorrection = editRawBlackPointCorrection,
|
||||
editRawWhitePointCorrection = editRawWhitePointCorrection,
|
||||
editRawDcpId = editRawDcpId,
|
||||
@@ -862,7 +859,6 @@ fun PhotoEditScreen(
|
||||
rawNlmNoiseFactor = editRawNlmNoiseFactor,
|
||||
rawExposureCompensation = editRawExposureCompensation,
|
||||
rawAutoExposure = editRawAutoExposure,
|
||||
rawMeteringCenterWeight = editRawMeteringCenterWeight,
|
||||
rawBlackPointCorrection = editRawBlackPointCorrection,
|
||||
rawWhitePointCorrection = editRawWhitePointCorrection,
|
||||
onSelectDcp = { dcpId ->
|
||||
@@ -889,9 +885,6 @@ fun PhotoEditScreen(
|
||||
onRawAutoExposureChange = {
|
||||
viewModel.saveRawAutoExposureValue(currentPhoto, it)
|
||||
},
|
||||
onRawMeteringCenterWeightChange = {
|
||||
viewModel.saveRawMeteringCenterWeightValue(currentPhoto, it)
|
||||
},
|
||||
onRawBlackPointCorrectionChange = {
|
||||
viewModel.saveRawBlackPointCorrectionValue(currentPhoto, it)
|
||||
},
|
||||
|
||||
@@ -195,7 +195,6 @@ fun SettingsScreen(
|
||||
val rawNlmNoiseFactor by viewModel.rawNlmNoiseFactor.collectAsState()
|
||||
val rawExposureCompensation by viewModel.rawExposureCompensation.collectAsState()
|
||||
val rawAutoExposure by viewModel.rawAutoExposure.collectAsState()
|
||||
val rawMeteringCenterWeight by viewModel.rawMeteringCenterWeight.collectAsState()
|
||||
val rawBlackPointCorrection by viewModel.rawBlackPointCorrection.collectAsState()
|
||||
val rawWhitePointCorrection by viewModel.rawWhitePointCorrection.collectAsState()
|
||||
val rawAutoWhiteBalanceEstimate by viewModel.rawAutoWhiteBalanceEstimate.collectAsState()
|
||||
@@ -1242,7 +1241,6 @@ fun SettingsScreen(
|
||||
rawNlmNoiseFactor = rawNlmNoiseFactor,
|
||||
rawExposureCompensation = rawExposureCompensation,
|
||||
rawAutoExposure = rawAutoExposure,
|
||||
rawMeteringCenterWeight = rawMeteringCenterWeight,
|
||||
rawBlackPointCorrection = rawBlackPointCorrection,
|
||||
rawWhitePointCorrection = rawWhitePointCorrection,
|
||||
onSelectDcp = { viewModel.setRawDcpId(it) },
|
||||
@@ -1259,7 +1257,6 @@ fun SettingsScreen(
|
||||
onRawNlmNoiseFactorChange = { viewModel.setRawNlmNoiseFactor(it) },
|
||||
onRawExposureCompensationChange = { viewModel.setRawExposureCompensation(it) },
|
||||
onRawAutoExposureChange = { viewModel.setRawAutoExposure(it) },
|
||||
onRawMeteringCenterWeightChange = { viewModel.setRawMeteringCenterWeight(it) },
|
||||
onRawBlackPointCorrectionChange = { viewModel.setRawBlackPointCorrection(it) },
|
||||
onRawWhitePointCorrectionChange = { viewModel.setRawWhitePointCorrection(it) },
|
||||
onAdjustmentStart = { },
|
||||
|
||||
@@ -235,9 +235,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
val rawAutoExposure: StateFlow<Boolean> = userPreferencesRepository.userPreferences
|
||||
.map { it.rawAutoExposure }
|
||||
.stateIn(viewModelScope, SharingStarted.Eagerly, true)
|
||||
val rawMeteringCenterWeight: StateFlow<Float> = userPreferencesRepository.userPreferences
|
||||
.map { it.rawMeteringCenterWeight }
|
||||
.stateIn(viewModelScope, SharingStarted.Eagerly, 0f)
|
||||
val rawBlackPointCorrection: StateFlow<Float> = userPreferencesRepository.userPreferences
|
||||
.map { it.rawBlackPointCorrection }
|
||||
.stateIn(viewModelScope, SharingStarted.Eagerly, 0f)
|
||||
@@ -717,9 +714,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
fun setRawAutoExposure(enabled: Boolean) {
|
||||
viewModelScope.launch { userPreferencesRepository.saveRawAutoExposure(enabled) }
|
||||
}
|
||||
fun setRawMeteringCenterWeight(value: Float) {
|
||||
viewModelScope.launch { userPreferencesRepository.saveRawMeteringCenterWeight(value) }
|
||||
}
|
||||
fun setRawBlackPointCorrection(value: Float) {
|
||||
viewModelScope.launch { userPreferencesRepository.saveRawBlackPointCorrection(value) }
|
||||
}
|
||||
@@ -901,7 +895,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = userPrefs?.rawNlmNoiseFactor ?: 0f,
|
||||
rawExposureCompensation = userPrefs?.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = userPrefs?.rawAutoExposure ?: true,
|
||||
rawMeteringCenterWeight = userPrefs?.rawMeteringCenterWeight ?: 0f,
|
||||
rawBlackPointCorrection = userPrefs?.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = userPrefs?.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = userPrefs?.rawAutoWhiteBalanceEstimate ?: false,
|
||||
@@ -2598,7 +2591,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = userPrefs?.rawNlmNoiseFactor ?: 0f,
|
||||
rawExposureCompensation = userPrefs?.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = userPrefs?.rawAutoExposure ?: true,
|
||||
rawMeteringCenterWeight = userPrefs?.rawMeteringCenterWeight ?: 0f,
|
||||
rawBlackPointCorrection = userPrefs?.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = userPrefs?.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = userPrefs?.rawAutoWhiteBalanceEstimate ?: false,
|
||||
@@ -2721,7 +2713,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = userPrefs?.rawNlmNoiseFactor ?: 0f,
|
||||
rawExposureCompensation = userPrefs?.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = userPrefs?.rawAutoExposure ?: true,
|
||||
rawMeteringCenterWeight = userPrefs?.rawMeteringCenterWeight ?: 0f,
|
||||
rawBlackPointCorrection = userPrefs?.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = userPrefs?.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = userPrefs?.rawAutoWhiteBalanceEstimate ?: false,
|
||||
@@ -2864,7 +2855,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = userPrefs?.rawNlmNoiseFactor ?: 0f,
|
||||
rawExposureCompensation = userPrefs?.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = userPrefs?.rawAutoExposure ?: true,
|
||||
rawMeteringCenterWeight = userPrefs?.rawMeteringCenterWeight ?: 0f,
|
||||
rawBlackPointCorrection = userPrefs?.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = userPrefs?.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = userPrefs?.rawAutoWhiteBalanceEstimate ?: false,
|
||||
@@ -3015,7 +3005,6 @@ class CameraViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = userPrefs?.rawNlmNoiseFactor ?: 0f,
|
||||
rawExposureCompensation = userPrefs?.rawExposureCompensation ?: 0f,
|
||||
rawAutoExposure = userPrefs?.rawAutoExposure ?: true,
|
||||
rawMeteringCenterWeight = userPrefs?.rawMeteringCenterWeight ?: 0f,
|
||||
rawBlackPointCorrection = userPrefs?.rawBlackPointCorrection ?: 0f,
|
||||
rawWhitePointCorrection = userPrefs?.rawWhitePointCorrection ?: 0f,
|
||||
rawAutoWhiteBalanceEstimate = userPrefs?.rawAutoWhiteBalanceEstimate ?: false,
|
||||
|
||||
@@ -292,8 +292,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
private set
|
||||
var editRawAutoExposure = MutableStateFlow(true)
|
||||
private set
|
||||
var editRawMeteringCenterWeight = MutableStateFlow(0f)
|
||||
private set
|
||||
var editRawBlackPointCorrection = MutableStateFlow(0f)
|
||||
private set
|
||||
var editRawWhitePointCorrection = MutableStateFlow(0f)
|
||||
@@ -1020,7 +1018,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
editRawDenoise.value = m.rawDenoiseValue ?: 0f
|
||||
editRawExposureCompensation.value = m.rawExposureCompensation ?: 0f
|
||||
editRawAutoExposure.value = m.rawAutoExposure ?: true
|
||||
editRawMeteringCenterWeight.value = m.rawMeteringCenterWeight ?: 0f
|
||||
editRawBlackPointCorrection.value = m.rawBlackPointCorrection ?: 0f
|
||||
editRawWhitePointCorrection.value = m.rawWhitePointCorrection ?: 0f
|
||||
editRawDcpId.value = m.rawDcpId
|
||||
@@ -1589,7 +1586,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
editRawDenoise.value = metadata.rawDenoiseValue ?: 0f
|
||||
editRawExposureCompensation.value = metadata.rawExposureCompensation ?: 0f
|
||||
editRawAutoExposure.value = metadata.rawAutoExposure ?: true
|
||||
editRawMeteringCenterWeight.value = metadata.rawMeteringCenterWeight ?: 0f
|
||||
editRawBlackPointCorrection.value = metadata.rawBlackPointCorrection ?: 0f
|
||||
editRawWhitePointCorrection.value = metadata.rawWhitePointCorrection ?: 0f
|
||||
editRawDcpId.value = metadata.rawDcpId
|
||||
@@ -1608,7 +1604,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
editRawDenoise.value = 0.2f
|
||||
editRawExposureCompensation.value = 0f
|
||||
editRawAutoExposure.value = true
|
||||
editRawMeteringCenterWeight.value = 0f
|
||||
editRawBlackPointCorrection.value = 0f
|
||||
editRawWhitePointCorrection.value = 0f
|
||||
editRawDcpId.value = null
|
||||
@@ -1642,7 +1637,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
editRawDenoise.value = 0.2f
|
||||
editRawExposureCompensation.value = 0f
|
||||
editRawAutoExposure.value = true
|
||||
editRawMeteringCenterWeight.value = 0f
|
||||
editRawBlackPointCorrection.value = 0f
|
||||
editRawWhitePointCorrection.value = 0f
|
||||
editRawDcpId.value = null
|
||||
@@ -1746,7 +1740,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = editRawDenoise.value,
|
||||
rawExposureCompensation = editRawExposureCompensation.value,
|
||||
rawAutoExposure = editRawAutoExposure.value,
|
||||
rawMeteringCenterWeight = editRawMeteringCenterWeight.value,
|
||||
rawBlackPointCorrection = editRawBlackPointCorrection.value,
|
||||
rawWhitePointCorrection = editRawWhitePointCorrection.value,
|
||||
rawDcpId = editRawDcpId.value,
|
||||
@@ -1777,11 +1770,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
persistRawEditMetadata(mediaData)
|
||||
}
|
||||
|
||||
fun saveRawMeteringCenterWeightValue(mediaData: MediaData, value: Float) {
|
||||
editRawMeteringCenterWeight.value = value.coerceIn(0f, 1f)
|
||||
persistRawEditMetadata(mediaData)
|
||||
}
|
||||
|
||||
fun saveRawBlackPointCorrectionValue(mediaData: MediaData, value: Float) {
|
||||
editRawBlackPointCorrection.value = value
|
||||
persistRawEditMetadata(mediaData)
|
||||
@@ -1986,7 +1974,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = editRawDenoise.value,
|
||||
rawExposureCompensation = editRawExposureCompensation.value,
|
||||
rawAutoExposure = editRawAutoExposure.value,
|
||||
rawMeteringCenterWeight = editRawMeteringCenterWeight.value,
|
||||
rawBlackPointCorrection = editRawBlackPointCorrection.value,
|
||||
rawWhitePointCorrection = editRawWhitePointCorrection.value,
|
||||
rawDcpId = editRawDcpId.value,
|
||||
@@ -2269,7 +2256,6 @@ class GalleryViewModel(application: Application) : AndroidViewModel(application)
|
||||
rawDenoiseValue = editRawDenoise.value,
|
||||
rawExposureCompensation = editRawExposureCompensation.value,
|
||||
rawAutoExposure = editRawAutoExposure.value,
|
||||
rawMeteringCenterWeight = editRawMeteringCenterWeight.value,
|
||||
rawBlackPointCorrection = editRawBlackPointCorrection.value,
|
||||
rawWhitePointCorrection = editRawWhitePointCorrection.value,
|
||||
rawDcpId = editRawDcpId.value,
|
||||
|
||||
Reference in new issue
Block a user