|
@@ -493,6 +493,15 @@ update_exp(controlstate *control, int direction)
|
|
control->value_req = control->value + (step * direction);
|
|
control->value_req = control->value + (step * direction);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int exposure_limit;
|
|
|
|
+
|
|
|
|
+static double sec_per_line()
|
|
|
|
+{
|
|
|
|
+ /* FIXME: may be approximate -- width/height should include blank areas */
|
|
|
|
+ double PCK = state_proc.mode->width * state_proc.mode->height * 30;
|
|
|
|
+ return state_proc.mode->width / PCK;
|
|
|
|
+}
|
|
|
|
+
|
|
static void
|
|
static void
|
|
summarize()
|
|
summarize()
|
|
{
|
|
{
|
|
@@ -501,10 +510,7 @@ summarize()
|
|
char *sep = portrait ? " " : "\n";
|
|
char *sep = portrait ? " " : "\n";
|
|
char buf[2048];
|
|
char buf[2048];
|
|
|
|
|
|
- /* FIXME: may be approximate -- width/height should include blank areas */
|
|
|
|
- double PCK = state_proc.mode->width * state_proc.mode->height * 30;
|
|
|
|
- double per_line = state_proc.mode->width / PCK;
|
|
|
|
- time = state_proc.exposure.value * per_line;
|
|
|
|
|
|
+ time = state_proc.exposure.value * sec_per_line();
|
|
|
|
|
|
/* Gain */
|
|
/* Gain */
|
|
gain = state_proc.gain.value / ((float) state_proc.gain.min);
|
|
gain = state_proc.gain.value / ((float) state_proc.gain.min);
|
|
@@ -568,7 +574,7 @@ process_aaa()
|
|
if (direction > 0) {
|
|
if (direction > 0) {
|
|
// Preview is too dark
|
|
// Preview is too dark
|
|
// Try raising the exposure time first
|
|
// Try raising the exposure time first
|
|
- if (state_proc.exposure.value < state_proc.exposure.max) {
|
|
|
|
|
|
+ if (state_proc.exposure.value < exposure_limit) {
|
|
update_exp(&state_proc.exposure, direction);
|
|
update_exp(&state_proc.exposure, direction);
|
|
printf("Expose + %d\n",
|
|
printf("Expose + %d\n",
|
|
state_proc.exposure.value_req);
|
|
state_proc.exposure.value_req);
|
|
@@ -576,6 +582,10 @@ process_aaa()
|
|
// Raise sensor gain if exposure limit is hit
|
|
// Raise sensor gain if exposure limit is hit
|
|
update_exp(&state_proc.gain, direction);
|
|
update_exp(&state_proc.gain, direction);
|
|
printf("Gain + %d\n", state_proc.gain.value_req);
|
|
printf("Gain + %d\n", state_proc.gain.value_req);
|
|
|
|
+ } else if (state_proc.exposure.value < state_proc.exposure.max) {
|
|
|
|
+ update_exp(&state_proc.exposure, direction);
|
|
|
|
+ printf("L/Expose + %d\n",
|
|
|
|
+ state_proc.exposure.value_req);
|
|
} else if (state_proc.dgain.value < state_proc.dgain.max) {
|
|
} else if (state_proc.dgain.value < state_proc.dgain.max) {
|
|
// Raise sensor dgain if out of ananlog gain
|
|
// Raise sensor dgain if out of ananlog gain
|
|
update_exp(&state_proc.dgain, direction);
|
|
update_exp(&state_proc.dgain, direction);
|
|
@@ -589,6 +599,10 @@ process_aaa()
|
|
if (state_proc.dgain.value > state_proc.dgain.min) {
|
|
if (state_proc.dgain.value > state_proc.dgain.min) {
|
|
update_exp(&state_proc.dgain, direction);
|
|
update_exp(&state_proc.dgain, direction);
|
|
printf("D/Gain - %d\n", state_proc.gain.value_req);
|
|
printf("D/Gain - %d\n", state_proc.gain.value_req);
|
|
|
|
+ } else if (state_proc.exposure.value > exposure_limit) {
|
|
|
|
+ update_exp(&state_proc.exposure, direction);
|
|
|
|
+ printf("L/Expose - %d\n",
|
|
|
|
+ state_proc.exposure.value_req);
|
|
} else if (state_proc.gain.value > state_proc.gain.min) {
|
|
} else if (state_proc.gain.value > state_proc.gain.min) {
|
|
update_exp(&state_proc.gain, direction);
|
|
update_exp(&state_proc.gain, direction);
|
|
printf("Gain - %d\n", state_proc.gain.value_req);
|
|
printf("Gain - %d\n", state_proc.gain.value_req);
|
|
@@ -1500,6 +1514,9 @@ update_state(MPPipeline *pipeline, const mp_state_proc *new_state)
|
|
on_output_changed(format_changed);
|
|
on_output_changed(format_changed);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ exposure_limit = 0.01 / sec_per_line();
|
|
|
|
+ printf("Exposure limit: %d\n", exposure_limit);
|
|
|
|
+
|
|
mp_state_main new_main = {
|
|
mp_state_main new_main = {
|
|
.camera = pr_camera,
|
|
.camera = pr_camera,
|
|
.has_auto_focus_continuous = false,
|
|
.has_auto_focus_continuous = false,
|