Skip to content

Instantly share code, notes, and snippets.

@nullbytepl
Last active June 8, 2020 23:32
Show Gist options
  • Save nullbytepl/db5757181c7ca1d9743687cb0eab575a to your computer and use it in GitHub Desktop.
Save nullbytepl/db5757181c7ca1d9743687cb0eab575a to your computer and use it in GitHub Desktop.

Leeco Le 2 Camera Blobs Modifications

You don't need qcom proprietary mm-camera source code if you just want to read this, but if you actually want to patch something - you 100% need it.

Increase max exposure time

mm-camera sets max exposure time via a loop that interates over all available resolutions. The loops looks like this (pseudocode): (file -> sensor.c)

uint64_t max;
for (i = 0; i < res_table.size; i++) {
  uint64_t current_max = (uint64_t)(((float)res_table[i].line_length_pclk *
        NANO_SEC_PER_SEC) / (float)(res_table[i].line_length_pclk * res_table[i].frame_length_lines * res_table[i].max_fps));
  max = MIN(current_max, max);
}
max = max * sensor->aec_info.max_linecount;
return max;

Easiest way to increase max expo is just to increase aec_info.max_linecount in sensor lib.

Increase max ISO

Max ISO is calculated using this algo: (file -> sensor.c)

capatibility->max_gain = (uint32_t)(sensor->aec_info.max_gain * 100);

Just increasing aec_info.max_gain in sensor lib is enough to increase the ISO.

Fix green tint / correct black level

Black level is set using: (file -> sensor.c)

capatibility->black_level_pattern[0] =
    sensor->color_level_info.r_pedestal;
capatibility->black_level_pattern[1] =
    sensor->color_level_info.gr_pedestal;
capatibility->black_level_pattern[2] =
    sensor->color_level_info.gb_pedestal;
capatibility->black_level_pattern[3] =
    sensor->color_level_info.b_pedestal;

Meaning we just have to change those values in sensor lib.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment