Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1d124ef authored by Yin-Chia Yeh's avatar Yin-Chia Yeh
Browse files

Camera: derive post RAW sensitivity boost range

Bug: 26625646
Change-Id: Ifbc49d744ac0dca201028aa414dae56febf28e4b
parent 157bd8a8
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -130,6 +130,7 @@ void CameraModule::deriveCameraCharacteristicsKeys(
        // Check if HAL supports RAW_OPAQUE output
        // Check if HAL supports RAW_OPAQUE output
        camera_metadata_entry entry = chars.find(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
        camera_metadata_entry entry = chars.find(ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS);
        bool supportRawOpaque = false;
        bool supportRawOpaque = false;
        bool supportAnyRaw = false;
        const int STREAM_CONFIGURATION_SIZE = 4;
        const int STREAM_CONFIGURATION_SIZE = 4;
        const int STREAM_FORMAT_OFFSET = 0;
        const int STREAM_FORMAT_OFFSET = 0;
        const int STREAM_WIDTH_OFFSET = 1;
        const int STREAM_WIDTH_OFFSET = 1;
@@ -151,6 +152,13 @@ void CameraModule::deriveCameraCharacteristicsKeys(
                // HAL does not fill in the opaque raw size
                // HAL does not fill in the opaque raw size
                rawOpaqueSizes.push(width * height *2);
                rawOpaqueSizes.push(width * height *2);
            }
            }
            if (isInput == ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS_OUTPUT &&
                    (format == HAL_PIXEL_FORMAT_RAW16 ||
                     format == HAL_PIXEL_FORMAT_RAW10 ||
                     format == HAL_PIXEL_FORMAT_RAW12 ||
                     format == HAL_PIXEL_FORMAT_RAW_OPAQUE)) {
                supportAnyRaw = true;
            }
        }
        }


        if (supportRawOpaque) {
        if (supportRawOpaque) {
@@ -161,6 +169,19 @@ void CameraModule::deriveCameraCharacteristicsKeys(
                derivedCharKeys.push(ANDROID_SENSOR_OPAQUE_RAW_SIZE);
                derivedCharKeys.push(ANDROID_SENSOR_OPAQUE_RAW_SIZE);
            }
            }
        }
        }

        // Check if HAL supports any RAW output, if so, fill in postRawSensitivityBoost range
        if (supportAnyRaw) {
            int32_t defaultRange[2] = {100, 100};
            entry = chars.find(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE);
            if (entry.count == 0) {
                // Fill in default value (100, 100)
                chars.update(
                        ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE,
                        defaultRange, 2);
                derivedCharKeys.push(ANDROID_CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE);
            }
        }
    }
    }


    // Always add a default for the pre-correction active array if the vendor chooses to omit this
    // Always add a default for the pre-correction active array if the vendor chooses to omit this