Преглед на файлове

ae: don't go over 1/100 sec exposure too easily

Pavel Machek преди 2 месеца
родител
ревизия
95f474076c
променени са 1 файла, в които са добавени 22 реда и са изтрити 5 реда
  1. 22 5
      src/process_pipeline.c

+ 22 - 5
src/process_pipeline.c

@@ -493,6 +493,15 @@ update_exp(controlstate *control, int 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
 summarize()
 {
@@ -501,10 +510,7 @@ summarize()
 	char *sep = portrait ? " " : "\n";
 	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 = state_proc.gain.value / ((float) state_proc.gain.min);
@@ -568,7 +574,7 @@ process_aaa()
                 if (direction > 0) {
                         // Preview is too dark
                         // 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);
                                 printf("Expose + %d\n",
                                        state_proc.exposure.value_req);
@@ -576,6 +582,10 @@ process_aaa()
                                 // Raise sensor gain if exposure limit is hit
 				update_exp(&state_proc.gain, direction);
                                 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) {
                                 // Raise sensor dgain if out of ananlog gain
 				update_exp(&state_proc.dgain, direction);
@@ -589,6 +599,10 @@ process_aaa()
                         if (state_proc.dgain.value > state_proc.dgain.min) {
 				update_exp(&state_proc.dgain, direction);
                                 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) {
 				update_exp(&state_proc.gain, direction);
                                 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);
         }
 
+	exposure_limit = 0.01 / sec_per_line();
+	printf("Exposure limit: %d\n", exposure_limit);
+
         mp_state_main new_main = {
                 .camera = pr_camera,
                 .has_auto_focus_continuous = false,