Browse Source

auto: Use helper function to set value.

Pavel Machek 6 months ago
parent
commit
dcc73a1647
1 changed files with 11 additions and 12 deletions
  1. 11 12
      src/process_pipeline.c

+ 11 - 12
src/process_pipeline.c

@@ -374,6 +374,14 @@ clamp_control(controlstate *control)
         }
 }
 
+static void
+update_control(controlstate *control)
+{
+	clamp_control(control);
+	mp_io_pipeline_set_control_int32(control, control->value_req);
+	control->value = control->value_req;
+}
+
 static int focus;
 static int focus_phase;
 
@@ -553,18 +561,9 @@ process_aaa()
                         }
                 }
 
-                clamp_control(&state_proc.gain);
-                clamp_control(&state_proc.dgain);
-                clamp_control(&state_proc.exposure);
-                mp_io_pipeline_set_control_int32(&state_proc.gain.control,
-                                                 state_proc.gain.value_req);
-                mp_io_pipeline_set_control_int32(&state_proc.dgain.control,
-                                                 state_proc.dgain.value_req);
-                mp_io_pipeline_set_control_int32(&state_proc.exposure.control,
-                                                 state_proc.exposure.value_req);
-                state_proc.gain.value = state_proc.gain.value_req;
-                state_proc.dgain.value = state_proc.dgain.value_req;
-                state_proc.exposure.value = state_proc.exposure.value_req;
+                update_control(&state_proc.gain);
+                update_control(&state_proc.dgain);
+                update_control(&state_proc.exposure);
         }
 
         if (auto_balance) {